mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-29 16:44:10 +02:00
UefiCpuPkg/CpuExceptionHandler: Add base support for the #VE exception
RFC: https://bugzilla.tianocore.org/show_bug.cgi?id=3429 Add base support to handle #VE exceptions. Update the common exception handlers to invoke the VmTdExitHandleVe () function of the VmgExitLib library when a #VE is encountered. A non-zero return code will propagate to the targeted exception handler. Cc: Brijesh Singh <brijesh.singh@amd.com> Cc: Erdem Aktas <erdemaktas@google.com> Cc: James Bottomley <jejb@linux.ibm.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Tom Lendacky <thomas.lendacky@amd.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Rahul Kumar <rahul1.kumar@intel.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Signed-off-by: Min Xu <min.m.xu@intel.com>
This commit is contained in:
parent
daf8f642f3
commit
de327f7d8a
@ -24,25 +24,48 @@ CommonExceptionHandlerWorker (
|
|||||||
IN EXCEPTION_HANDLER_DATA *ExceptionHandlerData
|
IN EXCEPTION_HANDLER_DATA *ExceptionHandlerData
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
EXCEPTION_HANDLER_CONTEXT *ExceptionHandlerContext;
|
EXCEPTION_HANDLER_CONTEXT *ExceptionHandlerContext;
|
||||||
RESERVED_VECTORS_DATA *ReservedVectors;
|
RESERVED_VECTORS_DATA *ReservedVectors;
|
||||||
EFI_CPU_INTERRUPT_HANDLER *ExternalInterruptHandler;
|
EFI_CPU_INTERRUPT_HANDLER *ExternalInterruptHandler;
|
||||||
|
|
||||||
if (ExceptionType == VC_EXCEPTION) {
|
switch (ExceptionType) {
|
||||||
EFI_STATUS Status;
|
case VC_EXCEPTION:
|
||||||
//
|
//
|
||||||
// #VC needs to be handled immediately upon enabling exception handling
|
// #VC needs to be handled immediately upon enabling exception handling
|
||||||
// and therefore can't use the RegisterCpuInterruptHandler() interface.
|
// and therefore can't use the RegisterCpuInterruptHandler() interface.
|
||||||
//
|
//
|
||||||
// Handle the #VC:
|
// Handle the #VC:
|
||||||
// On EFI_SUCCESS - Exception has been handled, return
|
// On EFI_SUCCESS - Exception has been handled, return
|
||||||
// On other - ExceptionType contains (possibly new) exception
|
// On other - ExceptionType contains (possibly new) exception
|
||||||
// value
|
// value
|
||||||
//
|
//
|
||||||
Status = VmgExitHandleVc (&ExceptionType, SystemContext);
|
Status = VmgExitHandleVc (&ExceptionType, SystemContext);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VE_EXCEPTION:
|
||||||
|
//
|
||||||
|
// #VE needs to be handled immediately upon enabling exception handling
|
||||||
|
// and therefore can't use the RegisterCpuInterruptHandler() interface.
|
||||||
|
//
|
||||||
|
// Handle the #VE:
|
||||||
|
// On EFI_SUCCESS - Exception has been handled, return
|
||||||
|
// On other - ExceptionType contains (possibly new) exception
|
||||||
|
// value
|
||||||
|
//
|
||||||
|
Status = VmTdExitHandleVe (&ExceptionType, SystemContext);
|
||||||
|
if (!EFI_ERROR (Status)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExceptionHandlerContext = (EXCEPTION_HANDLER_CONTEXT *)(UINTN)(SystemContext.SystemContextIa32);
|
ExceptionHandlerContext = (EXCEPTION_HANDLER_CONTEXT *)(UINTN)(SystemContext.SystemContextIa32);
|
||||||
|
@ -25,22 +25,47 @@ CommonExceptionHandler (
|
|||||||
IN EFI_SYSTEM_CONTEXT SystemContext
|
IN EFI_SYSTEM_CONTEXT SystemContext
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (ExceptionType == VC_EXCEPTION) {
|
EFI_STATUS Status;
|
||||||
EFI_STATUS Status;
|
|
||||||
//
|
switch (ExceptionType) {
|
||||||
// #VC needs to be handled immediately upon enabling exception handling
|
case VC_EXCEPTION:
|
||||||
// and therefore can't use the RegisterCpuInterruptHandler() interface
|
//
|
||||||
// (which isn't supported under Sec and Pei anyway).
|
// #VC needs to be handled immediately upon enabling exception handling
|
||||||
//
|
// and therefore can't use the RegisterCpuInterruptHandler() interface
|
||||||
// Handle the #VC:
|
// (which isn't supported under Sec and Pei anyway).
|
||||||
// On EFI_SUCCESS - Exception has been handled, return
|
//
|
||||||
// On other - ExceptionType contains (possibly new) exception
|
// Handle the #VC:
|
||||||
// value
|
// On EFI_SUCCESS - Exception has been handled, return
|
||||||
//
|
// On other - ExceptionType contains (possibly new) exception
|
||||||
Status = VmgExitHandleVc (&ExceptionType, SystemContext);
|
// value
|
||||||
if (!EFI_ERROR (Status)) {
|
//
|
||||||
return;
|
Status = VmgExitHandleVc (&ExceptionType, SystemContext);
|
||||||
}
|
if (!EFI_ERROR (Status)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VE_EXCEPTION:
|
||||||
|
//
|
||||||
|
// #VE needs to be handled immediately upon enabling exception handling
|
||||||
|
// and therefore can't use the RegisterCpuInterruptHandler() interface
|
||||||
|
// (which isn't supported under Sec and Pei anyway).
|
||||||
|
//
|
||||||
|
// Handle the #VE:
|
||||||
|
// On EFI_SUCCESS - Exception has been handled, return
|
||||||
|
// On other - ExceptionType contains (possibly new) exception
|
||||||
|
// value
|
||||||
|
//
|
||||||
|
Status = VmTdExitHandleVe (&ExceptionType, SystemContext);
|
||||||
|
if (!EFI_ERROR (Status)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
Loading…
x
Reference in New Issue
Block a user