6-54 Vol. 3
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
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 information about the
execute-disable bit, see
Chapter 4, “Paging”).
• 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 privilege violation, but the problem that caused the privilege
violation may be uncorrectable.
See also: Section 4.7, “Page-Fault Exceptions.”
Exception Error Code
Yes (special format). The processor provides the page-fault handler with two items of
information 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 6-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).