hello all,
i'm developing out a protected-mode os. I've jumped into the pmode and now i've started writing interrupts. I heard that interrupts 0h-1fh are exceptions and 20h-2fh are for hardware interrupts. I've written a procedure to install the interrupts. The idt structure is:
idt:
%rep 0x1f
dw 0
dw 08h ; code segment
db 0
db 8eh
dw 0
%endrep
idt_end:
idt_descriptor:
size dw idt_end - idt - 1
dd idt
------------------------------------
I've written a simple interrupt handler for the divide by 0 exception. But, when i write a code as:
mov ax, 20h
mov bl, 0h
div bl
i get the error message as "3rd (13) exception with no resolution". The interrupt handler is below:
int_0:
pusha
push ss
push gs
push ds
push fs
pop fs
pop ds
pop gs
pop ss
popa
iretd
The gdt structure for the code segment is :
code_descriptor:
dw 0xFFFF
dw 0
db 0
db 0x9A
db 0xCF
db 0
Please help me out of this problem.
Thanks in advance.
Try to solve this
RE:Try to solve this
1) IDT.offset == 0, but should point at the exception handler
%rep 0x1f
dw 0 <- IDT.offset low word
dw 08h ; code segment
db 0
db 8eh
dw 0 <- IDT.offset high word
%endrep
2) Your exception handler should not return back to the faulting code:
int_0:
pusha
push ss
push gs
push ds
push fs
pop fs
pop ds
pop gs
pop ss
popa
iretd
instead try:
int_0:
cli
hlt
which will hand the comp.
Cheers
%rep 0x1f
dw 0 <- IDT.offset low word
dw 08h ; code segment
db 0
db 8eh
dw 0 <- IDT.offset high word
%endrep
2) Your exception handler should not return back to the faulting code:
int_0:
pusha
push ss
push gs
push ds
push fs
pop fs
pop ds
pop gs
pop ss
popa
iretd
instead try:
int_0:
cli
hlt
which will hand the comp.
Cheers
RE:Try to solve this
Actually, i've written a procedure to assign the low-word and high-word of the interrupt handler. But, still i get the triple fault when i call the interrupt.