3 Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #ifndef _EFI_EDB_DISASM_SUPPORT_H_
16 #define _EFI_EDB_DISASM_SUPPORT_H_
20 #define EDB_BYTECODE_NUMBER_IN_LINE 5
23 #define EDB_PRINT_ADDRESS_FORMAT L"%08x: "
25 // To use 012l instead of 016l because space is not enough
26 #define EDB_PRINT_ADDRESS_FORMAT L"%012lx: "
29 #define OPCODE_MAX 0x40
31 #define EDB_INSTRUCTION_NAME_MAX_LENGTH 10
32 #define EDB_INSTRUCTION_NAME_MAX_SIZE (EDB_INSTRUCTION_NAME_MAX_LENGTH * sizeof(CHAR16))
33 #define EDB_INSTRUCTION_CONTENT_MAX_LENGTH 30
34 #define EDB_INSTRUCTION_CONTENT_MAX_SIZE (EDB_INSTRUCTION_CONTENT_MAX_LENGTH * sizeof(CHAR16))
38 Set offset for Instruction name and content.
40 @param InstructionNameOffset - Instruction name offset
41 @param InstructionContentOffset - Instruction content offset
46 IN UINTN InstructionNameOffset
,
47 IN UINTN InstructionContentOffset
52 Pre instruction string construction.
54 @return Instruction string
58 EdbPreInstructionString (
64 Post instruction string construction.
66 @return Instruction string
70 EdbPostInstructionString (
76 Print the instruction name.
78 @param Name - instruction name
80 @return Instruction name offset
84 EdbPrintInstructionName (
90 Get Sign, NaturalUnits, and ConstantUnits of the WORD data.
92 @param Data16 - WORD data
93 @param NaturalUnits - Natural Units of the WORD
94 @param ConstantUnits - Constant Units of the WORD
96 @return Sign value of WORD
100 EdbGetNaturalIndex16 (
102 OUT UINTN
*NaturalUnits
,
103 OUT UINTN
*ConstantUnits
108 Get Sign, NaturalUnits, and ConstantUnits of the DWORD data.
110 @param Data32 - DWORD data
111 @param NaturalUnits - Natural Units of the DWORD
112 @param ConstantUnits - Constant Units of the DWORD
114 @return Sign value of DWORD
118 EdbGetNaturalIndex32 (
120 OUT UINTN
*NaturalUnits
,
121 OUT UINTN
*ConstantUnits
126 Get Sign, NaturalUnits, and ConstantUnits of the QWORD data.
128 @param Data64 - QWORD data
129 @param NaturalUnits - Natural Units of the QWORD
130 @param ConstantUnits - Constant Units of the QWORD
132 @return Sign value of QWORD
136 EdbGetNaturalIndex64 (
138 OUT UINT64
*NaturalUnits
,
139 OUT UINT64
*ConstantUnits
144 Print the hexical WORD raw index data to instruction content.
146 @param Data16 - WORD data
148 @return Instruction content offset
152 EdbPrintRawIndexData16 (
158 Print the hexical DWORD raw index data to instruction content.
160 @param Data32 - DWORD data
162 @return Instruction content offset
166 EdbPrintRawIndexData32 (
172 Print the hexical QWORD raw index data to instruction content.
174 @param Data64 - QWORD data
176 @return Instruction content offset
180 EdbPrintRawIndexData64 (
186 Print register 1 in operands.
188 @param Operands - instruction operands
190 @return Instruction content offset
200 Print register 2 in operands.
202 @param Operands - instruction operands
204 @return Instruction content offset
214 Print dedicated register 1 in operands.
216 @param Operands - instruction operands
218 @return Instruction content offset
222 EdbPrintDedicatedRegister1 (
228 Print dedicated register 2 in operands.
230 @param Operands - instruction operands
232 @return Instruction content offset
236 EdbPrintDedicatedRegister2 (
242 Print the hexical UINTN index data to instruction content.
244 @param Sign - Signed bit of UINTN data
245 @param NaturalUnits - natural units of UINTN data
246 @param ConstantUnits - natural units of UINTN data
248 @return Instruction content offset
254 IN UINTN NaturalUnits
,
255 IN UINTN ConstantUnits
260 Print the hexical QWORD index data to instruction content.
262 @param Sign - Signed bit of QWORD data
263 @param NaturalUnits - natural units of QWORD data
264 @param ConstantUnits - natural units of QWORD data
266 @return Instruction content offset
270 EdbPrintIndexData64 (
272 IN UINT64 NaturalUnits
,
273 IN UINT64 ConstantUnits
278 Print the hexical BYTE immediate data to instruction content.
280 @param Data - BYTE data
282 @return Instruction content offset
292 Print the hexical WORD immediate data to instruction content.
294 @param Data - WORD data
296 @return Instruction content offset
306 Print the hexical DWORD immediate data to instruction content.
308 @param Data - DWORD data
310 @return Instruction content offset
320 Print the hexical QWORD immediate data to instruction content.
322 @param Data - QWORD data
324 @return Instruction content offset
334 Print the decimal UINTN immediate data to instruction content.
336 @param Data - UINTN data
338 @return Instruction content offset
348 Print the decimal QWORD immediate data to instruction content.
350 @param Data64 - QWORD data
352 @return Instruction content offset
362 Print the hexical BYTE to instruction content.
364 @param Data8 - BYTE data
366 @return Instruction content offset
376 Print the hexical WORD to instruction content.
378 @param Data16 - WORD data
380 @return Instruction content offset
390 Print the hexical DWORD to instruction content.
392 @param Data32 - DWORD data
394 @return Instruction content offset
404 Print the hexical QWORD to instruction content.
406 @param Data64 - QWORD data
408 @return Instruction content offset
418 Print the decimal unsigned UINTN to instruction content.
420 @param Data - unsigned UINTN data
422 @return Instruction content offset
432 Print the decimal unsigned QWORD to instruction content.
434 @param Data64 - unsigned QWORD data
436 @return Instruction content offset
446 Print the decimal signed BYTE to instruction content.
448 @param Data8 - signed BYTE data
450 @return Instruction content offset
460 Print the decimal signed WORD to instruction content.
462 @param Data16 - signed WORD data
464 @return Instruction content offset
474 Print the decimal signed DWORD to instruction content.
476 @param Data32 - signed DWORD data
478 @return Instruction content offset
488 Print the decimal signed QWORD to instruction content.
490 @param Data64 - signed QWORD data
492 @return Instruction content offset
502 Print the comma to instruction content.
504 @return Instruction content offset
514 Find the symbol string according to address, then print it.
516 @param Address - instruction address
518 @retval 1 - symbol string is found and printed
519 @retval 0 - symbol string not found
523 EdbFindAndPrintSymbol (
529 Print the EBC byte code.
531 @param InstructionAddress - instruction address
532 @param InstructionNumber - instruction number
537 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
538 IN UINTN InstructionNumber
543 Print the EBC asm code.
545 @param DebuggerPrivate - EBC Debugger private data structure
546 @param SystemContext - EBC system context.
548 @retval EFI_SUCCESS - show disasm successfully
553 IN EFI_DEBUGGER_PRIVATE_DATA
*DebuggerPrivate
,
554 IN EFI_SYSTEM_CONTEXT SystemContext
559 Get register value accroding to the system context, and register index.
561 @param SystemContext - EBC system context.
562 @param Index - EBC register index
564 @return register value
569 IN EFI_SYSTEM_CONTEXT SystemContext
,