diff --git a/Makefile b/Makefile index a429b21..c3c73e2 100644 --- a/Makefile +++ b/Makefile @@ -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 $@ diff --git a/include/pic.h b/include/pic.h index aa06fcd..ad4c094 100644 --- a/include/pic.h +++ b/include/pic.h @@ -4,5 +4,6 @@ #include "../include/utils.h" void pic_remap(int offset1, int offset2); +void pic_end_int(uint8_t irq); #endif diff --git a/src/isr.c b/src/isr.c index 4447a73..0f46302 100644 --- a/src/isr.c +++ b/src/isr.c @@ -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 +#include +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() diff --git a/src/pic.c b/src/pic.c index 5c7495b..25434f8 100644 --- a/src/pic.c +++ b/src/pic.c @@ -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); +}