Question

I have a question when I located the address in kernel. I insert a hello module in kernel, in this module, I used this solution.

For now I can use kmalloc to achieve the address by virt_to_phys.

char *mystring = kmalloc(19, GFP_KERNEL);
strcpy(mystring, "this is my address"); 
printk("<1>The address of mystring is %p", virt_to_phys(mystring));

But I want to know how to find the address of char mystring[]="this is my address";. This is no heap allocated memory, right? How to find it by some functions?

PS: I used a tool to dump the whole memory, physical addresses.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top