From 5db0091418c8ed6a62178469e8ffb3dacaab13ee Mon Sep 17 00:00:00 2001 From: Dongyan Qian Date: Tue, 25 Jun 2024 10:35:14 +0800 Subject: UefiCpuPkg/ExceptionHandler: Fix a context error in LoongArch64 On the LoongArch platform: the a0 register can be used as both a function parameter and a return value. Due to parameter EFI_SYSTEM_CONTEXT being overwritten by an invalid context address, when calling GetExceptionType, incorrect parameter address causes memory access exception. BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4796 Cc: Chao Li Signed-off-by: Dongyan Qian --- .../CpuExceptionHandlerLib/LoongArch/LoongArch64/ExceptionHandlerAsm.S | 1 + 1 file changed, 1 insertion(+) diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/LoongArch/LoongArch64/ExceptionHandlerAsm.S b/UefiCpuPkg/Library/CpuExceptionHandlerLib/LoongArch/LoongArch64/ExceptionHandlerAsm.S index 7c692e0..1c685f9 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/LoongArch/LoongArch64/ExceptionHandlerAsm.S +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/LoongArch/LoongArch64/ExceptionHandlerAsm.S @@ -34,6 +34,7 @@ PopContext: // bl DisableInterrupts + move $a0, $s0 // Restore a0 parameter through s0(EFI_SYSTEM_CONTEXT) bl GetExceptionType // Get current exception type, and stored in register a0 // Check whether the FPE is changed during interrupt handler, if ture restore it. -- cgit v1.1