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>
This commit is contained in:
Dongyan Qian 2024-06-25 10:35:14 +08:00 committed by mergify[bot]
parent dc93ff8a55
commit 5db0091418
1 changed files with 1 additions and 0 deletions

View File

@ -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.