isr: add keyboard (0x21) handler

This commit is contained in:
2025-03-19 21:29:10 +03:00
parent 9b308de99b
commit 5bff255a7a
4 changed files with 23 additions and 3 deletions
+1 -1
View File
@@ -41,7 +41,7 @@ bin/screen.o: src/screen.c
$(CC) $(CFLAGS) -c $< -o $@
bin/isr.o: src/isr.c
$(CC) $(CFLAGS) -c $< -o $@
$(CC) $(CFLAGS) -mgeneral-regs-only -c $< -o $@
bin/idt.o: src/idt.c
$(CC) $(CFLAGS) -c $< -o $@
+1
View File
@@ -4,5 +4,6 @@
#include "../include/utils.h"
void pic_remap(int offset1, int offset2);
void pic_end_int(uint8_t irq);
#endif
+16 -2
View File
@@ -2,6 +2,7 @@
#include "../include/isr.h"
#include "../include/types.h"
#include "../include/screen.h"
#include "../include/pic.h"
void isr_custom();
void default_handler();
@@ -55,10 +56,23 @@ void default_handler()
}
void isr_custom()
#include <stddef.h>
#include <stdint.h>
typedef size_t uword_t;
struct interrupt_frame
{
uword_t ip;
uword_t cs;
uword_t flags;
uword_t sp;
uword_t ss;
};
__attribute__((interrupt)) void isr_custom(struct interrupt_frame *frame)
{
terminal_writestring("YOOOOO!!!!!! I LOVE KATYA!!!!");
asm("hlt");
pic_end_int(0x21);
}
void isr0()
+5
View File
@@ -70,3 +70,8 @@ void pic_disable(void) {
outb(PIC1_DATA, 0xff);
outb(PIC2_DATA, 0xff);
}
void pic_end_int(uint8_t irq) {
if (irq >= 8) outb(PIC2_COMMAND, 0x20);
outb(PIC1_COMMAND, 0x20);
}