Hi,
Why does every boot code i've seen limit GDT at startup to 768 ??? IDT is limited to 256 that's ok because the Intel Architectur (x386) only knows 256 interrupts .. but what about GDT why 768 ????
GDT
Re:GDT
You only really need 5 descriptors for a simple O.S. A NULL, CS(kernel code), DS(kernel data), ES(user code), FS(user data). If your OS is multitasking, then I believe that you need additional descriptors in the GDT for each TSS(Task State Segment). For start-up, that is enough. Later on is when you reset the GDT, if you want/need more. Then, the GDT may have up to 2048 entries. 768 entries is a large amount, I don't see for a need for more than that. Major OS'es such as LINUX only have 64 processes running at once...
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:GDT
There is another reason why you could need more descriptors if you want to achieve more evoluted protection than linux does (for instance, giving a separate stack segment to every kernel thread so that a stack overflow doesn't corrupt datas, etc.) or if you want to give every process a separate LDT and GDT (Linux actually gives every CPU one TSS and performs purely software switching, which becomes costly when you have to swap the I/O map)