Page 1 of 1

IDT

Posted: Tue Apr 01, 2003 3:45 pm
by slacker
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

Re:IDT

Posted: Tue Apr 01, 2003 4:36 pm
by Ozguxxx
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.

Re:IDT

Posted: Tue Apr 01, 2003 6:19 pm
by slacker
i didnt enable interrupts and i did
int c = 7/0;
to cause the divide error.
do i have to enable interrupts for it to work?

Re:IDT

Posted: Tue Apr 01, 2003 8:18 pm
by Curufir
Processor exceptions will get called independent of whether you have the IDT setup correctly, are handling them correctly, or have interrupts enabled. The processor has no means to automatically recover from something like a GPF, so exceptions are never masked.

Re:IDT

Posted: Fri Apr 04, 2003 7:00 pm
by slacker
but is there something in my code that would make the PC reboot?

Re:IDT

Posted: Sat Apr 05, 2003 3:36 am
by Tim
If you don't have an exception handler then any exception will cause the PC to reboot.

Re:IDT

Posted: Sat Apr 05, 2003 8:06 am
by slacker
my ISR pushed all registers, called an external function, and popped registers..why would that reboot the pc?

Re:IDT

Posted: Sat Apr 05, 2003 8:08 am
by slacker
p.s. the external function that was called printed("divide by zero error") and i know my print function works....

Re:IDT

Posted: Sun Apr 06, 2003 4:57 am
by Pype.Clicker
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 ...