I tried to add keyboard interrupts to my OS (https://github.com/ackOS-project/dev), but now the OS reboots when I press any key.
I don't know what's wrong and I have left it for a few months now.
Please help
Keyboard interrupts crash the kernel
Re: Keyboard interrupts crash the kernel
Code: Select all
void idt_initialize()
{
_idt[1] = idt_entry_create((uint64_t)&interrupt_irq1, 0, INTERRUPT_GATE);
Code: Select all
;remapping PIC
OUTB 0x20, 0x11
OUTB 0xA0, 0x11
OUTB 0x21, 0x20
OUTB 0xA1, 40
OUTB 0x21, 0x04
OUTB 0xA1, 0x02
OUTB 0x21, 0x01
OUTB 0xA1, 0x01
OUTB 0x21, 0xF8 ;unmask irq 0, 1, 2
OUTB 0xA1, 0xEF ;unmask irq 12
Re: Keyboard interrupts crash the kernel
As the above post mentioned, PS/2 keyboard is not entry 1 in the IDT.
Also, ensure that your keyboard handler is sending an EOI to the PIC, and also reading from port 0x60 (keyboard).
Issues with interrupts are extremely common on this forum.
Also, I feel the need to explain that the reason the kernel crashes, is because the CPU is trying to send exceptions and they are going unhandled.
Also, ensure that your keyboard handler is sending an EOI to the PIC, and also reading from port 0x60 (keyboard).
Issues with interrupts are extremely common on this forum.
Also, I feel the need to explain that the reason the kernel crashes, is because the CPU is trying to send exceptions and they are going unhandled.
Skylight: https://github.com/austanss/skylight
I make stupid mistakes and my vision is terrible. Not a good combination.
NOTE: Never respond to my posts with "it's too hard".
I make stupid mistakes and my vision is terrible. Not a good combination.
NOTE: Never respond to my posts with "it's too hard".
Re: Keyboard interrupts crash the kernel
Yeah, I would also suggest getting the exception handlers going post-haste. And if all they do is print "exception x at IP y" and then hang indefinitely, that is still better than tripple faulting.
Carpe diem!