GRUB

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
Pela Kiu
Posts: 3
Joined: Tue Dec 06, 2005 12:00 am

GRUB

Post by Pela Kiu »

How is GDT,IDT,LDT tables asigned at the moment that grub call the entry point of the kernel. Are interrupts enabled?
User avatar
carbonBased
Member
Member
Posts: 382
Joined: Sat Nov 20, 2004 12:00 am
Location: Wellesley, Ontario, Canada
Contact:

Re: GRUB

Post by carbonBased »

This isn't defined by the multiboot standard, that i can recall, and therefore you shouldn't rely on GRUB to put your kernel in any known format.

The first thing you should do is setup your own GDT, IDT and (if required) LDT.

That being said, if I recall correctly, when I was writting my kernel entry code, GRUB put the system into a state with a GDT with two entries... one code, one data, each the full 4GB range. No LDT, and interrupts disabled (therefore probably no IDT either).

--Jeff
rexlunae
Member
Member
Posts: 134
Joined: Sun Oct 24, 2004 11:00 pm
Location: North Dakota, where the buffalo roam

Re: GRUB

Post by rexlunae »

carbonBased wrote:This isn't defined by the multiboot standard, that i can recall, and therefore you shouldn't rely on GRUB to put your kernel in any known format.
The multiboot standard specifies that you need to set up your own GDT and IDT, but it does specify that the interrupts are disabled, and it says that the os must define an IDT before enabling them. Enterring protected mode without an IDT defined and with interrupts enabled would risk a tripple-fault.

My info comes from <a href="http://www.gnu.org/software/grub/manual/multiboot/">this</a> document.
Post Reply