33 lines
839 B
C++
33 lines
839 B
C++
#define MODULE "irq"
|
|
|
|
#include "interrupts/IRQ.h"
|
|
#include "io/IO.h"
|
|
#include "io/PIC.h"
|
|
#include "log/Log.h"
|
|
#include "misc/reboot.h"
|
|
#include "rand/Init.h"
|
|
#include "std/stdio.h"
|
|
#include "thread/PIT.h"
|
|
#include "thread/Scheduler.h"
|
|
|
|
void IRQ::interrupt_handler(Context* context)
|
|
{
|
|
switch (context->irq_number)
|
|
{
|
|
case 0:
|
|
PIT::tick();
|
|
Scheduler::task_tick(context);
|
|
break;
|
|
case 1: {
|
|
[[maybe_unused]] volatile unsigned char scancode = IO::inb(0x60);
|
|
kdbgln("Keyboard key pressed/released, seconds since boot: %ld.%ld", PIT::ms_since_boot / 1000,
|
|
PIT::ms_since_boot % 1000);
|
|
reboot();
|
|
break;
|
|
}
|
|
default: kwarnln("Unhandled IRQ: %ld", context->irq_number); break;
|
|
}
|
|
Mersenne::reseed();
|
|
PIC::send_eoi(context->irq_number);
|
|
return;
|
|
} |