Chapter 3/ Hardware Briefing

Wondershare

PDPT. Keep in mind that CR3 doesn't store all 52 bits of the physical address.

It doesn't have to because most of them are zero,

The top two bits in the linear address designate an entry in this PDPT. The

corresponding PDPTE specifies the base physical address of a page directory.

Bits 21 through 29 in the linear address identify an entry in the page direc¬

tory, which in turn specifies the base physical address of a page table.

Bits 12 through 20 in the linear address denote an entry in the page table,

which in turn specifies the base physical address of a page of physical

memory. The lowest 12 bits in the linear address is added to this base physi¬

cal address to yield the final result: the address of a byte in physical memory.

A Closer Look at the Tables

Now let's take a closer look at the central players involved in paging: the

PDEs and the PTEs. Both the PDE and the PTE are 32-bit structures (such

that the page directory and page table can fit inside of a 4-KB page of stor¬

age), They also have similar fields (see Figure 3,17), This is intentional, so

32-Bit Page Directory Entry (PDE)

Bit3l 12 11 987654 3 2 10

20-bit Page-Table Base Address

Avail

G

PS

0

A

PCD

PWT

U/S

w

p

Avail

Available for OS use

G

Global page (ignored)

PS

Page size (0 indicates 4 KB page size)

0

Set to zero

A

Accessed (this page/page tabic has been accessed, when set)

PCD

Cache disabled (when this flag is set, this page/page table cannot be cached)

PWT

Write-through (if set, write-through caching is enabled I'or this page/page table)

U/S

User/Supervisor (when this flag is clear, the page has supervisor privileges )

w

Read/Write (if this flag is clear, the pages pointed to by this entry are read-only)

P

Present (if this flag is set, the 4 KB page/page table is currently loaded into memory)

32-Bit Page Table Entry (PTE)

Bit 31

12

11 9

8

7

6

5

4

3

2

1

0

20-bit Page Base Address

Avail

G

PAT

D

A

PCD

PWT

U/S

W

p

G Global flag (helps keep frequently accessed pages in the TLB)

PAT Page attribute table index

D Dirty bit (if set, the page pointed to has been written to)

Figure 3,17

98 I Part I