Files
2026-05-03 13:05:55 +04:00

72 lines
1.5 KiB
C

// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (c) 2026 0xKSor
#pragma once
#include <Types.h>
typedef struct ExceptionsContext {
UInt64 x0;
UInt64 x1;
UInt64 x2;
UInt64 x3;
UInt64 x4;
UInt64 x5;
UInt64 x6;
UInt64 x7;
UInt64 x8;
UInt64 x9;
UInt64 x10;
UInt64 x11;
UInt64 x12;
UInt64 x13;
UInt64 x14;
UInt64 x15;
UInt64 x16;
UInt64 x17;
UInt64 x18;
UInt64 x19;
UInt64 x20;
UInt64 x21;
UInt64 x22;
UInt64 x23;
UInt64 x24;
UInt64 x25;
UInt64 x26;
UInt64 x27;
UInt64 x28;
UInt64 x29; // fp
UInt64 x30; // lr
UInt64 elr_el1; // pc
UInt64 spsr_el1; // cpu status
UInt64 esr_el1; // error reason
UInt64 sp_el0; // user's stack
UInt64 padding; // align to 16 bytes
} ExceptionsContext;
typedef enum ExceptionsType {
// curr el with sp0 (EL1t)
// usually dont happen cuz we switch to sp_el1, but just in case
ExceptionsSyncEl1t,
ExceptionsIRQEl1t,
ExceptionsFIQEl1t,
ExceptionsSErrorEl1t,
// curr el with sp1 (EL1h)
// exception in kernel space
ExceptionsSyncEl1h,
ExceptionsIRQEl1h,
ExceptionsFIQEl1h,
ExceptionsSErrorEl1h,
// lower EL 64-bit from userspace
ExceptionsSyncEl064,
ExceptionsIRQEl064,
ExceptionsFIQEl064,
ExceptionsSErrorEl064,
// lower EL 32-bit from userspace
ExceptionsSyncEl032,
ExceptionsIRQEl032,
ExceptionsFIQEl032,
ExceptionsSErrorEl032,
} ExceptionsType;