RETURN_STATUS ArchVectorConfig( IN UINTN VectorBaseAddress ) { UINTN HcrReg; UINT8 *Stack; Stack = AllocatePages (EL0_STACK_PAGES); if (Stack == NULL) { return RETURN_OUT_OF_RESOURCES; } RegisterEl0Stack ((UINT8 *)Stack + EFI_PAGES_TO_SIZE (EL0_STACK_PAGES)); if (ArmReadCurrentEL() == AARCH64_EL2) { HcrReg = ArmReadHcr(); // Trap General Exceptions. All exceptions that would be routed to EL1 are routed to EL2 HcrReg |= ARM_HCR_TGE; ArmWriteHcr(HcrReg); } return RETURN_SUCCESS; }
VOID ArchInitialize ( VOID ) { // Enable Floating Point if (FixedPcdGet32 (PcdVFPEnabled)) { ArmEnableVFP (); } if (ArmReadCurrentEL () == AARCH64_EL2) { // Trap General Exceptions. All exceptions that would be routed to EL1 are routed to EL2 ArmWriteHcr (ARM_HCR_TGE); } }