]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c
UefiCpuPkg/CpuExceptionHandler: Add base support for the #VE exception
[mirror_edk2.git] / UefiCpuPkg / Library / CpuExceptionHandlerLib / PeiDxeSmmCpuException.c
index 762ea2460f9191ebe10026e43b97fe540dfe446a..f47a80dcab8f8226a130446a9aa9fe7f8a3bf689 100644 (file)
@@ -24,25 +24,48 @@ CommonExceptionHandlerWorker (
   IN EXCEPTION_HANDLER_DATA  *ExceptionHandlerData\r
   )\r
 {\r
+  EFI_STATUS                 Status;\r
   EXCEPTION_HANDLER_CONTEXT  *ExceptionHandlerContext;\r
   RESERVED_VECTORS_DATA      *ReservedVectors;\r
   EFI_CPU_INTERRUPT_HANDLER  *ExternalInterruptHandler;\r
 \r
-  if (ExceptionType == VC_EXCEPTION) {\r
-    EFI_STATUS  Status;\r
-    //\r
-    // #VC needs to be handled immediately upon enabling exception handling\r
-    // and therefore can't use the RegisterCpuInterruptHandler() interface.\r
-    //\r
-    // Handle the #VC:\r
-    //   On EFI_SUCCESS - Exception has been handled, return\r
-    //   On other       - ExceptionType contains (possibly new) exception\r
-    //                    value\r
-    //\r
-    Status = VmgExitHandleVc (&ExceptionType, SystemContext);\r
-    if (!EFI_ERROR (Status)) {\r
-      return;\r
-    }\r
+  switch (ExceptionType) {\r
+    case VC_EXCEPTION:\r
+      //\r
+      // #VC needs to be handled immediately upon enabling exception handling\r
+      // and therefore can't use the RegisterCpuInterruptHandler() interface.\r
+      //\r
+      // Handle the #VC:\r
+      //   On EFI_SUCCESS - Exception has been handled, return\r
+      //   On other       - ExceptionType contains (possibly new) exception\r
+      //                    value\r
+      //\r
+      Status = VmgExitHandleVc (&ExceptionType, SystemContext);\r
+      if (!EFI_ERROR (Status)) {\r
+        return;\r
+      }\r
+\r
+      break;\r
+\r
+    case VE_EXCEPTION:\r
+      //\r
+      // #VE needs to be handled immediately upon enabling exception handling\r
+      // and therefore can't use the RegisterCpuInterruptHandler() interface.\r
+      //\r
+      // Handle the #VE:\r
+      //   On EFI_SUCCESS - Exception has been handled, return\r
+      //   On other       - ExceptionType contains (possibly new) exception\r
+      //                    value\r
+      //\r
+      Status = VmTdExitHandleVe (&ExceptionType, SystemContext);\r
+      if (!EFI_ERROR (Status)) {\r
+        return;\r
+      }\r
+\r
+      break;\r
+\r
+    default:\r
+      break;\r
   }\r
 \r
   ExceptionHandlerContext  = (EXCEPTION_HANDLER_CONTEXT *)(UINTN)(SystemContext.SystemContextIa32);\r