Global Descriptor Table -- whoa
Posted: Tue Apr 12, 2005 4:50 pm
Hello again. I have gotten a little farther since my last posts (Hello World C Kernel after using GRUB) . Now I want to setup a GDT for my OS. This is good. Well I'm writing my C code to be more in assembly as opposed to C (don't ask why my coding style)
Something like this
gdt_install() refrencing code in my assembly stub .
Now I know that you must have a Dummy, Code, and Data entry and that you must you use the lgdt instruction to load the GDT. (Pointing it to a block of code with the length of the GDT and pointer to the GDT's memory address ) Good fine.
Now, I don't like writing code when I don't know how it will help me and what it's uses are. So can someone please enlighten me on this? Thanks.
I also need to know if it's needed to make a GDT for the user space as well (Dunno, saw it in a kernel once)
All help is appreciated.
Regards,
Warrior
Something like this
Code: Select all
void init_gdt()
{
???/* We want to jump to our Assembly code for the GDT */
???
???gdt_install();
???notify_kernel("The Global Descriptor Table has been loaded");???
??????return; /* Return Back to main() */
}
Now I know that you must have a Dummy, Code, and Data entry and that you must you use the lgdt instruction to load the GDT. (Pointing it to a block of code with the length of the GDT and pointer to the GDT's memory address ) Good fine.
Now, I don't like writing code when I don't know how it will help me and what it's uses are. So can someone please enlighten me on this? Thanks.
I also need to know if it's needed to make a GDT for the user space as well (Dunno, saw it in a kernel once)
All help is appreciated.
Regards,
Warrior