/** @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
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+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
// 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
VOID\r
HookEntry (\r
IN EFI_EXCEPTION_TYPE ExceptionType,\r
- IN VOID (*NewCallback) ()\r
+ IN CALLBACK_FUNC NewCallback\r
)\r
{\r
BOOLEAN OldIntFlagState;\r
//\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
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
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