Fix ps2 keyboard handling

This commit is contained in:
2025-09-09 21:43:05 +02:00
parent 3b42abc027
commit c4c26e0e19
2 changed files with 13 additions and 10 deletions

View File

@ -201,13 +201,15 @@ void intr_handleintr(IntrStackFrame *frame) {
break;
case INTR_IRQBASE+1:
int32_t c = ps2kb_intr();
intr_eoi(frame->trapnum - INTR_IRQBASE);
uint8_t *bytes = (uint8_t *)&c;
spinlock_acquire(&PS2KB_BUF.spinlock);
for (size_t i = 0; i < sizeof(c); i++) {
rbuf_push(&PS2KB_BUF.rbuf, bytes[i]);
if (c >= 0) {
uint8_t *bytes = (uint8_t *)&c;
spinlock_acquire(&PS2KB_BUF.spinlock);
for (size_t i = 0; i < sizeof(c); i++) {
rbuf_push(&PS2KB_BUF.rbuf, bytes[i]);
}
spinlock_release(&PS2KB_BUF.spinlock);
}
spinlock_release(&PS2KB_BUF.spinlock);
intr_eoi(frame->trapnum - INTR_IRQBASE);
break;
}
} else if (frame->trapnum == 0x80) {