The table itself is defined by two attributes (base and size), which can be created and loaded into the gdt regster in asm with:
Code: Select all
lgdt [gdt]
gdt:
limit dw 0x0000 ; ...some hex val
base dd 0x00000000 ; "
The first entry must be a null entry. I guess that means I add an entry (however I do that) of 8 bits all zeroed out. Okay, that sounds like it will be simple enough to do as soon as I learn how to add an entry, but again, what is the point? I don't want to do things "just because." WHY is it necessary to have a null entry first? I suppose I might better understand the answer to that if I at least understood the general prupose that the GDT serves.
Next, I need to add a code segment descriptor.
Next, I need to add a data segment descriptor.
Finally, as soon as I enter protected mode, I must jump to the first byte in the described code segment.
Okay, after having received these points about the GDT other questions come to mind... Let me organize them so they don't seem like a jumble of irrecoverable confusion
Is the code segment that I am required to set up and jump to akin to my Protected mode's "main" function?
Do I add two new descriptors (code and data) for every running process?
An well documented example of the GDT being used for something would be great help.
There are a lot of questions in there and probably a lot of statements made about the GDT that I thought were right but are actually flat out wrong. Again, I'm sorry if this is something that shouldn't be this hard to grasp, but I guess I'm just that slow.
All help is appreciated,
Brodeur235