Skip to content

Commit

Permalink
Ring3: Fixed buggy timer interrupt handling for AARCH64.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikhail Krichanov committed Sep 27, 2024
1 parent e4c26e4 commit 27556a1
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 7 deletions.
2 changes: 1 addition & 1 deletion ArmPkg/Library/ArmExceptionLib/AArch64/ExceptionSupport.S
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ ASM_PFX(CommonExceptionEntry):
ldp x24, x25, [sp, #0xc0]
ldp x26, x27, [sp, #0xd0]
// Preserve return value for SVC.
mrs x1, esr_el1
ldr x1, [x28, #(FP_CONTEXT_SIZE + 0x18)] // Exception syndrome register
lsr x1, x1, #26
and x1, x1, #0x3F
cmp x1, #0x15
Expand Down
1 change: 1 addition & 0 deletions ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ CommonCExceptionHandler (
if (ExceptionType <= gMaxExceptionNumber) {
if (gExceptionHandlers[ExceptionType]) {
gExceptionHandlers[ExceptionType](ExceptionType, SystemContext);
SystemContext.SystemContextAArch64->ESR = 0;
return EFI_SUCCESS;
}
} else {
Expand Down
6 changes: 0 additions & 6 deletions MdeModulePkg/Core/Dxe/SysCall/AARCH64/CoreBootServices.S
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ ASM_FUNC(ArmCallRing3)
//
msr spsr_el1, x1
isb
dsb sy
eret

//------------------------------------------------------------------------------
Expand All @@ -119,11 +118,6 @@ ASM_FUNC(ArmCallRing3)
// );
//------------------------------------------------------------------------------
ASM_FUNC(ReturnToCore)
// Zero Exception Syndrome Register to prevent QEMU from random crashing.
msr esr_el1, xzr
msr spsr_el1, xzr
msr elr_el1, xzr
msr far_el1, xzr
// Switch to Core Stack.
mov sp, x1
// Restore registers and Stack.
Expand Down

0 comments on commit 27556a1

Please sign in to comment.