diff options
| author | kx <kx@radix.pro> | 2024-06-04 06:43:08 +0300 |
|---|---|---|
| committer | kx <kx@radix.pro> | 2024-06-04 06:43:08 +0300 |
| commit | 7e2ccccace24636f29ddc210b94606abd4c7e42b (patch) | |
| tree | 545d43ea12671048956cafeb12303e84d601e571 /SourceLevelDebugPkg/Include | |
| parent | 27b044605cd5f6b33a3d231576003850b3fe305b (diff) | |
| download | edk2-trunk.tar.xz | |
Renormalized end-of-lines from master@27b044605cd5f6b33a3d231576003850b3fe305btrunk
Diffstat (limited to 'SourceLevelDebugPkg/Include')
| -rw-r--r-- | SourceLevelDebugPkg/Include/Guid/DebugAgentGuid.h | 52 | ||||
| -rw-r--r-- | SourceLevelDebugPkg/Include/Ia32/ProcessorContext.h | 606 | ||||
| -rw-r--r-- | SourceLevelDebugPkg/Include/ImageDebugSupport.h | 42 | ||||
| -rw-r--r-- | SourceLevelDebugPkg/Include/Library/DebugCommunicationLib.h | 286 | ||||
| -rw-r--r-- | SourceLevelDebugPkg/Include/TransferProtocol.h | 738 |
5 files changed, 862 insertions, 862 deletions
diff --git a/SourceLevelDebugPkg/Include/Guid/DebugAgentGuid.h b/SourceLevelDebugPkg/Include/Guid/DebugAgentGuid.h index 3fb53b70e5..179cdbc56e 100644 --- a/SourceLevelDebugPkg/Include/Guid/DebugAgentGuid.h +++ b/SourceLevelDebugPkg/Include/Guid/DebugAgentGuid.h @@ -1,26 +1,26 @@ -/** @file
- This file defines the debug agent GUID for HOB and configuration table.
-
- Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __EFI_DEBUG_AGENT_GUID_H__
-#define __EFI_DEBUG_AGENT_GUID_H__
-
-///
-/// This guid is used as a variable GUID for the capsule variable
-/// if the capsule pointer is passed through reset via a variable.
-///
-/// This guid is also used as a hob GUID for the capsule data
-/// when the capsule pointer is passed from PEI phase to DXE phase.
-///
-#define EFI_DEBUG_AGENT_GUID \
- { \
- 0x865a5a9b, 0xb85d, 0x474c, { 0x84, 0x55, 0x65, 0xd1, 0xbe, 0x84, 0x4b, 0xe2 } \
- }
-
-extern EFI_GUID gEfiDebugAgentGuid;
-
-#endif
+/** @file + This file defines the debug agent GUID for HOB and configuration table. + + Copyright (c) 2010, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __EFI_DEBUG_AGENT_GUID_H__ +#define __EFI_DEBUG_AGENT_GUID_H__ + +/// +/// This guid is used as a variable GUID for the capsule variable +/// if the capsule pointer is passed through reset via a variable. +/// +/// This guid is also used as a hob GUID for the capsule data +/// when the capsule pointer is passed from PEI phase to DXE phase. +/// +#define EFI_DEBUG_AGENT_GUID \ + { \ + 0x865a5a9b, 0xb85d, 0x474c, { 0x84, 0x55, 0x65, 0xd1, 0xbe, 0x84, 0x4b, 0xe2 } \ + } + +extern EFI_GUID gEfiDebugAgentGuid; + +#endif diff --git a/SourceLevelDebugPkg/Include/Ia32/ProcessorContext.h b/SourceLevelDebugPkg/Include/Ia32/ProcessorContext.h index 5989478b42..c7cfeab043 100644 --- a/SourceLevelDebugPkg/Include/Ia32/ProcessorContext.h +++ b/SourceLevelDebugPkg/Include/Ia32/ProcessorContext.h @@ -1,303 +1,303 @@ -/** @file
- IA32/x64 architecture specific definitions needed by debug transfer protocol.It is only
- intended to be used by Debug related module implementation.
-
- Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __PROCESSOR_CONTEXT_H__
-#define __PROCESSOR_CONTEXT_H__
-
-//
-// IA-32/x64 processor register index table
-//
-#define SOFT_DEBUGGER_REGISTER_DR0 0x00
-#define SOFT_DEBUGGER_REGISTER_DR1 0x01
-#define SOFT_DEBUGGER_REGISTER_DR2 0x02
-#define SOFT_DEBUGGER_REGISTER_DR3 0x03
-#define SOFT_DEBUGGER_REGISTER_DR6 0x04
-#define SOFT_DEBUGGER_REGISTER_DR7 0x05
-#define SOFT_DEBUGGER_REGISTER_EFLAGS 0x06
-#define SOFT_DEBUGGER_REGISTER_LDTR 0x07
-#define SOFT_DEBUGGER_REGISTER_TR 0x08
-#define SOFT_DEBUGGER_REGISTER_GDTR0 0x09 // the low 32bit of GDTR
-#define SOFT_DEBUGGER_REGISTER_GDTR1 0x0A // the high 32bit of GDTR
-#define SOFT_DEBUGGER_REGISTER_IDTR0 0x0B // the low 32bit of IDTR
-#define SOFT_DEBUGGER_REGISTER_IDTR1 0x0C // the high 32bot of IDTR
-#define SOFT_DEBUGGER_REGISTER_EIP 0x0D
-#define SOFT_DEBUGGER_REGISTER_GS 0x0E
-#define SOFT_DEBUGGER_REGISTER_FS 0x0F
-#define SOFT_DEBUGGER_REGISTER_ES 0x10
-#define SOFT_DEBUGGER_REGISTER_DS 0x11
-#define SOFT_DEBUGGER_REGISTER_CS 0x12
-#define SOFT_DEBUGGER_REGISTER_SS 0x13
-#define SOFT_DEBUGGER_REGISTER_CR0 0x14
-#define SOFT_DEBUGGER_REGISTER_CR1 0x15
-#define SOFT_DEBUGGER_REGISTER_CR2 0x16
-#define SOFT_DEBUGGER_REGISTER_CR3 0x17
-#define SOFT_DEBUGGER_REGISTER_CR4 0x18
-
-#define SOFT_DEBUGGER_REGISTER_DI 0x19
-#define SOFT_DEBUGGER_REGISTER_SI 0x1A
-#define SOFT_DEBUGGER_REGISTER_BP 0x1B
-#define SOFT_DEBUGGER_REGISTER_SP 0x1C
-#define SOFT_DEBUGGER_REGISTER_DX 0x1D
-#define SOFT_DEBUGGER_REGISTER_CX 0x1E
-#define SOFT_DEBUGGER_REGISTER_BX 0x1F
-#define SOFT_DEBUGGER_REGISTER_AX 0x20
-
-//
-// This below registers are only available for x64 (not valid for Ia32 mode)
-//
-#define SOFT_DEBUGGER_REGISTER_CR8 0x21
-#define SOFT_DEBUGGER_REGISTER_R8 0x22
-#define SOFT_DEBUGGER_REGISTER_R9 0x23
-#define SOFT_DEBUGGER_REGISTER_R10 0x24
-#define SOFT_DEBUGGER_REGISTER_R11 0x25
-#define SOFT_DEBUGGER_REGISTER_R12 0x26
-#define SOFT_DEBUGGER_REGISTER_R13 0x27
-#define SOFT_DEBUGGER_REGISTER_R14 0x28
-#define SOFT_DEBUGGER_REGISTER_R15 0x29
-
-//
-// This below registers are FP / MMX / XMM registers
-//
-#define SOFT_DEBUGGER_REGISTER_FP_BASE 0x30
-
-#define SOFT_DEBUGGER_REGISTER_FP_FCW (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x00)
-#define SOFT_DEBUGGER_REGISTER_FP_FSW (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x01)
-#define SOFT_DEBUGGER_REGISTER_FP_FTW (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x02)
-#define SOFT_DEBUGGER_REGISTER_FP_OPCODE (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x03)
-#define SOFT_DEBUGGER_REGISTER_FP_EIP (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x04)
-#define SOFT_DEBUGGER_REGISTER_FP_CS (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x05)
-#define SOFT_DEBUGGER_REGISTER_FP_DATAOFFSET (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x06)
-#define SOFT_DEBUGGER_REGISTER_FP_DS (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x07)
-#define SOFT_DEBUGGER_REGISTER_FP_MXCSR (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x08)
-#define SOFT_DEBUGGER_REGISTER_FP_MXCSR_MASK (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x09)
-#define SOFT_DEBUGGER_REGISTER_ST0 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x0A)
-#define SOFT_DEBUGGER_REGISTER_ST1 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x0B)
-#define SOFT_DEBUGGER_REGISTER_ST2 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x0C)
-#define SOFT_DEBUGGER_REGISTER_ST3 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x0D)
-#define SOFT_DEBUGGER_REGISTER_ST4 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x0E)
-#define SOFT_DEBUGGER_REGISTER_ST5 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x0F)
-#define SOFT_DEBUGGER_REGISTER_ST6 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x10)
-#define SOFT_DEBUGGER_REGISTER_ST7 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x11)
-#define SOFT_DEBUGGER_REGISTER_XMM0 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x12)
-#define SOFT_DEBUGGER_REGISTER_XMM1 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x13)
-#define SOFT_DEBUGGER_REGISTER_XMM2 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x14)
-#define SOFT_DEBUGGER_REGISTER_XMM3 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x15)
-#define SOFT_DEBUGGER_REGISTER_XMM4 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x16)
-#define SOFT_DEBUGGER_REGISTER_XMM5 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x17)
-#define SOFT_DEBUGGER_REGISTER_XMM6 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x18)
-#define SOFT_DEBUGGER_REGISTER_XMM7 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x19)
-#define SOFT_DEBUGGER_REGISTER_XMM8 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x1A)
-#define SOFT_DEBUGGER_REGISTER_XMM9 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x1B)
-#define SOFT_DEBUGGER_REGISTER_XMM10 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x1C)
-#define SOFT_DEBUGGER_REGISTER_XMM11 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x1D)
-#define SOFT_DEBUGGER_REGISTER_XMM12 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x1E)
-#define SOFT_DEBUGGER_REGISTER_XMM13 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x1F)
-#define SOFT_DEBUGGER_REGISTER_XMM14 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x20)
-#define SOFT_DEBUGGER_REGISTER_XMM15 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x21)
-#define SOFT_DEBUGGER_REGISTER_MM0 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x22)
-#define SOFT_DEBUGGER_REGISTER_MM1 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x23)
-#define SOFT_DEBUGGER_REGISTER_MM2 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x24)
-#define SOFT_DEBUGGER_REGISTER_MM3 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x25)
-#define SOFT_DEBUGGER_REGISTER_MM4 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x26)
-#define SOFT_DEBUGGER_REGISTER_MM5 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x27)
-#define SOFT_DEBUGGER_REGISTER_MM6 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x28)
-#define SOFT_DEBUGGER_REGISTER_MM7 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x29)
-
-#define SOFT_DEBUGGER_REGISTER_MAX SOFT_DEBUGGER_REGISTER_MM7
-
-#define SOFT_DEBUGGER_MSR_EFER (0xC0000080)
-
-#pragma pack(1)
-
-///
-/// FXSAVE_STATE
-/// FP / MMX / XMM registers (see fxrstor instruction definition)
-///
-typedef struct {
- UINT16 Fcw;
- UINT16 Fsw;
- UINT16 Ftw;
- UINT16 Opcode;
- UINT32 Eip;
- UINT16 Cs;
- UINT16 Reserved1;
- UINT32 DataOffset;
- UINT16 Ds;
- UINT8 Reserved2[2];
- UINT32 Mxcsr;
- UINT32 Mxcsr_Mask;
- UINT8 St0Mm0[10];
- UINT8 Reserved3[6];
- UINT8 St1Mm1[10];
- UINT8 Reserved4[6];
- UINT8 St2Mm2[10];
- UINT8 Reserved5[6];
- UINT8 St3Mm3[10];
- UINT8 Reserved6[6];
- UINT8 St4Mm4[10];
- UINT8 Reserved7[6];
- UINT8 St5Mm5[10];
- UINT8 Reserved8[6];
- UINT8 St6Mm6[10];
- UINT8 Reserved9[6];
- UINT8 St7Mm7[10];
- UINT8 Reserved10[6];
- UINT8 Xmm0[16];
- UINT8 Xmm1[16];
- UINT8 Xmm2[16];
- UINT8 Xmm3[16];
- UINT8 Xmm4[16];
- UINT8 Xmm5[16];
- UINT8 Xmm6[16];
- UINT8 Xmm7[16];
- UINT8 Reserved11[14 * 16];
-} DEBUG_DATA_IA32_FX_SAVE_STATE;
-
-///
-/// IA-32 processor context definition
-///
-typedef struct {
- UINT32 ExceptionData;
- DEBUG_DATA_IA32_FX_SAVE_STATE FxSaveState;
- UINT32 Dr0;
- UINT32 Dr1;
- UINT32 Dr2;
- UINT32 Dr3;
- UINT32 Dr6;
- UINT32 Dr7;
- UINT32 Eflags;
- UINT32 Ldtr;
- UINT32 Tr;
- UINT32 Gdtr[2];
- UINT32 Idtr[2];
- UINT32 Eip;
- UINT32 Gs;
- UINT32 Fs;
- UINT32 Es;
- UINT32 Ds;
- UINT32 Cs;
- UINT32 Ss;
- UINT32 Cr0;
- UINT32 Cr1; ///< Reserved
- UINT32 Cr2;
- UINT32 Cr3;
- UINT32 Cr4;
- UINT32 Edi;
- UINT32 Esi;
- UINT32 Ebp;
- UINT32 Esp;
- UINT32 Edx;
- UINT32 Ecx;
- UINT32 Ebx;
- UINT32 Eax;
-} DEBUG_DATA_IA32_SYSTEM_CONTEXT;
-
-///
-/// FXSAVE_STATE
-/// FP / MMX / XMM registers (see fxrstor instruction definition)
-///
-typedef struct {
- UINT16 Fcw;
- UINT16 Fsw;
- UINT16 Ftw;
- UINT16 Opcode;
- UINT32 Eip;
- UINT16 Cs;
- UINT16 Reserved1;
- UINT32 DataOffset;
- UINT16 Ds;
- UINT8 Reserved2[2];
- UINT32 Mxcsr;
- UINT32 Mxcsr_Mask;
- UINT8 St0Mm0[10];
- UINT8 Reserved3[6];
- UINT8 St1Mm1[10];
- UINT8 Reserved4[6];
- UINT8 St2Mm2[10];
- UINT8 Reserved5[6];
- UINT8 St3Mm3[10];
- UINT8 Reserved6[6];
- UINT8 St4Mm4[10];
- UINT8 Reserved7[6];
- UINT8 St5Mm5[10];
- UINT8 Reserved8[6];
- UINT8 St6Mm6[10];
- UINT8 Reserved9[6];
- UINT8 St7Mm7[10];
- UINT8 Reserved10[6];
- UINT8 Xmm0[16];
- UINT8 Xmm1[16];
- UINT8 Xmm2[16];
- UINT8 Xmm3[16];
- UINT8 Xmm4[16];
- UINT8 Xmm5[16];
- UINT8 Xmm6[16];
- UINT8 Xmm7[16];
- UINT8 Xmm8[16];
- UINT8 Xmm9[16];
- UINT8 Xmm10[16];
- UINT8 Xmm11[16];
- UINT8 Xmm12[16];
- UINT8 Xmm13[16];
- UINT8 Xmm14[16];
- UINT8 Xmm15[16];
- UINT8 Reserved11[6 * 16];
-} DEBUG_DATA_X64_FX_SAVE_STATE;
-
-///
-/// x64 processor context definition
-///
-typedef struct {
- UINT64 ExceptionData;
- DEBUG_DATA_X64_FX_SAVE_STATE FxSaveState;
- UINT64 Dr0;
- UINT64 Dr1;
- UINT64 Dr2;
- UINT64 Dr3;
- UINT64 Dr6;
- UINT64 Dr7;
- UINT64 Eflags;
- UINT64 Ldtr;
- UINT64 Tr;
- UINT64 Gdtr[2];
- UINT64 Idtr[2];
- UINT64 Eip;
- UINT64 Gs;
- UINT64 Fs;
- UINT64 Es;
- UINT64 Ds;
- UINT64 Cs;
- UINT64 Ss;
- UINT64 Cr0;
- UINT64 Cr1; ///< Reserved
- UINT64 Cr2;
- UINT64 Cr3;
- UINT64 Cr4;
- UINT64 Rdi;
- UINT64 Rsi;
- UINT64 Rbp;
- UINT64 Rsp;
- UINT64 Rdx;
- UINT64 Rcx;
- UINT64 Rbx;
- UINT64 Rax;
- UINT64 Cr8;
- UINT64 R8;
- UINT64 R9;
- UINT64 R10;
- UINT64 R11;
- UINT64 R12;
- UINT64 R13;
- UINT64 R14;
- UINT64 R15;
-} DEBUG_DATA_X64_SYSTEM_CONTEXT;
-
-#pragma pack()
-
-#endif
+/** @file + IA32/x64 architecture specific definitions needed by debug transfer protocol.It is only + intended to be used by Debug related module implementation. + + Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __PROCESSOR_CONTEXT_H__ +#define __PROCESSOR_CONTEXT_H__ + +// +// IA-32/x64 processor register index table +// +#define SOFT_DEBUGGER_REGISTER_DR0 0x00 +#define SOFT_DEBUGGER_REGISTER_DR1 0x01 +#define SOFT_DEBUGGER_REGISTER_DR2 0x02 +#define SOFT_DEBUGGER_REGISTER_DR3 0x03 +#define SOFT_DEBUGGER_REGISTER_DR6 0x04 +#define SOFT_DEBUGGER_REGISTER_DR7 0x05 +#define SOFT_DEBUGGER_REGISTER_EFLAGS 0x06 +#define SOFT_DEBUGGER_REGISTER_LDTR 0x07 +#define SOFT_DEBUGGER_REGISTER_TR 0x08 +#define SOFT_DEBUGGER_REGISTER_GDTR0 0x09 // the low 32bit of GDTR +#define SOFT_DEBUGGER_REGISTER_GDTR1 0x0A // the high 32bit of GDTR +#define SOFT_DEBUGGER_REGISTER_IDTR0 0x0B // the low 32bit of IDTR +#define SOFT_DEBUGGER_REGISTER_IDTR1 0x0C // the high 32bot of IDTR +#define SOFT_DEBUGGER_REGISTER_EIP 0x0D +#define SOFT_DEBUGGER_REGISTER_GS 0x0E +#define SOFT_DEBUGGER_REGISTER_FS 0x0F +#define SOFT_DEBUGGER_REGISTER_ES 0x10 +#define SOFT_DEBUGGER_REGISTER_DS 0x11 +#define SOFT_DEBUGGER_REGISTER_CS 0x12 +#define SOFT_DEBUGGER_REGISTER_SS 0x13 +#define SOFT_DEBUGGER_REGISTER_CR0 0x14 +#define SOFT_DEBUGGER_REGISTER_CR1 0x15 +#define SOFT_DEBUGGER_REGISTER_CR2 0x16 +#define SOFT_DEBUGGER_REGISTER_CR3 0x17 +#define SOFT_DEBUGGER_REGISTER_CR4 0x18 + +#define SOFT_DEBUGGER_REGISTER_DI 0x19 +#define SOFT_DEBUGGER_REGISTER_SI 0x1A +#define SOFT_DEBUGGER_REGISTER_BP 0x1B +#define SOFT_DEBUGGER_REGISTER_SP 0x1C +#define SOFT_DEBUGGER_REGISTER_DX 0x1D +#define SOFT_DEBUGGER_REGISTER_CX 0x1E +#define SOFT_DEBUGGER_REGISTER_BX 0x1F +#define SOFT_DEBUGGER_REGISTER_AX 0x20 + +// +// This below registers are only available for x64 (not valid for Ia32 mode) +// +#define SOFT_DEBUGGER_REGISTER_CR8 0x21 +#define SOFT_DEBUGGER_REGISTER_R8 0x22 +#define SOFT_DEBUGGER_REGISTER_R9 0x23 +#define SOFT_DEBUGGER_REGISTER_R10 0x24 +#define SOFT_DEBUGGER_REGISTER_R11 0x25 +#define SOFT_DEBUGGER_REGISTER_R12 0x26 +#define SOFT_DEBUGGER_REGISTER_R13 0x27 +#define SOFT_DEBUGGER_REGISTER_R14 0x28 +#define SOFT_DEBUGGER_REGISTER_R15 0x29 + +// +// This below registers are FP / MMX / XMM registers +// +#define SOFT_DEBUGGER_REGISTER_FP_BASE 0x30 + +#define SOFT_DEBUGGER_REGISTER_FP_FCW (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x00) +#define SOFT_DEBUGGER_REGISTER_FP_FSW (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x01) +#define SOFT_DEBUGGER_REGISTER_FP_FTW (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x02) +#define SOFT_DEBUGGER_REGISTER_FP_OPCODE (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x03) +#define SOFT_DEBUGGER_REGISTER_FP_EIP (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x04) +#define SOFT_DEBUGGER_REGISTER_FP_CS (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x05) +#define SOFT_DEBUGGER_REGISTER_FP_DATAOFFSET (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x06) +#define SOFT_DEBUGGER_REGISTER_FP_DS (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x07) +#define SOFT_DEBUGGER_REGISTER_FP_MXCSR (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x08) +#define SOFT_DEBUGGER_REGISTER_FP_MXCSR_MASK (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x09) +#define SOFT_DEBUGGER_REGISTER_ST0 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x0A) +#define SOFT_DEBUGGER_REGISTER_ST1 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x0B) +#define SOFT_DEBUGGER_REGISTER_ST2 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x0C) +#define SOFT_DEBUGGER_REGISTER_ST3 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x0D) +#define SOFT_DEBUGGER_REGISTER_ST4 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x0E) +#define SOFT_DEBUGGER_REGISTER_ST5 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x0F) +#define SOFT_DEBUGGER_REGISTER_ST6 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x10) +#define SOFT_DEBUGGER_REGISTER_ST7 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x11) +#define SOFT_DEBUGGER_REGISTER_XMM0 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x12) +#define SOFT_DEBUGGER_REGISTER_XMM1 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x13) +#define SOFT_DEBUGGER_REGISTER_XMM2 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x14) +#define SOFT_DEBUGGER_REGISTER_XMM3 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x15) +#define SOFT_DEBUGGER_REGISTER_XMM4 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x16) +#define SOFT_DEBUGGER_REGISTER_XMM5 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x17) +#define SOFT_DEBUGGER_REGISTER_XMM6 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x18) +#define SOFT_DEBUGGER_REGISTER_XMM7 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x19) +#define SOFT_DEBUGGER_REGISTER_XMM8 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x1A) +#define SOFT_DEBUGGER_REGISTER_XMM9 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x1B) +#define SOFT_DEBUGGER_REGISTER_XMM10 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x1C) +#define SOFT_DEBUGGER_REGISTER_XMM11 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x1D) +#define SOFT_DEBUGGER_REGISTER_XMM12 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x1E) +#define SOFT_DEBUGGER_REGISTER_XMM13 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x1F) +#define SOFT_DEBUGGER_REGISTER_XMM14 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x20) +#define SOFT_DEBUGGER_REGISTER_XMM15 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x21) +#define SOFT_DEBUGGER_REGISTER_MM0 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x22) +#define SOFT_DEBUGGER_REGISTER_MM1 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x23) +#define SOFT_DEBUGGER_REGISTER_MM2 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x24) +#define SOFT_DEBUGGER_REGISTER_MM3 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x25) +#define SOFT_DEBUGGER_REGISTER_MM4 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x26) +#define SOFT_DEBUGGER_REGISTER_MM5 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x27) +#define SOFT_DEBUGGER_REGISTER_MM6 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x28) +#define SOFT_DEBUGGER_REGISTER_MM7 (SOFT_DEBUGGER_REGISTER_FP_BASE + 0x29) + +#define SOFT_DEBUGGER_REGISTER_MAX SOFT_DEBUGGER_REGISTER_MM7 + +#define SOFT_DEBUGGER_MSR_EFER (0xC0000080) + +#pragma pack(1) + +/// +/// FXSAVE_STATE +/// FP / MMX / XMM registers (see fxrstor instruction definition) +/// +typedef struct { + UINT16 Fcw; + UINT16 Fsw; + UINT16 Ftw; + UINT16 Opcode; + UINT32 Eip; + UINT16 Cs; + UINT16 Reserved1; + UINT32 DataOffset; + UINT16 Ds; + UINT8 Reserved2[2]; + UINT32 Mxcsr; + UINT32 Mxcsr_Mask; + UINT8 St0Mm0[10]; + UINT8 Reserved3[6]; + UINT8 St1Mm1[10]; + UINT8 Reserved4[6]; + UINT8 St2Mm2[10]; + UINT8 Reserved5[6]; + UINT8 St3Mm3[10]; + UINT8 Reserved6[6]; + UINT8 St4Mm4[10]; + UINT8 Reserved7[6]; + UINT8 St5Mm5[10]; + UINT8 Reserved8[6]; + UINT8 St6Mm6[10]; + UINT8 Reserved9[6]; + UINT8 St7Mm7[10]; + UINT8 Reserved10[6]; + UINT8 Xmm0[16]; + UINT8 Xmm1[16]; + UINT8 Xmm2[16]; + UINT8 Xmm3[16]; + UINT8 Xmm4[16]; + UINT8 Xmm5[16]; + UINT8 Xmm6[16]; + UINT8 Xmm7[16]; + UINT8 Reserved11[14 * 16]; +} DEBUG_DATA_IA32_FX_SAVE_STATE; + +/// +/// IA-32 processor context definition +/// +typedef struct { + UINT32 ExceptionData; + DEBUG_DATA_IA32_FX_SAVE_STATE FxSaveState; + UINT32 Dr0; + UINT32 Dr1; + UINT32 Dr2; + UINT32 Dr3; + UINT32 Dr6; + UINT32 Dr7; + UINT32 Eflags; + UINT32 Ldtr; + UINT32 Tr; + UINT32 Gdtr[2]; + UINT32 Idtr[2]; + UINT32 Eip; + UINT32 Gs; + UINT32 Fs; + UINT32 Es; + UINT32 Ds; + UINT32 Cs; + UINT32 Ss; + UINT32 Cr0; + UINT32 Cr1; ///< Reserved + UINT32 Cr2; + UINT32 Cr3; + UINT32 Cr4; + UINT32 Edi; + UINT32 Esi; + UINT32 Ebp; + UINT32 Esp; + UINT32 Edx; + UINT32 Ecx; + UINT32 Ebx; + UINT32 Eax; +} DEBUG_DATA_IA32_SYSTEM_CONTEXT; + +/// +/// FXSAVE_STATE +/// FP / MMX / XMM registers (see fxrstor instruction definition) +/// +typedef struct { + UINT16 Fcw; + UINT16 Fsw; + UINT16 Ftw; + UINT16 Opcode; + UINT32 Eip; + UINT16 Cs; + UINT16 Reserved1; + UINT32 DataOffset; + UINT16 Ds; + UINT8 Reserved2[2]; + UINT32 Mxcsr; + UINT32 Mxcsr_Mask; + UINT8 St0Mm0[10]; + UINT8 Reserved3[6]; + UINT8 St1Mm1[10]; + UINT8 Reserved4[6]; + UINT8 St2Mm2[10]; + UINT8 Reserved5[6]; + UINT8 St3Mm3[10]; + UINT8 Reserved6[6]; + UINT8 St4Mm4[10]; + UINT8 Reserved7[6]; + UINT8 St5Mm5[10]; + UINT8 Reserved8[6]; + UINT8 St6Mm6[10]; + UINT8 Reserved9[6]; + UINT8 St7Mm7[10]; + UINT8 Reserved10[6]; + UINT8 Xmm0[16]; + UINT8 Xmm1[16]; + UINT8 Xmm2[16]; + UINT8 Xmm3[16]; + UINT8 Xmm4[16]; + UINT8 Xmm5[16]; + UINT8 Xmm6[16]; + UINT8 Xmm7[16]; + UINT8 Xmm8[16]; + UINT8 Xmm9[16]; + UINT8 Xmm10[16]; + UINT8 Xmm11[16]; + UINT8 Xmm12[16]; + UINT8 Xmm13[16]; + UINT8 Xmm14[16]; + UINT8 Xmm15[16]; + UINT8 Reserved11[6 * 16]; +} DEBUG_DATA_X64_FX_SAVE_STATE; + +/// +/// x64 processor context definition +/// +typedef struct { + UINT64 ExceptionData; + DEBUG_DATA_X64_FX_SAVE_STATE FxSaveState; + UINT64 Dr0; + UINT64 Dr1; + UINT64 Dr2; + UINT64 Dr3; + UINT64 Dr6; + UINT64 Dr7; + UINT64 Eflags; + UINT64 Ldtr; + UINT64 Tr; + UINT64 Gdtr[2]; + UINT64 Idtr[2]; + UINT64 Eip; + UINT64 Gs; + UINT64 Fs; + UINT64 Es; + UINT64 Ds; + UINT64 Cs; + UINT64 Ss; + UINT64 Cr0; + UINT64 Cr1; ///< Reserved + UINT64 Cr2; + UINT64 Cr3; + UINT64 Cr4; + UINT64 Rdi; + UINT64 Rsi; + UINT64 Rbp; + UINT64 Rsp; + UINT64 Rdx; + UINT64 Rcx; + UINT64 Rbx; + UINT64 Rax; + UINT64 Cr8; + UINT64 R8; + UINT64 R9; + UINT64 R10; + UINT64 R11; + UINT64 R12; + UINT64 R13; + UINT64 R14; + UINT64 R15; +} DEBUG_DATA_X64_SYSTEM_CONTEXT; + +#pragma pack() + +#endif diff --git a/SourceLevelDebugPkg/Include/ImageDebugSupport.h b/SourceLevelDebugPkg/Include/ImageDebugSupport.h index 0aebda7ad4..92f7312971 100644 --- a/SourceLevelDebugPkg/Include/ImageDebugSupport.h +++ b/SourceLevelDebugPkg/Include/ImageDebugSupport.h @@ -1,21 +1,21 @@ -/** @file
- Public include file for Debug Agent Library instance and PE/COFF Extra
- Action Library instance.
-
- Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __IMAGE_DEBUG_SUPPORT_H__
-#define __IMAGE_DEBUG_SUPPORT_H__
-
-#define IO_PORT_BREAKPOINT_ADDRESS 0x84
-#define IMAGE_LOAD_SIGNATURE SIGNATURE_32('L','O','A','D')
-#define IMAGE_UNLOAD_SIGNATURE SIGNATURE_32('U','N','L','O')
-#define AGENT_HANDLER_SIGNATURE SIGNATURE_32('A','G','T','H')
-
-#define DEBUG_AGENT_IMAGE_WAIT 0x00
-#define DEBUG_AGENT_IMAGE_CONTINUE 0x01
-
-#endif
+/** @file + Public include file for Debug Agent Library instance and PE/COFF Extra + Action Library instance. + + Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __IMAGE_DEBUG_SUPPORT_H__ +#define __IMAGE_DEBUG_SUPPORT_H__ + +#define IO_PORT_BREAKPOINT_ADDRESS 0x84 +#define IMAGE_LOAD_SIGNATURE SIGNATURE_32('L','O','A','D') +#define IMAGE_UNLOAD_SIGNATURE SIGNATURE_32('U','N','L','O') +#define AGENT_HANDLER_SIGNATURE SIGNATURE_32('A','G','T','H') + +#define DEBUG_AGENT_IMAGE_WAIT 0x00 +#define DEBUG_AGENT_IMAGE_CONTINUE 0x01 + +#endif diff --git a/SourceLevelDebugPkg/Include/Library/DebugCommunicationLib.h b/SourceLevelDebugPkg/Include/Library/DebugCommunicationLib.h index ebb2168632..81a0bead48 100644 --- a/SourceLevelDebugPkg/Include/Library/DebugCommunicationLib.h +++ b/SourceLevelDebugPkg/Include/Library/DebugCommunicationLib.h @@ -1,143 +1,143 @@ -/** @file
- Debug Communication Library definitions.
-
- Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __DEBUG_COMMUNICATION_LIB_H__
-#define __DEBUG_COMMUNICATION_LIB_H__
-
-typedef VOID *DEBUG_PORT_HANDLE;
-
-/**
- Caller provided function to be invoked at the end of DebugPortInitialize().
-
- Refer to the description for DebugPortInitialize() for more details.
-
- @param[in] Context The first input argument of DebugPortInitialize().
- @param[in] DebugPortHandle Debug port handle created by Debug Communication Library.
-
-**/
-typedef
-VOID
-(EFIAPI *DEBUG_PORT_CONTINUE)(
- IN VOID *Context,
- IN DEBUG_PORT_HANDLE DebugPortHandle
- );
-
-/**
- Initialize the debug port.
-
- This function will initialize debug port to get it ready for data transmission. If
- certain Debug Communication Library instance has to save some private data in the
- stack, this function must work on the mode that doesn't return to the caller, then
- the caller needs to wrap up all rest of logic after DebugPortInitialize() into one
- function and pass it into DebugPortInitialize(). DebugPortInitialize() is
- responsible to invoke the passing-in function at the end of DebugPortInitialize().
-
- If the parameter Function is not NULL, Debug Communication Library instance will
- invoke it by passing in the Context to be the first parameter. Debug Communication
- Library instance could create one debug port handle to be the second parameter
- passing into the Function. Debug Communication Library instance also could pass
- NULL to be the second parameter if it doesn't create the debug port handle.
-
- If the parameter Function is NULL, and Context is not NULL. At this time, Context
- is the debug port handle created by the previous Debug Communication Library
- instance.
- a) If the instance can understand and continue use the private data of the previous
- instance, it could return the same handle as passed in (as Context parameter).
- b) If the instance does not understand, or does not want to continue use the
- private data of the previous instance, it could ignore the input Context parameter
- and create the new handle to be returned.
-
- If Function() is NULL and Context is NULL, Debug Communication Library could create a
- new handle and return it. NULL is also a valid handle to be returned.
-
- @param[in] Context Context needed by callback function; it was optional.
- @param[in] Function Continue function called by Debug Communication library;
- it was optional.
-
- @return The debug port handle created by Debug Communication Library if Function
- is not NULL.
-
-**/
-DEBUG_PORT_HANDLE
-EFIAPI
-DebugPortInitialize (
- IN VOID *Context,
- IN DEBUG_PORT_CONTINUE Function
- );
-
-/**
- Read data from debug device and save the data in a buffer.
-
- Reads NumberOfBytes data bytes from a debug device into the buffer
- specified by Buffer. The number of bytes actually read is returned.
- If the return value is less than NumberOfBytes, then the rest operation failed.
- If NumberOfBytes is zero, then return 0.
-
- @param Handle Debug port handle.
- @param Buffer Pointer to the data buffer to store the data read from the debug device.
- @param NumberOfBytes Number of bytes which will be read.
- @param Timeout Timeout value for reading from debug device. Its unit is Microsecond.
-
- @retval 0 Read data failed, no data is to be read.
- @retval >0 Actual number of bytes read from debug device.
-
-**/
-UINTN
-EFIAPI
-DebugPortReadBuffer (
- IN DEBUG_PORT_HANDLE Handle,
- IN UINT8 *Buffer,
- IN UINTN NumberOfBytes,
- IN UINTN Timeout
- );
-
-/**
- Write data from buffer to debug device.
-
- Writes NumberOfBytes data bytes from Buffer to the debug device.
- The number of bytes actually written to the debug device is returned.
- If the return value is less than NumberOfBytes, then the write operation failed.
- If NumberOfBytes is zero, then return 0.
-
- @param Handle Debug port handle.
- @param Buffer Pointer to the data buffer to be written.
- @param NumberOfBytes Number of bytes to written to the debug device.
-
- @retval 0 NumberOfBytes is 0.
- @retval >0 The number of bytes written to the debug device.
- If this value is less than NumberOfBytes, then the write operation failed.
-
-**/
-UINTN
-EFIAPI
-DebugPortWriteBuffer (
- IN DEBUG_PORT_HANDLE Handle,
- IN UINT8 *Buffer,
- IN UINTN NumberOfBytes
- );
-
-/**
- Polls a debug device to see if there is any data waiting to be read.
-
- Polls a debug device to see if there is any data waiting to be read.
- If there is data waiting to be read from the debug device, then TRUE is returned.
- If there is no data waiting to be read from the debug device, then FALSE is returned.
-
- @param Handle Debug port handle.
-
- @retval TRUE Data is waiting to be read from the debug device.
- @retval FALSE There is no data waiting to be read from the debug device.
-
-**/
-BOOLEAN
-EFIAPI
-DebugPortPollBuffer (
- IN DEBUG_PORT_HANDLE Handle
- );
-
-#endif
+/** @file + Debug Communication Library definitions. + + Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __DEBUG_COMMUNICATION_LIB_H__ +#define __DEBUG_COMMUNICATION_LIB_H__ + +typedef VOID *DEBUG_PORT_HANDLE; + +/** + Caller provided function to be invoked at the end of DebugPortInitialize(). + + Refer to the description for DebugPortInitialize() for more details. + + @param[in] Context The first input argument of DebugPortInitialize(). + @param[in] DebugPortHandle Debug port handle created by Debug Communication Library. + +**/ +typedef +VOID +(EFIAPI *DEBUG_PORT_CONTINUE)( + IN VOID *Context, + IN DEBUG_PORT_HANDLE DebugPortHandle + ); + +/** + Initialize the debug port. + + This function will initialize debug port to get it ready for data transmission. If + certain Debug Communication Library instance has to save some private data in the + stack, this function must work on the mode that doesn't return to the caller, then + the caller needs to wrap up all rest of logic after DebugPortInitialize() into one + function and pass it into DebugPortInitialize(). DebugPortInitialize() is + responsible to invoke the passing-in function at the end of DebugPortInitialize(). + + If the parameter Function is not NULL, Debug Communication Library instance will + invoke it by passing in the Context to be the first parameter. Debug Communication + Library instance could create one debug port handle to be the second parameter + passing into the Function. Debug Communication Library instance also could pass + NULL to be the second parameter if it doesn't create the debug port handle. + + If the parameter Function is NULL, and Context is not NULL. At this time, Context + is the debug port handle created by the previous Debug Communication Library + instance. + a) If the instance can understand and continue use the private data of the previous + instance, it could return the same handle as passed in (as Context parameter). + b) If the instance does not understand, or does not want to continue use the + private data of the previous instance, it could ignore the input Context parameter + and create the new handle to be returned. + + If Function() is NULL and Context is NULL, Debug Communication Library could create a + new handle and return it. NULL is also a valid handle to be returned. + + @param[in] Context Context needed by callback function; it was optional. + @param[in] Function Continue function called by Debug Communication library; + it was optional. + + @return The debug port handle created by Debug Communication Library if Function + is not NULL. + +**/ +DEBUG_PORT_HANDLE +EFIAPI +DebugPortInitialize ( + IN VOID *Context, + IN DEBUG_PORT_CONTINUE Function + ); + +/** + Read data from debug device and save the data in a buffer. + + Reads NumberOfBytes data bytes from a debug device into the buffer + specified by Buffer. The number of bytes actually read is returned. + If the return value is less than NumberOfBytes, then the rest operation failed. + If NumberOfBytes is zero, then return 0. + + @param Handle Debug port handle. + @param Buffer Pointer to the data buffer to store the data read from the debug device. + @param NumberOfBytes Number of bytes which will be read. + @param Timeout Timeout value for reading from debug device. Its unit is Microsecond. + + @retval 0 Read data failed, no data is to be read. + @retval >0 Actual number of bytes read from debug device. + +**/ +UINTN +EFIAPI +DebugPortReadBuffer ( + IN DEBUG_PORT_HANDLE Handle, + IN UINT8 *Buffer, + IN UINTN NumberOfBytes, + IN UINTN Timeout + ); + +/** + Write data from buffer to debug device. + + Writes NumberOfBytes data bytes from Buffer to the debug device. + The number of bytes actually written to the debug device is returned. + If the return value is less than NumberOfBytes, then the write operation failed. + If NumberOfBytes is zero, then return 0. + + @param Handle Debug port handle. + @param Buffer Pointer to the data buffer to be written. + @param NumberOfBytes Number of bytes to written to the debug device. + + @retval 0 NumberOfBytes is 0. + @retval >0 The number of bytes written to the debug device. + If this value is less than NumberOfBytes, then the write operation failed. + +**/ +UINTN +EFIAPI +DebugPortWriteBuffer ( + IN DEBUG_PORT_HANDLE Handle, + IN UINT8 *Buffer, + IN UINTN NumberOfBytes + ); + +/** + Polls a debug device to see if there is any data waiting to be read. + + Polls a debug device to see if there is any data waiting to be read. + If there is data waiting to be read from the debug device, then TRUE is returned. + If there is no data waiting to be read from the debug device, then FALSE is returned. + + @param Handle Debug port handle. + + @retval TRUE Data is waiting to be read from the debug device. + @retval FALSE There is no data waiting to be read from the debug device. + +**/ +BOOLEAN +EFIAPI +DebugPortPollBuffer ( + IN DEBUG_PORT_HANDLE Handle + ); + +#endif diff --git a/SourceLevelDebugPkg/Include/TransferProtocol.h b/SourceLevelDebugPkg/Include/TransferProtocol.h index 66ede36e45..017723e692 100644 --- a/SourceLevelDebugPkg/Include/TransferProtocol.h +++ b/SourceLevelDebugPkg/Include/TransferProtocol.h @@ -1,369 +1,369 @@ -/** @file
- Transfer protocol definitions used by debug agent and host. It is only
- intended to be used by Debug related module implementation.
-
- Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __TRANSFER_PROTOCOL_H__
-#define __TRANSFER_PROTOCOL_H__
-
-#include "ProcessorContext.h"
-
-//
-// Current revision of transfer protocol
-// 0.4: Packet compression and decompression.
-//
-#define DEBUG_AGENT_REVISION_03 ((0 << 16) | 03)
-#define DEBUG_AGENT_REVISION_04 ((0 << 16) | 04)
-#define DEBUG_AGENT_CAPABILITIES 0
-
-//
-// Definitions for the (A)ttach command
-//
-#define DEBUG_STARTING_SYMBOL_ATTACH (0xFA)
-
-//
-// Definition for starting symbol of a normal debug packet. Choose a non-ASCII to avoid conflict with other serial output.
-//
-#define DEBUG_STARTING_SYMBOL_NORMAL (0xFE)
-
-//
-// Definition for starting symbol of a (C)ompressed debug packet. Choose a non-ASCII to avoid conflict with other serial output.
-//
-#define DEBUG_STARTING_SYMBOL_COMPRESS (0xFC)
-
-#pragma pack(1)
-
-//
-// Definition for debug packet header for debug packets (not including attach command)
-//
-typedef struct {
- UINT8 StartSymbol;
- UINT8 Command;
- UINT8 Length; // Length of Debug Packet including header and payload in byte
- UINT8 SequenceNo;
- UINT16 Crc;
-} DEBUG_PACKET_HEADER;
-
-//
-// Definition for Command field for debug packets
-//
-#define DEBUG_COMMAND_REQUEST (0 << 7)
-#define DEBUG_COMMAND_RESPONSE (1 << 7)
-
-#define IS_REQUEST(x) (((x)->Command & DEBUG_COMMAND_RESPONSE) == 0)
-
-//
-// HOST initiated commands
-//
-#define DEBUG_COMMAND_RESET (DEBUG_COMMAND_REQUEST | 0x00)
-#define DEBUG_COMMAND_GO (DEBUG_COMMAND_REQUEST | 0x01)
-#define DEBUG_COMMAND_BREAK_CAUSE (DEBUG_COMMAND_REQUEST | 0x02)
-#define DEBUG_COMMAND_SET_HW_BREAKPOINT (DEBUG_COMMAND_REQUEST | 0x03)
-#define DEBUG_COMMAND_CLEAR_HW_BREAKPOINT (DEBUG_COMMAND_REQUEST | 0x04)
-#define DEBUG_COMMAND_SINGLE_STEPPING (DEBUG_COMMAND_REQUEST | 0x05)
-#define DEBUG_COMMAND_SET_SW_BREAKPOINT (DEBUG_COMMAND_REQUEST | 0x06)
-#define DEBUG_COMMAND_READ_MEMORY (DEBUG_COMMAND_REQUEST | 0x07)
-#define DEBUG_COMMAND_WRITE_MEMORY (DEBUG_COMMAND_REQUEST | 0x08)
-#define DEBUG_COMMAND_READ_IO (DEBUG_COMMAND_REQUEST | 0x09)
-#define DEBUG_COMMAND_WRITE_IO (DEBUG_COMMAND_REQUEST | 0x0A)
-#define DEBUG_COMMAND_READ_REGISTER (DEBUG_COMMAND_REQUEST | 0x0B)
-#define DEBUG_COMMAND_WRITE_REGISTER (DEBUG_COMMAND_REQUEST | 0x0C)
-#define DEBUG_COMMAND_READ_ALL_REGISTERS (DEBUG_COMMAND_REQUEST | 0x0D)
-#define DEBUG_COMMAND_ARCH_MODE (DEBUG_COMMAND_REQUEST | 0x0E)
-#define DEBUG_COMMAND_READ_MSR (DEBUG_COMMAND_REQUEST | 0x0F)
-#define DEBUG_COMMAND_WRITE_MSR (DEBUG_COMMAND_REQUEST | 0x10)
-#define DEBUG_COMMAND_SET_DEBUG_SETTING (DEBUG_COMMAND_REQUEST | 0x11)
-#define DEBUG_COMMAND_GET_REVISION (DEBUG_COMMAND_REQUEST | 0x12)
-#define DEBUG_COMMAND_GET_EXCEPTION (DEBUG_COMMAND_REQUEST | 0x13)
-#define DEBUG_COMMAND_SET_VIEWPOINT (DEBUG_COMMAND_REQUEST | 0x14)
-#define DEBUG_COMMAND_GET_VIEWPOINT (DEBUG_COMMAND_REQUEST | 0x15)
-#define DEBUG_COMMAND_DETACH (DEBUG_COMMAND_REQUEST | 0x16)
-#define DEBUG_COMMAND_CPUID (DEBUG_COMMAND_REQUEST | 0x17)
-#define DEBUG_COMMAND_SEARCH_SIGNATURE (DEBUG_COMMAND_REQUEST | 0x18)
-#define DEBUG_COMMAND_HALT (DEBUG_COMMAND_REQUEST | 0x19)
-
-//
-// TARGET initiated commands
-//
-#define DEBUG_COMMAND_INIT_BREAK (DEBUG_COMMAND_REQUEST | 0x3F)
-#define DEBUG_COMMAND_BREAK_POINT (DEBUG_COMMAND_REQUEST | 0x3E)
-#define DEBUG_COMMAND_MEMORY_READY (DEBUG_COMMAND_REQUEST | 0x3D)
-#define DEBUG_COMMAND_PRINT_MESSAGE (DEBUG_COMMAND_REQUEST | 0x3C)
-#define DEBUG_COMMAND_ATTACH_BREAK (DEBUG_COMMAND_REQUEST | 0x3B)
-
-//
-// Response commands
-//
-#define DEBUG_COMMAND_OK (DEBUG_COMMAND_RESPONSE | 0x00)
-#define DEBUG_COMMAND_RESEND (DEBUG_COMMAND_RESPONSE | 0x01)
-#define DEBUG_COMMAND_ABORT (DEBUG_COMMAND_RESPONSE | 0x02)
-//
-// The below 2 commands are used when transferring big data (like > ~250 bytes).
-// The sequence is:
-// HOST TARGET
-// Request =>
-// <= IN_PROGRESS with partial data
-// CONTINUE =>
-// (could have multiple IN_PROGRESS and CONTINUE interactions)
-// <= OK with the last part of data
-// OK (no data as ACK) =>
-//
-#define DEBUG_COMMAND_IN_PROGRESS (DEBUG_COMMAND_RESPONSE | 0x03)
-#define DEBUG_COMMAND_CONTINUE (DEBUG_COMMAND_RESPONSE | 0x04)
-//
-// The below 2 commands are used to support deferred halt:
-// TARGET returns HALT_DEFERRED when it receives a HALT request in inter-active mode.
-// TARGET returns HALT_PROCESSED when it receives a GO request and has a pending HALT request.
-//
-#define DEBUG_COMMAND_HALT_DEFERRED (DEBUG_COMMAND_RESPONSE | 0x05)
-#define DEBUG_COMMAND_HALT_PROCESSED (DEBUG_COMMAND_RESPONSE | 0x06)
-
-#define DEBUG_COMMAND_TIMEOUT (DEBUG_COMMAND_RESPONSE | 0x07)
-#define DEBUG_COMMAND_NOT_SUPPORTED (DEBUG_COMMAND_RESPONSE | 0x0F)
-
-//
-// Definition for data field for debug packets
-//
-#define DEBUG_DATA_UPPER_LIMIT 0xff // Upper limit for the data size, by the limit of the packet header definition.
-
-#define DEBUG_DATA_MAXIMUM_REAL_DATA (DEBUG_DATA_UPPER_LIMIT - sizeof (DEBUG_PACKET_HEADER))
-
-//
-// Response data for DEBUG_COMMAND_BREAK_CAUSE
-//
-typedef struct {
- UINT8 Cause;
- UINT64 StopAddress;
-} DEBUG_DATA_RESPONSE_BREAK_CAUSE;
-//
-// Break type definitions for DEBUG_DATA_BREAK_CAUSE
-//
-#define DEBUG_DATA_BREAK_CAUSE_UNKNOWN 0
-#define DEBUG_DATA_BREAK_CAUSE_HW_BREAKPOINT 1
-#define DEBUG_DATA_BREAK_CAUSE_STEPPING 2
-#define DEBUG_DATA_BREAK_CAUSE_SW_BREAKPOINT 3
-#define DEBUG_DATA_BREAK_CAUSE_USER_HALT 4
-#define DEBUG_DATA_BREAK_CAUSE_IMAGE_LOAD 5
-#define DEBUG_DATA_BREAK_CAUSE_IMAGE_UNLOAD 6
-#define DEBUG_DATA_BREAK_CAUSE_SYSTEM_RESET 7
-#define DEBUG_DATA_BREAK_CAUSE_EXCEPTION 8
-#define DEBUG_DATA_BREAK_CAUSE_MEMORY_READY 9
-
-//
-// Response data for DEBUG_COMMAND_ARCH_MODE, defined as SOFT_DEBUGGER_PROCESSOR_...
-//
-typedef struct {
- UINT8 CpuMode;
-} DEBUG_DATA_RESPONSE_ARCH_MODE;
-//
-// Cpu architecture definitions for DEBUG_DATA_RESPONSE_ARCH_MODE
-//
-#define DEBUG_DATA_BREAK_CPU_ARCH_IA16 0
-#define DEBUG_DATA_BREAK_CPU_ARCH_IA32 1
-#define DEBUG_DATA_BREAK_CPU_ARCH_X64 2
-
-typedef struct {
- UINT8 Length : 2; // Refer to below DEBUG_DATA_BREAKPOINT_LENGTH_XX macros
- UINT8 Access : 2; // Refer to below DEBUG_DATA_BREAKPOINT_ACCESS_XX macros
- UINT8 Index : 2; // Index of debug register
- UINT8 Reserved : 2;
-} DEBUG_DATA_BREAKPOINT_TYPE;
-#define DEBUG_DATA_BREAKPOINT_MEMORY_ACCESS (0x3)
-#define DEBUG_DATA_BREAKPOINT_IO_ACCESS (0x2)
-#define DEBUG_DATA_BREAKPOINT_MEMORY_WRITE (0x1)
-#define DEBUG_DATA_BREAKPOINT_MEMORY_EXECUTE (0x0)
-#define DEBUG_DATA_BREAKPOINT_LENGTH_32 (0x3)
-#define DEBUG_DATA_BREAKPOINT_LENGTH_64 (0x2)
-#define DEBUG_DATA_BREAKPOINT_LENGTH_16 (0x1)
-#define DEBUG_DATA_BREAKPOINT_LENGTH_8 (0x0)
-
-//
-// Request data for DEBUG_COMMAND_SET_HW_BREAKPOINT
-//
-typedef struct {
- DEBUG_DATA_BREAKPOINT_TYPE Type;
- UINT64 Address;
-} DEBUG_DATA_SET_HW_BREAKPOINT;
-
-//
-// Request data for DEBUG_COMMAND_CLEAR_HW_BREAKPOINT
-//
-typedef struct {
- UINT8 IndexMask; // 0x0f will clear all hw breakpoints
-} DEBUG_DATA_CLEAR_HW_BREAKPOINT;
-
-//
-// Request and response data for DEBUG_COMMAND_SET_SW_BREAKPOINT
-//
-typedef struct {
- UINT64 Address;
-} DEBUG_DATA_SET_SW_BREAKPOINT;
-
-typedef struct {
- UINT8 OriginalData;
-} DEBUG_DATA_RESPONSE_SET_SW_BREAKPOINT;
-
-//
-// Request data for DEBUG_COMMAND_READ_MEMORY
-//
-typedef struct {
- UINT64 Address;
- UINT8 Width;
- UINT16 Count;
-} DEBUG_DATA_READ_MEMORY;
-
-//
-// Request data for DEBUG_COMMAND_WRITE_MEMORY
-//
-typedef struct {
- UINT64 Address;
- UINT8 Width;
- UINT16 Count;
- UINT8 Data[1]; // The actual length is (Width * Count)
-} DEBUG_DATA_WRITE_MEMORY;
-
-//
-// Request and response data for DEBUG_COMMAND_READ_IO
-//
-typedef struct {
- UINT64 Port;
- UINT8 Width;
-} DEBUG_DATA_READ_IO;
-
-typedef struct {
- UINT8 Data[1]; // The actual length depends on the packet header
-} DEBUG_DATA_RESPONSE_READ_IO;
-
-//
-// Request data for DEBUG_COMMAND_WRITE_IO
-//
-typedef struct {
- UINT64 Port;
- UINT8 Width;
- UINT8 Data[1]; // The actual length is Width
-} DEBUG_DATA_WRITE_IO;
-
-//
-// Request data for DEBUG_COMMAND_READ_REGISTER
-//
-typedef struct {
- UINT8 Index; // defined as SOFT_DEBUGGER_REGISTER_XX
-} DEBUG_DATA_READ_REGISTER;
-
-//
-// Request data for DEBUG_COMMAND_WRITE_REGISTER
-//
-typedef struct {
- UINT8 Index; // defined as SOFT_DEBUGGER_REGISTER_XX
- UINT8 Length;
- UINT8 Data[1]; // The actual length is Length
-} DEBUG_DATA_WRITE_REGISTER;
-
-//
-// Request and response data for DEBUG_COMMAND_READ_MSR
-//
-typedef struct {
- UINT32 Index;
-} DEBUG_DATA_READ_MSR;
-
-typedef struct {
- UINT64 Value;
-} DEBUG_DATA_RESPONSE_READ_MSR;
-
-//
-// Request data for DEBUG_COMMAND_WRITE_MSR
-//
-typedef struct {
- UINT32 Index;
- UINT64 Value;
-} DEBUG_DATA_WRITE_MSR;
-
-//
-// Response data for DEBUG_COMMAND_GET_REVISION
-//
-typedef struct {
- UINT32 Revision;
- UINT32 Capabilities;
-} DEBUG_DATA_RESPONSE_GET_REVISION;
-
-//
-// Response data for DEBUG_COMMAND_GET_EXCEPTION
-//
-typedef struct {
- UINT8 ExceptionNum;
- UINT32 ExceptionData;
-} DEBUG_DATA_RESPONSE_GET_EXCEPTION;
-
-//
-// Request data for DEBUG_DATA_SET_DEBUG_SETTING
-//
-typedef struct {
- UINT8 Key;
- UINT8 Value;
-} DEBUG_DATA_SET_DEBUG_SETTING;
-//
-// Supported keys
-//
-#define DEBUG_AGENT_SETTING_SMM_ENTRY_BREAK 1
-#define DEBUG_AGENT_SETTING_PRINT_ERROR_LEVEL 2
-#define DEBUG_AGENT_SETTING_BOOT_SCRIPT_ENTRY_BREAK 3
-//
-// Bitmask of print error level for debug message
-//
-#define DEBUG_AGENT_ERROR BIT0
-#define DEBUG_AGENT_WARNING BIT1
-#define DEBUG_AGENT_INFO BIT2
-#define DEBUG_AGENT_VERBOSE BIT3
-
-//
-// Request data for DEBUG_COMMAND_SET_VIEWPOINT
-//
-typedef struct {
- UINT32 ViewPoint; // The index of viewpoint will be set
-} DEBUG_DATA_SET_VIEWPOINT;
-
-//
-// Response data for DEBUG_COMMAND_GET_VIEWPOINT
-//
-typedef struct {
- UINT32 ViewPoint; // The index of viewpoint will be returned
-} DEBUG_DATA_RESPONSE_GET_VIEWPOINT;
-
-//
-// Request and response data for DEBUG_COMMAND_CPUID
-//
-typedef struct {
- UINT32 Eax; // The value of EAX prior to invoking the CPUID instruction
- UINT32 Ecx; // The value of ECX prior to invoking the CPUID instruction
-} DEBUG_DATA_CPUID;
-
-typedef struct {
- UINT32 Eax; // The value of EAX returned by the CPUID instruction
- UINT32 Ebx; // The value of EBX returned by the CPUID instruction
- UINT32 Ecx; // The value of ECX returned by the CPUID instruction
- UINT32 Edx; // The value of EDX returned by the CPUID instruction
-} DEBUG_DATA_RESPONSE_CPUID;
-
-//
-// Request and response data for DEBUG_COMMAND_SEARCH_SIGNATURE
-//
-typedef struct {
- UINT64 Start;
- UINT32 Count;
- UINT32 Alignment;
- BOOLEAN Positive; // TRUE to search in higher address memory
- UINT8 DataLength;
- UINT8 Data[1];
-} DEBUG_DATA_SEARCH_SIGNATURE;
-
-typedef struct {
- UINT64 Address; // -1 indicates not found
-} DEBUG_DATA_RESPONSE_SEARCH_SIGNATURE;
-
-#pragma pack()
-
-#endif
+/** @file + Transfer protocol definitions used by debug agent and host. It is only + intended to be used by Debug related module implementation. + + Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __TRANSFER_PROTOCOL_H__ +#define __TRANSFER_PROTOCOL_H__ + +#include "ProcessorContext.h" + +// +// Current revision of transfer protocol +// 0.4: Packet compression and decompression. +// +#define DEBUG_AGENT_REVISION_03 ((0 << 16) | 03) +#define DEBUG_AGENT_REVISION_04 ((0 << 16) | 04) +#define DEBUG_AGENT_CAPABILITIES 0 + +// +// Definitions for the (A)ttach command +// +#define DEBUG_STARTING_SYMBOL_ATTACH (0xFA) + +// +// Definition for starting symbol of a normal debug packet. Choose a non-ASCII to avoid conflict with other serial output. +// +#define DEBUG_STARTING_SYMBOL_NORMAL (0xFE) + +// +// Definition for starting symbol of a (C)ompressed debug packet. Choose a non-ASCII to avoid conflict with other serial output. +// +#define DEBUG_STARTING_SYMBOL_COMPRESS (0xFC) + +#pragma pack(1) + +// +// Definition for debug packet header for debug packets (not including attach command) +// +typedef struct { + UINT8 StartSymbol; + UINT8 Command; + UINT8 Length; // Length of Debug Packet including header and payload in byte + UINT8 SequenceNo; + UINT16 Crc; +} DEBUG_PACKET_HEADER; + +// +// Definition for Command field for debug packets +// +#define DEBUG_COMMAND_REQUEST (0 << 7) +#define DEBUG_COMMAND_RESPONSE (1 << 7) + +#define IS_REQUEST(x) (((x)->Command & DEBUG_COMMAND_RESPONSE) == 0) + +// +// HOST initiated commands +// +#define DEBUG_COMMAND_RESET (DEBUG_COMMAND_REQUEST | 0x00) +#define DEBUG_COMMAND_GO (DEBUG_COMMAND_REQUEST | 0x01) +#define DEBUG_COMMAND_BREAK_CAUSE (DEBUG_COMMAND_REQUEST | 0x02) +#define DEBUG_COMMAND_SET_HW_BREAKPOINT (DEBUG_COMMAND_REQUEST | 0x03) +#define DEBUG_COMMAND_CLEAR_HW_BREAKPOINT (DEBUG_COMMAND_REQUEST | 0x04) +#define DEBUG_COMMAND_SINGLE_STEPPING (DEBUG_COMMAND_REQUEST | 0x05) +#define DEBUG_COMMAND_SET_SW_BREAKPOINT (DEBUG_COMMAND_REQUEST | 0x06) +#define DEBUG_COMMAND_READ_MEMORY (DEBUG_COMMAND_REQUEST | 0x07) +#define DEBUG_COMMAND_WRITE_MEMORY (DEBUG_COMMAND_REQUEST | 0x08) +#define DEBUG_COMMAND_READ_IO (DEBUG_COMMAND_REQUEST | 0x09) +#define DEBUG_COMMAND_WRITE_IO (DEBUG_COMMAND_REQUEST | 0x0A) +#define DEBUG_COMMAND_READ_REGISTER (DEBUG_COMMAND_REQUEST | 0x0B) +#define DEBUG_COMMAND_WRITE_REGISTER (DEBUG_COMMAND_REQUEST | 0x0C) +#define DEBUG_COMMAND_READ_ALL_REGISTERS (DEBUG_COMMAND_REQUEST | 0x0D) +#define DEBUG_COMMAND_ARCH_MODE (DEBUG_COMMAND_REQUEST | 0x0E) +#define DEBUG_COMMAND_READ_MSR (DEBUG_COMMAND_REQUEST | 0x0F) +#define DEBUG_COMMAND_WRITE_MSR (DEBUG_COMMAND_REQUEST | 0x10) +#define DEBUG_COMMAND_SET_DEBUG_SETTING (DEBUG_COMMAND_REQUEST | 0x11) +#define DEBUG_COMMAND_GET_REVISION (DEBUG_COMMAND_REQUEST | 0x12) +#define DEBUG_COMMAND_GET_EXCEPTION (DEBUG_COMMAND_REQUEST | 0x13) +#define DEBUG_COMMAND_SET_VIEWPOINT (DEBUG_COMMAND_REQUEST | 0x14) +#define DEBUG_COMMAND_GET_VIEWPOINT (DEBUG_COMMAND_REQUEST | 0x15) +#define DEBUG_COMMAND_DETACH (DEBUG_COMMAND_REQUEST | 0x16) +#define DEBUG_COMMAND_CPUID (DEBUG_COMMAND_REQUEST | 0x17) +#define DEBUG_COMMAND_SEARCH_SIGNATURE (DEBUG_COMMAND_REQUEST | 0x18) +#define DEBUG_COMMAND_HALT (DEBUG_COMMAND_REQUEST | 0x19) + +// +// TARGET initiated commands +// +#define DEBUG_COMMAND_INIT_BREAK (DEBUG_COMMAND_REQUEST | 0x3F) +#define DEBUG_COMMAND_BREAK_POINT (DEBUG_COMMAND_REQUEST | 0x3E) +#define DEBUG_COMMAND_MEMORY_READY (DEBUG_COMMAND_REQUEST | 0x3D) +#define DEBUG_COMMAND_PRINT_MESSAGE (DEBUG_COMMAND_REQUEST | 0x3C) +#define DEBUG_COMMAND_ATTACH_BREAK (DEBUG_COMMAND_REQUEST | 0x3B) + +// +// Response commands +// +#define DEBUG_COMMAND_OK (DEBUG_COMMAND_RESPONSE | 0x00) +#define DEBUG_COMMAND_RESEND (DEBUG_COMMAND_RESPONSE | 0x01) +#define DEBUG_COMMAND_ABORT (DEBUG_COMMAND_RESPONSE | 0x02) +// +// The below 2 commands are used when transferring big data (like > ~250 bytes). +// The sequence is: +// HOST TARGET +// Request => +// <= IN_PROGRESS with partial data +// CONTINUE => +// (could have multiple IN_PROGRESS and CONTINUE interactions) +// <= OK with the last part of data +// OK (no data as ACK) => +// +#define DEBUG_COMMAND_IN_PROGRESS (DEBUG_COMMAND_RESPONSE | 0x03) +#define DEBUG_COMMAND_CONTINUE (DEBUG_COMMAND_RESPONSE | 0x04) +// +// The below 2 commands are used to support deferred halt: +// TARGET returns HALT_DEFERRED when it receives a HALT request in inter-active mode. +// TARGET returns HALT_PROCESSED when it receives a GO request and has a pending HALT request. +// +#define DEBUG_COMMAND_HALT_DEFERRED (DEBUG_COMMAND_RESPONSE | 0x05) +#define DEBUG_COMMAND_HALT_PROCESSED (DEBUG_COMMAND_RESPONSE | 0x06) + +#define DEBUG_COMMAND_TIMEOUT (DEBUG_COMMAND_RESPONSE | 0x07) +#define DEBUG_COMMAND_NOT_SUPPORTED (DEBUG_COMMAND_RESPONSE | 0x0F) + +// +// Definition for data field for debug packets +// +#define DEBUG_DATA_UPPER_LIMIT 0xff // Upper limit for the data size, by the limit of the packet header definition. + +#define DEBUG_DATA_MAXIMUM_REAL_DATA (DEBUG_DATA_UPPER_LIMIT - sizeof (DEBUG_PACKET_HEADER)) + +// +// Response data for DEBUG_COMMAND_BREAK_CAUSE +// +typedef struct { + UINT8 Cause; + UINT64 StopAddress; +} DEBUG_DATA_RESPONSE_BREAK_CAUSE; +// +// Break type definitions for DEBUG_DATA_BREAK_CAUSE +// +#define DEBUG_DATA_BREAK_CAUSE_UNKNOWN 0 +#define DEBUG_DATA_BREAK_CAUSE_HW_BREAKPOINT 1 +#define DEBUG_DATA_BREAK_CAUSE_STEPPING 2 +#define DEBUG_DATA_BREAK_CAUSE_SW_BREAKPOINT 3 +#define DEBUG_DATA_BREAK_CAUSE_USER_HALT 4 +#define DEBUG_DATA_BREAK_CAUSE_IMAGE_LOAD 5 +#define DEBUG_DATA_BREAK_CAUSE_IMAGE_UNLOAD 6 +#define DEBUG_DATA_BREAK_CAUSE_SYSTEM_RESET 7 +#define DEBUG_DATA_BREAK_CAUSE_EXCEPTION 8 +#define DEBUG_DATA_BREAK_CAUSE_MEMORY_READY 9 + +// +// Response data for DEBUG_COMMAND_ARCH_MODE, defined as SOFT_DEBUGGER_PROCESSOR_... +// +typedef struct { + UINT8 CpuMode; +} DEBUG_DATA_RESPONSE_ARCH_MODE; +// +// Cpu architecture definitions for DEBUG_DATA_RESPONSE_ARCH_MODE +// +#define DEBUG_DATA_BREAK_CPU_ARCH_IA16 0 +#define DEBUG_DATA_BREAK_CPU_ARCH_IA32 1 +#define DEBUG_DATA_BREAK_CPU_ARCH_X64 2 + +typedef struct { + UINT8 Length : 2; // Refer to below DEBUG_DATA_BREAKPOINT_LENGTH_XX macros + UINT8 Access : 2; // Refer to below DEBUG_DATA_BREAKPOINT_ACCESS_XX macros + UINT8 Index : 2; // Index of debug register + UINT8 Reserved : 2; +} DEBUG_DATA_BREAKPOINT_TYPE; +#define DEBUG_DATA_BREAKPOINT_MEMORY_ACCESS (0x3) +#define DEBUG_DATA_BREAKPOINT_IO_ACCESS (0x2) +#define DEBUG_DATA_BREAKPOINT_MEMORY_WRITE (0x1) +#define DEBUG_DATA_BREAKPOINT_MEMORY_EXECUTE (0x0) +#define DEBUG_DATA_BREAKPOINT_LENGTH_32 (0x3) +#define DEBUG_DATA_BREAKPOINT_LENGTH_64 (0x2) +#define DEBUG_DATA_BREAKPOINT_LENGTH_16 (0x1) +#define DEBUG_DATA_BREAKPOINT_LENGTH_8 (0x0) + +// +// Request data for DEBUG_COMMAND_SET_HW_BREAKPOINT +// +typedef struct { + DEBUG_DATA_BREAKPOINT_TYPE Type; + UINT64 Address; +} DEBUG_DATA_SET_HW_BREAKPOINT; + +// +// Request data for DEBUG_COMMAND_CLEAR_HW_BREAKPOINT +// +typedef struct { + UINT8 IndexMask; // 0x0f will clear all hw breakpoints +} DEBUG_DATA_CLEAR_HW_BREAKPOINT; + +// +// Request and response data for DEBUG_COMMAND_SET_SW_BREAKPOINT +// +typedef struct { + UINT64 Address; +} DEBUG_DATA_SET_SW_BREAKPOINT; + +typedef struct { + UINT8 OriginalData; +} DEBUG_DATA_RESPONSE_SET_SW_BREAKPOINT; + +// +// Request data for DEBUG_COMMAND_READ_MEMORY +// +typedef struct { + UINT64 Address; + UINT8 Width; + UINT16 Count; +} DEBUG_DATA_READ_MEMORY; + +// +// Request data for DEBUG_COMMAND_WRITE_MEMORY +// +typedef struct { + UINT64 Address; + UINT8 Width; + UINT16 Count; + UINT8 Data[1]; // The actual length is (Width * Count) +} DEBUG_DATA_WRITE_MEMORY; + +// +// Request and response data for DEBUG_COMMAND_READ_IO +// +typedef struct { + UINT64 Port; + UINT8 Width; +} DEBUG_DATA_READ_IO; + +typedef struct { + UINT8 Data[1]; // The actual length depends on the packet header +} DEBUG_DATA_RESPONSE_READ_IO; + +// +// Request data for DEBUG_COMMAND_WRITE_IO +// +typedef struct { + UINT64 Port; + UINT8 Width; + UINT8 Data[1]; // The actual length is Width +} DEBUG_DATA_WRITE_IO; + +// +// Request data for DEBUG_COMMAND_READ_REGISTER +// +typedef struct { + UINT8 Index; // defined as SOFT_DEBUGGER_REGISTER_XX +} DEBUG_DATA_READ_REGISTER; + +// +// Request data for DEBUG_COMMAND_WRITE_REGISTER +// +typedef struct { + UINT8 Index; // defined as SOFT_DEBUGGER_REGISTER_XX + UINT8 Length; + UINT8 Data[1]; // The actual length is Length +} DEBUG_DATA_WRITE_REGISTER; + +// +// Request and response data for DEBUG_COMMAND_READ_MSR +// +typedef struct { + UINT32 Index; +} DEBUG_DATA_READ_MSR; + +typedef struct { + UINT64 Value; +} DEBUG_DATA_RESPONSE_READ_MSR; + +// +// Request data for DEBUG_COMMAND_WRITE_MSR +// +typedef struct { + UINT32 Index; + UINT64 Value; +} DEBUG_DATA_WRITE_MSR; + +// +// Response data for DEBUG_COMMAND_GET_REVISION +// +typedef struct { + UINT32 Revision; + UINT32 Capabilities; +} DEBUG_DATA_RESPONSE_GET_REVISION; + +// +// Response data for DEBUG_COMMAND_GET_EXCEPTION +// +typedef struct { + UINT8 ExceptionNum; + UINT32 ExceptionData; +} DEBUG_DATA_RESPONSE_GET_EXCEPTION; + +// +// Request data for DEBUG_DATA_SET_DEBUG_SETTING +// +typedef struct { + UINT8 Key; + UINT8 Value; +} DEBUG_DATA_SET_DEBUG_SETTING; +// +// Supported keys +// +#define DEBUG_AGENT_SETTING_SMM_ENTRY_BREAK 1 +#define DEBUG_AGENT_SETTING_PRINT_ERROR_LEVEL 2 +#define DEBUG_AGENT_SETTING_BOOT_SCRIPT_ENTRY_BREAK 3 +// +// Bitmask of print error level for debug message +// +#define DEBUG_AGENT_ERROR BIT0 +#define DEBUG_AGENT_WARNING BIT1 +#define DEBUG_AGENT_INFO BIT2 +#define DEBUG_AGENT_VERBOSE BIT3 + +// +// Request data for DEBUG_COMMAND_SET_VIEWPOINT +// +typedef struct { + UINT32 ViewPoint; // The index of viewpoint will be set +} DEBUG_DATA_SET_VIEWPOINT; + +// +// Response data for DEBUG_COMMAND_GET_VIEWPOINT +// +typedef struct { + UINT32 ViewPoint; // The index of viewpoint will be returned +} DEBUG_DATA_RESPONSE_GET_VIEWPOINT; + +// +// Request and response data for DEBUG_COMMAND_CPUID +// +typedef struct { + UINT32 Eax; // The value of EAX prior to invoking the CPUID instruction + UINT32 Ecx; // The value of ECX prior to invoking the CPUID instruction +} DEBUG_DATA_CPUID; + +typedef struct { + UINT32 Eax; // The value of EAX returned by the CPUID instruction + UINT32 Ebx; // The value of EBX returned by the CPUID instruction + UINT32 Ecx; // The value of ECX returned by the CPUID instruction + UINT32 Edx; // The value of EDX returned by the CPUID instruction +} DEBUG_DATA_RESPONSE_CPUID; + +// +// Request and response data for DEBUG_COMMAND_SEARCH_SIGNATURE +// +typedef struct { + UINT64 Start; + UINT32 Count; + UINT32 Alignment; + BOOLEAN Positive; // TRUE to search in higher address memory + UINT8 DataLength; + UINT8 Data[1]; +} DEBUG_DATA_SEARCH_SIGNATURE; + +typedef struct { + UINT64 Address; // -1 indicates not found +} DEBUG_DATA_RESPONSE_SEARCH_SIGNATURE; + +#pragma pack() + +#endif |
