Working kernel written on C and userspace-ready #1
@@ -1,9 +1,20 @@
|
|||||||
#include <Arch/Exceptions.h>
|
#include <Arch/Exceptions.h>
|
||||||
#include <Arch/GIC.h>
|
#include <Arch/GIC.h>
|
||||||
#include <OS/Panic.h>
|
#include <OS/Panic.h>
|
||||||
|
#include <OS/Scheduler.h>
|
||||||
|
|
||||||
Address ExceptionsHandler(ExceptionsContext* frame, ExceptionsType type) {
|
Address ExceptionsHandler(ExceptionsContext* frame, ExceptionsType type) {
|
||||||
if (type == ExceptionsIRQEl1h || type == ExceptionsIRQEl064) return GICDispatch(frame, type);
|
if (type == ExceptionsIRQEl1h || type == ExceptionsIRQEl064) return GICDispatch(frame, type);
|
||||||
|
if (type == ExceptionsSyncEl1h || type == ExceptionsSyncEl064) {
|
||||||
|
UInt32 esr = frame->esr_el1;
|
||||||
|
UInt32 class = (esr >> 26) & 0x3F;
|
||||||
|
UInt32 syndrome = esr & 0x1FFFFFF;
|
||||||
|
|
||||||
|
if (class == 0x11 || class == 0x15) {
|
||||||
|
if (syndrome == kOSSchedulerExceptionNumber) {
|
||||||
|
return SchedulerNext((Address)frame);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
OSPanicException(frame);
|
OSPanicException(frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user