0
votes

I have three main questions which apply to the x86 architecture only, since i am a user of the intel 80386 microchip.

These are the basics i know: the interrupt table begins at address 0x0000, so the int 0x01 instruction would search the address 0x0001. The processor would then see the address contained in location 0x0001, and expect the beginning of the interrupt handler 0x01 at that address pointed to by 0x0001.

so my first question is, how does the interrupt handler indicate its own end and tell the cpu to return to the process who made the interrupt. Is the indicator only NULL, or is there a special value to indicate that the handler is done?

second question: In MS-DOS, the hardware interrupt 0x19 is used to reboot the computer. I want to know where the handler for this interrupt is. is it in BIOS ROM, is that why it is called a "BIOS Interrupt call"? please explain the term to me. also, since the MS-DOS Interrupt 0x21 includes MS-DOS functions (like getting and printing characters), it is in RAM and not BIOS, right? does that mean that it is not a BIOS interrupt?

finally, I want to know if i load an interrupt table with hex 99 interrupts, meaning that 0x99 is the last, what will happen if the user does 0x9A (which is one more than 0x99)?

Please answer these three questions of mine, as i am a lot into systems programming these days. I'm sorry if it's to long and complex. thanx in advance!

1

1 Answers

1
votes

In real mode each entry in the interrupt table is 4 bytes long, 2 bytes for the segment part of the address and 2 bytes for the offset. That means address for interrupt handler 0x01 is at address 0x0:0x0004. Interrupt handlers normally return the location where the interrupt occurred by executing the IRET instruction. This pops off address and the value FLAGS register that CPU saved on the stack when the interrupt occurred.

The handler for interrupt 0x19 would normally point to a location in the BIOS ROM, but it's possible that something hooked the interrupt and pointed it at a handler in RAM. The MS-DOS interrupt 0x21 would normally point to location in RAM, though there were versions of MS-DOS that were located in ROM.

In real mode, there's normally no limit to the interrupt table, so all 256 possible entries are present whether or not useful values have been loaded into all of them. When an interrupt occurs the CPU will begin executing instructions at whatever address it finds at the table. Generally this will cause a crash if the address isn't the location of an interrupt handler.