Modes and Exceptions

Cards (12)

  • An exception is an abrupt change in the control flow of a program.
  • When an exception is raised, the processor makes a call to the exception handler, which is an operating system subroutine. After the exception handler finishes running, it either
    1. Returns control to the current instruction.
    2. Returns control to the next instruction.
    3. The handler aborts the program.
  • Each exception is assigned a unique number known as the exception number.
  • Each exception type has its own exception handler. At the system boot time, the operating system initializes the exception table, which links the exception type to the appropriate exception handler.
  • The starting address (virtual) of the exception table is stored in the exception table base register.
  • The CPU can be interrupted by a hardware interrupt. Interrupts occur asynchronously.
  • A trap is an intentional exception that occur as the result of executing an instruction.
  • Both traps and interrupts return the program immediately to the next instruction.
  • A fault results from an error condition that the handler may or may not be able to correct. If it is not possible to correct the fault, the program aborts.
  • Aborts never return control back to the program.
  • An asynchronous exception is an exception that is not handled immediately, but instead is stored in a queue and handled later.
  • Synchronous exceptions include division by zero, invalid memory accesses, and attempts to execute instructions with incorrect privileges.