Page 1 of 1

Verifying the GDT

Posted: Mon Mar 04, 2024 5:25 pm
by FunnyGuy9796
I apologize in advance if this is a basic or stupid question. However, I was curious if there was a way to verify that the GDT is set up properly. I assume it would have something to do with the GDTR register but I wasn't sure.

Thanks

Re: Verifying the GDT

Posted: Mon Mar 04, 2024 6:56 pm
by Octocontrabass
The easiest way to verify your GDT is to use it. If it works, you must have done something right.

You can use "info gdt" in the Bochs debugger to decode the contents of the current GDT. It doesn't quite display everything, but it's good for a quick sanity check.

You can use "sreg" in the Bochs debugger or "info registers" in the QEMU monitor to decode the contents of the segment registers. Of course, you have to load descriptors from your GDT into the segment registers before you can see them this way.

Other virtual machines probably have similar tools, but I'm not familiar with any of them.