Move exception dispatch to InterruptHandler
This commit is contained in:
parent
3e1993084d
commit
10d006eb90
2 changed files with 30 additions and 22 deletions
|
@ -84,6 +84,34 @@ InterruptHandler::disableInterrupts()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
InterruptHandler::dispatchException(uint8_t exception)
|
||||||
|
{
|
||||||
|
using x86::Interrupt;
|
||||||
|
|
||||||
|
auto& console = kernel::Console::systemConsole();
|
||||||
|
console.printString("Received exception ");
|
||||||
|
switch (Interrupt(exception)) {
|
||||||
|
case Interrupt::DE:
|
||||||
|
console.printString("#DE");
|
||||||
|
break;
|
||||||
|
case Interrupt::NMI:
|
||||||
|
console.printString("NMI");
|
||||||
|
break;
|
||||||
|
case Interrupt::DF:
|
||||||
|
console.printString("#DF");
|
||||||
|
break;
|
||||||
|
case Interrupt::GP:
|
||||||
|
console.printString("#GP");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
console.printString("SOME OTHER THING");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
console.printString("\nAbort. :(");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
InterruptHandler::dispatchHardwareInterrupt(uint8_t irq)
|
InterruptHandler::dispatchHardwareInterrupt(uint8_t irq)
|
||||||
{
|
{
|
||||||
|
@ -150,28 +178,7 @@ extern "C"
|
||||||
void
|
void
|
||||||
dispatchExceptionHandler(size_t vector)
|
dispatchExceptionHandler(size_t vector)
|
||||||
{
|
{
|
||||||
using x86::Interrupt;
|
x86::InterruptHandler::systemInterruptHandler().dispatchException(vector);
|
||||||
|
|
||||||
auto& console = kernel::Console::systemConsole();
|
|
||||||
console.printString("Received exception ");
|
|
||||||
switch (Interrupt(vector)) {
|
|
||||||
case Interrupt::DE:
|
|
||||||
console.printString("#DE");
|
|
||||||
break;
|
|
||||||
case Interrupt::NMI:
|
|
||||||
console.printString("NMI");
|
|
||||||
break;
|
|
||||||
case Interrupt::DF:
|
|
||||||
console.printString("#DF");
|
|
||||||
break;
|
|
||||||
case Interrupt::GP:
|
|
||||||
console.printString("#GP");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
console.printString("SOME OTHER THING");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
console.printString("\nAbort. :(");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,7 @@ struct InterruptHandler
|
||||||
void enableInterrupts() const;
|
void enableInterrupts() const;
|
||||||
void disableInterrupts() const;
|
void disableInterrupts() const;
|
||||||
|
|
||||||
|
void dispatchException(uint8_t exception);
|
||||||
void dispatchHardwareInterrupt(uint8_t irq);
|
void dispatchHardwareInterrupt(uint8_t irq);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue