microZEUS
The whole stack, hand-drawn.

◄ Wiki / OS

CPU exception / trap

The CPU automatically jumping into special handler code when something like a fault or error occurs.

When a running instruction hits a problem — a bad memory access, a divide by zero, a page fault — the processor interrupts normal flow and transfers control to a designated handler. That mechanism is a CPU exception or trap. It runs in a special context, which is why a fault record is written from inside the exception rather than in ordinary code.

See also

  • code-segment selectorAn x86 register value that identifies which block of executable memory the CPU is currently running code from.
  • context switchThe kernel saving one thread's full state and loading another's, so a single CPU can juggle many tasks.
  • critical sectionA stretch of code that must be run by only one thread at a time to avoid corruption.

Referenced by

CNTP · code-segment selector