difference of 'INT' instruction between Linux and Windows

后端 未结 2 499
别跟我提以往
别跟我提以往 2021-01-22 11:47

I write some code to make my own operating system and study x86 assembly language, too. While studying x86 assembly language, I start wondering about interrupt. Look at below as

2条回答
  •  無奈伤痛
    2021-01-22 12:47

    The INT instruction triggers an exception almost like a divide by zero causes an exception. The difference is that INT allows you to specify what exception you are triggering.

    The operating system must define a table of exception and interrupt handlers. The location and size of the table is defined by hardware register IDTR. The various exceptions (like divide by zero) have an assigned exception number. (INT allows specifying any exception number.)

    See https://en.wikipedia.org/wiki/Interrupt_descriptor_table

    When an exception (or interrupt) occurs, the CPU uses the exception/interrupt number as an index into the table and calls the specific handler.

    The operating system defines the table and the handlers for interrupts and exceptions so they are different amount operating systems.

提交回复
热议问题