diff options
author | Dongyan Qian <qiandongyan@loongson.cn> | 2024-06-25 10:35:14 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2024-06-26 00:52:39 +0000 |
commit | 5db0091418c8ed6a62178469e8ffb3dacaab13ee (patch) | |
tree | 1ac5777d63b489066ba70a7bd34021eca88c64dd /UefiCpuPkg/Library | |
parent | dc93ff8a5561a3085eeda9d4ac00d40545eb43cd (diff) | |
download | edk2-5db0091418c8ed6a62178469e8ffb3dacaab13ee.tar.gz edk2-5db0091418c8ed6a62178469e8ffb3dacaab13ee.tar.bz2 edk2-5db0091418c8ed6a62178469e8ffb3dacaab13ee.zip |
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 <lichao@loongson.cn>
Signed-off-by: Dongyan Qian <qiandongyan@loongson.cn>
Diffstat (limited to 'UefiCpuPkg/Library')
-rw-r--r-- | UefiCpuPkg/Library/CpuExceptionHandlerLib/LoongArch/LoongArch64/ExceptionHandlerAsm.S | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/LoongArch/LoongArch64/ExceptionHandlerAsm.S b/UefiCpuPkg/Library/CpuExceptionHandlerLib/LoongArch/LoongArch64/ExceptionHandlerAsm.S index 7c692e01c1..1c685f9567 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.
|