mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-11-15 17:39:28 +00:00
20 lines
338 B
C
20 lines
338 B
C
|
#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);
|
||
|
}
|