Adam Sulmicki adam@cfar.umd.edu writes:
FWIW, here's summary what I was able to gather so far
And the format of the GDT is: dummy GDT location source GDT entry target GDT entry BIOS CS BIOS SS
ok, I think I got it nailed down, how about the way it is below?
I'm not quite sure of your interpretation of #2 (GDT location), can you elaborate? Ie what would it be used for by BIOS. It seems to me like I already get this info from ES:SI.
CX = counter of 2-byte words ES:SI = pointer to to a structure of size of 0x30 which contains 6 GDT entries.
1 0x00 Reserved GDT (all 0's) 2 0x08 FS & GS GDT
(I think this is actually for the indirect link)
3 0x10 DS (src) GDT 4 0x18 ES (dst) GDT 5 0x20 CS (bios) GDT 6 0x28 SS (bios) GDT
of all those caller of the interrupt is required to only fill out #3 and #4 and leave all other blank.
Because we are not passed indirect link with (size of GDT,ptr to GDT) we can't use it directly in our LGDT call (after filling out missing info). We have to either copy it over or add another level of indirection.
I would put the indirect link in table entry 0x00. That way you can trivially call lgdt with the address of the gdt... Table entry 0x01 would do as well, and I think that is what my documentation was suggesting.
Eric