thermosphere: add esr_el2 to exception frame

This commit is contained in:
TuxSH 2020-01-22 21:08:52 +00:00
parent 744491ca33
commit 418cabbd53
6 changed files with 39 additions and 34 deletions

View file

@ -19,24 +19,6 @@
#include "utils.h"
#include "core_ctx.h"
typedef struct ExceptionStackFrame {
u64 x[31]; // x0 .. x30
u64 sp_el1;
union {
u64 sp_el2;
u64 sp_el0;
};
u64 elr_el2;
u64 spsr_el2;
u64 far_el2;
u64 cntpct_el0;
u64 cntp_ctl_el0;
u64 cntv_ctl_el0;
u64 reserved;
} ExceptionStackFrame;
static_assert(sizeof(ExceptionStackFrame) == 0x140, "Wrong size for ExceptionStackFrame");
// Adapted from https://developer.arm.com/docs/ddi0596/a/a64-shared-pseudocode-functions/shared-exceptions-pseudocode
typedef enum ExceptionClass {
Exception_Uncategorized = 0x0,
@ -88,6 +70,25 @@ typedef struct ExceptionSyndromeRegister {
u32 res0 : 32;
} ExceptionSyndromeRegister;
typedef struct ExceptionStackFrame {
u64 x[31]; // x0 .. x30
u64 sp_el1;
union {
u64 sp_el2;
u64 sp_el0;
};
u64 elr_el2;
u64 spsr_el2;
ExceptionSyndromeRegister esr_el2;
u64 far_el2;
u64 cntpct_el0;
u64 cntp_ctl_el0;
u64 cntv_ctl_el0;
} ExceptionStackFrame;
static_assert(offsetof(ExceptionStackFrame, far_el2) == 0x120, "Wrong definition for ExceptionStackFrame");
static_assert(sizeof(ExceptionStackFrame) == 0x140, "Wrong size for ExceptionStackFrame");
static inline bool spsrIsA32(u64 spsr)
{
return (spsr & 0x10) != 0;
@ -139,7 +140,3 @@ void skipFaultingInstruction(ExceptionStackFrame *frame, u32 size);
void dumpStackFrame(const ExceptionStackFrame *frame, bool sameEl);
void exceptionEnterInterruptibleHypervisorCode(void);
void handleLowerElSyncException(ExceptionStackFrame *frame, ExceptionSyndromeRegister esr);
void handleSameElSyncException(ExceptionStackFrame *frame, ExceptionSyndromeRegister esr);
void handleUnknownException(u32 offset);