문제

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.

올바른 솔루션이 없습니다

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top