I'm currently working with a Linux kernel module and I need to access some 64-bit values stored in an array, however I first need to cast from a void pointer.
I'm using the kernel function phys_to_virt
which is returning a void pointer, and I'm not entirely sure how to actually use this void pointer to access elements within the array that it points to.
Currently I'm doing this:
void *ptr;
uint64_t test;
ptr = phys_to_virt(physAddr);
test = *(uint64_t*)ptr;
printk("Test: %llx\n", test);
The value I'm getting from test isn't what I expected to see within the array, so I'm fairly sure I'm doing something wrong. I need to access the first three elements in the array, so I need to cast the void pointer to a uint64_t[] but I'm not quite sure how to do that.
Any advice would be greatly appreciated.
Thanks