thermosphere: properly implement guest timer stuff

This commit is contained in:
TuxSH 2020-01-12 21:51:50 +00:00
parent 388c245ce4
commit 68a1ce6dd2
12 changed files with 180 additions and 53 deletions

View file

@ -15,6 +15,7 @@
*/
#pragma once
#include <assert.h>
#include "utils.h"
typedef struct ExceptionStackFrame {
@ -26,9 +27,15 @@ typedef struct ExceptionStackFrame {
};
u64 elr_el2;
u64 spsr_el2;
u64 cntvct_el0;
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,
@ -130,6 +137,8 @@ bool spsrEvaluateConditionCode(u64 spsr, u32 conditionCode);
void skipFaultingInstruction(ExceptionStackFrame *frame, u32 size);
void dumpStackFrame(const ExceptionStackFrame *frame, bool sameEl);
void exceptionEnterInterruptibleHypervisorCode(ExceptionStackFrame *frame);
void handleLowerElSyncException(ExceptionStackFrame *frame, ExceptionSyndromeRegister esr);
void handleSameElSyncException(ExceptionStackFrame *frame, ExceptionSyndromeRegister esr);
void handleUnknownException(u32 offset);