11extern EDB_DISASM_INSTRUCTION mEdbDisasmInstructionTable[];
14 CHAR16 Name[EDB_INSTRUCTION_NAME_MAX_LENGTH];
15 CHAR16 Content[EDB_INSTRUCTION_CONTENT_MAX_LENGTH];
20UINTN mInstructionNameOffset;
21UINTN mInstructionContentOffset;
34 IN UINTN InstructionContentOffset
37 mInstructionNameOffset = InstructionNameOffset;
38 mInstructionContentOffset = InstructionContentOffset;
55 ZeroMem (&mInstructionString,
sizeof (mInstructionString));
56 mInstructionNameOffset = 0;
57 mInstructionContentOffset = 0;
59 return (CHAR16 *)&mInstructionString;
76 for (Char = (CHAR16 *)&mInstructionString; Char < &mInstructionString.Tail; Char++) {
82 mInstructionString.Tail = 0;
84 mInstructionNameOffset = 0;
85 mInstructionContentOffset = 0;
87 return (CHAR16 *)&mInstructionString;
109 UINTN NaturalUnitBit;
111 Sign = (BOOLEAN)(Data16 >> 15);
112 NaturalUnitBit = (
UINTN)((Data16 >> 12) & 0x7);
114 Data16 = Data16 & 0xFFF;
115 *NaturalUnits = (
UINTN)(Data16 & ((1 << NaturalUnitBit) - 1));
116 *ConstantUnits = (
UINTN)((Data16 >> NaturalUnitBit) & ((1 << (12 - NaturalUnitBit)) - 1));
140 UINTN NaturalUnitBit;
142 Sign = (BOOLEAN)(Data32 >> 31);
143 NaturalUnitBit = (
UINTN)((Data32 >> 28) & 0x7);
145 Data32 = Data32 & 0xFFFFFFF;
146 *NaturalUnits = (
UINTN)(Data32 & ((1 << NaturalUnitBit) - 1));
147 *ConstantUnits = (
UINTN)((Data32 >> NaturalUnitBit) & ((1 << (28 - NaturalUnitBit)) - 1));
166 OUT UINT64 *NaturalUnits,
167 OUT UINT64 *ConstantUnits
171 UINTN NaturalUnitBit;
177 *NaturalUnits = (UINT64)(Data64 & (
LShiftU64 (1, NaturalUnitBit) - 1));
178 *ConstantUnits = (UINT64)(
RShiftU64 (Data64, NaturalUnitBit) & (
LShiftU64 (1, (60 - NaturalUnitBit)) - 1));
197 if (Value >= 10000000000000) {
199 }
else if (Value >= 1000000000000) {
201 }
else if (Value >= 100000000000) {
203 }
else if (Value >= 10000000000) {
205 }
else if (Value >= 1000000000) {
207 }
else if (Value >= 100000000) {
209 }
else if (Value >= 10000000) {
211 }
else if (Value >= 1000000) {
213 }
else if (Value >= 100000) {
215 }
else if (Value >= 10000) {
217 }
else if (Value >= 1000) {
219 }
else if (Value >= 100) {
221 }
else if (Value >= 10) {
243 mInstructionString.Name,
244 EDB_INSTRUCTION_NAME_MAX_SIZE,
245 mInstructionNameOffset,
249 mInstructionNameOffset +=
StrLen (Name);
251 return mInstructionNameOffset;
268 if ((Operands & OPERAND_M_INDIRECT1) != 0) {
270 mInstructionString.Content,
271 EDB_INSTRUCTION_CONTENT_MAX_SIZE,
272 mInstructionContentOffset,
275 mInstructionContentOffset += 1;
279 mInstructionString.Content,
280 EDB_INSTRUCTION_CONTENT_MAX_SIZE,
281 mInstructionContentOffset,
283 (
UINTN)(Operands & OPERAND_M_OP1)
285 mInstructionContentOffset += 2;
287 return mInstructionContentOffset;
304 if ((Operands & OPERAND_M_INDIRECT2) != 0) {
306 mInstructionString.Content,
307 EDB_INSTRUCTION_CONTENT_MAX_SIZE,
308 mInstructionContentOffset,
311 mInstructionContentOffset += 1;
315 mInstructionString.Content,
316 EDB_INSTRUCTION_CONTENT_MAX_SIZE,
317 mInstructionContentOffset,
319 (
UINTN)((Operands & OPERAND_M_OP2) >> 4)
321 mInstructionContentOffset += 2;
323 return mInstructionContentOffset;
340 switch (Operands & OPERAND_M_OP1) {
343 mInstructionString.Content,
344 EDB_INSTRUCTION_CONTENT_MAX_SIZE,
345 mInstructionContentOffset,
348 mInstructionContentOffset += 7;
352 mInstructionString.Content,
353 EDB_INSTRUCTION_CONTENT_MAX_SIZE,
354 mInstructionContentOffset,
357 mInstructionContentOffset += 4;
361 return mInstructionContentOffset;
378 switch ((Operands & OPERAND_M_OP2) >> 4) {
381 mInstructionString.Content,
382 EDB_INSTRUCTION_CONTENT_MAX_SIZE,
383 mInstructionContentOffset,
386 mInstructionContentOffset += 7;
390 mInstructionString.Content,
391 EDB_INSTRUCTION_CONTENT_MAX_SIZE,
392 mInstructionContentOffset,
395 mInstructionContentOffset += 4;
399 return mInstructionContentOffset;
421 mInstructionString.Content,
422 EDB_INSTRUCTION_CONTENT_MAX_SIZE,
423 mInstructionContentOffset,
432 return mInstructionContentOffset;
449 IN UINT64 NaturalUnits,
450 IN UINT64 ConstantUnits
454 mInstructionString.Content,
455 EDB_INSTRUCTION_CONTENT_MAX_SIZE,
456 mInstructionContentOffset,
465 return mInstructionContentOffset;
534 UINT64 ConstantUnits;
558 mInstructionString.Content,
559 EDB_INSTRUCTION_CONTENT_MAX_SIZE,
560 mInstructionContentOffset,
564 mInstructionContentOffset += 6;
566 return mInstructionContentOffset;
584 mInstructionString.Content,
585 EDB_INSTRUCTION_CONTENT_MAX_SIZE,
586 mInstructionContentOffset,
590 mInstructionContentOffset += 8;
592 return mInstructionContentOffset;
610 mInstructionString.Content,
611 EDB_INSTRUCTION_CONTENT_MAX_SIZE,
612 mInstructionContentOffset,
616 mInstructionContentOffset += 12;
618 return mInstructionContentOffset;
636 mInstructionString.Content,
637 EDB_INSTRUCTION_CONTENT_MAX_SIZE,
638 mInstructionContentOffset,
642 mInstructionContentOffset += 20;
644 return mInstructionContentOffset;
662 mInstructionString.Content,
663 EDB_INSTRUCTION_CONTENT_MAX_SIZE,
664 mInstructionContentOffset,
668 mInstructionContentOffset = mInstructionContentOffset + 2 +
EdbGetBitWidth (Data);
670 return mInstructionContentOffset;
688 mInstructionString.Content,
689 EDB_INSTRUCTION_CONTENT_MAX_SIZE,
690 mInstructionContentOffset,
694 mInstructionContentOffset = mInstructionContentOffset + 2 +
EdbGetBitWidth (Data64);
696 return mInstructionContentOffset;
714 mInstructionString.Content,
715 EDB_INSTRUCTION_CONTENT_MAX_SIZE,
716 mInstructionContentOffset,
720 mInstructionContentOffset += 4;
722 return mInstructionContentOffset;
740 mInstructionString.Content,
741 EDB_INSTRUCTION_CONTENT_MAX_SIZE,
742 mInstructionContentOffset,
746 mInstructionContentOffset += 6;
748 return mInstructionContentOffset;
766 mInstructionString.Content,
767 EDB_INSTRUCTION_CONTENT_MAX_SIZE,
768 mInstructionContentOffset,
772 mInstructionContentOffset += 10;
774 return mInstructionContentOffset;
792 mInstructionString.Content,
793 EDB_INSTRUCTION_CONTENT_MAX_SIZE,
794 mInstructionContentOffset,
798 mInstructionContentOffset += 18;
800 return mInstructionContentOffset;
818 mInstructionString.Content,
819 EDB_INSTRUCTION_CONTENT_MAX_SIZE,
820 mInstructionContentOffset,
824 mInstructionContentOffset = mInstructionContentOffset +
EdbGetBitWidth (Data);
826 return mInstructionContentOffset;
844 mInstructionString.Content,
845 EDB_INSTRUCTION_CONTENT_MAX_SIZE,
846 mInstructionContentOffset,
850 mInstructionContentOffset = mInstructionContentOffset +
EdbGetBitWidth (Data64);
852 return mInstructionContentOffset;
871 Sign = (BOOLEAN)(Data8 >> 7);
874 mInstructionString.Content,
875 EDB_INSTRUCTION_CONTENT_MAX_SIZE,
876 mInstructionContentOffset,
879 (
UINTN)(Data8 & 0x7F)
881 mInstructionContentOffset = mInstructionContentOffset + 1 +
EdbGetBitWidth (Data8 & 0x7F);
883 return mInstructionContentOffset;
902 Sign = (BOOLEAN)(Data16 >> 15);
905 mInstructionString.Content,
906 EDB_INSTRUCTION_CONTENT_MAX_SIZE,
907 mInstructionContentOffset,
910 (
UINTN)(Data16 & 0x7FFF)
912 mInstructionContentOffset = mInstructionContentOffset + 1 +
EdbGetBitWidth (Data16 & 0x7FFF);
914 return mInstructionContentOffset;
933 Sign = (BOOLEAN)(Data32 >> 31);
936 mInstructionString.Content,
937 EDB_INSTRUCTION_CONTENT_MAX_SIZE,
938 mInstructionContentOffset,
941 (
UINTN)(Data32 & 0x7FFFFFFF)
943 mInstructionContentOffset = mInstructionContentOffset + 1 +
EdbGetBitWidth (Data32 & 0x7FFFFFFF);
945 return mInstructionContentOffset;
969 mInstructionString.Content,
970 EDB_INSTRUCTION_CONTENT_MAX_SIZE,
971 mInstructionContentOffset,
976 mInstructionContentOffset = mInstructionContentOffset + 1 +
EdbGetBitWidth (Data64s);
978 return mInstructionContentOffset;
994 mInstructionString.Content,
995 EDB_INSTRUCTION_CONTENT_MAX_SIZE,
996 mInstructionContentOffset,
999 mInstructionContentOffset += 2;
1001 return mInstructionContentOffset;
1022 if (SymbolStr !=
NULL) {
1024 mInstructionString.Content,
1025 EDB_INSTRUCTION_CONTENT_MAX_SIZE,
1026 mInstructionContentOffset,
1056 if (InstructionNumber == 0) {
1060 LineNumber = InstructionNumber / EDB_BYTECODE_NUMBER_IN_LINE;
1061 ByteNumber = InstructionNumber % EDB_BYTECODE_NUMBER_IN_LINE;
1062 if (ByteNumber == 0) {
1064 ByteNumber = EDB_BYTECODE_NUMBER_IN_LINE;
1071 if (SymbolStr !=
NULL) {
1075 for (LineIndex = 0; LineIndex < LineNumber; LineIndex++) {
1076 EDBPrint (EDB_PRINT_ADDRESS_FORMAT, (
UINTN)InstructionAddress);
1077 for (ByteIndex = 0; ByteIndex < EDB_BYTECODE_NUMBER_IN_LINE; ByteIndex++) {
1079 InstructionAddress += 1;
1085 EDBPrint (EDB_PRINT_ADDRESS_FORMAT, (
UINTN)InstructionAddress);
1086 for (ByteIndex = 0; ByteIndex < ByteNumber; ByteIndex++) {
1088 InstructionAddress += 1;
1091 for (ByteIndex = 0; ByteIndex < EDB_BYTECODE_NUMBER_IN_LINE - ByteNumber; ByteIndex++) {
1115 UINTN InstructionNumber;
1116 UINTN InstructionLength;
1118 CHAR16 *InstructionString;
1122 InstructionAddress = DebuggerPrivate->InstructionScope;
1123 for (InstructionNumber = 0; InstructionNumber < DebuggerPrivate->InstructionNumber; InstructionNumber++) {
1127 if (((InstructionNumber % EFI_DEBUGGER_LINE_NUMBER_IN_PAGE) == 0) &&
1128 (InstructionNumber != 0))
1135 Opcode = GET_OPCODE (InstructionAddress);
1136 if ((Opcode < OPCODE_MAX) && (mEdbDisasmInstructionTable[Opcode] !=
NULL)) {
1137 InstructionLength = mEdbDisasmInstructionTable[Opcode](InstructionAddress, SystemContext, &InstructionString);
1138 if (InstructionLength != 0) {
1144 if (!DebuggerPrivate->DebuggerSymbolContext.DisplayCodeOnly) {
1145 EdbPrintRaw (InstructionAddress, InstructionLength);
1146 if (InstructionString !=
NULL) {
1147 EDBPrint (L
"%s\n", InstructionString);
1149 EDBPrint (L
"%s\n", L
"<Unknown Instruction>");
1155 InstructionAddress += InstructionLength;
1160 EdbPrintRaw (InstructionAddress, EDB_BYTECODE_NUMBER_IN_LINE);
1161 EDBPrint (L
"%s\n", L
"<Bad Instruction>");
1168 EdbPrintRaw (InstructionAddress, EDB_BYTECODE_NUMBER_IN_LINE);
1169 EDBPrint (L
"%s\n", L
"<Bad Instruction>");
1195 return SystemContext.SystemContextEbc->R0;
1197 return SystemContext.SystemContextEbc->R1;
1199 return SystemContext.SystemContextEbc->R2;
1201 return SystemContext.SystemContextEbc->R3;
1203 return SystemContext.SystemContextEbc->R4;
1205 return SystemContext.SystemContextEbc->R5;
1207 return SystemContext.SystemContextEbc->R6;
1209 return SystemContext.SystemContextEbc->R7;
UINT64 EFIAPI RShiftU64(IN UINT64 Operand, IN UINTN Count)
UINT64 EFIAPI LShiftU64(IN UINT64 Operand, IN UINTN Count)
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
UINTN EdbPrintImmData64(IN UINT64 Data)
UINTN EdbPrintRawIndexData16(IN UINT16 Data16)
UINTN EdbPrintIndexData(IN BOOLEAN Sign, IN UINTN NaturalUnits, IN UINTN ConstantUnits)
UINTN EdbPrintData64n(IN UINT64 Data64)
UINTN EdbPrintInstructionName(IN CHAR16 *Name)
VOID EdbSetOffset(IN UINTN InstructionNameOffset, IN UINTN InstructionContentOffset)
UINTN EdbPrintData64s(IN UINT64 Data64)
UINTN EdbPrintData8s(IN UINT8 Data8)
UINTN EdbPrintRegister1(IN UINT8 Operands)
UINTN EdbPrintImmData64n(IN UINT64 Data64)
BOOLEAN EdbGetNaturalIndex16(IN UINT16 Data16, OUT UINTN *NaturalUnits, OUT UINTN *ConstantUnits)
UINTN EdbPrintData16s(IN UINT16 Data16)
VOID EdbPrintRaw(IN EFI_PHYSICAL_ADDRESS InstructionAddress, IN UINTN InstructionNumber)
CHAR16 * EdbPreInstructionString(VOID)
UINTN EdbPrintImmData32(IN UINT32 Data)
UINTN EdbPrintIndexData64(IN BOOLEAN Sign, IN UINT64 NaturalUnits, IN UINT64 ConstantUnits)
UINTN EdbPrintData32s(IN UINT32 Data32)
BOOLEAN EdbGetNaturalIndex32(IN UINT32 Data32, OUT UINTN *NaturalUnits, OUT UINTN *ConstantUnits)
EFI_STATUS EdbShowDisasm(IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate, IN EFI_SYSTEM_CONTEXT SystemContext)
UINTN EdbPrintImmData8(IN UINT8 Data)
UINTN EdbPrintDatan(IN UINTN Data)
UINTN EdbPrintImmData16(IN UINT16 Data)
CHAR16 * EdbPostInstructionString(VOID)
UINTN EdbPrintRawIndexData32(IN UINT32 Data32)
UINTN EdbPrintData8(IN UINT8 Data8)
UINT8 EdbGetBitWidth(IN UINT64 Value)
UINT64 GetRegisterValue(IN EFI_SYSTEM_CONTEXT SystemContext, IN UINT8 Index)
UINTN EdbPrintRawIndexData64(IN UINT64 Data64)
UINTN EdbPrintData16(IN UINT16 Data16)
UINTN EdbPrintDedicatedRegister1(IN UINT8 Operands)
UINTN EdbPrintDedicatedRegister2(IN UINT8 Operands)
UINTN EdbPrintComma(VOID)
UINTN EdbFindAndPrintSymbol(IN UINTN Address)
BOOLEAN EdbGetNaturalIndex64(IN UINT64 Data64, OUT UINT64 *NaturalUnits, OUT UINT64 *ConstantUnits)
UINTN EdbPrintRegister2(IN UINT8 Operands)
UINTN EdbPrintData32(IN UINT32 Data32)
UINTN EdbPrintImmDatan(IN UINTN Data)
UINTN EdbPrintData64(IN UINT64 Data64)
BOOLEAN EFIAPI SetPageBreak(VOID)
UINTN EFIAPI EDBPrint(IN CONST CHAR16 *Format,...)
UINTN EFIAPI EDBSPrintWithOffset(OUT CHAR16 *Buffer, IN INTN BufferSize, IN UINTN Offset, IN CONST CHAR16 *Format,...)
UINTN EdbPrintSource(IN UINTN Address, IN BOOLEAN IsPrint)
CHAR8 * FindSymbolStr(IN UINTN Address)
UINT64 EFI_PHYSICAL_ADDRESS