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.
Asked
Active
Viewed 2,004 times
1
-
1Are you asking about Linux? You should probably tag your question so, if that's the case. – Carl Norum Dec 01 '13 at 04:34
-
Related to but not duplicate of http://stackoverflow.com/questions/6252063/simplest-way-to-get-physical-address-from-the-logical-one-in-linux-kernel-module – Jonathan Ben-Avraham Dec 01 '13 at 04:47
1 Answers
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
-
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