Files
ksOS/Kernel/Source/Arch/Exceptions.c
T
2026-05-03 21:57:20 +04:00

24 lines
798 B
C

// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (c) 2026 0xKSor
#include <Arch/Exceptions.h>
#include <Arch/GIC.h>
#include <OS/Panic.h>
#include <OS/Scheduler.h>
#include <OS/Syscall.h>
Address ExceptionsHandler(ExceptionsContext* frame, ExceptionsType 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 == 0x15) {
if (syndrome == kOSSchedulerExceptionNumber) return SchedulerNext((Address)frame);
if (syndrome == 0) return SyscallDispatch(frame);
}
}
OSPanicException(frame);
}