thermosphere: add more sysreg stuff & start writing trap stuff

This commit is contained in:
TuxSH
2019-07-23 04:47:57 +02:00
parent 4952b3c9bf
commit 70a9caa7e9
5 changed files with 189 additions and 41 deletions

20
thermosphere/src/traps.c Normal file
View File

@@ -0,0 +1,20 @@
#include "traps.h"
#include "sysreg.h"
void enableTraps(void)
{
u64 hcr = GET_SYSREG(hcr_el2);
// Trap *writes* to memory control registers
hcr |= HCR_TVM;
// Trap SMC instructions
hcr |= HCR_TSC;
// Reroute physical IRQ to EL2
hcr |= HCR_IMO;
// TODO debug exceptions
SET_SYSREG(hcr_el2, hcr);
}