IDT help

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
adeelmahmood1

IDT help

Post by adeelmahmood1 »

hi i started working on OS dev about 3 months ago and worked on it for about one and half month .. i got the boot loader working a a simple kernel with P mode enabled after that i tried to make my IDT which really got me in trouble .. i posted many messages but couldnt managed to make IDT ..
so here i m again asking for help
i want to make a simple IDT in C .. may be some one could help me
thanx
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:IDT help

Post by Pype.Clicker »

basically, what you need is some code that will set up an IDT entry to a given pointer (assuming most of your entries will be simple interrupt traps to the kernel code segment)

I also suggest you wrote a small assembly (yes. This is mandatory) stub code that will save registers and restore them once the C code has returned. Forget about having your C code referred directly by the IDT entry: this will not work (and using asm("iretd") at the end of the C function will not help you alot).
Mr_Spam

Re:IDT help

Post by Mr_Spam »

what about writing the IDT directly in asm? when i call an int instruction from within my kernel, the compputer resets..so theres probibly something wrong in my IDT.

so, an example of some IDT entry's in asm would look like?

dd isr_pointer0, isr_pointer1, isr_pointer2, isr_pointer3, isr_pointer4

or will that not work?
Peter_Vigren

Re:IDT help

Post by Peter_Vigren »

Mr_Spam wrote: what about writing the IDT directly in asm? when i call an int instruction from within my kernel, the compputer resets..so theres probibly something wrong in my IDT.

so, an example of some IDT entry's in asm would look like?

dd isr_pointer0, isr_pointer1, isr_pointer2, isr_pointer3, isr_pointer4

or will that not work?
The IDT entries is 8 byte wide.

The first word is the lower word of the Interrupt handler offset (the entry point for the interrupt).
The second word is the selector which the offset is located within.
The byte followed should be zero, according to what I've read.
Then a flag-byte is followed and the entry ends with the higher word of the offset to the handler...

Sorry if it was not that good as an explanation... is a bit tired...
Post Reply