ISR's in Pmode

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
Bart Grantham

ISR's in Pmode

Post by Bart Grantham »

So I'm trying to write an ISR that will run in Pmode.  I'm doing this in C, with the requisite asm wrapper.  I believe that my ASM wrapper and C code are ok because I can switch the iret to a ret and it works exactly as I expect (reads keycode from 0x60 and displays to screen).  So with all that in place...

How do I register this interrupt?  I know how to unmask the IRQ, but where do I put the pointer to my function?  I've read Craig Peacock's tutorial/intro [ http://www.nondot.org/sabre/os/files/Mi ... terupt.pdf ] and it seems very clear, but I think that it was written with real mode in mind and things seem very different in protected mode.

So obviously it's not as simple as writing &my_keyboard_isr to memory location 9 * 32.  How is it done?
Bart Grantham

Re: ISR's in Pmode

Post by Bart Grantham »

Ah!  I found a page that somewhat discusses my problem.  A quote:

"Unlike in real mode, where the interrupt vector table is always at address 00000h, in protected mode, the Interrupt Descriptor Table can be anywhere in memory and is protected by the processor and the OS. Also unlike the real-mode interrupt vector table, the IDT stores additional information about the various handlers, but it is essentially still a "jump table" indexed on the interrupt number."
[ http://courses.ece.uiuc.edu/ece291/book ... rupts.html ]

Well, I think I can figure it out from here by checking the Multiboot Spec (I am using GRUB).  If any of the guru's want to follow up, I'd appreciate the sanity check and I'm sure others would find it helpful.
Post Reply