I was new around these forums a little while back, but did not know a thing, so i stopped and started reading up more on C and Asm and studied through most of the Intel volumes.
Now i am back.
I have written myself a basic kernel with a print function as the first thing i load so i can give messages as what is loading. So after i had that in place it was time for a gdt, so i have been coding and finished just a few days ago, but i want to make sure it has indeed been refreshed (i am using grub..and kept getting triple fault errors until i read a tutorial on this site...but now i get no errors )
If you think i should take more time on reading up on intel's manuals and such, please tell me, it did wonders for me last time .
Prove my global descriptor table has indeed been reloaded.
-
- Member
- Posts: 29
- Joined: Mon Jun 30, 2008 9:51 am
Re: Prove my global descriptor table has indeed been reloaded.
Hi,
It should be easy to find out if your GDT has been loaded correctly - load a correct descriptor into a segment register and try to use it, then make that GDT entry "not present" (before you attempt to load the descriptor into a segment register) and see if the OS crashes (like it should). If changing your GDT descriptor has no effect on your code, then your code isn't using your GDT.
You could also use the SGDT instruction to find out where the CPU thinks the current GDT is. Another alternative would be to use Bochs debugger to display all the information about the current GDT (e.g. the "info gdt" command).
Cheers,
Brendan
It should be easy to find out if your GDT has been loaded correctly - load a correct descriptor into a segment register and try to use it, then make that GDT entry "not present" (before you attempt to load the descriptor into a segment register) and see if the OS crashes (like it should). If changing your GDT descriptor has no effect on your code, then your code isn't using your GDT.
You could also use the SGDT instruction to find out where the CPU thinks the current GDT is. Another alternative would be to use Bochs debugger to display all the information about the current GDT (e.g. the "info gdt" command).
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
-
- Member
- Posts: 29
- Joined: Mon Jun 30, 2008 9:51 am
Re: Prove my global descriptor table has indeed been reloaded.
Ah, that worked! My kernel crashed like it should have and restarted. Thank you very much!
Chris
Chris