mbr_asm/core/irq_handler.c

28 lines
647 B
C

#include "interrupt.h"
#include "io.h"
#include "irq.h"
#include "pic.h"
#include "vga.h"
// Need GCC > 6
__attribute__((interrupt)) void keyboard_handler(struct interrupt_frame *frame)
{
EOIIrq(IRQ_KEYBOARD);
char c = 0;
if (inb(0x60) != c) {
c = inb(0x60);
if (c > 0) {
printInt(c);
}
}
(void)frame;
}
__attribute__((interrupt)) void timer_handler(struct interrupt_frame *frame)
{
static int timeCnt = 0;
EOIIrq(IRQ_TIMER);
printIntDetails(timeCnt++, RED, BLACK, 20, VGA_HEIGHT - 1);
(void)frame;
}