Page Fault Exception Handler
As stated previously, the Linux Page Fault exception handler must distinguish exceptions caused by programming errors from those caused by a reference to a page that legitimately belongs to the process address space but simply hasn’t been allocated yet.
The memory region descriptors allow the exception handler to perform
its job quite efficiently. The do_page_fault( )
function, which is the Page Fault interrupt service routine for the
80 × 86 architecture, compares the linear address that
caused the Page Fault against the memory regions of the
current
process; it can thus determine the proper
way to handle the exception according to the scheme that is
illustrated in Figure 8-4.
Figure 8-4. Overall scheme for the Page Fault handler
In practice, things are a lot more complex because the Page Fault handler must recognize several particular subcases that fit awkwardly into the overall scheme, and it must distinguish several kinds of legal access. A detailed flow diagram of the handler is illustrated in Figure 8-5.
Figure 8-5. The flow diagram of the Page Fault handler
The identifiers vmalloc_fault
,
good_area
, bad_area
, and
no_context
are labels appearing in
do_page_fault( )
that should help you to relate the blocks of the flow diagram to specific lines of code. ...
Get Understanding the Linux Kernel, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.