summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Universal/DebugSupportDxe/Ia32/PlDebugSupport.c
diff options
context:
space:
mode:
Diffstat (limited to 'MdeModulePkg/Universal/DebugSupportDxe/Ia32/PlDebugSupport.c')
-rw-r--r--MdeModulePkg/Universal/DebugSupportDxe/Ia32/PlDebugSupport.c79
1 files changed, 40 insertions, 39 deletions
diff --git a/MdeModulePkg/Universal/DebugSupportDxe/Ia32/PlDebugSupport.c b/MdeModulePkg/Universal/DebugSupportDxe/Ia32/PlDebugSupport.c
index afea3a218c..40fe74d8c2 100644
--- a/MdeModulePkg/Universal/DebugSupportDxe/Ia32/PlDebugSupport.c
+++ b/MdeModulePkg/Universal/DebugSupportDxe/Ia32/PlDebugSupport.c
@@ -11,7 +11,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
// This the global main table to keep track of the interrupts
//
-IDT_ENTRY *IdtEntryTable = NULL;
+IDT_ENTRY *IdtEntryTable = NULL;
/**
Read IDT Gate Descriptor from IDT Table.
@@ -26,13 +26,13 @@ ReadIdtGateDescriptor (
OUT IA32_IDT_GATE_DESCRIPTOR *IdtGateDescriptor
)
{
- IA32_DESCRIPTOR IdtrValue;
- IA32_IDT_GATE_DESCRIPTOR *IdtTable;
+ IA32_DESCRIPTOR IdtrValue;
+ IA32_IDT_GATE_DESCRIPTOR *IdtTable;
- AsmReadIdtr (&IdtrValue);
- IdtTable = (IA32_IDT_GATE_DESCRIPTOR *) IdtrValue.Base;
+ AsmReadIdtr (&IdtrValue);
+ IdtTable = (IA32_IDT_GATE_DESCRIPTOR *)IdtrValue.Base;
- CopyMem ((VOID *) IdtGateDescriptor, (VOID *) &(IdtTable)[Vector], sizeof (IA32_IDT_GATE_DESCRIPTOR));
+ CopyMem ((VOID *)IdtGateDescriptor, (VOID *)&(IdtTable)[Vector], sizeof (IA32_IDT_GATE_DESCRIPTOR));
}
/**
@@ -48,13 +48,13 @@ WriteIdtGateDescriptor (
IA32_IDT_GATE_DESCRIPTOR *IdtGateDescriptor
)
{
- IA32_DESCRIPTOR IdtrValue;
- IA32_IDT_GATE_DESCRIPTOR *IdtTable;
+ IA32_DESCRIPTOR IdtrValue;
+ IA32_IDT_GATE_DESCRIPTOR *IdtTable;
- AsmReadIdtr (&IdtrValue);
- IdtTable = (IA32_IDT_GATE_DESCRIPTOR *) IdtrValue.Base;
+ AsmReadIdtr (&IdtrValue);
+ IdtTable = (IA32_IDT_GATE_DESCRIPTOR *)IdtrValue.Base;
- CopyMem ((VOID *) &(IdtTable)[Vector], (VOID *) IdtGateDescriptor, sizeof (IA32_IDT_GATE_DESCRIPTOR));
+ CopyMem ((VOID *)&(IdtTable)[Vector], (VOID *)IdtGateDescriptor, sizeof (IA32_IDT_GATE_DESCRIPTOR));
}
/**
@@ -71,13 +71,13 @@ WriteIdtGateDescriptor (
**/
VOID
HookEntry (
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN CALLBACK_FUNC NewCallback
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN CALLBACK_FUNC NewCallback
)
{
- BOOLEAN OldIntFlagState;
+ BOOLEAN OldIntFlagState;
- CreateEntryStub (ExceptionType, (VOID **) &IdtEntryTable[ExceptionType].StubEntry);
+ CreateEntryStub (ExceptionType, (VOID **)&IdtEntryTable[ExceptionType].StubEntry);
//
// Disables CPU interrupts and returns the previous interrupt state
@@ -91,7 +91,7 @@ HookEntry (
//
// stores orignal interrupt handle
//
- IdtEntryTable[ExceptionType].OrigVector = (DEBUG_PROC) GetInterruptHandleFromIdt (&(IdtEntryTable[ExceptionType].OrigDesc));
+ IdtEntryTable[ExceptionType].OrigVector = (DEBUG_PROC)GetInterruptHandleFromIdt (&(IdtEntryTable[ExceptionType].OrigDesc));
//
// encodes new IDT Gate descriptor by stub entry
@@ -112,7 +112,7 @@ HookEntry (
//
SetInterruptState (OldIntFlagState);
- return ;
+ return;
}
/**
@@ -123,10 +123,10 @@ HookEntry (
**/
VOID
UnhookEntry (
- IN EFI_EXCEPTION_TYPE ExceptionType
+ IN EFI_EXCEPTION_TYPE ExceptionType
)
{
- BOOLEAN OldIntFlagState;
+ BOOLEAN OldIntFlagState;
//
// Disables CPU interrupts and returns the previous interrupt state
@@ -143,7 +143,7 @@ UnhookEntry (
//
SetInterruptState (OldIntFlagState);
- return ;
+ return;
}
/**
@@ -162,8 +162,8 @@ UnhookEntry (
EFI_STATUS
EFIAPI
GetMaximumProcessorIndex (
- IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
- OUT UINTN *MaxProcessorIndex
+ IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
+ OUT UINTN *MaxProcessorIndex
)
{
*MaxProcessorIndex = 0;
@@ -187,9 +187,9 @@ GetMaximumProcessorIndex (
EFI_STATUS
EFIAPI
RegisterPeriodicCallback (
- IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
- IN UINTN ProcessorIndex,
- IN EFI_PERIODIC_CALLBACK PeriodicCallback
+ IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
+ IN UINTN ProcessorIndex,
+ IN EFI_PERIODIC_CALLBACK PeriodicCallback
)
{
return ManageIdtEntryTable (PeriodicCallback, SYSTEM_TIMER_VECTOR);
@@ -215,16 +215,15 @@ RegisterPeriodicCallback (
EFI_STATUS
EFIAPI
RegisterExceptionCallback (
- IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
- IN UINTN ProcessorIndex,
- IN EFI_EXCEPTION_CALLBACK ExceptionCallback,
- IN EFI_EXCEPTION_TYPE ExceptionType
+ IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
+ IN UINTN ProcessorIndex,
+ IN EFI_EXCEPTION_CALLBACK ExceptionCallback,
+ IN EFI_EXCEPTION_TYPE ExceptionType
)
{
return ManageIdtEntryTable (ExceptionCallback, ExceptionType);
}
-
/**
Invalidates processor instruction cache for a memory range. Subsequent execution in this range
causes a fresh memory fetch to retrieve code to be executed.
@@ -241,10 +240,10 @@ RegisterExceptionCallback (
EFI_STATUS
EFIAPI
InvalidateInstructionCache (
- IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
- IN UINTN ProcessorIndex,
- IN VOID *Start,
- IN UINT64 Length
+ IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
+ IN UINTN ProcessorIndex,
+ IN VOID *Start,
+ IN UINT64 Length
)
{
AsmWbinvd ();
@@ -263,8 +262,8 @@ InvalidateInstructionCache (
**/
VOID
InterruptDistrubutionHub (
- EFI_EXCEPTION_TYPE ExceptionType,
- EFI_SYSTEM_CONTEXT_IA32 *ContextRecord
+ EFI_EXCEPTION_TYPE ExceptionType,
+ EFI_SYSTEM_CONTEXT_IA32 *ContextRecord
)
{
if (IdtEntryTable[ExceptionType].RegisteredCallback != NULL) {
@@ -290,7 +289,7 @@ InterruptDistrubutionHub (
EFI_STATUS
EFIAPI
PlUnloadDebugSupportDriver (
- IN EFI_HANDLE ImageHandle
+ IN EFI_HANDLE ImageHandle
)
{
EFI_EXCEPTION_TYPE ExceptionType;
@@ -341,8 +340,8 @@ PlInitializeDebugSupportDriver (
return EFI_OUT_OF_RESOURCES;
}
- for (ExceptionType = 0; ExceptionType < NUM_IDT_ENTRIES; ExceptionType ++) {
- IdtEntryTable[ExceptionType].StubEntry = (DEBUG_PROC) (UINTN) AllocatePool (StubSize);
+ for (ExceptionType = 0; ExceptionType < NUM_IDT_ENTRIES; ExceptionType++) {
+ IdtEntryTable[ExceptionType].StubEntry = (DEBUG_PROC)(UINTN)AllocatePool (StubSize);
if (IdtEntryTable[ExceptionType].StubEntry == NULL) {
goto ErrorCleanup;
}
@@ -352,6 +351,7 @@ PlInitializeDebugSupportDriver (
//
CopyMem ((VOID *)(UINTN)IdtEntryTable[ExceptionType].StubEntry, InterruptEntryStub, StubSize);
}
+
return EFI_SUCCESS;
ErrorCleanup:
@@ -361,6 +361,7 @@ ErrorCleanup:
FreePool ((VOID *)(UINTN)IdtEntryTable[ExceptionType].StubEntry);
}
}
+
FreePool (IdtEntryTable);
return EFI_OUT_OF_RESOURCES;