address = 42133008 pgd = c36f1420 pmd = c36f1420 (the pgd and pmd have the same value?????) pte = f95894cc
And the error message is:
Unable to handle kernel page request at address f95894cc.
So it looks like the function is dying in the pte_val() call. That means that it's the PTE array (??) that needs to be paged in, not the page I'm trying to get the physical address for. Is that even possible?
What exactly does 'pte' in my function below point to? Is it an entry in a array of pte_t structures? If so, shouldn't that array ALWAYS be present in memory?
I have a suspcion that 0x42133008 is a bogus user-space virtual address.
Timur Tabi wrote:
The following function is causing this error:
unsigned long user_virt_to_phys(unsigned long address) { pgd_t *pgd = pgd_offset(current->mm, address); pmd_t *pmd = pmd_offset(pgd, address); #ifdef pte_offset_kernel pte_t *pte = pte_offset_kernel(pmd, address); #else pte_t *pte = pte_offset(pmd, address); #endif
return pte_val(*pte) & PTE_MASK; }
I'm assuming that the error message is displayed when I try to obtain the physical address for a page that isn't in memory (and therefore, has no physical address). Is that correct?
-- Timur Tabi Staff Software Engineer timur.tabi@ammasso.com
-- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/