]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/Library/CcExitLib/CcExitVcHandler.c
OvmfPkg/UefiCpuPkg: Add CcExit prefix to the APIs of CcExitLib
[mirror_edk2.git] / OvmfPkg / Library / CcExitLib / CcExitVcHandler.c
index ad2a922c9f43b3548fef327bf832093cc8f8ad02..985e5479775ca5bc149d398ec99ff76ea9afbf8d 100644 (file)
@@ -611,7 +611,7 @@ UnsupportedExit (
 {\r
   UINT64  Status;\r
 \r
-  Status = VmgExit (Ghcb, SVM_EXIT_UNSUPPORTED, Regs->ExceptionData, 0);\r
+  Status = CcExitVmgExit (Ghcb, SVM_EXIT_UNSUPPORTED, Regs->ExceptionData, 0);\r
   if (Status == 0) {\r
     GHCB_EVENT_INJECTION  Event;\r
 \r
@@ -755,8 +755,8 @@ MmioExit (
       CopyMem (Ghcb->SharedBuffer, &InstructionData->Ext.RegData, Bytes);\r
 \r
       Ghcb->SaveArea.SwScratch = (UINT64)Ghcb->SharedBuffer;\r
-      VmgSetOffsetValid (Ghcb, GhcbSwScratch);\r
-      Status = VmgExit (Ghcb, SVM_EXIT_MMIO_WRITE, ExitInfo1, ExitInfo2);\r
+      CcExitVmgSetOffsetValid (Ghcb, GhcbSwScratch);\r
+      Status = CcExitVmgExit (Ghcb, SVM_EXIT_MMIO_WRITE, ExitInfo1, ExitInfo2);\r
       if (Status != 0) {\r
         return Status;\r
       }\r
@@ -807,8 +807,8 @@ MmioExit (
       CopyMem (Ghcb->SharedBuffer, &Regs->Rax, Bytes);\r
 \r
       Ghcb->SaveArea.SwScratch = (UINT64)Ghcb->SharedBuffer;\r
-      VmgSetOffsetValid (Ghcb, GhcbSwScratch);\r
-      Status = VmgExit (Ghcb, SVM_EXIT_MMIO_WRITE, ExitInfo1, ExitInfo2);\r
+      CcExitVmgSetOffsetValid (Ghcb, GhcbSwScratch);\r
+      Status = CcExitVmgExit (Ghcb, SVM_EXIT_MMIO_WRITE, ExitInfo1, ExitInfo2);\r
       if (Status != 0) {\r
         return Status;\r
       }\r
@@ -843,8 +843,8 @@ MmioExit (
       CopyMem (Ghcb->SharedBuffer, InstructionData->Immediate, Bytes);\r
 \r
       Ghcb->SaveArea.SwScratch = (UINT64)Ghcb->SharedBuffer;\r
-      VmgSetOffsetValid (Ghcb, GhcbSwScratch);\r
-      Status = VmgExit (Ghcb, SVM_EXIT_MMIO_WRITE, ExitInfo1, ExitInfo2);\r
+      CcExitVmgSetOffsetValid (Ghcb, GhcbSwScratch);\r
+      Status = CcExitVmgExit (Ghcb, SVM_EXIT_MMIO_WRITE, ExitInfo1, ExitInfo2);\r
       if (Status != 0) {\r
         return Status;\r
       }\r
@@ -882,8 +882,8 @@ MmioExit (
       ExitInfo2 = Bytes;\r
 \r
       Ghcb->SaveArea.SwScratch = (UINT64)Ghcb->SharedBuffer;\r
-      VmgSetOffsetValid (Ghcb, GhcbSwScratch);\r
-      Status = VmgExit (Ghcb, SVM_EXIT_MMIO_READ, ExitInfo1, ExitInfo2);\r
+      CcExitVmgSetOffsetValid (Ghcb, GhcbSwScratch);\r
+      Status = CcExitVmgExit (Ghcb, SVM_EXIT_MMIO_READ, ExitInfo1, ExitInfo2);\r
       if (Status != 0) {\r
         return Status;\r
       }\r
@@ -942,8 +942,8 @@ MmioExit (
       ExitInfo2 = Bytes;\r
 \r
       Ghcb->SaveArea.SwScratch = (UINT64)Ghcb->SharedBuffer;\r
-      VmgSetOffsetValid (Ghcb, GhcbSwScratch);\r
-      Status = VmgExit (Ghcb, SVM_EXIT_MMIO_READ, ExitInfo1, ExitInfo2);\r
+      CcExitVmgSetOffsetValid (Ghcb, GhcbSwScratch);\r
+      Status = CcExitVmgExit (Ghcb, SVM_EXIT_MMIO_READ, ExitInfo1, ExitInfo2);\r
       if (Status != 0) {\r
         return Status;\r
       }\r
@@ -979,8 +979,8 @@ MmioExit (
       ExitInfo2 = Bytes;\r
 \r
       Ghcb->SaveArea.SwScratch = (UINT64)Ghcb->SharedBuffer;\r
-      VmgSetOffsetValid (Ghcb, GhcbSwScratch);\r
-      Status = VmgExit (Ghcb, SVM_EXIT_MMIO_READ, ExitInfo1, ExitInfo2);\r
+      CcExitVmgSetOffsetValid (Ghcb, GhcbSwScratch);\r
+      Status = CcExitVmgExit (Ghcb, SVM_EXIT_MMIO_READ, ExitInfo1, ExitInfo2);\r
       if (Status != 0) {\r
         return Status;\r
       }\r
@@ -1011,8 +1011,8 @@ MmioExit (
       ExitInfo2 = Bytes;\r
 \r
       Ghcb->SaveArea.SwScratch = (UINT64)Ghcb->SharedBuffer;\r
-      VmgSetOffsetValid (Ghcb, GhcbSwScratch);\r
-      Status = VmgExit (Ghcb, SVM_EXIT_MMIO_READ, ExitInfo1, ExitInfo2);\r
+      CcExitVmgSetOffsetValid (Ghcb, GhcbSwScratch);\r
+      Status = CcExitVmgExit (Ghcb, SVM_EXIT_MMIO_READ, ExitInfo1, ExitInfo2);\r
       if (Status != 0) {\r
         return Status;\r
       }\r
@@ -1068,11 +1068,11 @@ MwaitExit (
   DecodeModRm (Regs, InstructionData);\r
 \r
   Ghcb->SaveArea.Rax = Regs->Rax;\r
-  VmgSetOffsetValid (Ghcb, GhcbRax);\r
+  CcExitVmgSetOffsetValid (Ghcb, GhcbRax);\r
   Ghcb->SaveArea.Rcx = Regs->Rcx;\r
-  VmgSetOffsetValid (Ghcb, GhcbRcx);\r
+  CcExitVmgSetOffsetValid (Ghcb, GhcbRcx);\r
 \r
-  return VmgExit (Ghcb, SVM_EXIT_MWAIT, 0, 0);\r
+  return CcExitVmgExit (Ghcb, SVM_EXIT_MWAIT, 0, 0);\r
 }\r
 \r
 /**\r
@@ -1100,13 +1100,13 @@ MonitorExit (
   DecodeModRm (Regs, InstructionData);\r
 \r
   Ghcb->SaveArea.Rax = Regs->Rax;  // Identity mapped, so VA = PA\r
-  VmgSetOffsetValid (Ghcb, GhcbRax);\r
+  CcExitVmgSetOffsetValid (Ghcb, GhcbRax);\r
   Ghcb->SaveArea.Rcx = Regs->Rcx;\r
-  VmgSetOffsetValid (Ghcb, GhcbRcx);\r
+  CcExitVmgSetOffsetValid (Ghcb, GhcbRcx);\r
   Ghcb->SaveArea.Rdx = Regs->Rdx;\r
-  VmgSetOffsetValid (Ghcb, GhcbRdx);\r
+  CcExitVmgSetOffsetValid (Ghcb, GhcbRdx);\r
 \r
-  return VmgExit (Ghcb, SVM_EXIT_MONITOR, 0, 0);\r
+  return CcExitVmgExit (Ghcb, SVM_EXIT_MONITOR, 0, 0);\r
 }\r
 \r
 /**\r
@@ -1131,7 +1131,7 @@ WbinvdExit (
   IN     SEV_ES_INSTRUCTION_DATA  *InstructionData\r
   )\r
 {\r
-  return VmgExit (Ghcb, SVM_EXIT_WBINVD, 0, 0);\r
+  return CcExitVmgExit (Ghcb, SVM_EXIT_WBINVD, 0, 0);\r
 }\r
 \r
 /**\r
@@ -1160,14 +1160,14 @@ RdtscpExit (
 \r
   DecodeModRm (Regs, InstructionData);\r
 \r
-  Status = VmgExit (Ghcb, SVM_EXIT_RDTSCP, 0, 0);\r
+  Status = CcExitVmgExit (Ghcb, SVM_EXIT_RDTSCP, 0, 0);\r
   if (Status != 0) {\r
     return Status;\r
   }\r
 \r
-  if (!VmgIsOffsetValid (Ghcb, GhcbRax) ||\r
-      !VmgIsOffsetValid (Ghcb, GhcbRcx) ||\r
-      !VmgIsOffsetValid (Ghcb, GhcbRdx))\r
+  if (!CcExitVmgIsOffsetValid (Ghcb, GhcbRax) ||\r
+      !CcExitVmgIsOffsetValid (Ghcb, GhcbRcx) ||\r
+      !CcExitVmgIsOffsetValid (Ghcb, GhcbRdx))\r
   {\r
     return UnsupportedExit (Ghcb, Regs, InstructionData);\r
   }\r
@@ -1206,16 +1206,16 @@ VmmCallExit (
   DecodeModRm (Regs, InstructionData);\r
 \r
   Ghcb->SaveArea.Rax = Regs->Rax;\r
-  VmgSetOffsetValid (Ghcb, GhcbRax);\r
+  CcExitVmgSetOffsetValid (Ghcb, GhcbRax);\r
   Ghcb->SaveArea.Cpl = (UINT8)(Regs->Cs & 0x3);\r
-  VmgSetOffsetValid (Ghcb, GhcbCpl);\r
+  CcExitVmgSetOffsetValid (Ghcb, GhcbCpl);\r
 \r
-  Status = VmgExit (Ghcb, SVM_EXIT_VMMCALL, 0, 0);\r
+  Status = CcExitVmgExit (Ghcb, SVM_EXIT_VMMCALL, 0, 0);\r
   if (Status != 0) {\r
     return Status;\r
   }\r
 \r
-  if (!VmgIsOffsetValid (Ghcb, GhcbRax)) {\r
+  if (!CcExitVmgIsOffsetValid (Ghcb, GhcbRax)) {\r
     return UnsupportedExit (Ghcb, Regs, InstructionData);\r
   }\r
 \r
@@ -1254,28 +1254,28 @@ MsrExit (
     case 0x30: // WRMSR\r
       ExitInfo1          = 1;\r
       Ghcb->SaveArea.Rax = Regs->Rax;\r
-      VmgSetOffsetValid (Ghcb, GhcbRax);\r
+      CcExitVmgSetOffsetValid (Ghcb, GhcbRax);\r
       Ghcb->SaveArea.Rdx = Regs->Rdx;\r
-      VmgSetOffsetValid (Ghcb, GhcbRdx);\r
+      CcExitVmgSetOffsetValid (Ghcb, GhcbRdx);\r
     //\r
     // fall through\r
     //\r
     case 0x32: // RDMSR\r
       Ghcb->SaveArea.Rcx = Regs->Rcx;\r
-      VmgSetOffsetValid (Ghcb, GhcbRcx);\r
+      CcExitVmgSetOffsetValid (Ghcb, GhcbRcx);\r
       break;\r
     default:\r
       return UnsupportedExit (Ghcb, Regs, InstructionData);\r
   }\r
 \r
-  Status = VmgExit (Ghcb, SVM_EXIT_MSR, ExitInfo1, 0);\r
+  Status = CcExitVmgExit (Ghcb, SVM_EXIT_MSR, ExitInfo1, 0);\r
   if (Status != 0) {\r
     return Status;\r
   }\r
 \r
   if (ExitInfo1 == 0) {\r
-    if (!VmgIsOffsetValid (Ghcb, GhcbRax) ||\r
-        !VmgIsOffsetValid (Ghcb, GhcbRdx))\r
+    if (!CcExitVmgIsOffsetValid (Ghcb, GhcbRax) ||\r
+        !CcExitVmgIsOffsetValid (Ghcb, GhcbRdx))\r
     {\r
       return UnsupportedExit (Ghcb, Regs, InstructionData);\r
     }\r
@@ -1471,8 +1471,8 @@ IoioExit (
       }\r
 \r
       Ghcb->SaveArea.SwScratch = (UINT64)Ghcb->SharedBuffer;\r
-      VmgSetOffsetValid (Ghcb, GhcbSwScratch);\r
-      Status = VmgExit (Ghcb, SVM_EXIT_IOIO_PROT, ExitInfo1, ExitInfo2);\r
+      CcExitVmgSetOffsetValid (Ghcb, GhcbSwScratch);\r
+      Status = CcExitVmgExit (Ghcb, SVM_EXIT_IOIO_PROT, ExitInfo1, ExitInfo2);\r
       if (Status != 0) {\r
         return Status;\r
       }\r
@@ -1495,15 +1495,15 @@ IoioExit (
       CopyMem (&Ghcb->SaveArea.Rax, &Regs->Rax, IOIO_DATA_BYTES (ExitInfo1));\r
     }\r
 \r
-    VmgSetOffsetValid (Ghcb, GhcbRax);\r
+    CcExitVmgSetOffsetValid (Ghcb, GhcbRax);\r
 \r
-    Status = VmgExit (Ghcb, SVM_EXIT_IOIO_PROT, ExitInfo1, 0);\r
+    Status = CcExitVmgExit (Ghcb, SVM_EXIT_IOIO_PROT, ExitInfo1, 0);\r
     if (Status != 0) {\r
       return Status;\r
     }\r
 \r
     if ((ExitInfo1 & IOIO_TYPE_IN) != 0) {\r
-      if (!VmgIsOffsetValid (Ghcb, GhcbRax)) {\r
+      if (!CcExitVmgIsOffsetValid (Ghcb, GhcbRax)) {\r
         return UnsupportedExit (Ghcb, Regs, InstructionData);\r
       }\r
 \r
@@ -1536,7 +1536,7 @@ InvdExit (
   IN     SEV_ES_INSTRUCTION_DATA  *InstructionData\r
   )\r
 {\r
-  return VmgExit (Ghcb, SVM_EXIT_INVD, 0, 0);\r
+  return CcExitVmgExit (Ghcb, SVM_EXIT_INVD, 0, 0);\r
 }\r
 \r
 /**\r
@@ -1581,23 +1581,23 @@ GetCpuidHyp (
 {\r
   *UnsupportedExit   = FALSE;\r
   Ghcb->SaveArea.Rax = EaxIn;\r
-  VmgSetOffsetValid (Ghcb, GhcbRax);\r
+  CcExitVmgSetOffsetValid (Ghcb, GhcbRax);\r
   Ghcb->SaveArea.Rcx = EcxIn;\r
-  VmgSetOffsetValid (Ghcb, GhcbRcx);\r
+  CcExitVmgSetOffsetValid (Ghcb, GhcbRcx);\r
   if (EaxIn == CPUID_EXTENDED_STATE) {\r
     Ghcb->SaveArea.XCr0 = XCr0;\r
-    VmgSetOffsetValid (Ghcb, GhcbXCr0);\r
+    CcExitVmgSetOffsetValid (Ghcb, GhcbXCr0);\r
   }\r
 \r
-  *Status = VmgExit (Ghcb, SVM_EXIT_CPUID, 0, 0);\r
+  *Status = CcExitVmgExit (Ghcb, SVM_EXIT_CPUID, 0, 0);\r
   if (*Status != 0) {\r
     return FALSE;\r
   }\r
 \r
-  if (!VmgIsOffsetValid (Ghcb, GhcbRax) ||\r
-      !VmgIsOffsetValid (Ghcb, GhcbRbx) ||\r
-      !VmgIsOffsetValid (Ghcb, GhcbRcx) ||\r
-      !VmgIsOffsetValid (Ghcb, GhcbRdx))\r
+  if (!CcExitVmgIsOffsetValid (Ghcb, GhcbRax) ||\r
+      !CcExitVmgIsOffsetValid (Ghcb, GhcbRbx) ||\r
+      !CcExitVmgIsOffsetValid (Ghcb, GhcbRcx) ||\r
+      !CcExitVmgIsOffsetValid (Ghcb, GhcbRdx))\r
   {\r
     *UnsupportedExit = TRUE;\r
     return FALSE;\r
@@ -2049,15 +2049,15 @@ RdpmcExit (
   UINT64  Status;\r
 \r
   Ghcb->SaveArea.Rcx = Regs->Rcx;\r
-  VmgSetOffsetValid (Ghcb, GhcbRcx);\r
+  CcExitVmgSetOffsetValid (Ghcb, GhcbRcx);\r
 \r
-  Status = VmgExit (Ghcb, SVM_EXIT_RDPMC, 0, 0);\r
+  Status = CcExitVmgExit (Ghcb, SVM_EXIT_RDPMC, 0, 0);\r
   if (Status != 0) {\r
     return Status;\r
   }\r
 \r
-  if (!VmgIsOffsetValid (Ghcb, GhcbRax) ||\r
-      !VmgIsOffsetValid (Ghcb, GhcbRdx))\r
+  if (!CcExitVmgIsOffsetValid (Ghcb, GhcbRax) ||\r
+      !CcExitVmgIsOffsetValid (Ghcb, GhcbRdx))\r
   {\r
     return UnsupportedExit (Ghcb, Regs, InstructionData);\r
   }\r
@@ -2092,13 +2092,13 @@ RdtscExit (
 {\r
   UINT64  Status;\r
 \r
-  Status = VmgExit (Ghcb, SVM_EXIT_RDTSC, 0, 0);\r
+  Status = CcExitVmgExit (Ghcb, SVM_EXIT_RDTSC, 0, 0);\r
   if (Status != 0) {\r
     return Status;\r
   }\r
 \r
-  if (!VmgIsOffsetValid (Ghcb, GhcbRax) ||\r
-      !VmgIsOffsetValid (Ghcb, GhcbRdx))\r
+  if (!CcExitVmgIsOffsetValid (Ghcb, GhcbRax) ||\r
+      !CcExitVmgIsOffsetValid (Ghcb, GhcbRdx))\r
   {\r
     return UnsupportedExit (Ghcb, Regs, InstructionData);\r
   }\r
@@ -2150,9 +2150,9 @@ Dr7WriteExit (
   // Using a value of 0 for ExitInfo1 means RAX holds the value\r
   //\r
   Ghcb->SaveArea.Rax = *Register;\r
-  VmgSetOffsetValid (Ghcb, GhcbRax);\r
+  CcExitVmgSetOffsetValid (Ghcb, GhcbRax);\r
 \r
-  Status = VmgExit (Ghcb, SVM_EXIT_DR7_WRITE, 0, 0);\r
+  Status = CcExitVmgExit (Ghcb, SVM_EXIT_DR7_WRITE, 0, 0);\r
   if (Status != 0) {\r
     return Status;\r
   }\r
@@ -2243,7 +2243,7 @@ InternalVmgExitHandleVc (
 \r
   Regs = SystemContext.SystemContextX64;\r
 \r
-  VmgInit (Ghcb, &InterruptState);\r
+  CcExitVmgInit (Ghcb, &InterruptState);\r
 \r
   ExitCode = Regs->ExceptionData;\r
   switch (ExitCode) {\r
@@ -2327,7 +2327,7 @@ InternalVmgExitHandleVc (
     VcRet = EFI_PROTOCOL_ERROR;\r
   }\r
 \r
-  VmgDone (Ghcb, InterruptState);\r
+  CcExitVmgDone (Ghcb, InterruptState);\r
 \r
   return VcRet;\r
 }\r