]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/DebugSupportDxe/Ia32/PlDebugSupportIa32.c
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdeModulePkg / Universal / DebugSupportDxe / Ia32 / PlDebugSupportIa32.c
index 290fea69d5c12c9f50d809a3c3d26a1fec4f657c..0201427adec5f1538287e99f346b2dba1a7240f1 100644 (file)
@@ -1,20 +1,16 @@
 /** @file\r
   IA32 specific functions to support Debug Support protocol.\r
 \r
-Copyright (c) 2008, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
 #include "PlDebugSupport.h"\r
 \r
-IA32_IDT_GATE_DESCRIPTOR  NullDesc = {{0}};\r
+IA32_IDT_GATE_DESCRIPTOR  NullDesc = {\r
+  { 0 }\r
+};\r
 \r
 /**\r
   Get Interrupt Handle from IDT Gate Descriptor.\r
@@ -29,14 +25,14 @@ GetInterruptHandleFromIdt (
   IN IA32_IDT_GATE_DESCRIPTOR  *IdtGateDescriptor\r
   )\r
 {\r
-  UINTN      InterruptHandle;\r
+  UINTN  InterruptHandle;\r
 \r
   //\r
   // InterruptHandle  0-15 : OffsetLow\r
   // InterruptHandle 16-31 : OffsetHigh\r
   //\r
-  ((UINT16 *) &InterruptHandle)[0] = (UINT16) IdtGateDescriptor->Bits.OffsetLow;\r
-  ((UINT16 *) &InterruptHandle)[1] = (UINT16) IdtGateDescriptor->Bits.OffsetHigh;\r
+  ((UINT16 *)&InterruptHandle)[0] = (UINT16)IdtGateDescriptor->Bits.OffsetLow;\r
+  ((UINT16 *)&InterruptHandle)[1] = (UINT16)IdtGateDescriptor->Bits.OffsetHigh;\r
 \r
   return InterruptHandle;\r
 }\r
@@ -54,11 +50,11 @@ GetInterruptHandleFromIdt (
 **/\r
 VOID\r
 CreateEntryStub (\r
-  IN EFI_EXCEPTION_TYPE     ExceptionType,\r
-  OUT VOID                  **Stub\r
+  IN EFI_EXCEPTION_TYPE  ExceptionType,\r
+  OUT VOID               **Stub\r
   )\r
 {\r
-  UINT8       *StubCopy;\r
+  UINT8  *StubCopy;\r
 \r
   StubCopy = *Stub;\r
 \r
@@ -78,14 +74,14 @@ CreateEntryStub (
   //\r
   // poke in the exception type so the second push pushes the exception type\r
   //\r
-  StubCopy[0x0c] = (UINT8) ExceptionType;\r
+  StubCopy[0x0c] = (UINT8)ExceptionType;\r
 \r
   //\r
   // fixup the jump target to point to the common entry\r
   //\r
-  *(UINT32 *) &StubCopy[0x0e] = (UINT32) CommonIdtEntry - (UINT32) &StubCopy[StubSize];\r
+  *(UINT32 *)&StubCopy[0x0e] = (UINT32)CommonIdtEntry - (UINT32)&StubCopy[StubSize];\r
 \r
-  return ;\r
+  return;\r
 }\r
 \r
 /**\r
@@ -107,39 +103,37 @@ CreateEntryStub (
 **/\r
 EFI_STATUS\r
 ManageIdtEntryTable (\r
-  VOID               (*NewCallback)(),\r
-  EFI_EXCEPTION_TYPE ExceptionType\r
+  CALLBACK_FUNC       NewCallback,\r
+  EFI_EXCEPTION_TYPE  ExceptionType\r
   )\r
 {\r
   EFI_STATUS  Status;\r
 \r
   Status = EFI_SUCCESS;\r
 \r
-  if (!FeaturePcdGet (PcdNtEmulatorEnable)) {\r
-    if (CompareMem (&IdtEntryTable[ExceptionType].NewDesc, &NullDesc, sizeof (IA32_IDT_GATE_DESCRIPTOR)) != 0) {\r
+  if (CompareMem (&IdtEntryTable[ExceptionType].NewDesc, &NullDesc, sizeof (IA32_IDT_GATE_DESCRIPTOR)) != 0) {\r
+    //\r
+    // we've already installed to this vector\r
+    //\r
+    if (NewCallback != NULL) {\r
       //\r
-      // we've already installed to this vector\r
+      // if the input handler is non-null, error\r
       //\r
-      if (NewCallback != NULL) {\r
-        //\r
-        // if the input handler is non-null, error\r
-        //\r
-        Status = EFI_ALREADY_STARTED;\r
-      } else {\r
-        UnhookEntry (ExceptionType);\r
-      }\r
+      Status = EFI_ALREADY_STARTED;\r
     } else {\r
+      UnhookEntry (ExceptionType);\r
+    }\r
+  } else {\r
+    //\r
+    // no user handler installed on this vector\r
+    //\r
+    if (NewCallback == NULL) {\r
       //\r
-      // no user handler installed on this vector\r
+      // if the input handler is null, error\r
       //\r
-      if (NewCallback == NULL) {\r
-        //\r
-        // if the input handler is null, error\r
-        //\r
-        Status = EFI_INVALID_PARAMETER;\r
-      } else {\r
-        HookEntry (ExceptionType, NewCallback);\r
-      }\r
+      Status = EFI_INVALID_PARAMETER;\r
+    } else {\r
+      HookEntry (ExceptionType, NewCallback);\r
     }\r
   }\r
 \r