IDT problem

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
david

IDT problem

Post by david »

I try to setup my IDT:

--------------------------------------
...
cli ; no interrupts allowed!

mov edi, idt
mov esi, panic
mov ecx, 64     ; number of exception handlers
do_idt:
mov eax, esi   ; EAX=offset of entry point
mov [edi], ax   ; set low 16 bits of gate offset
shr eax,16
mov [edi + 6], ax   ; set high 16 bits of gate offset
add edi, 8     ; 8 bytes/interrupt gate
dec ecx
jne do_idt
...

jmp dword code_desc:go32
[bits 32]
go32:
...
sti
        ...

idtr dw idt_end-idt-1
dd idt
idt:

%rep 64
dw 0 ; offset 15:0
dw code_desc ; selector, linear code selector
db 0     ; (always 0 for interrupt gates)
db sys_interrupt ; present,ring 0,'386 interrupt gate
dw 0   ; offset 31:16
%endrep

idt_end:

irq_clear:
push ax
mov al, 0x20
out 0x20, al ; quiet screaming irq chip.
pop ax
ret

panic:
push edi
mov byte [es:edi], "#" ; ES = Video_desc
pop edi                     ; just print a debug message
call irq_clear
iret
------------------------------------------
After I use "sti", Bochs says:

FATAL: floppy recal:f07: ctrl not ready
>>PANIC<< BIOS panic at rombios.c, line 1558

What's the worse, CPU turns back to real mode after "sti". :-(

But what's the matter? Is there anything wrong?
Hope someone can help me.

Thanks in advance.
~

RE:IDT problem

Post by ~ »

i guess there there should be mov eax,[esi] after do_idt
David

RE:IDT problem

Post by David »

Sad but true, this still cannot work. :-(

Bochs says:
FATAL: floppy recal:f07: ctrl not ready
>>PANIC<< BIOS panic at rombios.c, line 1558

CPU turns back to real mode,too.
EyeScream

RE:IDT problem

Post by EyeScream »

Maybe I'm just stupid, but where's the "LIDT"?
Post Reply