hw_x86_64: Forward interrupts to _interrupt function

Extend the Thread::exception function to forward external interrupts to
the _interrupt function for processing.
This commit is contained in:
Reto Buerki 2015-02-27 16:51:33 +01:00 committed by Christian Helmuth
parent d0024e1893
commit 2ecdf4f729
1 changed files with 7 additions and 2 deletions

View File

@ -16,8 +16,10 @@
#include <kernel/thread.h> #include <kernel/thread.h>
enum Cpu_exception { enum Cpu_exception {
PAGE_FAULT = 0x0e, PAGE_FAULT = 0x0e,
SUPERVISOR_CALL = 0x80, SUPERVISOR_CALL = 0x80,
INTERRUPTS_START = 0x20,
INTERRUPTS_END = 0xff,
}; };
using namespace Kernel; using namespace Kernel;
@ -38,6 +40,9 @@ void Thread::exception(unsigned const cpu)
if (trapno == SUPERVISOR_CALL) { if (trapno == SUPERVISOR_CALL) {
_call(); _call();
return; return;
} else if (trapno >= INTERRUPTS_START && trapno <= INTERRUPTS_END) {
_interrupt(cpu);
return;
} else { } else {
PWRN("unknown exception 0x%lx", trapno); PWRN("unknown exception 0x%lx", trapno);
_stop(); _stop();