Verifying the GDT

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
FunnyGuy9796
Member
Member
Posts: 61
Joined: Tue Sep 13, 2022 9:29 pm
Libera.chat IRC: FunnyGuy9796

Verifying the GDT

Post 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
Octocontrabass
Member
Member
Posts: 5492
Joined: Mon Mar 25, 2013 7:01 pm

Re: Verifying the GDT

Post 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.
Post Reply