mirror of https://github.com/acidanthera/audk.git
UefiCpuPkg: Adjust the exception handler logic on LoongArch64
There is a problem with LoongArch64 exception handler, it returns a unhandled value when we get an exception type, the correct value should be right shifted 16 bits, so fix it. Cc: Ray Ni <ray.ni@intel.com> Cc: Jiaxin Wu <jiaxin.wu@intel.com> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Cc: Dun Tan <dun.tan@intel.com> Cc: Rahul Kumar <rahul1.kumar@intel.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Jiaxin Wu <jiaxin.wu@intel.com> Signed-off-by: Chao Li <lichao@loongson.cn>
This commit is contained in:
parent
fbbf4206c1
commit
0fdffb71df
|
@ -115,23 +115,22 @@ CommonExceptionHandler (
|
|||
// Interrupt
|
||||
//
|
||||
InterruptType = GetInterruptType (SystemContext);
|
||||
if (InterruptType == 0xFF) {
|
||||
ExceptionType = InterruptType;
|
||||
} else {
|
||||
if (InterruptType != 0xFF) {
|
||||
if ((ExternalInterruptHandler != NULL) && (ExternalInterruptHandler[InterruptType] != NULL)) {
|
||||
ExternalInterruptHandler[InterruptType](InterruptType, SystemContext);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else if (ExceptionType == EXCEPT_LOONGARCH_FPD) {
|
||||
EnableFloatingPointUnits ();
|
||||
InitializeFloatingPointUnits ();
|
||||
return;
|
||||
} else {
|
||||
//
|
||||
// Exception
|
||||
//
|
||||
ExceptionType >>= CSR_ESTAT_EXC_SHIFT;
|
||||
if (ExceptionType == EXCEPT_LOONGARCH_FPD) {
|
||||
EnableFloatingPointUnits ();
|
||||
InitializeFloatingPointUnits ();
|
||||
return;
|
||||
}
|
||||
|
||||
if ((ExceptionHandler != NULL) && (ExceptionHandler[ExceptionType] != NULL)) {
|
||||
ExceptionHandler[ExceptionType](ExceptionType, SystemContext);
|
||||
return;
|
||||
|
|
|
@ -27,7 +27,7 @@ GetExceptionType (
|
|||
{
|
||||
EFI_EXCEPTION_TYPE ExceptionType;
|
||||
|
||||
ExceptionType = (SystemContext.SystemContextLoongArch64->ESTAT & CSR_ESTAT_EXC);
|
||||
ExceptionType = (SystemContext.SystemContextLoongArch64->ESTAT & CSR_ESTAT_EXC) >> CSR_ESTAT_EXC_SHIFT;
|
||||
return ExceptionType;
|
||||
}
|
||||
|
||||
|
|
|
@ -68,14 +68,7 @@ CommonExceptionHandler (
|
|||
//
|
||||
IpiInterruptHandler (InterruptType, SystemContext);
|
||||
return;
|
||||
} else {
|
||||
ExceptionType = InterruptType;
|
||||
}
|
||||
} else {
|
||||
//
|
||||
// Exception
|
||||
//
|
||||
ExceptionType >>= CSR_ESTAT_EXC_SHIFT;
|
||||
}
|
||||
|
||||
DefaultExceptionHandler (ExceptionType, SystemContext);
|
||||
|
|
Loading…
Reference in New Issue