They all have the same ISR, which does nothing than a call to putc().
So this is my IDT:
Code: Select all
; **** Interrupt Descriptor Table ****
; have 256 descriptor here, all having
; the same interrupt handler
; will change this at runtime
idt:
%rep 256
dw 0 ; offset 15:0
dw CS_SELECTOR ; selector
db 0
db 8Eh ; present, ring 0, '386 interrupt gate
dw 0 ; offset 31:16
%endrep
idt_end:
idt_ptr:
dw idt_end - idt - 1; IDT limit
dd idt ; start of IDT
; **** End of Interrupt Descriptor Table ****
Code: Select all
; now, let's set up an IDT
; up to now, we have 256 descriptors
; so first, fill every descriptor with
; a common interrupt handler routine
; afterwards, we'll change this
mov ecx,(idt_end - idt) >> 3 ; number of descriptors
mov edi,idt ; idt location
mov esi,common_isr ; common handler to esi
fill_idt:
mov eax,esi
mov [edi],ax ; low offset
shr eax,16
mov [edi+6],ax ; high offset
add edi,8 ; descriptor length
loop fill_idt
lidt [idt_ptr] ; ok, load the IDT
Code: Select all
common_isr:
; this is the common interrupt service routine
; this means, we haven't implemented this
; interrupt yet
; so we just return
extern putc
mov eax,"g"
push eax
call putc
iretd
Bochs sais something like:
LDTR.valid=0
Somebody can help? Is my IDT not right, or is the Interrupt Service routine not correct?