anyone see a problem in this code?
when an int0 occurs the PC reboots..
;-----------------------constants-------------
IDTpntr:
IDTlim DW IDTend-IDT
IDTbase DD IDT
;------------------------idt--------------------
IDT:
;int0
offsetL DW ISR0
CODEsel DW 0x08
zeroes DB 0x00
settings DB 0x8E
IDTend:
offsetH DW 0x00
;--------------------------isr's--------------------
ISR0:
PUSHA
PUSH ES
PUSH FS
PUSH GS
PUSH SI
PUSH DI
[extern _isr00]
call _isr00
POP DI
POP SI
POP GS
POP FS
POP ES
POPA
iret
IDT
Re:IDT
Might be caused by pusha, you must push all 32 bit registers, so I think you might want to try with pushad and popad... Also why did you put IDTEnd before offsetH? I could not understand it... Another question how do you call int0? It is reserved interrupt I mean do you cause a divide by 0 error intentionally to call int0? Also are you sure you are enabling interrupts in a good time I mean are you programming pic and setting idt correctly by loading idtr? Also your isr routine might cause an error... Different advices... Hope one of them helps... Good luck.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:IDT
declaring only one entry for your IDT is not a good idea. Even if it's just in order to test it, you should declare the first 32 interrupts to be valid and have a handler ,even if it just prints "kernel panic" and hang the processor. Any exception caught for a invalid (out of the IDT limit) interrupt will raise a GPF. If the GPF isn't valid, it raises a "double fault". As this one isn't valid aswell, you got a tripple fault condition, which resets the computer ...