3 Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
4 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #ifndef _EFI_EDB_DISASM_SUPPORT_H_
10 #define _EFI_EDB_DISASM_SUPPORT_H_
14 #define EDB_BYTECODE_NUMBER_IN_LINE 5
17 #define EDB_PRINT_ADDRESS_FORMAT L"%08x: "
19 // To use 012l instead of 016l because space is not enough
20 #define EDB_PRINT_ADDRESS_FORMAT L"%012lx: "
23 #define OPCODE_MAX 0x40
25 #define EDB_INSTRUCTION_NAME_MAX_LENGTH 10
26 #define EDB_INSTRUCTION_NAME_MAX_SIZE (EDB_INSTRUCTION_NAME_MAX_LENGTH * sizeof(CHAR16))
27 #define EDB_INSTRUCTION_CONTENT_MAX_LENGTH 30
28 #define EDB_INSTRUCTION_CONTENT_MAX_SIZE (EDB_INSTRUCTION_CONTENT_MAX_LENGTH * sizeof(CHAR16))
32 Set offset for Instruction name and content.
34 @param InstructionNameOffset - Instruction name offset
35 @param InstructionContentOffset - Instruction content offset
40 IN UINTN InstructionNameOffset
,
41 IN UINTN InstructionContentOffset
46 Pre instruction string construction.
48 @return Instruction string
52 EdbPreInstructionString (
58 Post instruction string construction.
60 @return Instruction string
64 EdbPostInstructionString (
70 Print the instruction name.
72 @param Name - instruction name
74 @return Instruction name offset
78 EdbPrintInstructionName (
84 Get Sign, NaturalUnits, and ConstantUnits of the WORD data.
86 @param Data16 - WORD data
87 @param NaturalUnits - Natural Units of the WORD
88 @param ConstantUnits - Constant Units of the WORD
90 @return Sign value of WORD
94 EdbGetNaturalIndex16 (
96 OUT UINTN
*NaturalUnits
,
97 OUT UINTN
*ConstantUnits
102 Get Sign, NaturalUnits, and ConstantUnits of the DWORD data.
104 @param Data32 - DWORD data
105 @param NaturalUnits - Natural Units of the DWORD
106 @param ConstantUnits - Constant Units of the DWORD
108 @return Sign value of DWORD
112 EdbGetNaturalIndex32 (
114 OUT UINTN
*NaturalUnits
,
115 OUT UINTN
*ConstantUnits
120 Get Sign, NaturalUnits, and ConstantUnits of the QWORD data.
122 @param Data64 - QWORD data
123 @param NaturalUnits - Natural Units of the QWORD
124 @param ConstantUnits - Constant Units of the QWORD
126 @return Sign value of QWORD
130 EdbGetNaturalIndex64 (
132 OUT UINT64
*NaturalUnits
,
133 OUT UINT64
*ConstantUnits
138 Print the hexical WORD raw index data to instruction content.
140 @param Data16 - WORD data
142 @return Instruction content offset
146 EdbPrintRawIndexData16 (
152 Print the hexical DWORD raw index data to instruction content.
154 @param Data32 - DWORD data
156 @return Instruction content offset
160 EdbPrintRawIndexData32 (
166 Print the hexical QWORD raw index data to instruction content.
168 @param Data64 - QWORD data
170 @return Instruction content offset
174 EdbPrintRawIndexData64 (
180 Print register 1 in operands.
182 @param Operands - instruction operands
184 @return Instruction content offset
194 Print register 2 in operands.
196 @param Operands - instruction operands
198 @return Instruction content offset
208 Print dedicated register 1 in operands.
210 @param Operands - instruction operands
212 @return Instruction content offset
216 EdbPrintDedicatedRegister1 (
222 Print dedicated register 2 in operands.
224 @param Operands - instruction operands
226 @return Instruction content offset
230 EdbPrintDedicatedRegister2 (
236 Print the hexical UINTN index data to instruction content.
238 @param Sign - Signed bit of UINTN data
239 @param NaturalUnits - natural units of UINTN data
240 @param ConstantUnits - natural units of UINTN data
242 @return Instruction content offset
248 IN UINTN NaturalUnits
,
249 IN UINTN ConstantUnits
254 Print the hexical QWORD index data to instruction content.
256 @param Sign - Signed bit of QWORD data
257 @param NaturalUnits - natural units of QWORD data
258 @param ConstantUnits - natural units of QWORD data
260 @return Instruction content offset
264 EdbPrintIndexData64 (
266 IN UINT64 NaturalUnits
,
267 IN UINT64 ConstantUnits
272 Print the hexical BYTE immediate data to instruction content.
274 @param Data - BYTE data
276 @return Instruction content offset
286 Print the hexical WORD immediate data to instruction content.
288 @param Data - WORD data
290 @return Instruction content offset
300 Print the hexical DWORD immediate data to instruction content.
302 @param Data - DWORD data
304 @return Instruction content offset
314 Print the hexical QWORD immediate data to instruction content.
316 @param Data - QWORD data
318 @return Instruction content offset
328 Print the decimal UINTN immediate data to instruction content.
330 @param Data - UINTN data
332 @return Instruction content offset
342 Print the decimal QWORD immediate data to instruction content.
344 @param Data64 - QWORD data
346 @return Instruction content offset
356 Print the hexical BYTE to instruction content.
358 @param Data8 - BYTE data
360 @return Instruction content offset
370 Print the hexical WORD to instruction content.
372 @param Data16 - WORD data
374 @return Instruction content offset
384 Print the hexical DWORD to instruction content.
386 @param Data32 - DWORD data
388 @return Instruction content offset
398 Print the hexical QWORD to instruction content.
400 @param Data64 - QWORD data
402 @return Instruction content offset
412 Print the decimal unsigned UINTN to instruction content.
414 @param Data - unsigned UINTN data
416 @return Instruction content offset
426 Print the decimal unsigned QWORD to instruction content.
428 @param Data64 - unsigned QWORD data
430 @return Instruction content offset
440 Print the decimal signed BYTE to instruction content.
442 @param Data8 - signed BYTE data
444 @return Instruction content offset
454 Print the decimal signed WORD to instruction content.
456 @param Data16 - signed WORD data
458 @return Instruction content offset
468 Print the decimal signed DWORD to instruction content.
470 @param Data32 - signed DWORD data
472 @return Instruction content offset
482 Print the decimal signed QWORD to instruction content.
484 @param Data64 - signed QWORD data
486 @return Instruction content offset
496 Print the comma to instruction content.
498 @return Instruction content offset
508 Find the symbol string according to address, then print it.
510 @param Address - instruction address
512 @retval 1 - symbol string is found and printed
513 @retval 0 - symbol string not found
517 EdbFindAndPrintSymbol (
523 Print the EBC byte code.
525 @param InstructionAddress - instruction address
526 @param InstructionNumber - instruction number
531 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
532 IN UINTN InstructionNumber
537 Print the EBC asm code.
539 @param DebuggerPrivate - EBC Debugger private data structure
540 @param SystemContext - EBC system context.
542 @retval EFI_SUCCESS - show disasm successfully
547 IN EFI_DEBUGGER_PRIVATE_DATA
*DebuggerPrivate
,
548 IN EFI_SYSTEM_CONTEXT SystemContext
553 Get register value according to the system context, and register index.
555 @param SystemContext - EBC system context.
556 @param Index - EBC register index
558 @return register value
563 IN EFI_SYSTEM_CONTEXT SystemContext
,