Luna/kernel/src/interrupts/IRQ.cpp

23 lines
623 B
C++
Raw Normal View History

2022-09-05 14:13:51 +00:00
#include "interrupts/IRQ.h"
#include "io/IO.h"
#include "io/PIC.h"
2022-09-14 16:54:40 +00:00
#include "rand/Init.h"
2022-09-05 14:13:51 +00:00
#include "scheduling/PIT.h"
#include "std/stdio.h"
void IRQ::interrupt_handler(SavedContext* context)
{
switch (context->irq_number)
{
case 0: PIT::tick(); break;
2022-09-05 14:13:51 +00:00
case 1: {
[[maybe_unused]] volatile unsigned char scancode = IO::inb(0x60);
2022-09-06 16:31:27 +00:00
printf("Keyboard key pressed, seconds since boot: %ld\n", PIT::ms_since_boot / 1000);
2022-09-05 14:13:51 +00:00
break;
}
2022-09-06 16:31:27 +00:00
default: printf("Unhandled IRQ: %ld", context->irq_number); break;
2022-09-05 14:13:51 +00:00
}
2022-09-14 16:54:40 +00:00
Mersenne::reseed();
2022-09-05 14:13:51 +00:00
PIC::send_eoi(context->irq_number);
return;
}