Rough outline of InterruptHandler

This commit is contained in:
Eryn Wells 2016-03-09 01:17:13 -05:00
parent 3879b3c324
commit 6677af27f6
3 changed files with 85 additions and 1 deletions

57
src/Interrupts.cc Normal file
View file

@ -0,0 +1,57 @@
/* Interrupts.cc
* vim: set tw=80:
* Eryn Wells <eryn@erynwells.me>
*/
/**
* Implementation of interrupt handers and things.
*/
#include "Interrupts.hh"
namespace x86 {
/*
* Static
*/
InterruptHandler&
InterruptHandler::systemInterruptHandler()
{
static InterruptHandler sInterruptHandler;
return sInterruptHandler;
}
/*
* Public
*/
InterruptHandler::InterruptHandler()
: mPIC(),
mIDT()
{ }
void
InterruptHandler::initialize()
{
mIDT.load();
mPIC.remap(0x20, 0x28, 2); // Map hardware IRQs to interrupt vectors 32 through 48.
}
void
InterruptHandler::enableInterrupts()
const
{
asm("sti");
}
void
InterruptHandler::disableInterrupts()
const
{
asm("cli");
}
} /* namespace x86 */