Hello. ^^
I've a question about IRQ0(system timer) handling.

= env =
# CS:0008
# DS:0010
# IRQ0 -> IDT 20h (redirected)
# IDT 20h (0008:irq0_handler, system seg, 32bit, DPL:0, interrupt gate)
# IRQ0 ( 50 times per second)

= irq0_handler =
pushad
mov al, 20h ; send EOI
out 20h, al
;; print "IRQ0 handler" ;;
popad
iretd

= result =
IRQ0 handler (==>> this handler was called ONLY ONE TIME!!)

= problem =
After enabling maskable interrupt(by STI), "first IRQ0 interrupt" occured and irq0_handler started correctly.
But, "second IRQ0 interrupt" didn't occur! ONLY ONE TIME this handler was called by processor.

I dunno why it is.. I think all setting are completely adapted. other interrupts(i.e. GP) works OK!!
but, only IRQ0 didn't work well.
why?? why?? did i wrong something?


thank you for reading..
regards..
Posted on 2003-08-18 04:31:21 by Yeori

Hello. ^^
I've a question about IRQ0(system timer) handling.

= env =
# CS:0008
# DS:0010
# IRQ0 -> IDT 20h (redirected)
# IDT 20h (0008:irq0_handler, system seg, 32bit, DPL:0, interrupt gate)
# IRQ0 ( 50 times per second)

= irq0_handler =
pushad
mov al, 20h ; send EOI
out 20h, al
;; print "IRQ0 handler" ;;
popad
iretd

= result =
IRQ0 handler (==>> this handler was called ONLY ONE TIME!!)

= problem =
After enabling maskable interrupt(by STI), "first IRQ0 interrupt" occured and irq0_handler started correctly.
But, "second IRQ0 interrupt" didn't occur! ONLY ONE TIME this handler was called by processor.

I dunno why it is.. I think all setting are completely adapted. other interrupts(i.e. GP) works OK!!
but, only IRQ0 didn't work well.
why?? why?? did i wrong something?


thank you for reading..
regards..




;= irq0_handler =
sti ;Enable Interrupts because cli was called on the interrupt...
pushad
mov al, 20h ; send EOI
out 20h, al
;; print "IRQ0 handler" ;;
popad
iretd
Posted on 2003-08-19 11:04:32 by SpooK
This is the IRQ0 handler of SOL OS, as you can see there is no STI inside and / or at end of handler because IRETD is supposed to reenable this... actually you might notice that i was unsure of the IRQ enable/disable status in start of handler so i use CLI to stop eventually reentrant IRQ0 reguest (i know its overkill)

So the error should be somewhere else, the fact that Exceptions and Traps work its good ... but is no guarantee that hardware IRQs will work also because those are a little bit more complicated ...



irq_00_hand:
cli
pushad

inc [cnt_timer] ; increment system timer/counter

mov eax,[fdd_motor_on_timer] ;defined in fdc_8272.asm
test eax,eax
jz irq_00_exit

dec eax
mov [fdd_motor_on_timer],eax
jnz irq_00_exit
;-------------------------------------------------
; time to stop FDD motor ...
;-------------------------------------------------
mov edx,03F2h
mov eax,00h ;0Ch=just stop mottor do not disable FDC.. maybe but why to do that?
mov [fdd_motor_on_flag],eax ;defined in fdc_8272.asm
out dx,al

irq_00_exit:
;---------------------------
; send EOI to PIC
;---------------------------
mov al,20h
out 20h,al

popad
iretd
Posted on 2003-08-19 15:30:30 by BogdanOntanu
Thank you all guys. ^^

and @BogdanOntanu, your OS makes me amazing..
How did you develop the OS only in ASM..?? I can't never do that.. :)

Anyway, all guys have a happy day! thanks alot! :grin:
Posted on 2003-08-21 12:31:10 by Yeori