Hi, Vikas Aggarwal wrote:
#define __vpa(va) ((pte_val(*pte_offset(pmd_offset(pgd_offset_k(va),(va)),(va))) & PAGE_MASK) + (va & ~PAGE_MASK))
What is supposed to do this macro ? As far as I understand it, it's supposed to convert a virtual address into a physical one by traveling through the page tables. Is that it ?
If yes, then the virt_to_phys() macro already does the job, but only for kernel virtual addresses (I think, I only had a quick look at the code). Directly translating user virtual addresses to physical addresses is, I think, a bad idea, because user stuff might be swapped.
Then, can you give more details about the context of use ? (The code of the function is which it is used for example).
Sincerly, Thomas -- Thomas Petazzoni thomas.petazzoni@xxxxxxxx -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/