OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Apr 23, 2024 2:26 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: Interrupt Descriptor Table in x86
PostPosted: Sat Feb 07, 2015 5:16 am 
Offline

Joined: Sat Feb 07, 2015 4:52 am
Posts: 5
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:
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
Code:
int 0x10
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
Code:
int 0x10
instruction
Why is this happening??


Last edited by hello123 on Sat Feb 07, 2015 6:52 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Interrupt Descriptor Table in x86
PostPosted: Sat Feb 07, 2015 5:26 am 
Offline
Member
Member

Joined: Tue Mar 04, 2014 5:27 am
Posts: 1108
Are 10 and 0x10 the same thing in your assembler?


Top
 Profile  
 
 Post subject: Re: Interrupt Descriptor Table in x86
PostPosted: Sat Feb 07, 2015 5:26 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 3:45 am
Posts: 9301
Location: On the balcony, where I can actually keep 1½m distance
In 0x10 bytes, how many 32-bit entries can you fit?

_________________
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]


Top
 Profile  
 
 Post subject: Re: Interrupt Descriptor Table in x86
PostPosted: Sat Feb 07, 2015 5:38 am 
Offline
Member
Member
User avatar

Joined: Thu Mar 27, 2014 3:57 am
Posts: 568
Location: Moscow, Russia
As far as I know, the BIOS sets up an IVT, not IDT.

_________________
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
- Alan Kay


Top
 Profile  
 
 Post subject: Re: Interrupt Descriptor Table in x86
PostPosted: Sat Feb 07, 2015 6:48 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4594
Location: Chichester, UK
Roman wrote:
As far as I know, the BIOS sets up an IVT, not IDT.

http://en.m.wikipedia.org/wiki/Interrup ... ptor_table


Top
 Profile  
 
 Post subject: Re: Interrupt Descriptor Table in x86
PostPosted: Sat Feb 07, 2015 6:56 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4594
Location: Chichester, UK
*** Sorry, wrong thread ***


Last edited by iansjack on Sat Feb 07, 2015 6:57 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Interrupt Descriptor Table in x86
PostPosted: Sat Feb 07, 2015 6:56 am 
Offline

Joined: Sat Feb 07, 2015 4:52 am
Posts: 5
alexfru wrote:
Are 10 and 0x10 the same thing in your assembler?

No I am sorry I have edited my question


Top
 Profile  
 
 Post subject: Re: Interrupt Descriptor Table in x86
PostPosted: Sat Feb 07, 2015 7:00 am 
Offline

Joined: Sat Feb 07, 2015 4:52 am
Posts: 5
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


Top
 Profile  
 
 Post subject: Re: Interrupt Descriptor Table in x86
PostPosted: Sat Feb 07, 2015 9:09 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 3:45 am
Posts: 9301
Location: On the balcony, where I can actually keep 1½m distance
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.

_________________
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]


Top
 Profile  
 
 Post subject: Re: Interrupt Descriptor Table in x86
PostPosted: Sat Feb 07, 2015 9:24 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4594
Location: Chichester, UK
Quote:
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.


Top
 Profile  
 
 Post subject: Re: Interrupt Descriptor Table in x86
PostPosted: Sat Feb 07, 2015 1:09 pm 
Offline

Joined: Sat Feb 07, 2015 4:52 am
Posts: 5
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.


Top
 Profile  
 
 Post subject: Re: Interrupt Descriptor Table in x86
PostPosted: Sat Feb 07, 2015 1:11 pm 
Offline

Joined: Sat Feb 07, 2015 4:52 am
Posts: 5
iansjack wrote:
Quote:
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 :) :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 61 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group