summaryrefslogtreecommitdiff
path: root/SourceLevelDebugPkg/Include
diff options
context:
space:
mode:
Diffstat (limited to 'SourceLevelDebugPkg/Include')
-rw-r--r--SourceLevelDebugPkg/Include/Ia32/ProcessorContext.h421
-rw-r--r--SourceLevelDebugPkg/Include/SoftDebuggerDefinitions.h42
-rw-r--r--SourceLevelDebugPkg/Include/TransferProtocol.h369
3 files changed, 441 insertions, 391 deletions
diff --git a/SourceLevelDebugPkg/Include/Ia32/ProcessorContext.h b/SourceLevelDebugPkg/Include/Ia32/ProcessorContext.h
index d2759b5be7..c549a7f6f8 100644
--- a/SourceLevelDebugPkg/Include/Ia32/ProcessorContext.h
+++ b/SourceLevelDebugPkg/Include/Ia32/ProcessorContext.h
@@ -2,7 +2,7 @@
IA32/x64 architecture specific defintions needed by debug transfer protocol.It is only
intended to be used by Debug related module implementation.
- Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -19,161 +19,292 @@
//
// IA-32/x64 processor register index table
//
-#define SOFT_DEBUGGER_REGISTER_DR0 0
-#define SOFT_DEBUGGER_REGISTER_DR1 1
-#define SOFT_DEBUGGER_REGISTER_DR2 2
-#define SOFT_DEBUGGER_REGISTER_DR3 3
-#define SOFT_DEBUGGER_REGISTER_DR6 4
-#define SOFT_DEBUGGER_REGISTER_DR7 5
-#define SOFT_DEBUGGER_REGISTER_EFLAGS 6
-#define SOFT_DEBUGGER_REGISTER_LDTR 7
-#define SOFT_DEBUGGER_REGISTER_TR 8
-#define SOFT_DEBUGGER_REGISTER_GDTR0 9 // the low 32bit of GDTR
-#define SOFT_DEBUGGER_REGISTER_GDTR1 10 // the high 32bit of GDTR
-#define SOFT_DEBUGGER_REGISTER_IDTR0 11 // the low 32bit of IDTR
-#define SOFT_DEBUGGER_REGISTER_IDTR1 12 // the high 32bot of IDTR
-#define SOFT_DEBUGGER_REGISTER_EIP 13
-#define SOFT_DEBUGGER_REGISTER_GS 14
-#define SOFT_DEBUGGER_REGISTER_FS 15
-#define SOFT_DEBUGGER_REGISTER_ES 16
-#define SOFT_DEBUGGER_REGISTER_DS 17
-#define SOFT_DEBUGGER_REGISTER_CS 18
-#define SOFT_DEBUGGER_REGISTER_SS 19
-#define SOFT_DEBUGGER_REGISTER_CR0 20
-#define SOFT_DEBUGGER_REGISTER_CR1 21
-#define SOFT_DEBUGGER_REGISTER_CR2 22
-#define SOFT_DEBUGGER_REGISTER_CR3 23
-#define SOFT_DEBUGGER_REGISTER_CR4 24
-
-#define SOFT_DEBUGGER_REGISTER_DI 25
-#define SOFT_DEBUGGER_REGISTER_SI 26
-#define SOFT_DEBUGGER_REGISTER_BP 27
-#define SOFT_DEBUGGER_REGISTER_SP 28
-#define SOFT_DEBUGGER_REGISTER_DX 29
-#define SOFT_DEBUGGER_REGISTER_CX 30
-#define SOFT_DEBUGGER_REGISTER_BX 31
-#define SOFT_DEBUGGER_REGISTER_AX 32
+#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 33
-#define SOFT_DEBUGGER_REGISTER_R8 34
-#define SOFT_DEBUGGER_REGISTER_R9 35
-#define SOFT_DEBUGGER_REGISTER_R10 36
-#define SOFT_DEBUGGER_REGISTER_R11 37
-#define SOFT_DEBUGGER_REGISTER_R12 38
-#define SOFT_DEBUGGER_REGISTER_R13 39
-#define SOFT_DEBUGGER_REGISTER_R14 40
-#define SOFT_DEBUGGER_REGISTER_R15 41
-
-#define SOFT_DEBUGGER_REGISTER_MAX_COUNT_IA32 33
-#define SOFT_DEBUGGER_REGISTER_MAX_COUNT_X64 42
+#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 50
-
-#define SOFT_DEBUGGER_REGISTER_FP_FCW (SOFT_DEBUGGER_REGISTER_FP_BASE + 0)
-#define SOFT_DEBUGGER_REGISTER_FP_FSW (SOFT_DEBUGGER_REGISTER_FP_BASE + 1)
-#define SOFT_DEBUGGER_REGISTER_FP_FTW (SOFT_DEBUGGER_REGISTER_FP_BASE + 2)
-#define SOFT_DEBUGGER_REGISTER_FP_OPCODE (SOFT_DEBUGGER_REGISTER_FP_BASE + 3)
-#define SOFT_DEBUGGER_REGISTER_FP_EIP (SOFT_DEBUGGER_REGISTER_FP_BASE + 4)
-#define SOFT_DEBUGGER_REGISTER_FP_CS (SOFT_DEBUGGER_REGISTER_FP_BASE + 5)
-#define SOFT_DEBUGGER_REGISTER_FP_DATAOFFSET (SOFT_DEBUGGER_REGISTER_FP_BASE + 6)
-#define SOFT_DEBUGGER_REGISTER_FP_DS (SOFT_DEBUGGER_REGISTER_FP_BASE + 7)
-#define SOFT_DEBUGGER_REGISTER_FP_MXCSR (SOFT_DEBUGGER_REGISTER_FP_BASE + 8)
-#define SOFT_DEBUGGER_REGISTER_FP_MXCSR_MASK (SOFT_DEBUGGER_REGISTER_FP_BASE + 9)
-#define SOFT_DEBUGGER_REGISTER_ST0 (SOFT_DEBUGGER_REGISTER_FP_BASE + 10)
-#define SOFT_DEBUGGER_REGISTER_ST1 (SOFT_DEBUGGER_REGISTER_FP_BASE + 11)
-#define SOFT_DEBUGGER_REGISTER_ST2 (SOFT_DEBUGGER_REGISTER_FP_BASE + 12)
-#define SOFT_DEBUGGER_REGISTER_ST3 (SOFT_DEBUGGER_REGISTER_FP_BASE + 13)
-#define SOFT_DEBUGGER_REGISTER_ST4 (SOFT_DEBUGGER_REGISTER_FP_BASE + 14)
-#define SOFT_DEBUGGER_REGISTER_ST5 (SOFT_DEBUGGER_REGISTER_FP_BASE + 15)
-#define SOFT_DEBUGGER_REGISTER_ST6 (SOFT_DEBUGGER_REGISTER_FP_BASE + 16)
-#define SOFT_DEBUGGER_REGISTER_ST7 (SOFT_DEBUGGER_REGISTER_FP_BASE + 17)
-#define SOFT_DEBUGGER_REGISTER_XMM0 (SOFT_DEBUGGER_REGISTER_FP_BASE + 18)
-#define SOFT_DEBUGGER_REGISTER_XMM1 (SOFT_DEBUGGER_REGISTER_FP_BASE + 19)
-#define SOFT_DEBUGGER_REGISTER_XMM2 (SOFT_DEBUGGER_REGISTER_FP_BASE + 20)
-#define SOFT_DEBUGGER_REGISTER_XMM3 (SOFT_DEBUGGER_REGISTER_FP_BASE + 21)
-#define SOFT_DEBUGGER_REGISTER_XMM4 (SOFT_DEBUGGER_REGISTER_FP_BASE + 22)
-#define SOFT_DEBUGGER_REGISTER_XMM5 (SOFT_DEBUGGER_REGISTER_FP_BASE + 23)
-#define SOFT_DEBUGGER_REGISTER_XMM6 (SOFT_DEBUGGER_REGISTER_FP_BASE + 24)
-#define SOFT_DEBUGGER_REGISTER_XMM7 (SOFT_DEBUGGER_REGISTER_FP_BASE + 25)
-#define SOFT_DEBUGGER_REGISTER_XMM8 (SOFT_DEBUGGER_REGISTER_FP_BASE + 26)
-#define SOFT_DEBUGGER_REGISTER_XMM9 (SOFT_DEBUGGER_REGISTER_FP_BASE + 27)
-#define SOFT_DEBUGGER_REGISTER_XMM10 (SOFT_DEBUGGER_REGISTER_FP_BASE + 28)
-#define SOFT_DEBUGGER_REGISTER_XMM11 (SOFT_DEBUGGER_REGISTER_FP_BASE + 29)
-#define SOFT_DEBUGGER_REGISTER_XMM12 (SOFT_DEBUGGER_REGISTER_FP_BASE + 30)
-#define SOFT_DEBUGGER_REGISTER_XMM13 (SOFT_DEBUGGER_REGISTER_FP_BASE + 31)
-#define SOFT_DEBUGGER_REGISTER_XMM14 (SOFT_DEBUGGER_REGISTER_FP_BASE + 32)
-#define SOFT_DEBUGGER_REGISTER_XMM15 (SOFT_DEBUGGER_REGISTER_FP_BASE + 33)
-#define SOFT_DEBUGGER_REGISTER_MM0 (SOFT_DEBUGGER_REGISTER_FP_BASE + 34)
-#define SOFT_DEBUGGER_REGISTER_MM1 (SOFT_DEBUGGER_REGISTER_FP_BASE + 35)
-#define SOFT_DEBUGGER_REGISTER_MM2 (SOFT_DEBUGGER_REGISTER_FP_BASE + 36)
-#define SOFT_DEBUGGER_REGISTER_MM3 (SOFT_DEBUGGER_REGISTER_FP_BASE + 37)
-#define SOFT_DEBUGGER_REGISTER_MM4 (SOFT_DEBUGGER_REGISTER_FP_BASE + 38)
-#define SOFT_DEBUGGER_REGISTER_MM5 (SOFT_DEBUGGER_REGISTER_FP_BASE + 39)
-#define SOFT_DEBUGGER_REGISTER_MM6 (SOFT_DEBUGGER_REGISTER_FP_BASE + 40)
-#define SOFT_DEBUGGER_REGISTER_MM7 (SOFT_DEBUGGER_REGISTER_FP_BASE + 41)
+#define SOFT_DEBUGGER_REGISTER_FP_BASE 0x30
-//
-// This below registers are for GDT, LDT, TSS
-//
-#define SOFT_DEBUGGER_REGISTER_OTHERS_BASE 100
-
-#define SOFT_DEBUGGER_REGISTER_CS_LIM (SOFT_DEBUGGER_REGISTER_OTHERS_BASE + 0)
-#define SOFT_DEBUGGER_REGISTER_SS_LIM (SOFT_DEBUGGER_REGISTER_OTHERS_BASE + 1)
-#define SOFT_DEBUGGER_REGISTER_GS_LIM (SOFT_DEBUGGER_REGISTER_OTHERS_BASE + 2)
-#define SOFT_DEBUGGER_REGISTER_FS_LIM (SOFT_DEBUGGER_REGISTER_OTHERS_BASE + 3)
-#define SOFT_DEBUGGER_REGISTER_ES_LIM (SOFT_DEBUGGER_REGISTER_OTHERS_BASE + 4)
-#define SOFT_DEBUGGER_REGISTER_DS_LIM (SOFT_DEBUGGER_REGISTER_OTHERS_BASE + 5)
-#define SOFT_DEBUGGER_REGISTER_LDT_LIM (SOFT_DEBUGGER_REGISTER_OTHERS_BASE + 6)
-#define SOFT_DEBUGGER_REGISTER_TSS_LIM (SOFT_DEBUGGER_REGISTER_OTHERS_BASE + 7)
-
-#define SOFT_DEBUGGER_REGISTER_CS_BAS (SOFT_DEBUGGER_REGISTER_OTHERS_BASE + 8)
-#define SOFT_DEBUGGER_REGISTER_SS_BAS (SOFT_DEBUGGER_REGISTER_OTHERS_BASE + 9)
-#define SOFT_DEBUGGER_REGISTER_GS_BAS (SOFT_DEBUGGER_REGISTER_OTHERS_BASE + 10)
-#define SOFT_DEBUGGER_REGISTER_FS_BAS (SOFT_DEBUGGER_REGISTER_OTHERS_BASE + 11)
-#define SOFT_DEBUGGER_REGISTER_ES_BAS (SOFT_DEBUGGER_REGISTER_OTHERS_BASE + 12)
-#define SOFT_DEBUGGER_REGISTER_DS_BAS (SOFT_DEBUGGER_REGISTER_OTHERS_BASE + 13)
-#define SOFT_DEBUGGER_REGISTER_LDT_BAS (SOFT_DEBUGGER_REGISTER_OTHERS_BASE + 14)
-#define SOFT_DEBUGGER_REGISTER_TSS_BAS (SOFT_DEBUGGER_REGISTER_OTHERS_BASE + 15)
-
-#define SOFT_DEBUGGER_REGISTER_CSAS (SOFT_DEBUGGER_REGISTER_OTHERS_BASE + 16)
-#define SOFT_DEBUGGER_REGISTER_SSAS (SOFT_DEBUGGER_REGISTER_OTHERS_BASE + 17)
-#define SOFT_DEBUGGER_REGISTER_GSAS (SOFT_DEBUGGER_REGISTER_OTHERS_BASE + 18)
-#define SOFT_DEBUGGER_REGISTER_FSAS (SOFT_DEBUGGER_REGISTER_OTHERS_BASE + 19)
-#define SOFT_DEBUGGER_REGISTER_ESAS (SOFT_DEBUGGER_REGISTER_OTHERS_BASE + 20)
-#define SOFT_DEBUGGER_REGISTER_DSAS (SOFT_DEBUGGER_REGISTER_OTHERS_BASE + 21)
-#define SOFT_DEBUGGER_REGISTER_LDTAS (SOFT_DEBUGGER_REGISTER_OTHERS_BASE + 22)
-#define SOFT_DEBUGGER_REGISTER_TSSAS (SOFT_DEBUGGER_REGISTER_OTHERS_BASE + 23)
-
-#define SOFT_DEBUGGER_REGISTER_IDT_LIM (SOFT_DEBUGGER_REGISTER_OTHERS_BASE + 24)
-#define SOFT_DEBUGGER_REGISTER_GDT_LIM (SOFT_DEBUGGER_REGISTER_OTHERS_BASE + 25)
-#define SOFT_DEBUGGER_REGISTER_IDT_BAS (SOFT_DEBUGGER_REGISTER_OTHERS_BASE + 26)
-#define SOFT_DEBUGGER_REGISTER_GDT_BAS (SOFT_DEBUGGER_REGISTER_OTHERS_BASE + 27)
-
-
-#define SOFT_DEBUGGER_MSR_EFER (0xC0000080)
+#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)
-//
-// Definition for the Index field for DEBUG_DATA_READ_REGISTER_GROUP
-//
-#define SOFT_DEBUGGER_REGISTER_GROUP_GPDRS32 1 //for cs,ds,es,fs,gs,ss,eflags,ebp,eip,esp,eax,ebx,ecx,edx,esi,edi,dr0,dr1,dr2,dr3,dr6,dr7
-#define SOFT_DEBUGGER_REGISTER_GROUP_SEGMENT_LIMITS32 2 //for cslim,sslim,gslim,fslim,eslim,dslim,ldtlim,tsslim
-#define SOFT_DEBUGGER_REGISTER_GROUP_SEGMENT_BASES32 3 //for csbas,ssbas,gsbas,fsbas,esbas,dsbas,ldtbas,tssbas
-
-#define SOFT_DEBUGGER_REGISTER_GROUP_SEGMENT64 4 //for cs,ds,es,fs,gs,ss
-#define SOFT_DEBUGGER_REGISTER_GROUP_GP2_64 5 //for eflags,rbp,rip,rsp
-#define SOFT_DEBUGGER_REGISTER_GROUP_GP64 6 //for rax,rbx,rcx,rdx,rsi,rdi,r8,r9,r10,r11,r12,r13,r14,r15
-#define SOFT_DEBUGGER_REGISTER_GROUP_DR64 7 //for dr0,dr1,dr2,dr3,dr6,dr7
-#define SOFT_DEBUGGER_REGISTER_GROUP_SEGMENT_BAS_LIM64 8 //for ldtbas,ldtlim,gdtbas,gdtlim,cslim,sslim,gslim,fslim,eslim,dslim,ldtlim,tsslim,csbas,ssbas,gsbas,fsbas,esbas,dsbas,ldtbas,tssbas
-#define SOFT_DEBUGGER_REGISTER_GROUP_SEGMENT_BASES64 9 //for idtr,tr,csas,ssas,gsas,fsas,esas,dsas,idtas,tssas
-#define SOFT_DEBUGGER_REGISTER_GROUP_CR64 10 //for cr0,cr2,cr3,cr4,cr8
-#define SOFT_DEBUGGER_REGISTER_GROUP_XMM64 11 //for xmm0,xmm1,xmm2,xmm3,xmm4,xmm5,xmm6,xmm7,xmm8,xmm9,xmm10,xmm11,xmm12,xmm13,xmm14,xmm15
+#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/SoftDebuggerDefinitions.h b/SourceLevelDebugPkg/Include/SoftDebuggerDefinitions.h
deleted file mode 100644
index 4e2b638227..0000000000
--- a/SourceLevelDebugPkg/Include/SoftDebuggerDefinitions.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/** @file
- Soft Debugger defintions. The definitions will also be used as part
- of debug transfer protocol. It is only intended to be used by Debug
- related module implementation.
-
- Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef __SOFT_DEBUGGER_DEFINITIONS_H__
-#define __SOFT_DEBUGGER_DEFINITIONS_H__
-
-//
-// Definition for processor mode (IA16, IA32, X64, ...)
-//
-#define SOFT_DEBUGGER_PROCESSOR_IA16 0
-#define SOFT_DEBUGGER_PROCESSOR_IA32 1
-#define SOFT_DEBUGGER_PROCESSOR_X64 2
-
-//
-// Break cause defintions
-//
-#define SOFT_DEBUGGER_BREAK_CAUSE_UNKNOWN 0
-#define SOFT_DEBUGGER_BREAK_CAUSE_HW_BREAKPOINT 1
-#define SOFT_DEBUGGER_BREAK_CAUSE_STEPPING 2
-#define SOFT_DEBUGGER_BREAK_CAUSE_SW_BREAKPOINT 3
-#define SOFT_DEBUGGER_BREAK_CAUSE_USER_HALT 4
-#define SOFT_DEBUGGER_BREAK_CAUSE_IMAGE_LOAD 5
-#define SOFT_DEBUGGER_BREAK_CAUSE_IMAGE_UNLOAD 6
-#define SOFT_DEBUGGER_BREAK_CAUSE_SYSTEM_RESET 7
-#define SOFT_DEBUGGER_BREAK_CAUSE_EXCEPTION 8
-
-#define SOFT_DEBUGGER_SETTING_SMM_ENTRY_BREAK 1
-
-#endif
diff --git a/SourceLevelDebugPkg/Include/TransferProtocol.h b/SourceLevelDebugPkg/Include/TransferProtocol.h
index af80a7450c..bb7b07b4e2 100644
--- a/SourceLevelDebugPkg/Include/TransferProtocol.h
+++ b/SourceLevelDebugPkg/Include/TransferProtocol.h
@@ -17,16 +17,25 @@
#define __TRANSFER_PROTOCOL_H__
#include "ProcessorContext.h"
-#include "SoftDebuggerDefinitions.h"
+
+//
+// Current revision of transfer protocol
+//
+#define DEBUG_AGENT_REVISION ((0 << 16) | 02)
+#define DEBUG_AGENT_CAPABILITIES 0
//
// Definitions for break command.
//
-#define DEBUG_STARTING_SYMBOL_BREAK (0x21) // '!'
-#define DEBUG_STARTING_SYMBOL_BREAK_STRING ("!")
+#define DEBUG_STARTING_SYMBOL_BREAK (0xFC)
+
+//
+// Definitions for attach 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.
+// 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)
@@ -34,22 +43,14 @@
#pragma pack(1)
//
-// Definition for common header for normal debug packets (not including break command)
+// Definition for debug packet header for normal debug packets (not including break/attach command)
//
typedef struct {
UINT8 StartSymbol;
UINT8 Command;
- UINT8 DataLength;
-} DEBUG_COMMAND_HEADER;
-
-//
-// Structure to facilitate debug packet header parsing or construction
-//
-typedef struct {
- UINT8 Command;
- UINT8 DataLength;
-} DEBUG_COMMAND_HEADER_NO_START_SYMBOL;
-
+ UINT8 Length; // Length of Debug Packet including header and payload in byte
+ UINT8 CheckSum;
+} DEBUG_PACKET_HEADER;
//
// Definition for Command field for debug packets
@@ -57,103 +58,79 @@ typedef struct {
#define DEBUG_COMMAND_REQUEST (0 << 7)
#define DEBUG_COMMAND_RESPONSE (1 << 7)
-
-
-#define DEBUG_COMMAND_RESET (DEBUG_COMMAND_REQUEST | 0) // 0
-
-#define DEBUG_COMMAND_GO (DEBUG_COMMAND_REQUEST | 1) // 1
-
-#define DEBUG_COMMAND_BREAK_CAUSE (DEBUG_COMMAND_REQUEST | 2) // 2
-
-#define DEBUG_COMMAND_SET_HW_BREAKPOINT (DEBUG_COMMAND_REQUEST | 3) // 3
-#define DEBUG_COMMAND_CLEAR_HW_BREAKPOINT (DEBUG_COMMAND_REQUEST | 4) // 4
-
-#define DEBUG_COMMAND_SINGLE_STEPPING (DEBUG_COMMAND_REQUEST | 5) // 5
-
-#define DEBUG_COMMAND_SET_SW_BREAKPOINT (DEBUG_COMMAND_REQUEST | 6) // 6
-#define DEBUG_COMMAND_CLEAR_SW_BREAKPOINT (DEBUG_COMMAND_REQUEST | 7) // 7
-
-#define DEBUG_COMMAND_READ_MEMORY_8 (DEBUG_COMMAND_REQUEST | 8) // 8
-#define DEBUG_COMMAND_READ_MEMORY_16 (DEBUG_COMMAND_REQUEST | 9) // 9
-#define DEBUG_COMMAND_READ_MEMORY_32 (DEBUG_COMMAND_REQUEST | 10) // 10
-#define DEBUG_COMMAND_READ_MEMORY_64 (DEBUG_COMMAND_REQUEST | 11) // 11
-
-#define DEBUG_COMMAND_WRITE_MEMORY_8 (DEBUG_COMMAND_REQUEST | 12) // 12
-#define DEBUG_COMMAND_WRITE_MEMORY_16 (DEBUG_COMMAND_REQUEST | 13) // 13
-#define DEBUG_COMMAND_WRITE_MEMORY_32 (DEBUG_COMMAND_REQUEST | 14) // 14
-#define DEBUG_COMMAND_WRITE_MEMORY_64 (DEBUG_COMMAND_REQUEST | 15) // 15
-
-#define DEBUG_COMMAND_READ_IO (DEBUG_COMMAND_REQUEST | 16) // 16
-#define DEBUG_COMMAND_WRITE_IO (DEBUG_COMMAND_REQUEST | 20) // 20
-
-#define DEBUG_COMMAND_READ_REGISTER (DEBUG_COMMAND_REQUEST | 24) // 24
-#define DEBUG_COMMAND_WRITE_REGISTER (DEBUG_COMMAND_REQUEST | 26) // 26
-
-#define DEBUG_COMMAND_STEP_OVER (DEBUG_COMMAND_REQUEST | 28) // 28
-#define DEBUG_COMMAND_STEP_OUT (DEBUG_COMMAND_REQUEST | 29) // 29
-#define DEBUG_COMMAND_STEP_BRANCH (DEBUG_COMMAND_REQUEST | 30) // 30
-
-#define DEBUG_COMMAND_ARCH_MODE (DEBUG_COMMAND_REQUEST | 34) // 34
-
-#define DEBUG_COMMAND_READ_MSR (DEBUG_COMMAND_REQUEST | 35) // 35
-#define DEBUG_COMMAND_WRITE_MSR (DEBUG_COMMAND_REQUEST | 36) // 36
-
-#define DEBUG_COMMAND_READ_REGISTER_GROUP (DEBUG_COMMAND_REQUEST | 37) // 37
-
-#define DEBUG_COMMAND_SET_DEBUG_FLAG (DEBUG_COMMAND_REQUEST | 38) // 38
-
-#define DEBUG_COMMAND_GET_REVISION (DEBUG_COMMAND_REQUEST | 39) // 39
-
-#define DEBUG_COMMAND_GET_EXCEPTION (DEBUG_COMMAND_REQUEST | 40) // 40
-
-#define DEBUG_COMMAND_SET_VIEWPOINT (DEBUG_COMMAND_REQUEST | 41) // 41
-
-#define DEBUG_COMMAND_GET_VIEWPOINT (DEBUG_COMMAND_REQUEST | 42) // 42
-
-//
-// The below are target side initiated commands.
//
-#define DEBUG_COMMAND_INIT_BREAK (DEBUG_COMMAND_REQUEST | 63) // 63
-#define DEBUG_COMMAND_BREAK_POINT (DEBUG_COMMAND_REQUEST | 62) // 62
-#define DEBUG_COMMAND_MEMORY_READY (DEBUG_COMMAND_REQUEST | 61) // 61
-
-#define DEBUG_COMMAND_OK (DEBUG_COMMAND_RESPONSE | 0)
-#define DEBUG_COMMAND_RESEND (DEBUG_COMMAND_RESPONSE | 1)
-#define DEBUG_COMMAND_ABORT (DEBUG_COMMAND_RESPONSE | 2)
-
-//
-// The below 2 commands are used when transferring big data (like > ~250 bytes). The sequence is:
-// Host Macine Target Macine
-// Request =>
-// <= IN_PROGRESS with part of the 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 | 3) // Used when trying to
-#define DEBUG_COMMAND_CONTINUE (DEBUG_COMMAND_RESPONSE | 4) // Used when trying to transfer big data (like > ~250 bytes)
-
-//
-// The below 2 commands are used to support deferred halt. HALT_DEFERRED will be returned when a halt request received while target is already in inter-active mode.
-// HALT_PROCESSED will be return as a possible return value for GO command, if target has a pending halt request.
-//
-#define DEBUG_COMMAND_HALT_DEFERRED (DEBUG_COMMAND_RESPONSE | 5)
-#define DEBUG_COMMAND_HALT_PROCESSED (DEBUG_COMMAND_RESPONSE | 6)
-
-#define DEBUG_COMMAND_TIMEOUT (DEBUG_COMMAND_RESPONSE | 7)
-#define DEBUG_COMMAND_NOT_SUPPORTED (DEBUG_COMMAND_RESPONSE | 15)
+// 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)
+
+//
+// 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)
+
+//
+// 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_MAXIMUM_LENGTH_FOR_SMALL_COMMANDS 20
-
-#define DEBUG_DATA_UPPER_LIMIT 0xff // This is the upper limit for the data size, by the limit of the packet header definition.
-
-#define DEBUG_DATA_MAXIMUM_REAL_DATA 0xf8
+#define DEBUG_DATA_UPPER_LIMIT 0xff // Upper limit for the data size, by the limit of the packet header definition.
-#define DEBUG_DEFINITION_MAX_IO_LENGTH 4
+#define DEBUG_DATA_MAXIMUM_REAL_DATA (DEBUG_DATA_UPPER_LIMIT - sizeof (DEBUG_PACKET_HEADER))
//
// Response data for DEBUG_COMMAND_BREAK_CAUSE
@@ -162,7 +139,6 @@ typedef struct {
UINT8 Cause;
UINT64 StopAddress;
} DEBUG_DATA_RESPONSE_BREAK_CAUSE;
-
//
// Break type defintions for DEBUG_DATA_BREAK_CAUSE
//
@@ -183,7 +159,6 @@ typedef struct {
typedef struct {
UINT8 CpuMode;
} DEBUG_DATA_RESPONSE_ARCH_MODE;
-
//
// Cpu architecture defintions for DEBUG_DATA_RESPONSE_ARCH_MODE
//
@@ -191,28 +166,23 @@ typedef struct {
#define DEBUG_DATA_BREAK_CPU_ARCH_IA32 1
#define DEBUG_DATA_BREAK_CPU_ARCH_X64 2
-//
-// Command and response data for DEBUG_COMMAND_XX_YY_BREAKPOINT
-//
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 (0x11)
-#define DEBUG_DATA_BREAKPOINT_IO_ACCESS (0x10)
-#define DEBUG_DATA_BREAKPOINT_MEMORY_WRITE (0x01)
-#define DEBUG_DATA_BREAKPOINT_MEMORY_EXECUTE (0x00)
-
-#define DEBUG_DATA_BREAKPOINT_LENGTH_64 (0x11)
-#define DEBUG_DATA_BREAKPOINT_LENGTH_32 (0x10)
-#define DEBUG_DATA_BREAKPOINT_LENGTH_16 (0x01)
-#define DEBUG_DATA_BREAKPOINT_LENGTH_8 (0x00)
+#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)
//
-// Command data for DEBUG_COMMAND_SET_HW_BREAKPOINT
+// Request data for DEBUG_COMMAND_SET_HW_BREAKPOINT
//
typedef struct {
DEBUG_DATA_BREAKPOINT_TYPE Type;
@@ -220,119 +190,92 @@ typedef struct {
} DEBUG_DATA_SET_HW_BREAKPOINT;
//
-// Command data for DEBUG_COMMAND_CLEAR_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;
//
-// Command data for DEBUG_COMMAND_SET_SW_BREAKPOINT
+// Request and response data for DEBUG_COMMAND_SET_SW_BREAKPOINT
//
typedef struct {
UINT64 Address;
} DEBUG_DATA_SET_SW_BREAKPOINT;
-//
-// Response data for DEBUG_COMMAND_SET_SW_BREAKPOINT
-//
typedef struct {
UINT8 OriginalData;
} DEBUG_DATA_RESPONSE_SET_SW_BREAKPOINT;
//
-// Command data for DEBUG_COMMAND_CLEAR_SW_BREAKPOINT
-//
-typedef DEBUG_DATA_SET_SW_BREAKPOINT DEBUG_DATA_CLEAR_SW_BREAKPOINT;
-
-//
-// Command data for DEBUG_COMMAND_READ_MEMORY_XX
+// Request data for DEBUG_COMMAND_READ_MEMORY
//
typedef struct {
UINT64 Address;
+ UINT8 Width;
UINT16 Count;
-} DEBUG_DATA_READ_MEMORY_8;
-
-typedef DEBUG_DATA_READ_MEMORY_8 DEBUG_DATA_READ_MEMORY_16;
-
-typedef DEBUG_DATA_READ_MEMORY_8 DEBUG_DATA_READ_MEMORY_32;
-
-typedef DEBUG_DATA_READ_MEMORY_8 DEBUG_DATA_READ_MEMORY_64;
+} DEBUG_DATA_READ_MEMORY;
//
-// Command data for DEBUG_COMMAND_WRITE_MEMORY_XX
+// Request data for DEBUG_COMMAND_WRITE_MEMORY
//
typedef struct {
UINT64 Address;
+ UINT8 Width;
UINT16 Count;
- UINT8 Data; // The actual length for this field is decided by Width x Count
-} DEBUG_DATA_WRITE_MEMORY_8;
-
-typedef DEBUG_DATA_WRITE_MEMORY_8 DEBUG_DATA_WRITE_MEMORY_16;
-
-typedef DEBUG_DATA_WRITE_MEMORY_8 DEBUG_DATA_WRITE_MEMORY_32;
-
-typedef DEBUG_DATA_WRITE_MEMORY_8 DEBUG_DATA_WRITE_MEMORY_64;
+ UINT8 Data[1]; // The actual length is (Width * Count)
+} DEBUG_DATA_WRITE_MEMORY;
//
-// Command data for DEBUG_COMMAND_READ_IO
+// Request and response data for DEBUG_COMMAND_READ_IO
//
typedef struct {
- UINT16 Port;
+ UINT64 Port;
UINT8 Width;
} DEBUG_DATA_READ_IO;
-//
-// Response data for DEBUG_COMMAND_READ_IO
-//
typedef struct {
- UINT8 Data; // The actual length of this structure will be adjusted according to the Width field
+ UINT8 Data[1]; // The actual length depends on the packet header
} DEBUG_DATA_RESPONSE_READ_IO;
//
-// Command data for DEBUG_COMMAND_WRITE_IO
+// Request data for DEBUG_COMMAND_WRITE_IO
//
typedef struct {
- UINT16 Port;
+ UINT64 Port;
UINT8 Width;
- UINT8 Data; // The actual length of this structure will be adjusted according to the Width field
+ UINT8 Data[1]; // The actual length is Width
} DEBUG_DATA_WRITE_IO;
//
-// Command data for DEBUG_COMMAND_READ_REGISTER
+// Request data for DEBUG_COMMAND_READ_REGISTER
//
typedef struct {
- UINT8 Index; // defined as DEBUG_DEFINITION_REGISTER_XX
- UINT8 Offset:4;
- UINT8 Length:4;
+ UINT8 Index; // defined as SOFT_DEBUGGER_REGISTER_XX
} DEBUG_DATA_READ_REGISTER;
//
-// Command data for DEBUG_COMMAND_WRITE_REGISTER
+// Request data for DEBUG_COMMAND_WRITE_REGISTER
//
typedef struct {
- UINT8 Index; // defined as DEBUG_DEFINITION_REGISTER_XX
- UINT8 Offset:4;
- UINT8 Length:4;
- UINT64 Value;
+ UINT8 Index; // defined as SOFT_DEBUGGER_REGISTER_XX
+ UINT8 Length;
+ UINT8 Data[1]; // The actual length is Length
} DEBUG_DATA_WRITE_REGISTER;
//
-// Command data for DEBUG_COMMAND_READ_MSR
+// Request and response data for DEBUG_COMMAND_READ_MSR
//
typedef struct {
UINT32 Index;
} DEBUG_DATA_READ_MSR;
-//
-// Response data for DEBUG_COMMAND_READ_MSR
-//
typedef struct {
UINT64 Value;
} DEBUG_DATA_RESPONSE_READ_MSR;
//
-// Command data for DEBUG_COMMAND_WRITE_MSR
+// Request data for DEBUG_COMMAND_WRITE_MSR
//
typedef struct {
UINT32 Index;
@@ -340,14 +283,6 @@ typedef struct {
} DEBUG_DATA_WRITE_MSR;
//
-// Command data for DEBUG_COMMAND_READ_REGISTER_GROUP
-//
-typedef struct {
- // For possible values, refer to the definition for DEBUG_DEFINITION_REGISTER_GROUP_XXX (in another .h file as it is architecture specific)
- UINT8 Index;
-} DEBUG_DATA_READ_REGISTER_GROUP;
-
-//
// Response data for DEBUG_COMMAND_GET_REVISION
//
typedef struct {
@@ -360,24 +295,31 @@ typedef struct {
//
typedef struct {
UINT8 ExceptionNum;
- UINT64 ExceptionData;
+ UINT32 ExceptionData;
} DEBUG_DATA_RESPONSE_GET_EXCEPTION;
-typedef struct {
- UINT8 DRn; // The index of DR register which to be used as temporary breakpoint
-} DEBUG_DATA_STEP_OVER;
-
//
-// Command data for DEBUG_COMMAND_SET_DEBUG_FLAG
+// Request data for DEBUG_DATA_SET_DEBUG_SETTING
//
typedef struct {
- UINT32 DebugFlag; // The index of DR register which to be used as temporary breakpoint
-} DEBUG_DATA_SET_DEBUG_FLAG;
+ 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
+//
+// 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
//
-// Command data for DEBUG_COMMAND_SET_VIEWPOINT
-// If viewpoint is changed successfully, DEBUG_COMMAND_OK will be returned.
-// If viewpoint is not availabe, DEBUG_COMMAND_NOT_SUPPORTED will be returned.
+// Request data for DEBUG_COMMAND_SET_VIEWPOINT
//
typedef struct {
UINT32 ViewPoint; // The index of viewpoint will be set
@@ -390,19 +332,38 @@ typedef struct {
UINT32 ViewPoint; // The index of viewpoint will be returned
} DEBUG_DATA_RESPONSE_GET_VIEWPOINT;
-#pragma pack()
+//
+// 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;
-#define DEBUG_PACKET_CONSTRUCTOR_WITH_NO_DATA(DebugPacket,ShortCommandType) \
- ((DEBUG_COMMAND_HEADER *)DebugPacket)->StartSymbol = DEBUG_STARTING_SYMBOL_NORMAL; \
- ((DEBUG_COMMAND_HEADER *)DebugPacket)->Command = DEBUG_COMMAND_##ShortCommandType; \
- ((DEBUG_COMMAND_HEADER *)DebugPacket)->DataLength = 0;
-
-#define DEBUG_PACKET_CONSTRUCTOR_WITH_DATA(DebugPacket,ShortCommandType, DebugPacketDataPointer, PacketLength) \
- ((DEBUG_COMMAND_HEADER *)DebugPacket)->StartSymbol = DEBUG_STARTING_SYMBOL_NORMAL; \
- ((DEBUG_COMMAND_HEADER *)DebugPacket)->Command = DEBUG_COMMAND_##ShortCommandType; \
- ((DEBUG_COMMAND_HEADER *)DebugPacket)->DataLength = sizeof (DEBUG_DATA_##ShortCommandType); \
- *DebugPacketDataPointer = (DEBUG_DATA_##ShortCommandType *)((DEBUG_COMMAND_HEADER *)DebugPacket+1); \
- *PacketLength = sizeof (DEBUG_COMMAND_HEADER) + sizeof (DEBUG_DATA_##ShortCommandType);
+//
+// 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