Code: Select all
filler_int:
cli
cld
pusha
push ds
push es
mov eax, 0x10 ;data descriptor
mov ds, eax
mov esi, interrupt_msg
call simple_print
;note we are useing eax and the stack, that is because it is safe
; to assume we are in protected mode, because we dont setup the
; IDT until we are in protected mode.
pop es
pop ds
popa
iret
i mapped the pic, copying the code from this tutorial http://osdev.neopages.net/tutorials/pic.php
and this is how i load the idt (lifted from the linux setup code mainly)
Code: Select all
;Setup IDT with filler interrupt handler.
; eax: offset 16-31 (16b) | flags (16b)
; ebx: segment selector (16b) | offset 0-15
;eax = 0010 for offset. and 0x8e00 for flags. 0x00108e00
;ebx = 0008, 003c for offset
lea eax, [filler_int] ; 0x0010003c in eax for example, ax here is 003c
mov ax, 0x8e00 ;mov flags into low word. flags are: interrupt
;gate, dpl = 0, present.
mov ebx, 0x00080000 ;mov in offset of CS segment selector, and clear
; low word (bx) for coming offset
lea ecx, [filler_int] ;get address so we can put bottom half in ebx
mov bx, cx ;move low word of interrupt handler into ebx
lea edi, [IDT]
mov ecx, 0x100 ;loop 256 times to fill all of idt
load_idt_with_filler_interrupt:
mov [edi], eax ;load first half of handler into address of IDT
add edi, 4
mov [edi], ebx ;load second half into address of IDT (assuming edi is
; the base of the IDT, IDT now points to top of IDT)
add edi, 4
dec ecx
jne load_idt_with_filler_interrupt
did i setup everything correctly?
and am i testing this the correct way?
also i am wondering if i loaded the interrupt gate in the correct order, i loaded, the flags (dpl, present-flag, signature to say it is an interrupt gate etc) first ( i load 16bits at a time), then i load the last half of the offset, then the first part of the offset, then the segment selector.
i have searched the forum and the only relavent post i could find was a fellow who had the same problem as me but was loading without any exception gates (just like i am doing) so i tried to replace some and all of the IDT entries with exception gates but i still had the same problem.
any help would be most appreciated.
thanks for your time,
libber