This is run in QEMU - when receiving a keyboard interrupt the following is written to the log by QEMU:
Code: Select all
Servicing hardware INT=0x21
118: v=21 e=0000 i=0 cpl=0 IP=0008:ffffffff80108813 pc=ffffffff80108813 SP=0010:ffffffff80919ff0 env->regs[R_EAX]=ffffffff82976000
When executing a read system call, the interrupt service routine will block execution until a new line is entered. But when the CPU is executing the system call ISR, I am not receiving any keyboard IRQs from the PIC, so the above message never appears.
Specifically, this is done by loading an ELF program from the file system and executing it. The program will perform a read system call by calling a software interrupt through int 80h.
Interrupts definitely work, as the kernel will handle a division error or any other exception. It's just the keyboard hardware interrupt that doesn't work.
The code for the OS is here: https://github.com/glolichen/lios.
Does this have to do with how the PIC is remapped, by any chance?
Code: Select all
mov dx, 0x20
mov al, 0x11
out dx, al
mov dx, 0x80
mov al, 0
out dx, al
mov dx, 0xA0
mov al, 0x11
out dx, al
mov dx, 0x80
mov al, 0
out dx, al
mov dx, 0x21
mov al, 0x20
out dx, al
mov dx, 0x80
mov al, 0
out dx, al
mov dx, 0xA1
mov al, 0x28
out dx, al
mov dx, 0x80
mov al, 0
out dx, al
mov dx, 0x21
mov al, 0x04
out dx, al
mov dx, 0x80
mov al, 0
out dx, al
mov dx, 0xA1
mov al, 0x02
out dx, al
mov dx, 0x80
mov al, 0
out dx, al
mov dx, 0x21
mov al, 0x01
out dx, al
mov dx, 0x80
mov al, 0
out dx, al
mov dx, 0xA1
mov al, 0x01
out dx, al
mov dx, 0x80
mov al, 0
out dx, al
mov dx, 0x21
mov al, 0xFD
out dx, al
mov dx, 0xA1
mov al, 0xFF
out dx, al