Set up the IDT

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
Darkman

Set up the IDT

Post by Darkman »

Its a stupid question but i can't find anything to help. How do i set up the IDT. Can anyone help or point me in the right derection please. thanks.

-- Darkman
jamethiel

RE:Set up the IDT

Post by jamethiel »

It's quite simple, really. The IDT is an array of 8-byte descriptors, similar to the GDT or LDT.

The first 32 are reserved to the CPU, and the rest are available for general use. It is theoretically possible to only have entries through the double-fault interrupt, but nobody is nuts enough to do that. Most people have 48 entries (the 32 CPU interrupts and the 16 hardware interrupts).

Basically, you allocate the memory for the IDT, initialize it with interrupt gates pointing to your interrupt handlers, and execute LIDT with the address and size of the table.

I'd post sample code, but the only sample I have handy is from my OS, and it would be spectacularly unenlightening (I'll post it anyway if anyone asks).

Hope this helps.
Darkman

RE:Set up the IDT

Post by Darkman »

Yah that helps. Thanks alot. :D
Post Reply