Abstract
- Instruction that changes Privilege Level from User Mode to Kernel Mode and saves the state of CPU like Return Address onto the Stack Segment of the Kernel for use later,
- The kernel codes following the trap interrupt dispatch the correct Interrupt Handler via Interrupt Vector Table to fulfil the need of programs in the User Space and perform Process Management
When is trap instruction triggered?
Trap instruction is usually triggered to handle an exceptional events like an error or an Interrupts (中断). Basically events than need privileged access from the kernel.
INT Instruction
INT is a Trap Interrupt x86-64.
Trap
The term Trap comes from the idea that the CPU is being “trapped” or diverted from its normal execution flow into a special routine or handler.