GDT Tutorial: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content deleted Content added
m Add 'See Also' section with link to GDT article
Null descriptor clarificaiton
Line 21: Line 21:
For sanity purpose, you should always have these items stored in your GDT:
For sanity purpose, you should always have these items stored in your GDT:


* The null descriptor (you can't go without it, really). ''The null descriptor entry in the GDT table is compulsory. Certain emulators, like bochs, will complain about limit exceptions if you do not have one present. --Matt Durgavich (mattdurgavich@yahoo.com)''
* The null descriptor which is never referenced by the processor. Certain emulators, like Bochs, will complain about limit exceptions if you do not have one present. Some use this descriptor to store a pointer to the GDT itself (to use with the LGDT instructions). The null descriptor is 8 bytes wide and the pointer is 6 bytes wide so it might just be the perfect place for this.
* A code segment descriptor (for your kernel, it should have type=0x9A)
* A code segment descriptor (for your kernel, it should have type=0x9A)
* A data segment descriptor (you can't write to a code segment, so add this with type=0x92)
* A data segment descriptor (you can't write to a code segment, so add this with type=0x92)