0

While researching virtual memory, I sometimes see conflicting use of the nouns page table, page table entry, and page. For example "A page table is a table of pages..." and "A page table holds page table entries".

My understanding of the relationships (in the context of x86-64) are as follows:

  • Virtual memory is divided into blocks (i.e. pages)
  • A page table is an array of entries
    • There is one entry per page
    • Each entry is an address composed of metadata
      • Permission bits
      • In a direct mapping, a physical address to a frame
      • Or, a physical address to another other page tables

Is this high-level summary, and use of the aforementioned nouns, accurate?

Tantillo
  • 367
  • 1
  • 5

1 Answers1

1

Is this high-level summary, and use of the aforementioned nouns, accurate?

Not quite (none of the entries ever contain virtual addresses). For "plain 32-bit paging" on 80x86 (2 levels):

  • A page directory is an array of page directory entries

    • A page directory entry contains the physical address of a page table, with some bits (that would've been zero) re-purposed for various flags (e.g. permission bits)
  • A page table is an array of page table entries

    • A page table entry contains the physical address of a page, with some bits (that would've been zero) re-purposed for various flags (e.g. permission bits)

For "long mode paging" on 80x86 (4 levels):

  • A PML4 (Page Map Level 4) is an array of PML4 entries

    • A PML4 entry contains the physical address of a page, with some bits (that would've been zero) re-purposed for various flags (e.g. permission bits)
  • A PDPT (Page Directory Pointer Table) is an array of PDPT entries

    • A PDPT entry contains the physical address of a page directory, with some bits (that would've been zero) re-purposed for various flags (e.g. permission bits)
  • A page directory is an array of page directory entries

    • A page directory entry contains the physical address of a page table, with some bits (that would've been zero) re-purposed for various flags (e.g. permission bits)
  • A page table is an array of page table entries

    • A page table entry contains the physical address of a page, with some bits (that would've been zero) re-purposed for various flags (e.g. permission bits)

Of course there's a pattern here:

  • A <NAME> is an array of <NAME> entries

    • A <NAME> entry contains the physical address of a <NEXT_LOWER_LEVEL_NAME>, with some bits (that would've been zero) re-purposed for various flags (e.g. permission bits)

.. where "<NAME>" is (from highest to lowest) one of: PML5, PML4, Page Directory Pointer Table, Page Directory, Page Table.

Brendan
  • 35,656
  • 2
  • 39
  • 66