Page 1 of 1
Interrupt Descriptor Table in x86
Posted: Sat Feb 07, 2015 5:16 am
by hello123
I am trying to implement a boot-loader for x86. The initial version just uses the BIOS interrupt call to print "Hello" on the screen. I am using QEmu along with GDB for going through my code sequentially.
Here is a snippet of the code
Code: Select all
mov ah, 0x0e
mov al, 'H'
int 0x10
mov al, 'e'
The boot-loader starts from address 0x07c00.
From what I understood, the BIOS sets up the Interrupt Descriptor table from address 0x0 till 0x3ff (1024 bytes). The IDT has 256 32bit entries, each entry specifies 16bit segment and 16bit offset which is the address of the Interrupt service routine.
Thus , when I execute
I should jump to the address pointed by the 17th entry in the IDT. When I checked the contents of the memory 0x10, it contained the following data " 0xf000ff53", so the program should jump to the location 0xfff53 but I found that it instead jumps to 0xc4c71 after executing the
instruction
Why is this happening??
Re: Interrupt Descriptor Table in x86
Posted: Sat Feb 07, 2015 5:26 am
by alexfru
Are 10 and 0x10 the same thing in your assembler?
Re: Interrupt Descriptor Table in x86
Posted: Sat Feb 07, 2015 5:26 am
by Combuster
In 0x10 bytes, how many 32-bit entries can you fit?
Re: Interrupt Descriptor Table in x86
Posted: Sat Feb 07, 2015 5:38 am
by Roman
As far as I know, the BIOS sets up an IVT, not IDT.
Re: Interrupt Descriptor Table in x86
Posted: Sat Feb 07, 2015 6:48 am
by iansjack
Roman wrote:As far as I know, the BIOS sets up an IVT, not IDT.
http://en.m.wikipedia.org/wiki/Interrup ... ptor_table
Re: Interrupt Descriptor Table in x86
Posted: Sat Feb 07, 2015 6:56 am
by iansjack
*** Sorry, wrong thread ***
Re: Interrupt Descriptor Table in x86
Posted: Sat Feb 07, 2015 6:56 am
by hello123
alexfru wrote:Are 10 and 0x10 the same thing in your assembler?
No I am sorry I have edited my question
Re: Interrupt Descriptor Table in x86
Posted: Sat Feb 07, 2015 7:00 am
by hello123
Combuster wrote:In 0x10 bytes, how many 32-bit entries can you fit?
I am not sure what are you asking me here, but what I meant is 0x10 is an index into the IDT and the address stored in this location i.e. 0x10 should be where ISR should be found. But that does not seem to be happening
Re: Interrupt Descriptor Table in x86
Posted: Sat Feb 07, 2015 9:09 am
by Combuster
hello123 wrote:Combuster wrote:In 0x10 bytes, how many 32-bit entries can you fit?
I am not sure what are you asking me here, but what I meant is 0x10 is an index into the IDT and the address stored in this location i.e. 0x10 should be where ISR should be found. But that does not seem to be happening
That basically means that besides not knowing what's going on and avoiding the question, you also posted more inaccurate information. Which exact address in physical memory do you address? How many 32-bit entries can you fit in 0x10 bytes? As long as we don't know what you're doing wrong exactly, we can't fix it for you.
Re: Interrupt Descriptor Table in x86
Posted: Sat Feb 07, 2015 9:24 am
by iansjack
should jump to the address pointed by the 17th entry in the IDT. When I checked the contents of the memory 0x10, it contained the following data " 0xf000ff53", so the program should jump to the location 0xfff53 but I found that it instead jumps to 0xc4c71
Just to be sure - you checked location 0x40 (the 17th entry in the IDT)? On my computer, using qemu, after the BIOS has initialized the IDT that location contains 0xC00083F9. That's near enough, allowing for different versions, to what you expect. 0x10 is only the 5th entry in the table.
Re: Interrupt Descriptor Table in x86
Posted: Sat Feb 07, 2015 1:09 pm
by hello123
Combuster wrote:hello123 wrote:Combuster wrote:In 0x10 bytes, how many 32-bit entries can you fit?
I am not sure what are you asking me here, but what I meant is 0x10 is an index into the IDT and the address stored in this location i.e. 0x10 should be where ISR should be found. But that does not seem to be happening
That basically means that besides not knowing what's going on and avoiding the question, you also posted more inaccurate information. Which exact address in physical memory do you address? How many 32-bit entries can you fit in 0x10 bytes? As long as we don't know what you're doing wrong exactly, we can't fix it for you.
Could you please elaborate your question, because I do not understand what you want to fit in 0x10 bytes. As I have said previously, 0x10 is an interrupt number which is an INDEX into the table IDT which starts at address 0x0 and which contains 32 bit entries, so for example: int 0x0 would mean jump to the address (32 bits) starting at address 0x0 in RAM. I do not know how to say it more clearly.
Re: Interrupt Descriptor Table in x86
Posted: Sat Feb 07, 2015 1:11 pm
by hello123
iansjack wrote: should jump to the address pointed by the 17th entry in the IDT. When I checked the contents of the memory 0x10, it contained the following data " 0xf000ff53", so the program should jump to the location 0xfff53 but I found that it instead jumps to 0xc4c71
Just to be sure - you checked location 0x40 (the 17th entry in the IDT)? On my computer, using qemu, after the BIOS has initialized the IDT that location contains 0xC00083F9. That's near enough, allowing for different versions, to what you expect. 0x10 is only the 5th entry in the table.
No I checked the location 0x10...got my mistake....thanks