Intel 64 and IA-32 Architectures Software Developers Manual Volume 3A, System Programming Guide, Part 1

Vol. 3A 3-51
PROTECTED-MODE MEMORY MANAGEMENT
procedures running at privilege level of 0 can invalidate TLBs or selected TLB entries.
Whenever a page-directory or page-table entry is changed (including when the
present flag is set to zero), the operating-system must immediately invalidate the
corresponding entry in the TLB so that it can be updated the next time the entry is
referenced.
All of the (non-global) TLBs are automatically invalidated any time the CR3 register is
loaded (unless the G flag for a page or page-table entry is set, as describe later in this
section). The CR3 register can be loaded in either of two ways:
Explicitly, using the MOV instruction, for example:
MOV CR3, EAX
where the EAX register contains an appropriate page-directory base address.
Implicitly by executing a task switch, which automatically changes the contents
of the CR3 register.
The INVLPG instruction is provided to invalidate a specific page-table entry in the
TLB. Normally, this instruction invalidates only an individual TLB entry; however, in
some cases, it may invalidate more than the selected entry and may even invalidate
all of the TLBs. This instruction ignores the setting of the G flag in a page-directory or
page-table entry (see following paragraph).
(Introduced in the Pentium Pro processor.) The page global enable (PGE) flag in
register CR4 and the global (G) flag of a page-directory or page-table entry (bit 8)
can be used to prevent frequently used pages from being automatically invalidated in
the TLBs on a task switch or a load of register CR3. (See Section 3.7.6, “Page-Direc-
tory and Page-Table Entries”, for more information about the global flag.) When the
processor loads a page-directory or page-table entry for a global page into a TLB, the
entry will remain in the TLB indefinitely. The only ways to deterministically invalidate
global page entries are as follows:
Clear the PGE flag; this will invalidate the TLBs.
Execute the INVLPG instruction to invalidate individual page-directory or page-
table entries in the TLBs.
For additional information about invalidation of the TLBs, see Section 10.9, “Invali-
dating the Translation Lookaside Buffers (TLBs)”.