What is the difference between Trap and Interrupt?

后端 未结 10 1075
时光说笑
时光说笑 2020-12-02 03:44

What is the difference between Trap and Interrupt?

If the terminology is different for different systems, then what do they mean on x86?

10条回答
  •  佛祖请我去吃肉
    2020-12-02 04:03

    Interrupts are hardware interrupts, while traps are software-invoked interrupts. Occurrences of hardware interrupts usually disable other hardware interrupts, but this is not true for traps. If you need to disallow hardware interrupts until a trap is served, you need to explicitly clear the interrupt flag. And usually the interrupt flag on the computer affects (hardware) interrupts as opposed to traps. This means that clearing this flag will not prevent traps. Unlike traps, interrupts should preserve the previous state of the CPU.

提交回复
热议问题