Intel IA-32 User Manual
Page 227
Vol. 3A 5-51
INTERRUPT AND EXCEPTION HANDLING
Interrupt 14—Page-Fault Exception (#PF)
Exception Class
Fault.
Description
Indicates that, with paging enabled (the PG flag in the CR0 register is set), the processor detected
one of the following conditions while using the page-translation mechanism to translate a linear
address to a physical address:
•
The P (present) flag in a page-directory or page-table entry needed for the address
translation is clear, indicating that a page table or the page containing the operand is not
present in physical memory.
•
The procedure does not have sufficient privilege to access the indicated page (that is, a
procedure running in user mode attempts to access a supervisor-mode page).
•
Code running in user mode attempts to write to a read-only page. In the Intel486 and later
processors, if the WP flag is set in CR0, the page fault will also be triggered by code
running in supervisor mode that tries to write to a read-only user-mode page.
•
An instruction fetch to a linear address that translates to a physical address in a memory
page with the execute-disable bit set (for an IA-32 processor whose enhanced paging
structures support the execute disable bit, see Section 3.10, “PAE-Enabled Paging in IA-32e
Mode”).
•
One or more reserved bits in page directory entry are set to 1. See description below of
RSVD error code flag.
The exception handler can recover from page-not-present conditions and restart the program or
task without any loss of program continuity. It can also restart the program or task after a privi-
lege violation, but the problem that caused the privilege violation may be uncorrectable.
Exception Error Code
Yes (special format). The processor provides the page-fault handler with two items of informa-
tion to aid in diagnosing the exception and recovering from it:
•
An error code on the stack. The error code for a page fault has a format different from that
for other exceptions (see Figure 5-9). The error code tells the exception handler four
things:
— The P flag indicates whether the exception was due to a not-present page (0) or to
either an access rights violation or the use of a reserved bit (1).
— The W/R flag indicates whether the memory access that caused the exception was a
read (0) or write (1).
— The U/S flag indicates whether the processor was executing at user mode (1) or
supervisor mode (0) at the time of the exception.