Page Directories and Page Tables in Linux Kernel

Page directories and the page tables for the user and the kernel segment is managed by the kernel itself.
The short identifier for the page directory is pgd, pmd (page middle directory) and the short identifier for the page table is pte.
The data type for the page directory and the page table is respectively pgd_t, pmd_t and pte_t. 

Functions  relevant to Page directory
  • pgd_val(), pmd_val() - These functions allow to access the real value of the directory entry (either 32 bit or 64bit).
  • pgd_alloc(), pmd_alloc() - provides the memory page for the respective page directory.  
  • pgd_free(), pmd_free() - The directories are freed.
  • pgd_clear, pmd_clear() - deletes the entry in the page directory.
  • pgd_present, pmd_present() - checks whether the directory entry refers to the page middle directory or page table, returns a positive result if there is an entry present, else returns a negative value.
  • pgd_none(), pmd_none() - just the reverse of pgd_present(), pmd_present()
  • set_pgd(), set_pmd() - the kernel fills the page directory and the page middle directory with entries.
Functions related to page tables
  • pte_val() -returns the value of the page table
  • pte_alloc(), pte_alloc_kernel() -allocating the page table entry
  • pte_free(), pte_free_kernel() - free a page table,
  • pte_page() -page table entry finds a pointer into the mem_map which contains all the physical memory pages of the computer.
  • set_pte() -the values of the page table entry are set, but the entry must either not be present or cannot be updated by the hardware.

Comments

Popular Posts