]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/DebugSupportDxe/Ia32/PlDebugSupport.c
Improve coding style in MdeModulePkg.
[mirror_edk2.git] / MdeModulePkg / Universal / DebugSupportDxe / Ia32 / PlDebugSupport.c
index 24e2cd070003f5fbe7bb89e9a688d242fecde16d..c78285a60e46e5e022a7735a76ed3ccadce02e1e 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
-  Generic debug support functions for IA32/x64.\r
+  IA32/x64 generic functions to support Debug Support protocol.\r
 \r
-Copyright (c) 2006 - 2008, Intel Corporation\r
+Copyright (c) 2006 - 2010, 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
@@ -18,7 +18,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 // This the global main table to keep track of the interrupts\r
 //\r
 IDT_ENTRY                 *IdtEntryTable  = NULL;\r
-IA32_IDT_GATE_DESCRIPTOR  NullDesc        = {0};\r
 \r
 /**\r
   Read IDT Gate Descriptor from IDT Table.\r
@@ -79,7 +78,7 @@ WriteIdtGateDescriptor (
 VOID\r
 HookEntry (\r
   IN EFI_EXCEPTION_TYPE            ExceptionType,\r
-  IN VOID                         (*NewCallback) ()\r
+  IN CALLBACK_FUNC                 NewCallback\r
   )\r
 {\r
   BOOLEAN     OldIntFlagState;\r
@@ -91,11 +90,27 @@ HookEntry (
   //\r
   OldIntFlagState = SaveAndDisableInterrupts ();\r
 \r
+  //\r
+  // gets IDT Gate descriptor by index\r
+  //\r
   ReadIdtGateDescriptor (ExceptionType, &(IdtEntryTable[ExceptionType].OrigDesc));\r
+  //\r
+  // stores orignal interrupt handle \r
+  //\r
   IdtEntryTable[ExceptionType].OrigVector = (DEBUG_PROC) GetInterruptHandleFromIdt (&(IdtEntryTable[ExceptionType].OrigDesc));\r
 \r
+  // \r
+  // encodes new IDT Gate descriptor by stub entry \r
+  //\r
   Vect2Desc (&IdtEntryTable[ExceptionType].NewDesc, IdtEntryTable[ExceptionType].StubEntry);\r
+  //\r
+  // stores NewCallback\r
+  //\r
   IdtEntryTable[ExceptionType].RegisteredCallback = NewCallback;\r
+\r
+  //\r
+  // writes back new IDT Gate descriptor\r
+  //\r
   WriteIdtGateDescriptor (ExceptionType, &(IdtEntryTable[ExceptionType].NewDesc));\r
 \r
   //\r
@@ -215,6 +230,7 @@ RegisterExceptionCallback (
   return ManageIdtEntryTable (ExceptionCallback, ExceptionType);\r
 }\r
 \r
+\r
 /**\r
   Invalidates processor instruction cache for a memory range. Subsequent execution in this range\r
   causes a fresh memory fetch to retrieve code to be executed.                                  \r
@@ -245,6 +261,7 @@ InvalidateInstructionCache (
   Common piece of code that invokes the registered handlers.\r
 \r
   This code executes in exception context so no efi calls are allowed.\r
+  This code is called from assembly file.\r
 \r
   @param  ExceptionType     Exception type\r
   @param  ContextRecord     System context\r