]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/DebugSupportDxe/Ia32/PlDebugSupportIa32.c
1. Use Mde library for Debug Port Module
[mirror_edk2.git] / MdeModulePkg / Universal / DebugSupportDxe / Ia32 / PlDebugSupportIa32.c
index 47e4e0e3508676e8ee5527c3e427e80291e68325..290fea69d5c12c9f50d809a3c3d26a1fec4f657c 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
-  IA32 specific debug support functions\r
+  IA32 specific functions to support Debug Support protocol.\r
 \r
-Copyright (c) 2006 - 2008, Intel Corporation\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
@@ -12,26 +12,33 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 **/\r
 \r
-#include "DebugSupport.h"\r
+#include "PlDebugSupport.h"\r
+\r
+IA32_IDT_GATE_DESCRIPTOR  NullDesc = {{0}};\r
 \r
 /**\r
-  Get Procedure Entry Point from IDT Gate Descriptor.\r
+  Get Interrupt Handle from IDT Gate Descriptor.\r
 \r
-  @param  IdtGateDecriptor  IDT Gate Descriptor.\r
+  @param  IdtGateDescriptor  IDT Gate Descriptor.\r
 \r
-  @return Procedure Entry Point located in IDT Gate Descriptor.\r
+  @return Interrupt Handle stored in IDT Gate Descriptor.\r
 \r
 **/\r
-UINTN GetProcedureEntryPoint (\r
-  IN IA32_IDT_GATE_DESCRIPTOR  *IdtGateDecriptor\r
+UINTN\r
+GetInterruptHandleFromIdt (\r
+  IN IA32_IDT_GATE_DESCRIPTOR  *IdtGateDescriptor\r
   )\r
 {\r
-  UINTN      ProcedureEntryPoint;\r
\r
-  ((UINT16 *) &ProcedureEntryPoint)[0] = (UINT16) IdtGateDecriptor->Bits.OffsetLow;\r
-  ((UINT16 *) &ProcedureEntryPoint)[1] = (UINT16) IdtGateDecriptor->Bits.OffsetHigh;\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
 \r
-  return ProcedureEntryPoint;\r
+  return InterruptHandle;\r
 }\r
 \r
 /**\r
@@ -44,10 +51,8 @@ UINTN GetProcedureEntryPoint (
                           for.\r
   @param  Stub            On successful exit, *Stub contains the newly allocated entry stub.\r
 \r
-  @retval EFI_SUCCESS     Always.\r
-\r
 **/\r
-EFI_STATUS\r
+VOID\r
 CreateEntryStub (\r
   IN EFI_EXCEPTION_TYPE     ExceptionType,\r
   OUT VOID                  **Stub\r
@@ -80,7 +85,7 @@ CreateEntryStub (
   //\r
   *(UINT32 *) &StubCopy[0x0e] = (UINT32) CommonIdtEntry - (UINT32) &StubCopy[StubSize];\r
 \r
-  return EFI_SUCCESS;\r
+  return ;\r
 }\r
 \r
 /**\r
@@ -94,16 +99,15 @@ CreateEntryStub (
                         be uninstalled.\r
   @param  ExceptionType Indicates which entry to manage.\r
 \r
-  @retval EFI_SUCCESS            Process is ok.\r
+  @retval EFI_SUCCESS            Installing or Uninstalling operation is ok.\r
   @retval EFI_INVALID_PARAMETER  Requested uninstalling a handler from a vector that has\r
                                  no handler registered for it\r
   @retval EFI_ALREADY_STARTED    Requested install to a vector that already has a handler registered.\r
-  @retval others                 Possible return values are passed through from UnHookEntry and HookEntry.\r
 \r
 **/\r
 EFI_STATUS\r
 ManageIdtEntryTable (\r
-  VOID (*NewCallback)(),\r
+  VOID               (*NewCallback)(),\r
   EFI_EXCEPTION_TYPE ExceptionType\r
   )\r
 {\r
@@ -122,7 +126,7 @@ ManageIdtEntryTable (
         //\r
         Status = EFI_ALREADY_STARTED;\r
       } else {\r
-        Status = UnhookEntry (ExceptionType);\r
+        UnhookEntry (ExceptionType);\r
       }\r
     } else {\r
       //\r
@@ -134,7 +138,7 @@ ManageIdtEntryTable (
         //\r
         Status = EFI_INVALID_PARAMETER;\r
       } else {\r
-        Status = HookEntry (ExceptionType, NewCallback);\r
+        HookEntry (ExceptionType, NewCallback);\r
       }\r
     }\r
   }\r