Page 1 of 1

GDT theory ?

Posted: Wed Feb 29, 2012 3:37 am
by Sam111
Ok I know all the different types of system descriptors possible for the GDT are

Code: Select all

System Descriptor Types
Type Meaning Segment/Gate  
0 Reserved 
1 available 16-bit TSS System segment 
2 LDT System segment 
3 active 16-bit TSS System segment 
4 16-bit Call Gate Gate 
5 Task Gate Gate 
6 16-bit Interrupt Gate Gate 
7 16-bit Trap Gate Gate 
8 Reserved 
9 available 32-bit TSS System segment 
10 Reserved 
11 active 32-bit TSS System segment 
12 32-bit Call Gate Gate 
13 Reserved 
14 32-bit Interrupt Gate Gate 
15 32-bit Trap Gate Gate 
This is assuming the S bit = 1.

Now I know if I set the S bit = 0 this means it is going to be a code/data descriptor instead of a system descriptor above.

My problem is for the 4bit type field in this case I found.

Code: Select all

format of TYPE field
          bit  2    Executable (E)     0 = Descriptor is data type    
               1    Expansion Direction (ED) 0 = Expand up
                                             1 = Expand up
               0    Writeable (W)       W = 0 data segment is read only
                                        W = 1 data segment is R/W     


          bit  2    Executable (E)  1 = Descriptor is code type  
               1    Conforming (C)   ( I don't understand )
               0    Readable (R)        R = 0 Code segment execute only
                                        R = 1 Code segment is Readable
But I don't understand where's bit 3 in the break down what is it suppose to be set to?
What would be the difference in setting it like s=0 type=0-011 or type=1-011 both of the lower 3bits indicate it is a data segment entry ,expands up , and is read/writeable.

I am just being picky since I have always used the default type values given to create my gdt descriptor enties.

So what is the 4th supposed to be set to and what would happen if I did the opposite .... (I am assuming it would at best ignore it and at worse throw a global protection fault )

Question 2
The only last issue I was curious about is what the 1 Conforming (C) ( I don't understand ) is suppose to stand for?
Is this some type of writable bit or something , or perhaps something that has to do with a 64bit mode compatiblity issue , or an old 16 bit mode.

Either way I don't understand what this should be perhaps zero by default. (but maybe means 16 bit data/code seg or 32 bit data/code that would probably make the most sense.... but now that I think about it that is covered in the D/B bit for 16/32 bits)

Perhaps somebody knows for sure and can explain this little last issue I was wondering about GDT entry fields

Thanks for any help

Re: GDT theory ?

Posted: Wed Feb 29, 2012 4:46 am
by Combuster
I know your manual reading skills suck, but it's even on the GDT page, images and all.

I'll go beyond berkus' favorite insult: Learn to use your eyes.

Re: GDT theory ?

Posted: Wed Feb 29, 2012 5:59 am
by gravaera
There's no such thing as "GDT theory" because the GDT isn't theory. It's an implementation detail.