PIC changing offset fails
Posted: Sun Oct 14, 2018 3:41 am
Hi everyone. I have been playing around with a toy kernel for a while. Now, I have started adding interrupts. IDT is set up, ISR works, prints a line on the screen (although crashes after several hundred timer ticks, since it messes up the stack, I'll fix that later, I promise )
However, the timer interrupt only fires if I bind it to INT 0x8. I have added the PIC init code to the initialization sequence to remap the master PIC to INT 0x20, but the ISR runs only if I also bind it to INT 8.
I thought maybe I use C asm blocks incorrectly, so I moved the PIC init code to the ASM loader part of the kernel. Still, nothing changes, INT 8 fires, INT 0x20 doesn't. I use QEMU to run the kernel, I even thought about recompiling QEMU to add debug statements to the PIC emulation code, but it seems an unreasonable amount of work.
Could someone please proofread my PIC init asm code? I use NASM.
However, the timer interrupt only fires if I bind it to INT 0x8. I have added the PIC init code to the initialization sequence to remap the master PIC to INT 0x20, but the ISR runs only if I also bind it to INT 8.
I thought maybe I use C asm blocks incorrectly, so I moved the PIC init code to the ASM loader part of the kernel. Still, nothing changes, INT 8 fires, INT 0x20 doesn't. I use QEMU to run the kernel, I even thought about recompiling QEMU to add debug statements to the PIC emulation code, but it seems an unreasonable amount of work.
Could someone please proofread my PIC init asm code? I use NASM.
Code: Select all
mov al,0x11
out 0x20,al
out 0xa0,al
mov al,0x20
out 0x21,al
mov al,0x28
out 0xa1,al
mov al,0x04
out 0x21,al
mov al,0x02
out 0xa1,al
mov al,01
out 0x21,al
out 0xa1,al
mov al,0xfe
out 0x21,al