1

As we know, on ARM platform, 16MB space is reserved for kernel modules below PAGE_OFFSET. If I write a module and define a global variable, then how I get its phisical address? It is obvious that I get a wrong physical address using virt_to_phys function.

artless noise
  • 21,212
  • 6
  • 68
  • 105
user3053668
  • 41
  • 1
  • 4

1 Answers1

1

If virt_to_phys won't work for you, you can use the MMU to do a V=>P mapping, see Find the physical address of exception vector table from kernel module

Community
  • 1
  • 1
scott
  • 728
  • 4
  • 8
  • I am wondering why those kernel developer guys did not provide such function as virt_to_phys? – user3053668 Dec 01 '13 at 13:58
  • `virt_to_phys` is a simple macro. For code in the kernel proper, there is a one-to-one mapping of virtual to physical memory; simple math can get the address. For other memory, the physical page is semi-random and a lookup must be done. – artless noise Dec 01 '13 at 20:59