]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbDisasmSupport.h
MdeModulePkg/EbcDxe: Add comments for functions
[mirror_edk2.git] / MdeModulePkg / Universal / EbcDxe / EbcDebugger / EdbDisasmSupport.h
CommitLineData
e8a5ac7c 1/** @file\r
748edcd5 2\r
e8a5ac7c
DB
3Copyright (c) 2007, Intel Corporation All rights reserved.<BR>\r
4This program and the accompanying materials\r
748edcd5
PB
5are licensed and made available under the terms and conditions of the BSD License\r
6which accompanies this distribution. The full text of the license may be found at\r
7http://opensource.org/licenses/bsd-license.php\r
8\r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
11\r
748edcd5 12\r
e8a5ac7c 13**/\r
748edcd5
PB
14\r
15#ifndef _EFI_EDB_DISASM_SUPPORT_H_\r
16#define _EFI_EDB_DISASM_SUPPORT_H_\r
17\r
18#include <Uefi.h>\r
19\r
20#define EDB_BYTECODE_NUMBER_IN_LINE 5\r
21\r
22#ifdef EFI32\r
23#define EDB_PRINT_ADDRESS_FORMAT L"%08x: "\r
24#else\r
25// To use 012l instead of 016l because space is not enough\r
26#define EDB_PRINT_ADDRESS_FORMAT L"%012lx: "\r
27#endif\r
28\r
29#define OPCODE_MAX 0x40\r
30\r
31#define EDB_INSTRUCTION_NAME_MAX_LENGTH 10\r
32#define EDB_INSTRUCTION_NAME_MAX_SIZE (EDB_INSTRUCTION_NAME_MAX_LENGTH * sizeof(CHAR16))\r
33#define EDB_INSTRUCTION_CONTENT_MAX_LENGTH 30\r
34#define EDB_INSTRUCTION_CONTENT_MAX_SIZE (EDB_INSTRUCTION_CONTENT_MAX_LENGTH * sizeof(CHAR16))\r
35\r
d138a2e9
DB
36/**\r
37\r
38 Set offset for Instruction name and content.\r
39\r
40 @param InstructionNameOffset - Instruction name offset\r
41 @param InstructionContentOffset - Instruction content offset\r
42\r
43**/\r
748edcd5
PB
44VOID\r
45EdbSetOffset (\r
46 IN UINTN InstructionNameOffset,\r
47 IN UINTN InstructionContentOffset\r
48 );\r
49\r
d138a2e9
DB
50/**\r
51\r
52 Pre instruction string construction.\r
53\r
54 @return Instruction string\r
55\r
56**/\r
748edcd5
PB
57CHAR16 *\r
58EdbPreInstructionString (\r
59 VOID\r
60 );\r
61\r
d138a2e9
DB
62/**\r
63\r
64 Post instruction string construction.\r
65\r
66 @return Instruction string\r
67\r
68**/\r
748edcd5
PB
69CHAR16 *\r
70EdbPostInstructionString (\r
71 VOID\r
72 );\r
73\r
d138a2e9
DB
74/**\r
75\r
76 Print the instruction name.\r
77\r
78 @param Name - instruction name\r
79\r
80 @return Instruction name offset\r
81\r
82**/\r
748edcd5
PB
83UINTN\r
84EdbPrintInstructionName (\r
85 IN CHAR16 *Name\r
86 );\r
87\r
d138a2e9
DB
88/**\r
89\r
90 Get Sign, NaturalUnits, and ConstantUnits of the WORD data.\r
91\r
92 @param Data16 - WORD data\r
93 @param NaturalUnits - Natural Units of the WORD\r
94 @param ConstantUnits - Constant Units of the WORD\r
95\r
96 @return Sign value of WORD\r
97\r
98**/\r
748edcd5
PB
99BOOLEAN\r
100EdbGetNaturalIndex16 (\r
101 IN UINT16 Data16,\r
102 OUT UINTN *NaturalUnits,\r
103 OUT UINTN *ConstantUnits\r
104 );\r
105\r
d138a2e9
DB
106/**\r
107\r
108 Get Sign, NaturalUnits, and ConstantUnits of the DWORD data.\r
109\r
110 @param Data32 - DWORD data\r
111 @param NaturalUnits - Natural Units of the DWORD\r
112 @param ConstantUnits - Constant Units of the DWORD\r
113\r
114 @return Sign value of DWORD\r
115\r
116**/\r
748edcd5
PB
117BOOLEAN\r
118EdbGetNaturalIndex32 (\r
119 IN UINT32 Data32,\r
120 OUT UINTN *NaturalUnits,\r
121 OUT UINTN *ConstantUnits\r
122 );\r
123\r
d138a2e9
DB
124/**\r
125\r
126 Get Sign, NaturalUnits, and ConstantUnits of the QWORD data.\r
127\r
128 @param Data64 - QWORD data\r
129 @param NaturalUnits - Natural Units of the QWORD\r
130 @param ConstantUnits - Constant Units of the QWORD\r
131\r
132 @return Sign value of QWORD\r
133\r
134**/\r
748edcd5
PB
135BOOLEAN\r
136EdbGetNaturalIndex64 (\r
137 IN UINT64 Data64,\r
138 OUT UINT64 *NaturalUnits,\r
139 OUT UINT64 *ConstantUnits\r
140 );\r
141\r
d138a2e9
DB
142/**\r
143\r
144 Print the hexical WORD raw index data to instruction content.\r
145\r
146 @param Data16 - WORD data\r
147\r
148 @return Instruction content offset\r
149\r
150**/\r
748edcd5
PB
151UINTN\r
152EdbPrintRawIndexData16 (\r
153 IN UINT16 Data16\r
154 );\r
155\r
d138a2e9
DB
156/**\r
157\r
158 Print the hexical DWORD raw index data to instruction content.\r
159\r
160 @param Data32 - DWORD data\r
161\r
162 @return Instruction content offset\r
163\r
164**/\r
748edcd5
PB
165UINTN\r
166EdbPrintRawIndexData32 (\r
167 IN UINT32 Data32\r
168 );\r
169\r
d138a2e9
DB
170/**\r
171\r
172 Print the hexical QWORD raw index data to instruction content.\r
173\r
174 @param Data64 - QWORD data\r
175\r
176 @return Instruction content offset\r
177\r
178**/\r
748edcd5
PB
179UINTN\r
180EdbPrintRawIndexData64 (\r
181 IN UINT64 Data64\r
182 );\r
183\r
d138a2e9
DB
184/**\r
185\r
186 Print register 1 in operands.\r
187\r
188 @param Operands - instruction operands\r
189\r
190 @return Instruction content offset\r
191\r
192**/\r
748edcd5
PB
193UINTN\r
194EdbPrintRegister1 (\r
195 IN UINT8 Operands\r
196 );\r
197\r
d138a2e9
DB
198/**\r
199\r
200 Print register 2 in operands.\r
201\r
202 @param Operands - instruction operands\r
203\r
204 @return Instruction content offset\r
205\r
206**/\r
748edcd5
PB
207UINTN\r
208EdbPrintRegister2 (\r
209 IN UINT8 Operands\r
210 );\r
211\r
d138a2e9
DB
212/**\r
213\r
214 Print dedicated register 1 in operands.\r
215\r
216 @param Operands - instruction operands\r
217\r
218 @return Instruction content offset\r
219\r
220**/\r
748edcd5
PB
221UINTN\r
222EdbPrintDedicatedRegister1 (\r
223 IN UINT8 Operands\r
224 );\r
225\r
d138a2e9
DB
226/**\r
227\r
228 Print dedicated register 2 in operands.\r
229\r
230 @param Operands - instruction operands\r
231\r
232 @return Instruction content offset\r
233\r
234**/\r
748edcd5
PB
235UINTN\r
236EdbPrintDedicatedRegister2 (\r
237 IN UINT8 Operands\r
238 );\r
239\r
d138a2e9
DB
240/**\r
241\r
242 Print the hexical UINTN index data to instruction content.\r
243\r
244 @param Sign - Signed bit of UINTN data\r
245 @param NaturalUnits - natural units of UINTN data\r
246 @param ConstantUnits - natural units of UINTN data\r
247\r
248 @return Instruction content offset\r
249\r
250**/\r
748edcd5
PB
251UINTN\r
252EdbPrintIndexData (\r
253 IN BOOLEAN Sign,\r
254 IN UINTN NaturalUnits,\r
255 IN UINTN ConstantUnits\r
256 );\r
257\r
d138a2e9
DB
258/**\r
259\r
260 Print the hexical QWORD index data to instruction content.\r
261\r
262 @param Sign - Signed bit of QWORD data\r
263 @param NaturalUnits - natural units of QWORD data\r
264 @param ConstantUnits - natural units of QWORD data\r
265\r
266 @return Instruction content offset\r
267\r
268**/\r
748edcd5
PB
269UINTN\r
270EdbPrintIndexData64 (\r
271 IN BOOLEAN Sign,\r
272 IN UINT64 NaturalUnits,\r
273 IN UINT64 ConstantUnits\r
274 );\r
275\r
d138a2e9
DB
276/**\r
277\r
278 Print the hexical BYTE immediate data to instruction content.\r
279\r
280 @param Data - BYTE data\r
281\r
282 @return Instruction content offset\r
283\r
284**/\r
748edcd5
PB
285UINTN\r
286EdbPrintImmData8 (\r
287 IN UINT8 Data\r
288 );\r
289\r
d138a2e9
DB
290/**\r
291\r
292 Print the hexical WORD immediate data to instruction content.\r
293\r
294 @param Data - WORD data\r
295\r
296 @return Instruction content offset\r
297\r
298**/\r
748edcd5
PB
299UINTN\r
300EdbPrintImmData16 (\r
301 IN UINT16 Data\r
302 );\r
303\r
d138a2e9
DB
304/**\r
305\r
306 Print the hexical DWORD immediate data to instruction content.\r
307\r
308 @param Data - DWORD data\r
309\r
310 @return Instruction content offset\r
311\r
312**/\r
748edcd5
PB
313UINTN\r
314EdbPrintImmData32 (\r
315 IN UINT32 Data\r
316 );\r
317\r
d138a2e9
DB
318/**\r
319\r
320 Print the hexical QWORD immediate data to instruction content.\r
321\r
322 @param Data - QWORD data\r
323\r
324 @return Instruction content offset\r
325\r
326**/\r
748edcd5
PB
327UINTN\r
328EdbPrintImmData64 (\r
329 IN UINT64 Data\r
330 );\r
331\r
d138a2e9
DB
332/**\r
333\r
334 Print the decimal UINTN immediate data to instruction content.\r
335\r
336 @param Data - UINTN data\r
337\r
338 @return Instruction content offset\r
339\r
340**/\r
748edcd5
PB
341UINTN\r
342EdbPrintImmDatan (\r
343 IN UINTN Data\r
344 );\r
345\r
d138a2e9
DB
346/**\r
347\r
348 Print the decimal QWORD immediate data to instruction content.\r
349\r
350 @param Data64 - QWORD data\r
351\r
352 @return Instruction content offset\r
353\r
354**/\r
748edcd5
PB
355UINTN\r
356EdbPrintImmData64n (\r
357 IN UINT64 Data64\r
358 );\r
359\r
d138a2e9
DB
360/**\r
361\r
362 Print the hexical BYTE to instruction content.\r
363\r
364 @param Data8 - BYTE data\r
365\r
366 @return Instruction content offset\r
367\r
368**/\r
748edcd5
PB
369UINTN\r
370EdbPrintData8 (\r
371 IN UINT8 Data8\r
372 );\r
373\r
d138a2e9
DB
374/**\r
375\r
376 Print the hexical WORD to instruction content.\r
377\r
378 @param Data16 - WORD data\r
379\r
380 @return Instruction content offset\r
381\r
382**/\r
748edcd5
PB
383UINTN\r
384EdbPrintData16 (\r
385 IN UINT16 Data16\r
386 );\r
387\r
d138a2e9
DB
388/**\r
389\r
390 Print the hexical DWORD to instruction content.\r
391\r
392 @param Data32 - DWORD data\r
393\r
394 @return Instruction content offset\r
395\r
396**/\r
748edcd5
PB
397UINTN\r
398EdbPrintData32 (\r
399 IN UINT32 Data32\r
400 );\r
401\r
d138a2e9
DB
402/**\r
403\r
404 Print the hexical QWORD to instruction content.\r
405\r
406 @param Data64 - QWORD data\r
407\r
408 @return Instruction content offset\r
409\r
410**/\r
748edcd5
PB
411UINTN\r
412EdbPrintData64 (\r
413 IN UINT64 Data64\r
414 );\r
415\r
d138a2e9
DB
416/**\r
417\r
418 Print the decimal unsigned UINTN to instruction content.\r
419\r
420 @param Data - unsigned UINTN data\r
421\r
422 @return Instruction content offset\r
423\r
424**/\r
748edcd5
PB
425UINTN\r
426EdbPrintDatan (\r
427 IN UINTN Data\r
428 );\r
429\r
d138a2e9
DB
430/**\r
431\r
432 Print the decimal unsigned QWORD to instruction content.\r
433\r
434 @param Data64 - unsigned QWORD data\r
435\r
436 @return Instruction content offset\r
437\r
438**/\r
748edcd5
PB
439UINTN\r
440EdbPrintData64n (\r
441 IN UINT64 Data64\r
442 );\r
443\r
d138a2e9
DB
444/**\r
445\r
446 Print the decimal signed BYTE to instruction content.\r
447\r
448 @param Data8 - signed BYTE data\r
449\r
450 @return Instruction content offset\r
451\r
452**/\r
748edcd5
PB
453UINTN\r
454EdbPrintData8s (\r
455 IN UINT8 Data8\r
456 );\r
457\r
d138a2e9
DB
458/**\r
459\r
460 Print the decimal signed WORD to instruction content.\r
461\r
462 @param Data16 - signed WORD data\r
463\r
464 @return Instruction content offset\r
465\r
466**/\r
748edcd5
PB
467UINTN\r
468EdbPrintData16s (\r
469 IN UINT16 Data16\r
470 );\r
471\r
d138a2e9
DB
472/**\r
473\r
474 Print the decimal signed DWORD to instruction content.\r
475\r
476 @param Data32 - signed DWORD data\r
477\r
478 @return Instruction content offset\r
479\r
480**/\r
748edcd5
PB
481UINTN\r
482EdbPrintData32s (\r
483 IN UINT32 Data32\r
484 );\r
485\r
d138a2e9
DB
486/**\r
487\r
488 Print the decimal signed QWORD to instruction content.\r
489\r
490 @param Data64 - signed QWORD data\r
491\r
492 @return Instruction content offset\r
493\r
494**/\r
748edcd5
PB
495UINTN\r
496EdbPrintData64s (\r
497 IN UINT64 Data64\r
498 );\r
499\r
d138a2e9
DB
500/**\r
501\r
502 Print the comma to instruction content.\r
503\r
504 @return Instruction content offset\r
505\r
506**/\r
748edcd5
PB
507UINTN\r
508EdbPrintComma (\r
509 VOID\r
510 );\r
511\r
d138a2e9
DB
512/**\r
513\r
514 Find the symbol string according to address, then print it.\r
515\r
516 @param Address - instruction address\r
517\r
518 @retval 1 - symbol string is found and printed\r
519 @retval 0 - symbol string not found\r
520\r
521**/\r
748edcd5
PB
522UINTN\r
523EdbFindAndPrintSymbol (\r
524 IN UINTN Address\r
525 );\r
526\r
d138a2e9
DB
527/**\r
528\r
529 Print the EBC byte code.\r
530\r
531 @param InstructionAddress - instruction address\r
532 @param InstructionNumber - instruction number\r
533\r
534**/\r
748edcd5
PB
535VOID\r
536EdbPrintRaw (\r
537 IN EFI_PHYSICAL_ADDRESS InstructionAddress,\r
538 IN UINTN InstructionNumber\r
539 );\r
540\r
d138a2e9
DB
541/**\r
542\r
543 Print the EBC asm code.\r
544\r
545 @param DebuggerPrivate - EBC Debugger private data structure\r
546 @param SystemContext - EBC system context.\r
547\r
548 @retval EFI_SUCCESS - show disasm successfully\r
549\r
550**/\r
748edcd5
PB
551EFI_STATUS\r
552EdbShowDisasm (\r
553 IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,\r
554 IN EFI_SYSTEM_CONTEXT SystemContext\r
555 );\r
556\r
d138a2e9
DB
557/**\r
558\r
559 Get register value accroding to the system context, and register index.\r
560\r
561 @param SystemContext - EBC system context.\r
562 @param Index - EBC register index\r
563\r
564 @return register value\r
565\r
566**/\r
748edcd5
PB
567UINT64\r
568GetRegisterValue (\r
569 IN EFI_SYSTEM_CONTEXT SystemContext,\r
570 IN UINT8 Index\r
571 );\r
572\r
573#endif\r