OSDev.org

The Place to Start for Operating System Developers
It is currently Sun Jun 13, 2021 4:40 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: System Descriptor Types
PostPosted: Wed Jul 14, 2004 3:29 pm 
Hi,
Is there anybody who can explain me the purpose of each kind of Descriptor ?

- Code / Data segment descriptor
- TSS descriptor
- Call gate descriptor
- Interrupt gate descriptor
- Trap gate descriptor
- Task gate descriptor...

How does it work ?

I've understood that under PM, it was necessary do describe the different segments used. So, I think that for Code and Data segment descriptor, I've caught the idea...

Concerning the TSS descriptor, I imagine I must fill a GDT entry with this for each task running on my system ?

But I've got some troubles with Call gate, interrupt gate, trap gate and task gate descriptors... What is their aim ?

For instance, I've read that IDT can only contain Task gate, Interrupt gate or trap gate descriptor. How to choose one among them ?
I would be inclined to use Interrupt gate... But I've seen trap gate descriptors where used in IDT ! What is the difference between them ?
And what the hell a task gate descriptor comes into an IDT ?

Thanks for your help !
Silver.


Top
  
 
 Post subject: Re:System Descriptor Types
PostPosted: Wed Jul 14, 2004 4:05 pm 
Offline
Member
Member
User avatar

Joined: Fri Nov 04, 2005 12:00 am
Posts: 381
Location: Serbia
Try here:

"IA-32 Intel Architecture Software Developer?s Manual Volume 3: System Programming Guide"

It explains everything


Top
 Profile  
 
 Post subject: Re:System Descriptor Types
PostPosted: Thu Jul 15, 2004 12:22 am 
OK, I'll try to find an answer in this doc...
Thanks.


Top
  
 
 Post subject: Re:System Descriptor Types
PostPosted: Thu Jul 15, 2004 4:03 pm 
So, I've read the IA32 Book 3.
But there is still something I didn't understand :
What is the difference between a trap gate and an interrupt gate ?
Why to use one rather another in the IDT ?


Top
  
 
 Post subject: Re:System Descriptor Types
PostPosted: Thu Jul 15, 2004 11:03 pm 
Offline
Member
Member
User avatar

Joined: Sat Jan 15, 2005 12:00 am
Posts: 8561
Location: At his keyboard!
Hi,

Silverhawk wrote:
So, I've read the IA32 Book 3.
But there is still something I didn't understand :
What is the difference between a trap gate and an interrupt gate ?
Why to use one rather another in the IDT ?


When an interrupt gate is used the CPU will disable interrupts when the handler is being entered (and restore them during IRETD). With a trap gate this doesn't happen.

You could *almost* simulate an interrupt gate with a trap gate using the following:

Code:
intHandler:
     pushfd
     cli
     ..handle interrupt..
     popfd
     iretd


The difference is that EFLAGS would be on the stack twice, and it's possible to get another IRQ between "intHandler" and "cli". With a true interrupt gate it's impossible for another interrupt/IRQ handler to be called by the CPU before the first interrupt handler has had a chance to start.

In general I'd use trap gates for software interrupts and interrupt gates for IRQs.


Cheers,

Brendan

_________________
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.


Top
 Profile  
 
 Post subject: Re:System Descriptor Types
PostPosted: Fri Jul 16, 2004 2:57 am 
Hi,
Thanks a lot Brendan for this explanation !
I'll sleep better :D

Bye.
Silver


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: Majestic-12 [Bot] and 15 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