SourceLevelDebugPkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the SourceLevelDebugPkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
This commit is contained in:
committed by
mergify[bot]
parent
b878648967
commit
c1e126b119
File diff suppressed because it is too large
Load Diff
@@ -41,32 +41,32 @@
|
||||
//
|
||||
// These macros may be already defined in DebugAgentLib.h
|
||||
//
|
||||
#define DEBUG_AGENT_INIT_PEI 9
|
||||
#define DEBUG_AGENT_INIT_DXE_LOAD 10
|
||||
#define DEBUG_AGENT_INIT_DXE_UNLOAD 11
|
||||
#define DEBUG_AGENT_INIT_THUNK_PEI_IA32TOX64 12
|
||||
#define DEBUG_AGENT_INIT_PEI 9
|
||||
#define DEBUG_AGENT_INIT_DXE_LOAD 10
|
||||
#define DEBUG_AGENT_INIT_DXE_UNLOAD 11
|
||||
#define DEBUG_AGENT_INIT_THUNK_PEI_IA32TOX64 12
|
||||
|
||||
#define DEBUG_INT1_VECTOR DEBUG_EXCEPT_DEBUG
|
||||
#define DEBUG_INT3_VECTOR DEBUG_EXCEPT_BREAKPOINT
|
||||
#define DEBUG_TIMER_VECTOR 32
|
||||
#define DEBUG_MAILBOX_VECTOR 33
|
||||
#define DEBUG_INT1_VECTOR DEBUG_EXCEPT_DEBUG
|
||||
#define DEBUG_INT3_VECTOR DEBUG_EXCEPT_BREAKPOINT
|
||||
#define DEBUG_TIMER_VECTOR 32
|
||||
#define DEBUG_MAILBOX_VECTOR 33
|
||||
|
||||
//
|
||||
// Timeout value for reading packet (unit is microsecond)
|
||||
//
|
||||
#define READ_PACKET_TIMEOUT (500 * 1000)
|
||||
#define DEBUG_TIMER_INTERVAL (100 * 1000)
|
||||
#define READ_PACKET_TIMEOUT (500 * 1000)
|
||||
#define DEBUG_TIMER_INTERVAL (100 * 1000)
|
||||
|
||||
#define SOFT_INTERRUPT_SIGNATURE SIGNATURE_32('S','O','F','T')
|
||||
#define SYSTEM_RESET_SIGNATURE SIGNATURE_32('S','Y','S','R')
|
||||
#define MEMORY_READY_SIGNATURE SIGNATURE_32('M','E','M','R')
|
||||
#define SOFT_INTERRUPT_SIGNATURE SIGNATURE_32('S','O','F','T')
|
||||
#define SYSTEM_RESET_SIGNATURE SIGNATURE_32('S','Y','S','R')
|
||||
#define MEMORY_READY_SIGNATURE SIGNATURE_32('M','E','M','R')
|
||||
|
||||
extern UINTN Exception0Handle;
|
||||
extern UINTN TimerInterruptHandle;
|
||||
extern UINT32 ExceptionStubHeaderSize;
|
||||
extern BOOLEAN mSkipBreakpoint;
|
||||
extern EFI_VECTOR_HANDOFF_INFO mVectorHandoffInfoDebugAgent[];
|
||||
extern UINTN mVectorHandoffInfoCount;
|
||||
extern UINTN Exception0Handle;
|
||||
extern UINTN TimerInterruptHandle;
|
||||
extern UINT32 ExceptionStubHeaderSize;
|
||||
extern BOOLEAN mSkipBreakpoint;
|
||||
extern EFI_VECTOR_HANDOFF_INFO mVectorHandoffInfoDebugAgent[];
|
||||
extern UINTN mVectorHandoffInfoCount;
|
||||
|
||||
//
|
||||
// CPU exception information issued by debug agent
|
||||
@@ -75,11 +75,11 @@ typedef struct {
|
||||
//
|
||||
// This field is used to save CPU content before executing HOST command
|
||||
//
|
||||
BASE_LIBRARY_JUMP_BUFFER JumpBuffer;
|
||||
BASE_LIBRARY_JUMP_BUFFER JumpBuffer;
|
||||
//
|
||||
// This field returns the exception information issued by the HOST command
|
||||
//
|
||||
DEBUG_DATA_RESPONSE_GET_EXCEPTION ExceptionContent;
|
||||
DEBUG_DATA_RESPONSE_GET_EXCEPTION ExceptionContent;
|
||||
} DEBUG_AGENT_EXCEPTION_BUFFER;
|
||||
|
||||
#define DEBUG_AGENT_FLAG_HOST_ATTACHED BIT0
|
||||
@@ -107,38 +107,38 @@ typedef union {
|
||||
//
|
||||
// Lower 32 bits to store the status of DebugAgent
|
||||
//
|
||||
UINT32 HostAttached : 1; // 1: HOST is attached
|
||||
UINT32 AgentInProgress : 1; // 1: Debug Agent is communicating with HOST
|
||||
UINT32 MemoryReady : 1; // 1: Memory is ready
|
||||
UINT32 SteppingFlag : 1; // 1: Agent is running stepping command
|
||||
UINT32 CheckMailboxInHob : 1; // 1: Need to check mailbox saved in HOB
|
||||
UINT32 InitArch : 2; // value of DEBUG_DATA_RESPONSE_ARCH_MODE
|
||||
UINT32 InterruptFlag : 1; // 1: EFLAGS.IF is set
|
||||
UINT32 Reserved1 : 24;
|
||||
UINT32 HostAttached : 1; // 1: HOST is attached
|
||||
UINT32 AgentInProgress : 1; // 1: Debug Agent is communicating with HOST
|
||||
UINT32 MemoryReady : 1; // 1: Memory is ready
|
||||
UINT32 SteppingFlag : 1; // 1: Agent is running stepping command
|
||||
UINT32 CheckMailboxInHob : 1; // 1: Need to check mailbox saved in HOB
|
||||
UINT32 InitArch : 2; // value of DEBUG_DATA_RESPONSE_ARCH_MODE
|
||||
UINT32 InterruptFlag : 1; // 1: EFLAGS.IF is set
|
||||
UINT32 Reserved1 : 24;
|
||||
//
|
||||
// Higher 32bits to control the behavior of DebugAgent
|
||||
//
|
||||
UINT32 BreakOnNextSmi : 1; // 1: Break on next SMI
|
||||
UINT32 PrintErrorLevel : 4; // Bitmask of print error level for debug message
|
||||
UINT32 BreakOnBootScript : 1; // 1: Break before executing boot script
|
||||
UINT32 Reserved2 : 26;
|
||||
UINT32 BreakOnNextSmi : 1; // 1: Break on next SMI
|
||||
UINT32 PrintErrorLevel : 4; // Bitmask of print error level for debug message
|
||||
UINT32 BreakOnBootScript : 1; // 1: Break before executing boot script
|
||||
UINT32 Reserved2 : 26;
|
||||
} Bits;
|
||||
UINT64 Uint64;
|
||||
UINT64 Uint64;
|
||||
} DEBUG_AGENT_FLAG;
|
||||
|
||||
typedef struct {
|
||||
DEBUG_AGENT_FLAG DebugFlag;
|
||||
UINT64 DebugPortHandle;
|
||||
DEBUG_AGENT_FLAG DebugFlag;
|
||||
UINT64 DebugPortHandle;
|
||||
//
|
||||
// Pointer to DEBUG_AGENT_EXCEPTION_BUFFER
|
||||
//
|
||||
UINT64 ExceptionBufferPointer;
|
||||
UINT8 LastAck; // The last ack packet type
|
||||
UINT8 SequenceNo;
|
||||
UINT8 HostSequenceNo;
|
||||
UINT32 DebugTimerFrequency;
|
||||
UINT8 CheckSum; // Mailbox checksum
|
||||
UINT8 ToBeCheckSum; // To be Mailbox checksum at the next
|
||||
UINT64 ExceptionBufferPointer;
|
||||
UINT8 LastAck; // The last ack packet type
|
||||
UINT8 SequenceNo;
|
||||
UINT8 HostSequenceNo;
|
||||
UINT32 DebugTimerFrequency;
|
||||
UINT8 CheckSum; // Mailbox checksum
|
||||
UINT8 ToBeCheckSum; // To be Mailbox checksum at the next
|
||||
} DEBUG_AGENT_MAILBOX;
|
||||
#pragma pack()
|
||||
|
||||
@@ -147,33 +147,32 @@ typedef struct {
|
||||
///
|
||||
typedef union {
|
||||
struct {
|
||||
UINT32 OffsetLow:16; ///< Offset bits 15..0.
|
||||
UINT32 Selector:16; ///< Selector.
|
||||
UINT32 Reserved_0:8; ///< Reserved.
|
||||
UINT32 GateType:8; ///< Gate Type. See #defines above.
|
||||
UINT32 OffsetHigh:16; ///< Offset bits 31..16.
|
||||
UINT32 OffsetLow : 16; ///< Offset bits 15..0.
|
||||
UINT32 Selector : 16; ///< Selector.
|
||||
UINT32 Reserved_0 : 8; ///< Reserved.
|
||||
UINT32 GateType : 8; ///< Gate Type. See #defines above.
|
||||
UINT32 OffsetHigh : 16; ///< Offset bits 31..16.
|
||||
} Bits;
|
||||
UINT64 Uint64;
|
||||
UINT64 Uint64;
|
||||
} IA32_IDT_ENTRY;
|
||||
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
UINT32 LimitLow : 16;
|
||||
UINT32 BaseLow : 16;
|
||||
UINT32 BaseMid : 8;
|
||||
UINT32 Type : 4;
|
||||
UINT32 System : 1;
|
||||
UINT32 Dpl : 2;
|
||||
UINT32 Present : 1;
|
||||
UINT32 LimitHigh : 4;
|
||||
UINT32 Software : 1;
|
||||
UINT32 Reserved : 1;
|
||||
UINT32 DefaultSize : 1;
|
||||
UINT32 Granularity : 1;
|
||||
UINT32 BaseHigh : 8;
|
||||
UINT32 LimitLow : 16;
|
||||
UINT32 BaseLow : 16;
|
||||
UINT32 BaseMid : 8;
|
||||
UINT32 Type : 4;
|
||||
UINT32 System : 1;
|
||||
UINT32 Dpl : 2;
|
||||
UINT32 Present : 1;
|
||||
UINT32 LimitHigh : 4;
|
||||
UINT32 Software : 1;
|
||||
UINT32 Reserved : 1;
|
||||
UINT32 DefaultSize : 1;
|
||||
UINT32 Granularity : 1;
|
||||
UINT32 BaseHigh : 8;
|
||||
} Bits;
|
||||
UINT64 Uint64;
|
||||
UINT64 Uint64;
|
||||
} IA32_GDT;
|
||||
|
||||
/**
|
||||
@@ -197,9 +196,9 @@ InitializeDebugIdt (
|
||||
**/
|
||||
UINT8 *
|
||||
ArchReadRegisterBuffer (
|
||||
IN DEBUG_CPU_CONTEXT *CpuContext,
|
||||
IN UINT8 Index,
|
||||
IN UINT8 *Width
|
||||
IN DEBUG_CPU_CONTEXT *CpuContext,
|
||||
IN UINT8 Index,
|
||||
IN UINT8 *Width
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -216,9 +215,9 @@ ArchReadRegisterBuffer (
|
||||
**/
|
||||
RETURN_STATUS
|
||||
SendDataResponsePacket (
|
||||
IN UINT8 *Data,
|
||||
IN UINT16 DataSize,
|
||||
IN OUT DEBUG_PACKET_HEADER *DebugHeader
|
||||
IN UINT8 *Data,
|
||||
IN UINT16 DataSize,
|
||||
IN OUT DEBUG_PACKET_HEADER *DebugHeader
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -267,8 +266,8 @@ GetDebugPortHandle (
|
||||
**/
|
||||
EFI_STATUS
|
||||
DebugReadBreakSymbol (
|
||||
IN DEBUG_PORT_HANDLE Handle,
|
||||
OUT UINT8 *BreakSymbol
|
||||
IN DEBUG_PORT_HANDLE Handle,
|
||||
OUT UINT8 *BreakSymbol
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -286,8 +285,8 @@ DebugReadBreakSymbol (
|
||||
VOID
|
||||
EFIAPI
|
||||
DebugAgentMsgPrint (
|
||||
IN UINT8 ErrorLevel,
|
||||
IN CHAR8 *Format,
|
||||
IN UINT8 ErrorLevel,
|
||||
IN CHAR8 *Format,
|
||||
...
|
||||
);
|
||||
|
||||
@@ -299,7 +298,7 @@ DebugAgentMsgPrint (
|
||||
**/
|
||||
VOID
|
||||
TriggerSoftInterrupt (
|
||||
IN UINT32 Signature
|
||||
IN UINT32 Signature
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -322,7 +321,7 @@ MultiProcessorDebugSupport (
|
||||
**/
|
||||
VOID
|
||||
FindAndReportModuleImageInfo (
|
||||
IN UINTN AlignSize
|
||||
IN UINTN AlignSize
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -345,7 +344,7 @@ IsDebugAgentInitialzed (
|
||||
**/
|
||||
VOID
|
||||
UpdateMailboxChecksum (
|
||||
IN DEBUG_AGENT_MAILBOX *Mailbox
|
||||
IN DEBUG_AGENT_MAILBOX *Mailbox
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -358,7 +357,7 @@ UpdateMailboxChecksum (
|
||||
**/
|
||||
VOID
|
||||
VerifyMailboxChecksum (
|
||||
IN DEBUG_AGENT_MAILBOX *Mailbox
|
||||
IN DEBUG_AGENT_MAILBOX *Mailbox
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -370,8 +369,8 @@ VerifyMailboxChecksum (
|
||||
**/
|
||||
VOID
|
||||
SetDebugFlag (
|
||||
IN UINT64 FlagMask,
|
||||
IN UINT32 FlagValue
|
||||
IN UINT64 FlagMask,
|
||||
IN UINT32 FlagValue
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -384,7 +383,7 @@ SetDebugFlag (
|
||||
**/
|
||||
UINT32
|
||||
GetDebugFlag (
|
||||
IN UINT64 FlagMask
|
||||
IN UINT64 FlagMask
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -397,9 +396,9 @@ GetDebugFlag (
|
||||
**/
|
||||
VOID
|
||||
UpdateMailboxContent (
|
||||
IN DEBUG_AGENT_MAILBOX *Mailbox,
|
||||
IN UINTN Index,
|
||||
IN UINT64 Value
|
||||
IN DEBUG_AGENT_MAILBOX *Mailbox,
|
||||
IN UINTN Index,
|
||||
IN UINT64 Value
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -412,7 +411,7 @@ UpdateMailboxContent (
|
||||
**/
|
||||
VOID *
|
||||
GetExceptionHandlerInIdtEntry (
|
||||
IN UINTN ExceptionNum
|
||||
IN UINTN ExceptionNum
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -424,8 +423,8 @@ GetExceptionHandlerInIdtEntry (
|
||||
**/
|
||||
VOID
|
||||
SetExceptionHandlerInIdtEntry (
|
||||
IN UINTN ExceptionNum,
|
||||
IN VOID *ExceptionHandler
|
||||
IN UINTN ExceptionNum,
|
||||
IN VOID *ExceptionHandler
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -446,10 +445,10 @@ SetExceptionHandlerInIdtEntry (
|
||||
VOID
|
||||
EFIAPI
|
||||
DebugAgentDataMsgPrint (
|
||||
IN UINT8 ErrorLevel,
|
||||
IN BOOLEAN IsSend,
|
||||
IN UINT8 *Data,
|
||||
IN UINT8 Length
|
||||
IN UINT8 ErrorLevel,
|
||||
IN BOOLEAN IsSend,
|
||||
IN UINT8 *Data,
|
||||
IN UINT8 Length
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -465,8 +464,8 @@ DebugAgentDataMsgPrint (
|
||||
**/
|
||||
EFI_STATUS
|
||||
ReadRemainingBreakPacket (
|
||||
IN DEBUG_PORT_HANDLE Handle,
|
||||
IN OUT DEBUG_PACKET_HEADER *DebugHeader
|
||||
IN DEBUG_PORT_HANDLE Handle,
|
||||
IN OUT DEBUG_PACKET_HEADER *DebugHeader
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -488,11 +487,10 @@ ReadRemainingBreakPacket (
|
||||
**/
|
||||
UINTN
|
||||
DebugAgentReadBuffer (
|
||||
IN DEBUG_PORT_HANDLE Handle,
|
||||
IN OUT UINT8 *Buffer,
|
||||
IN UINTN NumberOfBytes,
|
||||
IN UINTN Timeout
|
||||
IN DEBUG_PORT_HANDLE Handle,
|
||||
IN OUT UINT8 *Buffer,
|
||||
IN UINTN NumberOfBytes,
|
||||
IN UINTN Timeout
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -8,9 +8,9 @@
|
||||
|
||||
#include "DebugAgent.h"
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED DEBUG_MP_CONTEXT volatile mDebugMpContext = {0,0,0,{0},{0},0,0,0,0,FALSE,FALSE};
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED DEBUG_MP_CONTEXT volatile mDebugMpContext = { 0, 0, 0, { 0 }, { 0 }, 0, 0, 0, 0, FALSE, FALSE };
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED DEBUG_CPU_DATA volatile mDebugCpuData = {0};
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED DEBUG_CPU_DATA volatile mDebugCpuData = { 0 };
|
||||
|
||||
/**
|
||||
Acquire a spin lock when Multi-processor supported.
|
||||
@@ -23,10 +23,10 @@ GLOBAL_REMOVE_IF_UNREFERENCED DEBUG_CPU_DATA volatile mDebugCpuData = {0};
|
||||
**/
|
||||
VOID
|
||||
AcquireMpSpinLock (
|
||||
IN OUT SPIN_LOCK *MpSpinLock
|
||||
IN OUT SPIN_LOCK *MpSpinLock
|
||||
)
|
||||
{
|
||||
if (!MultiProcessorDebugSupport()) {
|
||||
if (!MultiProcessorDebugSupport ()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ AcquireMpSpinLock (
|
||||
if (AcquireSpinLockOrFail (MpSpinLock)) {
|
||||
break;
|
||||
}
|
||||
|
||||
CpuPause ();
|
||||
continue;
|
||||
}
|
||||
@@ -47,10 +48,10 @@ AcquireMpSpinLock (
|
||||
**/
|
||||
VOID
|
||||
ReleaseMpSpinLock (
|
||||
IN OUT SPIN_LOCK *MpSpinLock
|
||||
IN OUT SPIN_LOCK *MpSpinLock
|
||||
)
|
||||
{
|
||||
if (!MultiProcessorDebugSupport()) {
|
||||
if (!MultiProcessorDebugSupport ()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -65,12 +66,12 @@ ReleaseMpSpinLock (
|
||||
**/
|
||||
VOID
|
||||
HaltOtherProcessors (
|
||||
IN UINT32 CurrentProcessorIndex
|
||||
IN UINT32 CurrentProcessorIndex
|
||||
)
|
||||
{
|
||||
DebugAgentMsgPrint (DEBUG_AGENT_INFO, "processor[%x]:Try to halt other processors.\n", CurrentProcessorIndex);
|
||||
if (!DebugAgentIsBsp (CurrentProcessorIndex)) {
|
||||
SetIpiSentByApFlag (TRUE);;
|
||||
SetIpiSentByApFlag (TRUE);
|
||||
}
|
||||
|
||||
mDebugMpContext.BreakAtCpuIndex = CurrentProcessorIndex;
|
||||
@@ -84,7 +85,6 @@ HaltOtherProcessors (
|
||||
// Send fixed IPI to other processors.
|
||||
//
|
||||
SendFixedIpiAllExcludingSelf (DEBUG_TIMER_VECTOR);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -98,14 +98,14 @@ GetProcessorIndex (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
UINT32 Index;
|
||||
UINT16 LocalApicID;
|
||||
UINT32 Index;
|
||||
UINT16 LocalApicID;
|
||||
|
||||
LocalApicID = (UINT16) GetApicId ();
|
||||
LocalApicID = (UINT16)GetApicId ();
|
||||
|
||||
AcquireMpSpinLock (&mDebugMpContext.MpContextSpinLock);
|
||||
|
||||
for (Index = 0; Index < mDebugCpuData.CpuCount; Index ++) {
|
||||
for (Index = 0; Index < mDebugCpuData.CpuCount; Index++) {
|
||||
if (mDebugCpuData.ApicID[Index] == LocalApicID) {
|
||||
break;
|
||||
}
|
||||
@@ -113,7 +113,7 @@ GetProcessorIndex (
|
||||
|
||||
if (Index == mDebugCpuData.CpuCount) {
|
||||
mDebugCpuData.ApicID[Index] = LocalApicID;
|
||||
mDebugCpuData.CpuCount ++ ;
|
||||
mDebugCpuData.CpuCount++;
|
||||
}
|
||||
|
||||
ReleaseMpSpinLock (&mDebugMpContext.MpContextSpinLock);
|
||||
@@ -153,6 +153,7 @@ DebugAgentIsBsp (
|
||||
mDebugMpContext.BspIndex = ProcessorIndex;
|
||||
ReleaseMpSpinLock (&mDebugMpContext.MpContextSpinLock);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
@@ -169,12 +170,12 @@ DebugAgentIsBsp (
|
||||
**/
|
||||
VOID
|
||||
SetCpuStopFlagByIndex (
|
||||
IN UINT32 ProcessorIndex,
|
||||
IN BOOLEAN StopFlag
|
||||
IN UINT32 ProcessorIndex,
|
||||
IN BOOLEAN StopFlag
|
||||
)
|
||||
{
|
||||
UINT8 Value;
|
||||
UINTN Index;
|
||||
UINT8 Value;
|
||||
UINTN Index;
|
||||
|
||||
AcquireMpSpinLock (&mDebugMpContext.MpContextSpinLock);
|
||||
|
||||
@@ -185,6 +186,7 @@ SetCpuStopFlagByIndex (
|
||||
} else {
|
||||
Value = BitFieldWrite8 (Value, Index, Index, 0);
|
||||
}
|
||||
|
||||
mDebugMpContext.CpuStopStatusMask[ProcessorIndex / 8] = Value;
|
||||
|
||||
ReleaseMpSpinLock (&mDebugMpContext.MpContextSpinLock);
|
||||
@@ -200,12 +202,12 @@ SetCpuStopFlagByIndex (
|
||||
**/
|
||||
VOID
|
||||
SetCpuBreakFlagByIndex (
|
||||
IN UINT32 ProcessorIndex,
|
||||
IN BOOLEAN BreakFlag
|
||||
IN UINT32 ProcessorIndex,
|
||||
IN BOOLEAN BreakFlag
|
||||
)
|
||||
{
|
||||
UINT8 Value;
|
||||
UINTN Index;
|
||||
UINT8 Value;
|
||||
UINTN Index;
|
||||
|
||||
AcquireMpSpinLock (&mDebugMpContext.MpContextSpinLock);
|
||||
|
||||
@@ -216,6 +218,7 @@ SetCpuBreakFlagByIndex (
|
||||
} else {
|
||||
Value = BitFieldWrite8 (Value, Index, Index, 0);
|
||||
}
|
||||
|
||||
mDebugMpContext.CpuBreakMask[ProcessorIndex / 8] = Value;
|
||||
|
||||
ReleaseMpSpinLock (&mDebugMpContext.MpContextSpinLock);
|
||||
@@ -232,12 +235,12 @@ SetCpuBreakFlagByIndex (
|
||||
**/
|
||||
BOOLEAN
|
||||
IsCpuStopped (
|
||||
IN UINT32 ProcessorIndex
|
||||
IN UINT32 ProcessorIndex
|
||||
)
|
||||
{
|
||||
UINT8 CpuMask;
|
||||
UINT8 CpuMask;
|
||||
|
||||
CpuMask = (UINT8) (1 << (ProcessorIndex % 8));
|
||||
CpuMask = (UINT8)(1 << (ProcessorIndex % 8));
|
||||
|
||||
if ((mDebugMpContext.CpuStopStatusMask[ProcessorIndex / 8] & CpuMask) != 0) {
|
||||
return TRUE;
|
||||
@@ -255,7 +258,7 @@ IsCpuStopped (
|
||||
**/
|
||||
VOID
|
||||
SetCpuRunningFlag (
|
||||
IN BOOLEAN RunningFlag
|
||||
IN BOOLEAN RunningFlag
|
||||
)
|
||||
{
|
||||
AcquireMpSpinLock (&mDebugMpContext.MpContextSpinLock);
|
||||
@@ -271,7 +274,7 @@ SetCpuRunningFlag (
|
||||
**/
|
||||
VOID
|
||||
SetDebugViewPoint (
|
||||
IN UINT32 ProcessorIndex
|
||||
IN UINT32 ProcessorIndex
|
||||
)
|
||||
{
|
||||
AcquireMpSpinLock (&mDebugMpContext.MpContextSpinLock);
|
||||
@@ -288,7 +291,7 @@ SetDebugViewPoint (
|
||||
**/
|
||||
VOID
|
||||
SetIpiSentByApFlag (
|
||||
IN BOOLEAN IpiSentByApFlag
|
||||
IN BOOLEAN IpiSentByApFlag
|
||||
)
|
||||
{
|
||||
AcquireMpSpinLock (&mDebugMpContext.MpContextSpinLock);
|
||||
@@ -309,13 +312,14 @@ FindNextPendingBreakCpu (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
UINT32 Index;
|
||||
UINT32 Index;
|
||||
|
||||
for (Index = 0; Index < DEBUG_CPU_MAX_COUNT / 8; Index ++) {
|
||||
for (Index = 0; Index < DEBUG_CPU_MAX_COUNT / 8; Index++) {
|
||||
if (mDebugMpContext.CpuBreakMask[Index] != 0) {
|
||||
return (UINT32) LowBitSet32 (mDebugMpContext.CpuBreakMask[Index]) + Index * 8;
|
||||
return (UINT32)LowBitSet32 (mDebugMpContext.CpuBreakMask[Index]) + Index * 8;
|
||||
}
|
||||
}
|
||||
|
||||
return (UINT32)-1;
|
||||
}
|
||||
|
||||
@@ -331,13 +335,14 @@ IsAllCpuRunning (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
UINTN Index;
|
||||
|
||||
for (Index = 0; Index < DEBUG_CPU_MAX_COUNT / 8; Index ++) {
|
||||
for (Index = 0; Index < DEBUG_CPU_MAX_COUNT / 8; Index++) {
|
||||
if (mDebugMpContext.CpuStopStatusMask[Index] != 0) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -354,11 +359,11 @@ IsAllCpuRunning (
|
||||
**/
|
||||
BOOLEAN
|
||||
IsFirstBreakProcessor (
|
||||
IN UINT32 ProcessorIndex
|
||||
IN UINT32 ProcessorIndex
|
||||
)
|
||||
{
|
||||
if (MultiProcessorDebugSupport()) {
|
||||
if (mDebugMpContext.BreakAtCpuIndex != (UINT32) -1) {
|
||||
if (MultiProcessorDebugSupport ()) {
|
||||
if (mDebugMpContext.BreakAtCpuIndex != (UINT32)-1) {
|
||||
//
|
||||
// The current processor is not the first breaking one.
|
||||
//
|
||||
@@ -372,6 +377,6 @@ IsFirstBreakProcessor (
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@@ -9,7 +9,7 @@
|
||||
#ifndef _DEBUG_MP_H_
|
||||
#define _DEBUG_MP_H_
|
||||
|
||||
#define DEBUG_CPU_MAX_COUNT 256
|
||||
#define DEBUG_CPU_MAX_COUNT 256
|
||||
|
||||
typedef struct {
|
||||
UINT32 CpuCount; ///< Processor count
|
||||
@@ -17,21 +17,21 @@ typedef struct {
|
||||
} DEBUG_CPU_DATA;
|
||||
|
||||
typedef struct {
|
||||
SPIN_LOCK MpContextSpinLock; ///< Lock for writing MP context
|
||||
SPIN_LOCK DebugPortSpinLock; ///< Lock for access debug port
|
||||
SPIN_LOCK MailboxSpinLock; ///< Lock for accessing mail box
|
||||
UINT8 CpuBreakMask[DEBUG_CPU_MAX_COUNT/8]; ///< Bitmask of all breaking CPUs
|
||||
UINT8 CpuStopStatusMask[DEBUG_CPU_MAX_COUNT/8]; ///< Bitmask of CPU stop status
|
||||
UINT32 ViewPointIndex; ///< Current view point to be debugged
|
||||
UINT32 BspIndex; ///< Processor index value of BSP
|
||||
UINT32 BreakAtCpuIndex; ///< Processor index value of the current breaking CPU
|
||||
UINT32 DebugTimerInitCount; ///< Record BSP's init timer count
|
||||
BOOLEAN IpiSentByAp; ///< TRUE: IPI is sent by AP. FALSE: IPI is sent by BSP
|
||||
BOOLEAN RunCommandSet; ///< TRUE: RUN command is executing. FALSE: RUN command has been executed.
|
||||
SPIN_LOCK MpContextSpinLock; ///< Lock for writing MP context
|
||||
SPIN_LOCK DebugPortSpinLock; ///< Lock for access debug port
|
||||
SPIN_LOCK MailboxSpinLock; ///< Lock for accessing mail box
|
||||
UINT8 CpuBreakMask[DEBUG_CPU_MAX_COUNT/8]; ///< Bitmask of all breaking CPUs
|
||||
UINT8 CpuStopStatusMask[DEBUG_CPU_MAX_COUNT/8]; ///< Bitmask of CPU stop status
|
||||
UINT32 ViewPointIndex; ///< Current view point to be debugged
|
||||
UINT32 BspIndex; ///< Processor index value of BSP
|
||||
UINT32 BreakAtCpuIndex; ///< Processor index value of the current breaking CPU
|
||||
UINT32 DebugTimerInitCount; ///< Record BSP's init timer count
|
||||
BOOLEAN IpiSentByAp; ///< TRUE: IPI is sent by AP. FALSE: IPI is sent by BSP
|
||||
BOOLEAN RunCommandSet; ///< TRUE: RUN command is executing. FALSE: RUN command has been executed.
|
||||
} DEBUG_MP_CONTEXT;
|
||||
|
||||
extern DEBUG_MP_CONTEXT volatile mDebugMpContext;
|
||||
extern DEBUG_CPU_DATA volatile mDebugCpuData;
|
||||
extern DEBUG_MP_CONTEXT volatile mDebugMpContext;
|
||||
extern DEBUG_CPU_DATA volatile mDebugCpuData;
|
||||
|
||||
/**
|
||||
Break the other processor by send IPI.
|
||||
@@ -41,7 +41,7 @@ extern DEBUG_CPU_DATA volatile mDebugCpuData;
|
||||
**/
|
||||
VOID
|
||||
HaltOtherProcessors (
|
||||
IN UINT32 CurrentProcessorIndex
|
||||
IN UINT32 CurrentProcessorIndex
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -66,7 +66,7 @@ GetProcessorIndex (
|
||||
**/
|
||||
VOID
|
||||
AcquireMpSpinLock (
|
||||
IN OUT SPIN_LOCK *MpSpinLock
|
||||
IN OUT SPIN_LOCK *MpSpinLock
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -77,7 +77,7 @@ AcquireMpSpinLock (
|
||||
**/
|
||||
VOID
|
||||
ReleaseMpSpinLock (
|
||||
IN OUT SPIN_LOCK *MpSpinLock
|
||||
IN OUT SPIN_LOCK *MpSpinLock
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -91,7 +91,7 @@ ReleaseMpSpinLock (
|
||||
**/
|
||||
BOOLEAN
|
||||
DebugAgentIsBsp (
|
||||
IN UINT32 ProcessorIndex
|
||||
IN UINT32 ProcessorIndex
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -104,8 +104,8 @@ DebugAgentIsBsp (
|
||||
**/
|
||||
VOID
|
||||
SetCpuStopFlagByIndex (
|
||||
IN UINT32 ProcessorIndex,
|
||||
IN BOOLEAN StopFlag
|
||||
IN UINT32 ProcessorIndex,
|
||||
IN BOOLEAN StopFlag
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -118,8 +118,8 @@ SetCpuStopFlagByIndex (
|
||||
**/
|
||||
VOID
|
||||
SetCpuBreakFlagByIndex (
|
||||
IN UINT32 ProcessorIndex,
|
||||
IN BOOLEAN BreakFlag
|
||||
IN UINT32 ProcessorIndex,
|
||||
IN BOOLEAN BreakFlag
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -133,7 +133,7 @@ SetCpuBreakFlagByIndex (
|
||||
**/
|
||||
BOOLEAN
|
||||
IsCpuStopped (
|
||||
IN UINT32 ProcessorIndex
|
||||
IN UINT32 ProcessorIndex
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -145,7 +145,7 @@ IsCpuStopped (
|
||||
**/
|
||||
VOID
|
||||
SetCpuRunningFlag (
|
||||
IN BOOLEAN RunningFlag
|
||||
IN BOOLEAN RunningFlag
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -156,7 +156,7 @@ SetCpuRunningFlag (
|
||||
**/
|
||||
VOID
|
||||
SetDebugViewPoint (
|
||||
IN UINT32 ProcessorIndex
|
||||
IN UINT32 ProcessorIndex
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -168,7 +168,7 @@ SetDebugViewPoint (
|
||||
**/
|
||||
VOID
|
||||
SetIpiSentByApFlag (
|
||||
IN BOOLEAN IpiSentByApFlag
|
||||
IN BOOLEAN IpiSentByApFlag
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -209,8 +209,7 @@ IsAllCpuRunning (
|
||||
**/
|
||||
BOOLEAN
|
||||
IsFirstBreakProcessor (
|
||||
IN UINT32 ProcessorIndex
|
||||
IN UINT32 ProcessorIndex
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -18,27 +18,27 @@
|
||||
**/
|
||||
UINT32
|
||||
InitializeDebugTimer (
|
||||
OUT UINT32 *TimerFrequency,
|
||||
IN BOOLEAN DumpFlag
|
||||
OUT UINT32 *TimerFrequency,
|
||||
IN BOOLEAN DumpFlag
|
||||
)
|
||||
{
|
||||
UINTN ApicTimerDivisor;
|
||||
UINT32 InitialCount;
|
||||
UINT32 ApicTimerFrequency;
|
||||
UINTN ApicTimerDivisor;
|
||||
UINT32 InitialCount;
|
||||
UINT32 ApicTimerFrequency;
|
||||
|
||||
InitializeLocalApicSoftwareEnable (TRUE);
|
||||
GetApicTimerState (&ApicTimerDivisor, NULL, NULL);
|
||||
ApicTimerFrequency = PcdGet32(PcdFSBClock) / (UINT32)ApicTimerDivisor;
|
||||
ApicTimerFrequency = PcdGet32 (PcdFSBClock) / (UINT32)ApicTimerDivisor;
|
||||
//
|
||||
// Cpu Local Apic timer interrupt frequency, it is set to 0.1s
|
||||
//
|
||||
InitialCount = (UINT32)DivU64x32 (
|
||||
MultU64x64 (
|
||||
ApicTimerFrequency,
|
||||
DEBUG_TIMER_INTERVAL
|
||||
),
|
||||
1000000u
|
||||
);
|
||||
MultU64x64 (
|
||||
ApicTimerFrequency,
|
||||
DEBUG_TIMER_INTERVAL
|
||||
),
|
||||
1000000u
|
||||
);
|
||||
|
||||
InitializeApicTimer (ApicTimerDivisor, InitialCount, TRUE, DEBUG_TIMER_VECTOR);
|
||||
//
|
||||
@@ -48,14 +48,16 @@ InitializeDebugTimer (
|
||||
DisableApicTimerInterrupt ();
|
||||
|
||||
if (DumpFlag) {
|
||||
DEBUG ((DEBUG_INFO, "Debug Timer: FSB Clock = %d\n", PcdGet32(PcdFSBClock)));
|
||||
DEBUG ((DEBUG_INFO, "Debug Timer: FSB Clock = %d\n", PcdGet32 (PcdFSBClock)));
|
||||
DEBUG ((DEBUG_INFO, "Debug Timer: Divisor = %d\n", ApicTimerDivisor));
|
||||
DEBUG ((DEBUG_INFO, "Debug Timer: Frequency = %d\n", ApicTimerFrequency));
|
||||
DEBUG ((DEBUG_INFO, "Debug Timer: InitialCount = %d\n", InitialCount));
|
||||
}
|
||||
|
||||
if (TimerFrequency != NULL) {
|
||||
*TimerFrequency = ApicTimerFrequency;
|
||||
}
|
||||
|
||||
return InitialCount;
|
||||
}
|
||||
|
||||
@@ -75,10 +77,10 @@ InitializeDebugTimer (
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
SaveAndSetDebugTimerInterrupt (
|
||||
IN BOOLEAN EnableStatus
|
||||
IN BOOLEAN EnableStatus
|
||||
)
|
||||
{
|
||||
BOOLEAN OldDebugTimerInterruptState;
|
||||
BOOLEAN OldDebugTimerInterruptState;
|
||||
|
||||
OldDebugTimerInterruptState = GetApicTimerInterruptState ();
|
||||
|
||||
@@ -88,6 +90,7 @@ SaveAndSetDebugTimerInterrupt (
|
||||
} else {
|
||||
DisableApicTimerInterrupt ();
|
||||
}
|
||||
|
||||
//
|
||||
// Validate the Debug Timer interrupt state
|
||||
// This will make additional delay after Local Apic Timer interrupt state is changed.
|
||||
@@ -114,9 +117,9 @@ SaveAndSetDebugTimerInterrupt (
|
||||
**/
|
||||
BOOLEAN
|
||||
IsDebugTimerTimeout (
|
||||
IN UINT32 TimerCycle,
|
||||
IN UINT32 Timer,
|
||||
IN UINT32 TimeoutTicker
|
||||
IN UINT32 TimerCycle,
|
||||
IN UINT32 Timer,
|
||||
IN UINT32 TimeoutTicker
|
||||
)
|
||||
{
|
||||
UINT64 CurrentTimer;
|
||||
@@ -138,5 +141,5 @@ IsDebugTimerTimeout (
|
||||
Delta = TimerCycle - (CurrentTimer - Timer) + 1;
|
||||
}
|
||||
|
||||
return (BOOLEAN) (Delta >= TimeoutTicker);
|
||||
return (BOOLEAN)(Delta >= TimeoutTicker);
|
||||
}
|
||||
|
@@ -19,8 +19,8 @@
|
||||
**/
|
||||
UINT32
|
||||
InitializeDebugTimer (
|
||||
OUT UINT32 *TimerFrequency,
|
||||
IN BOOLEAN DumpFlag
|
||||
OUT UINT32 *TimerFrequency,
|
||||
IN BOOLEAN DumpFlag
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -36,10 +36,9 @@ InitializeDebugTimer (
|
||||
**/
|
||||
BOOLEAN
|
||||
IsDebugTimerTimeout (
|
||||
IN UINT32 TimerCycle,
|
||||
IN UINT32 Timer,
|
||||
IN UINT32 TimeoutTicker
|
||||
IN UINT32 TimerCycle,
|
||||
IN UINT32 Timer,
|
||||
IN UINT32 TimeoutTicker
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -17,12 +17,12 @@ InitializeDebugIdt (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
IA32_IDT_GATE_DESCRIPTOR *IdtEntry;
|
||||
UINTN InterruptHandler;
|
||||
IA32_DESCRIPTOR IdtDescriptor;
|
||||
UINTN Index;
|
||||
UINT16 CodeSegment;
|
||||
UINT32 RegEdx;
|
||||
IA32_IDT_GATE_DESCRIPTOR *IdtEntry;
|
||||
UINTN InterruptHandler;
|
||||
IA32_DESCRIPTOR IdtDescriptor;
|
||||
UINTN Index;
|
||||
UINT16 CodeSegment;
|
||||
UINT32 RegEdx;
|
||||
|
||||
AsmReadIdtr (&IdtDescriptor);
|
||||
|
||||
@@ -31,23 +31,24 @@ InitializeDebugIdt (
|
||||
//
|
||||
CodeSegment = AsmReadCs ();
|
||||
|
||||
IdtEntry = (IA32_IDT_GATE_DESCRIPTOR *) IdtDescriptor.Base;
|
||||
IdtEntry = (IA32_IDT_GATE_DESCRIPTOR *)IdtDescriptor.Base;
|
||||
|
||||
for (Index = 0; Index < 20; Index ++) {
|
||||
for (Index = 0; Index < 20; Index++) {
|
||||
if (((PcdGet32 (PcdExceptionsIgnoredByDebugger) & ~(BIT1 | BIT3)) & (1 << Index)) != 0) {
|
||||
//
|
||||
// If the exception is masked to be reserved except for INT1 and INT3, skip it
|
||||
//
|
||||
continue;
|
||||
}
|
||||
InterruptHandler = (UINTN)&Exception0Handle + Index * ExceptionStubHeaderSize;
|
||||
|
||||
InterruptHandler = (UINTN)&Exception0Handle + Index * ExceptionStubHeaderSize;
|
||||
IdtEntry[Index].Bits.OffsetLow = (UINT16)(UINTN)InterruptHandler;
|
||||
IdtEntry[Index].Bits.OffsetHigh = (UINT16)((UINTN)InterruptHandler >> 16);
|
||||
IdtEntry[Index].Bits.Selector = CodeSegment;
|
||||
IdtEntry[Index].Bits.GateType = IA32_IDT_GATE_TYPE_INTERRUPT_32;
|
||||
}
|
||||
|
||||
InterruptHandler = (UINTN) &TimerInterruptHandle;
|
||||
InterruptHandler = (UINTN)&TimerInterruptHandle;
|
||||
IdtEntry[DEBUG_TIMER_VECTOR].Bits.OffsetLow = (UINT16)(UINTN)InterruptHandler;
|
||||
IdtEntry[DEBUG_TIMER_VECTOR].Bits.OffsetHigh = (UINT16)((UINTN)InterruptHandler >> 16);
|
||||
IdtEntry[DEBUG_TIMER_VECTOR].Bits.Selector = CodeSegment;
|
||||
@@ -73,16 +74,16 @@ InitializeDebugIdt (
|
||||
**/
|
||||
VOID *
|
||||
GetExceptionHandlerInIdtEntry (
|
||||
IN UINTN ExceptionNum
|
||||
IN UINTN ExceptionNum
|
||||
)
|
||||
{
|
||||
IA32_IDT_GATE_DESCRIPTOR *IdtEntry;
|
||||
IA32_DESCRIPTOR IdtDescriptor;
|
||||
IA32_IDT_GATE_DESCRIPTOR *IdtEntry;
|
||||
IA32_DESCRIPTOR IdtDescriptor;
|
||||
|
||||
AsmReadIdtr (&IdtDescriptor);
|
||||
IdtEntry = (IA32_IDT_GATE_DESCRIPTOR *) IdtDescriptor.Base;
|
||||
IdtEntry = (IA32_IDT_GATE_DESCRIPTOR *)IdtDescriptor.Base;
|
||||
|
||||
return (VOID *) (((UINTN)IdtEntry[ExceptionNum].Bits.OffsetLow) |
|
||||
return (VOID *)(((UINTN)IdtEntry[ExceptionNum].Bits.OffsetLow) |
|
||||
(((UINTN)IdtEntry[ExceptionNum].Bits.OffsetHigh) << 16));
|
||||
}
|
||||
|
||||
@@ -95,16 +96,16 @@ GetExceptionHandlerInIdtEntry (
|
||||
**/
|
||||
VOID
|
||||
SetExceptionHandlerInIdtEntry (
|
||||
IN UINTN ExceptionNum,
|
||||
IN VOID *ExceptionHandler
|
||||
IN UINTN ExceptionNum,
|
||||
IN VOID *ExceptionHandler
|
||||
)
|
||||
{
|
||||
IA32_IDT_GATE_DESCRIPTOR *IdtEntry;
|
||||
IA32_DESCRIPTOR IdtDescriptor;
|
||||
IA32_IDT_GATE_DESCRIPTOR *IdtEntry;
|
||||
IA32_DESCRIPTOR IdtDescriptor;
|
||||
|
||||
AsmReadIdtr (&IdtDescriptor);
|
||||
IdtEntry = (IA32_IDT_GATE_DESCRIPTOR *) IdtDescriptor.Base;
|
||||
IdtEntry = (IA32_IDT_GATE_DESCRIPTOR *)IdtDescriptor.Base;
|
||||
|
||||
IdtEntry[ExceptionNum].Bits.OffsetLow = (UINT16)(UINTN)ExceptionHandler;
|
||||
IdtEntry[ExceptionNum].Bits.OffsetHigh = (UINT16)((UINTN)ExceptionHandler >> 16);
|
||||
IdtEntry[ExceptionNum].Bits.OffsetLow = (UINT16)(UINTN)ExceptionHandler;
|
||||
IdtEntry[ExceptionNum].Bits.OffsetHigh = (UINT16)((UINTN)ExceptionHandler >> 16);
|
||||
}
|
||||
|
@@ -12,10 +12,10 @@
|
||||
#include "ProcessorContext.h"
|
||||
#include "TransferProtocol.h"
|
||||
|
||||
#define DEBUG_SW_BREAKPOINT_SYMBOL 0xcc
|
||||
#define DEBUG_ARCH_SYMBOL DEBUG_DATA_BREAK_CPU_ARCH_IA32
|
||||
#define DEBUG_SW_BREAKPOINT_SYMBOL 0xcc
|
||||
#define DEBUG_ARCH_SYMBOL DEBUG_DATA_BREAK_CPU_ARCH_IA32
|
||||
|
||||
typedef DEBUG_DATA_IA32_FX_SAVE_STATE DEBUG_DATA_FX_SAVE_STATE;
|
||||
typedef DEBUG_DATA_IA32_SYSTEM_CONTEXT DEBUG_CPU_CONTEXT;
|
||||
typedef DEBUG_DATA_IA32_FX_SAVE_STATE DEBUG_DATA_FX_SAVE_STATE;
|
||||
typedef DEBUG_DATA_IA32_SYSTEM_CONTEXT DEBUG_CPU_CONTEXT;
|
||||
|
||||
#endif
|
||||
|
@@ -9,22 +9,22 @@
|
||||
#ifndef _DEBUG_EXCEPTION_H_
|
||||
#define _DEBUG_EXCEPTION_H_
|
||||
|
||||
#define DEBUG_EXCEPT_DIVIDE_ERROR 0
|
||||
#define DEBUG_EXCEPT_DEBUG 1
|
||||
#define DEBUG_EXCEPT_NMI 2
|
||||
#define DEBUG_EXCEPT_BREAKPOINT 3
|
||||
#define DEBUG_EXCEPT_OVERFLOW 4
|
||||
#define DEBUG_EXCEPT_BOUND 5
|
||||
#define DEBUG_EXCEPT_INVALID_OPCODE 6
|
||||
#define DEBUG_EXCEPT_DOUBLE_FAULT 8
|
||||
#define DEBUG_EXCEPT_INVALID_TSS 10
|
||||
#define DEBUG_EXCEPT_SEG_NOT_PRESENT 11
|
||||
#define DEBUG_EXCEPT_STACK_FAULT 12
|
||||
#define DEBUG_EXCEPT_GP_FAULT 13
|
||||
#define DEBUG_EXCEPT_PAGE_FAULT 14
|
||||
#define DEBUG_EXCEPT_FP_ERROR 16
|
||||
#define DEBUG_EXCEPT_ALIGNMENT_CHECK 17
|
||||
#define DEBUG_EXCEPT_MACHINE_CHECK 18
|
||||
#define DEBUG_EXCEPT_SIMD 19
|
||||
#define DEBUG_EXCEPT_DIVIDE_ERROR 0
|
||||
#define DEBUG_EXCEPT_DEBUG 1
|
||||
#define DEBUG_EXCEPT_NMI 2
|
||||
#define DEBUG_EXCEPT_BREAKPOINT 3
|
||||
#define DEBUG_EXCEPT_OVERFLOW 4
|
||||
#define DEBUG_EXCEPT_BOUND 5
|
||||
#define DEBUG_EXCEPT_INVALID_OPCODE 6
|
||||
#define DEBUG_EXCEPT_DOUBLE_FAULT 8
|
||||
#define DEBUG_EXCEPT_INVALID_TSS 10
|
||||
#define DEBUG_EXCEPT_SEG_NOT_PRESENT 11
|
||||
#define DEBUG_EXCEPT_STACK_FAULT 12
|
||||
#define DEBUG_EXCEPT_GP_FAULT 13
|
||||
#define DEBUG_EXCEPT_PAGE_FAULT 14
|
||||
#define DEBUG_EXCEPT_FP_ERROR 16
|
||||
#define DEBUG_EXCEPT_ALIGNMENT_CHECK 17
|
||||
#define DEBUG_EXCEPT_MACHINE_CHECK 18
|
||||
#define DEBUG_EXCEPT_SIMD 19
|
||||
|
||||
#endif
|
||||
|
@@ -17,12 +17,12 @@ InitializeDebugIdt (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
IA32_IDT_GATE_DESCRIPTOR *IdtEntry;
|
||||
UINTN InterruptHandler;
|
||||
IA32_DESCRIPTOR IdtDescriptor;
|
||||
UINTN Index;
|
||||
UINT16 CodeSegment;
|
||||
UINT32 RegEdx;
|
||||
IA32_IDT_GATE_DESCRIPTOR *IdtEntry;
|
||||
UINTN InterruptHandler;
|
||||
IA32_DESCRIPTOR IdtDescriptor;
|
||||
UINTN Index;
|
||||
UINT16 CodeSegment;
|
||||
UINT32 RegEdx;
|
||||
|
||||
AsmReadIdtr (&IdtDescriptor);
|
||||
|
||||
@@ -31,29 +31,30 @@ InitializeDebugIdt (
|
||||
//
|
||||
CodeSegment = AsmReadCs ();
|
||||
|
||||
IdtEntry = (IA32_IDT_GATE_DESCRIPTOR *) IdtDescriptor.Base;
|
||||
IdtEntry = (IA32_IDT_GATE_DESCRIPTOR *)IdtDescriptor.Base;
|
||||
|
||||
for (Index = 0; Index < 20; Index ++) {
|
||||
for (Index = 0; Index < 20; Index++) {
|
||||
if (((PcdGet32 (PcdExceptionsIgnoredByDebugger) & ~(BIT1 | BIT3)) & (1 << Index)) != 0) {
|
||||
//
|
||||
// If the exception is masked to be reserved except for INT1 and INT3, skip it
|
||||
//
|
||||
continue;
|
||||
}
|
||||
InterruptHandler = (UINTN)&Exception0Handle + Index * ExceptionStubHeaderSize;
|
||||
IdtEntry[Index].Bits.OffsetLow = (UINT16)(UINTN)InterruptHandler;
|
||||
IdtEntry[Index].Bits.OffsetHigh = (UINT16)((UINTN)InterruptHandler >> 16);
|
||||
IdtEntry[Index].Bits.OffsetUpper = (UINT32)((UINTN)InterruptHandler >> 32);
|
||||
IdtEntry[Index].Bits.Selector = CodeSegment;
|
||||
IdtEntry[Index].Bits.GateType = IA32_IDT_GATE_TYPE_INTERRUPT_32;
|
||||
|
||||
InterruptHandler = (UINTN)&Exception0Handle + Index * ExceptionStubHeaderSize;
|
||||
IdtEntry[Index].Bits.OffsetLow = (UINT16)(UINTN)InterruptHandler;
|
||||
IdtEntry[Index].Bits.OffsetHigh = (UINT16)((UINTN)InterruptHandler >> 16);
|
||||
IdtEntry[Index].Bits.OffsetUpper = (UINT32)((UINTN)InterruptHandler >> 32);
|
||||
IdtEntry[Index].Bits.Selector = CodeSegment;
|
||||
IdtEntry[Index].Bits.GateType = IA32_IDT_GATE_TYPE_INTERRUPT_32;
|
||||
}
|
||||
|
||||
InterruptHandler = (UINTN) &TimerInterruptHandle;
|
||||
IdtEntry[DEBUG_TIMER_VECTOR].Bits.OffsetLow = (UINT16)(UINTN)InterruptHandler;
|
||||
IdtEntry[DEBUG_TIMER_VECTOR].Bits.OffsetHigh = (UINT16)((UINTN)InterruptHandler >> 16);
|
||||
IdtEntry[DEBUG_TIMER_VECTOR].Bits.OffsetUpper = (UINT32)((UINTN)InterruptHandler >> 32);
|
||||
IdtEntry[DEBUG_TIMER_VECTOR].Bits.Selector = CodeSegment;
|
||||
IdtEntry[DEBUG_TIMER_VECTOR].Bits.GateType = IA32_IDT_GATE_TYPE_INTERRUPT_32;
|
||||
InterruptHandler = (UINTN)&TimerInterruptHandle;
|
||||
IdtEntry[DEBUG_TIMER_VECTOR].Bits.OffsetLow = (UINT16)(UINTN)InterruptHandler;
|
||||
IdtEntry[DEBUG_TIMER_VECTOR].Bits.OffsetHigh = (UINT16)((UINTN)InterruptHandler >> 16);
|
||||
IdtEntry[DEBUG_TIMER_VECTOR].Bits.OffsetUpper = (UINT32)((UINTN)InterruptHandler >> 32);
|
||||
IdtEntry[DEBUG_TIMER_VECTOR].Bits.Selector = CodeSegment;
|
||||
IdtEntry[DEBUG_TIMER_VECTOR].Bits.GateType = IA32_IDT_GATE_TYPE_INTERRUPT_32;
|
||||
|
||||
//
|
||||
// If the CPU supports Debug Extensions(CPUID:01 EDX:BIT2), then
|
||||
@@ -75,16 +76,16 @@ InitializeDebugIdt (
|
||||
**/
|
||||
VOID *
|
||||
GetExceptionHandlerInIdtEntry (
|
||||
IN UINTN ExceptionNum
|
||||
IN UINTN ExceptionNum
|
||||
)
|
||||
{
|
||||
IA32_IDT_GATE_DESCRIPTOR *IdtEntry;
|
||||
IA32_DESCRIPTOR IdtDescriptor;
|
||||
IA32_IDT_GATE_DESCRIPTOR *IdtEntry;
|
||||
IA32_DESCRIPTOR IdtDescriptor;
|
||||
|
||||
AsmReadIdtr (&IdtDescriptor);
|
||||
IdtEntry = (IA32_IDT_GATE_DESCRIPTOR *) IdtDescriptor.Base;
|
||||
IdtEntry = (IA32_IDT_GATE_DESCRIPTOR *)IdtDescriptor.Base;
|
||||
|
||||
return (VOID *) (IdtEntry[ExceptionNum].Bits.OffsetLow |
|
||||
return (VOID *)(IdtEntry[ExceptionNum].Bits.OffsetLow |
|
||||
(((UINTN)IdtEntry[ExceptionNum].Bits.OffsetHigh) << 16) |
|
||||
(((UINTN)IdtEntry[ExceptionNum].Bits.OffsetUpper) << 32));
|
||||
}
|
||||
@@ -98,15 +99,15 @@ GetExceptionHandlerInIdtEntry (
|
||||
**/
|
||||
VOID
|
||||
SetExceptionHandlerInIdtEntry (
|
||||
IN UINTN ExceptionNum,
|
||||
IN VOID *ExceptionHandler
|
||||
IN UINTN ExceptionNum,
|
||||
IN VOID *ExceptionHandler
|
||||
)
|
||||
{
|
||||
IA32_IDT_GATE_DESCRIPTOR *IdtEntry;
|
||||
IA32_DESCRIPTOR IdtDescriptor;
|
||||
IA32_IDT_GATE_DESCRIPTOR *IdtEntry;
|
||||
IA32_DESCRIPTOR IdtDescriptor;
|
||||
|
||||
AsmReadIdtr (&IdtDescriptor);
|
||||
IdtEntry = (IA32_IDT_GATE_DESCRIPTOR *) IdtDescriptor.Base;
|
||||
IdtEntry = (IA32_IDT_GATE_DESCRIPTOR *)IdtDescriptor.Base;
|
||||
|
||||
IdtEntry[ExceptionNum].Bits.OffsetLow = (UINT16)(UINTN)ExceptionHandler;
|
||||
IdtEntry[ExceptionNum].Bits.OffsetHigh = (UINT16)((UINTN)ExceptionHandler >> 16);
|
||||
|
@@ -12,10 +12,10 @@
|
||||
#include "ProcessorContext.h"
|
||||
#include "TransferProtocol.h"
|
||||
|
||||
#define DEBUG_SW_BREAKPOINT_SYMBOL 0xcc
|
||||
#define DEBUG_ARCH_SYMBOL DEBUG_DATA_BREAK_CPU_ARCH_X64
|
||||
#define DEBUG_SW_BREAKPOINT_SYMBOL 0xcc
|
||||
#define DEBUG_ARCH_SYMBOL DEBUG_DATA_BREAK_CPU_ARCH_X64
|
||||
|
||||
typedef DEBUG_DATA_X64_FX_SAVE_STATE DEBUG_DATA_FX_SAVE_STATE;
|
||||
typedef DEBUG_DATA_X64_SYSTEM_CONTEXT DEBUG_CPU_CONTEXT;
|
||||
typedef DEBUG_DATA_X64_FX_SAVE_STATE DEBUG_DATA_FX_SAVE_STATE;
|
||||
typedef DEBUG_DATA_X64_SYSTEM_CONTEXT DEBUG_CPU_CONTEXT;
|
||||
|
||||
#endif
|
||||
|
@@ -9,22 +9,22 @@
|
||||
#ifndef _DEBUG_EXCEPTION_H_
|
||||
#define _DEBUG_EXCEPTION_H_
|
||||
|
||||
#define DEBUG_EXCEPT_DIVIDE_ERROR 0
|
||||
#define DEBUG_EXCEPT_DEBUG 1
|
||||
#define DEBUG_EXCEPT_NMI 2
|
||||
#define DEBUG_EXCEPT_BREAKPOINT 3
|
||||
#define DEBUG_EXCEPT_OVERFLOW 4
|
||||
#define DEBUG_EXCEPT_BOUND 5
|
||||
#define DEBUG_EXCEPT_INVALID_OPCODE 6
|
||||
#define DEBUG_EXCEPT_DOUBLE_FAULT 8
|
||||
#define DEBUG_EXCEPT_INVALID_TSS 10
|
||||
#define DEBUG_EXCEPT_SEG_NOT_PRESENT 11
|
||||
#define DEBUG_EXCEPT_STACK_FAULT 12
|
||||
#define DEBUG_EXCEPT_GP_FAULT 13
|
||||
#define DEBUG_EXCEPT_PAGE_FAULT 14
|
||||
#define DEBUG_EXCEPT_FP_ERROR 16
|
||||
#define DEBUG_EXCEPT_ALIGNMENT_CHECK 17
|
||||
#define DEBUG_EXCEPT_MACHINE_CHECK 18
|
||||
#define DEBUG_EXCEPT_SIMD 19
|
||||
#define DEBUG_EXCEPT_DIVIDE_ERROR 0
|
||||
#define DEBUG_EXCEPT_DEBUG 1
|
||||
#define DEBUG_EXCEPT_NMI 2
|
||||
#define DEBUG_EXCEPT_BREAKPOINT 3
|
||||
#define DEBUG_EXCEPT_OVERFLOW 4
|
||||
#define DEBUG_EXCEPT_BOUND 5
|
||||
#define DEBUG_EXCEPT_INVALID_OPCODE 6
|
||||
#define DEBUG_EXCEPT_DOUBLE_FAULT 8
|
||||
#define DEBUG_EXCEPT_INVALID_TSS 10
|
||||
#define DEBUG_EXCEPT_SEG_NOT_PRESENT 11
|
||||
#define DEBUG_EXCEPT_STACK_FAULT 12
|
||||
#define DEBUG_EXCEPT_GP_FAULT 13
|
||||
#define DEBUG_EXCEPT_PAGE_FAULT 14
|
||||
#define DEBUG_EXCEPT_FP_ERROR 16
|
||||
#define DEBUG_EXCEPT_ALIGNMENT_CHECK 17
|
||||
#define DEBUG_EXCEPT_MACHINE_CHECK 18
|
||||
#define DEBUG_EXCEPT_SIMD 19
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user