No INTs after switch to real mode
Posted: Tue Sep 02, 2008 10:45 am
Hi,
if I would switch from protected mode to real mode, it all works, but I can't receive interrupts - e.g. xor ax, ax int 16h will freeze with "internal keybuffer full, ignoring scancode", that same applies if I would try to read from floppy drive using BIOS's services.
My kernel starts from real mode and there I save the original GDT and IDT,
and then, immediately before the rmode switch, I load these backup gdt and idt, lgdt [savegdt], lidt [saveidt]. After switching I set the segment registers and remap the PIC to real mode values, like this:
but it doesn't work either.
My guess is that the PIC is remapped incorrectly... any advice?
Regards
inflater
if I would switch from protected mode to real mode, it all works, but I can't receive interrupts - e.g. xor ax, ax int 16h will freeze with "internal keybuffer full, ignoring scancode", that same applies if I would try to read from floppy drive using BIOS's services.
My kernel starts from real mode and there I save the original GDT and IDT,
Code: Select all
savegdt:
rw 1
rd 1
saveidt:
rw 1
rd 1
sgdt [savegdt]
sidt [saveidt]
Code: Select all
remap_pic_realmode:
cli
out 0x21,al
mov al,0x4
out 0x21,al
mov al,0x1
out 0x21,al
mov al,0x11
out 0xa0,al
mov al,0x70
out 0xa1,al
mov al,0x2
out 0xa1,al
mov al,0x1
out 0xa1,al
mov al,0x0
out 0x21,al
mov al,0x0
out 0xa1,al
sti
ret
My guess is that the PIC is remapped incorrectly... any advice?
Regards
inflater