I'm progressing on Writing OS in Rust. Today I learned about different CPU exception types.

When illegal operation occurs, CPU will stop execution and will start executing an exception handler. Different exception handlers are defined for different scenarios.

CPU has over 20 exception types, those are the most common:

  • Page Fault — occurs when there is invalid memory access, for example writing to read-only page
  • Invalid Opcode — when the instruction to be executed is incorrect (like new SSE instruction on old CPU)
  • General Protection Fault — for various access violations
  • Double Fault — when exception occurs during exception handling
  • Triple Fault — when exception occurs during Double Fault exception handler, this time most CPUs will reset themselves and reboot the OS