Computer Systems A Programmer ' s perspective Second Edition
Exception number Description Exception class
0 Divide Error Fault
General Protection Fault Fault
Page Fault Fault
Machine Check Abort
32–127 os-de?ned Exceptions Interrupt or Trap
(0x80) System call Trap
129–255 os-de?ned Exceptions Interrupt or Trap
Figure 8.9 Examples of exceptions in IA32 systems.
LINUX/IA32 faults and aborts
Divide error. A Divide error (Exception 0) occurs when the application attempts to
Divide by zero, or when the result of a divide instruction was too big for the destina-
tion operand. Unix does not attempt to recover from divide errors, opting instead
to abort the program. Linux shells typically report divide errors as "floating ex-
Ceptions. "
General Protection Fault. The infamous General Protection Fault (exception 13)
Occurs for many reasons, usually because a program references an unde?ned area
of virtual memory, or because the program attempts to write to a read-only text
Segment. Linux does not attempt to recover from the this fault. Linux shells typically
Report general protection faults as "segmentation faults."
Page fault. A page Fault (exception) is an example of A exception where
The faulting instruction is restarted. The handler maps the appropriate page of
Physical memory on disk to a page of virtual memory, and then restarts the
Faulting instruction. We'll see how page faults work in detail in Chapter 9.
Machine check. A machine Check (exception) occurs as a result of a fatal
Hardware error is detected during the execution of the faulting instruction.
Machine Check handlers never return control to the application program.
General Protection Fault Exceptions in Linux/ia32 Systems