IRQ handler Ok?

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
jrfritz

IRQ handler Ok?

Post by jrfritz »

I would like to know if this IRQ handler is OK...anything special I should add/anything missing?

Code: Select all

IRQ_0:      ;PIT (Programmable Interrupt Timer)
   ;****************************************************
   ;* A sample of how to handle a interrupt from IRQ 0 *
   ;****************************************************
   PUSHA
   CALL PIT_Handler
   MOV AL, 0x20
   OUT 0x20, AL
   POPA
   IRET

IRQ_1:      ;Keyboard
   ;*****************************************************
   ;* A sample of how to handle an interrupt from IRQ 1 *
   ;*****************************************************
   PUSHA
   CALL KHan
   MOV AL, 0x20
   OUT 0x20, AL
   POPA
   IRET
Unexpected

Re:IRQ handler Ok?

Post by Unexpected »

I think all ok ;D
K.J.

Re:IRQ handler Ok?

Post by K.J. »

Looks good... though you might want to save/change cs, ds, es, or ds later on when you get multiple rings.

K.J.
Whatever5k

Re:IRQ handler Ok?

Post by Whatever5k »

I would recommend to save (push) all registers and load them with a selector that is known to be ok. Something like this:

Code: Select all

...
pusha
mov eax, DS_SELECTOR
mov ds, eax
mov es, eax
mov fs, eax
mov gs, eax
...
Post Reply