GDT theory ?

Discussions on more advanced topics such as monolithic vs micro-kernels, transactional memory models, and paging vs segmentation should go here. Use this forum to expand and improve the wiki!
Locked
User avatar
Sam111
Member
Member
Posts: 385
Joined: Mon Nov 03, 2008 6:06 pm

GDT theory ?

Post 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
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: GDT theory ?

Post 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.
"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 ]
User avatar
gravaera
Member
Member
Posts: 737
Joined: Tue Jun 02, 2009 4:35 pm
Location: Supporting the cause: Use \tabs to indent code. NOT \x20 spaces.

Re: GDT theory ?

Post by gravaera »

There's no such thing as "GDT theory" because the GDT isn't theory. It's an implementation detail.
17:56 < sortie> Paging is called paging because you need to draw it on pages in your notebook to succeed at it.
Locked