I'm busy handling some exceptions but unfortunately I still don't have any success with it. I'm installing a IDT and have a default exception handler, the only problem is: the handler is never called. This is my code, I'm in 32bits pure assembly:
Code: Select all
Initialize_IDT:
pusha
mov ecx, 0
.loop:
cmp ecx, 256 ;Did we set every decriptor?
je .done
mov eax, 8 ;Location of descriptor = IDT_start + (NumberOfInterrupt * 8)
mul ecx
mov ebx, IDT_start
add eax, ebx ;EAX is location to store handler
mov edx, handler
mov ebx, edx
and edx, 0xFFFF ;EDX = LoBase
shr ebx, 16 ;EBX = HiBase
mov WORD [eax], dx ;Store the LoBase
mov WORD [eax+2], 0x8 ;Set the selector
mov BYTE [eax+4], 0 ;Reserved
mov BYTE [eax+5], 10001110b ;01110 = 32bits, 00 = ring 0, 1 = set
mov WORD [eax+6], bx ;Store the HiBase
inc ecx ;Point to next decriptor
jmp .loop ;Loop
.done:
lidt [idtr] ;Install the IDT
popa
ret
handler:
mov DWORD [gs:0xB8000], ') : ' ;Print a sad smiley to the screen
cli
hlt
IDT_start:
times 2048 db 0 ;IDT buffer
IDT_end:
idtr:
dw IDT_end - IDT_start - 1
dd IDT_start
Thanks in advance!