Chapter3:MemoryManagement
Table 3-2: Functions for Analyzing Page Table Entries.
Function Descriptionpgd_val
pud_val
pmd_val
pte_val
pgprot_valConvert a variable of typepte_tand so on to anunsigned longnumber.__pgd
__pud
__pmd
__pte
__pgprotDo the reverse ofpdg_valand so on: They convert anunsigned longnumber into
avariableoftypepdg_tand so on.pgd_index
pud_index
pmd_index
pte_indexYield the address of the next-level table starting from a memory pointer and a
page table entry.pgd_present
pud_present
pmd_present
pte_presentCheck whether the_PRESENTbit of the corresponding entry is set. This is the case
when the page or page table addressed is in RAM memory.pgd_none
pud_none
pmd_none
pte_noneDo the logical reverse of thexxx_presentfunctions. If they return a true value,
the searched page isnotin RAM.pgd_clear
pud_clear
pmd_clear
pte_clearDelete the passed page table entry. This is usually done by setting it to zero.pgd_bad
pud_bad
pmd_badCheck whether entries of the page middle, upper, and global directories are
invalid. They are used for safety purposes in functions that receive input param-
eters from the outside where it cannot be assumed that the parameters are valid.pmd_page
pud_page
pte_pageReturn the address of thepagestructure holding the data on the page or the
entries of the page middle directories.How do theoffsetfunctions work? Let us considerpmd_offsetas an example. It requires as parameter
an entry from the page global directory (src_pgd)andanaddressin memory. It returns an element from
one of the page middle directories.
src_pmd = pmd_offset(src_pgd, address);