0

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 Answer 1

1

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.

3
  • Great explanation. however, the pointer the interrupt handler 0x01 STARTS at 0x0:0x0001 and ends at 0x0:0x0004 right? If so, are you saying that if the user does int 0x02, the CPU will search address 0x0:0x0005 (till 0x0:0x0008) for a pointer to the interrupt handler? actually, i want to know, since an address is a doubleword value in x86 as you said, by what address will we refer to the doubleword value beginning at location 0x0:0x0005? Please explain. Commented Sep 5, 2014 at 7:35
  • No, the entry for interrupt handler 1 is 4 bytes long, the first byte is address 0000:0004, the second at 0000:0005, third at 0000:0006 and the last at 0000:0007. The bytes at 0000:0000 - 0000:0003 make up the entry for interrupt handler 0. The entry for interrupt handler 2 is at 0000:0x0008 - 0000:0x000B. The four bytes that make an entry in the table are a doubleword value that is the address of the handler.
    – Ross Ridge
    Commented Sep 5, 2014 at 16:03
  • Thanks a lot man. I got the whole thing (finally). By the way, I'm writing this on my virtual machine! Commented Sep 8, 2014 at 5:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.