3 Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
4 SPDX-License-Identifier: BSD-2-Clause-Patent
12 // Debugger Disasm definition
14 #define EDB_DISASM_DEFINE(func) \
17 IN EFI_PHYSICAL_ADDRESS InstructionAddress, \
18 IN EFI_SYSTEM_CONTEXT SystemContext, \
19 OUT CHAR16 **DisasmString \
22 EDB_DISASM_DEFINE (EdbDisasmBREAK
);
23 EDB_DISASM_DEFINE (EdbDisasmJMP
);
24 EDB_DISASM_DEFINE (EdbDisasmJMP8
);
25 EDB_DISASM_DEFINE (EdbDisasmCALL
);
26 EDB_DISASM_DEFINE (EdbDisasmRET
);
27 EDB_DISASM_DEFINE (EdbDisasmCMP
);
28 EDB_DISASM_DEFINE (EdbDisasmUnsignedDataManip
);
29 EDB_DISASM_DEFINE (EdbDisasmSignedDataManip
);
30 EDB_DISASM_DEFINE (EdbDisasmMOVxx
);
31 EDB_DISASM_DEFINE (EdbDisasmMOVsnw
);
32 EDB_DISASM_DEFINE (EdbDisasmMOVsnd
);
33 EDB_DISASM_DEFINE (EdbDisasmLOADSP
);
34 EDB_DISASM_DEFINE (EdbDisasmSTORESP
);
35 EDB_DISASM_DEFINE (EdbDisasmPUSH
);
36 EDB_DISASM_DEFINE (EdbDisasmPOP
);
37 EDB_DISASM_DEFINE (EdbDisasmCMPI
);
38 EDB_DISASM_DEFINE (EdbDisasmPUSHn
);
39 EDB_DISASM_DEFINE (EdbDisasmPOPn
);
40 EDB_DISASM_DEFINE (EdbDisasmMOVI
);
41 EDB_DISASM_DEFINE (EdbDisasmMOVIn
);
42 EDB_DISASM_DEFINE (EdbDisasmMOVREL
);
45 // Debugger Disasm Table
47 EDB_DISASM_INSTRUCTION mEdbDisasmInstructionTable
[] = {
48 EdbDisasmBREAK
, // opcode 0x00 BREAK
49 EdbDisasmJMP
, // opcode 0x01 JMP
50 EdbDisasmJMP8
, // opcode 0x02 JMP8
51 EdbDisasmCALL
, // opcode 0x03 CALL
52 EdbDisasmRET
, // opcode 0x04 RET
53 EdbDisasmCMP
, // opcode 0x05 CMPEQ
54 EdbDisasmCMP
, // opcode 0x06 CMPLTE
55 EdbDisasmCMP
, // opcode 0x07 CMPGTE
56 EdbDisasmCMP
, // opcode 0x08 CMPULTE
57 EdbDisasmCMP
, // opcode 0x09 CMPUGTE
58 EdbDisasmUnsignedDataManip
, // opcode 0x0A NOT
59 EdbDisasmSignedDataManip
, // opcode 0x0B NEG
60 EdbDisasmSignedDataManip
, // opcode 0x0C ADD
61 EdbDisasmSignedDataManip
, // opcode 0x0D SUB
62 EdbDisasmSignedDataManip
, // opcode 0x0E MUL
63 EdbDisasmUnsignedDataManip
, // opcode 0x0F MULU
64 EdbDisasmSignedDataManip
, // opcode 0x10 DIV
65 EdbDisasmUnsignedDataManip
, // opcode 0x11 DIVU
66 EdbDisasmSignedDataManip
, // opcode 0x12 MOD
67 EdbDisasmUnsignedDataManip
, // opcode 0x13 MODU
68 EdbDisasmUnsignedDataManip
, // opcode 0x14 AND
69 EdbDisasmUnsignedDataManip
, // opcode 0x15 OR
70 EdbDisasmUnsignedDataManip
, // opcode 0x16 XOR
71 EdbDisasmUnsignedDataManip
, // opcode 0x17 SHL
72 EdbDisasmUnsignedDataManip
, // opcode 0x18 SHR
73 EdbDisasmSignedDataManip
, // opcode 0x19 ASHR
74 EdbDisasmUnsignedDataManip
, // opcode 0x1A EXTNDB
75 EdbDisasmUnsignedDataManip
, // opcode 0x1B EXTNDW
76 EdbDisasmUnsignedDataManip
, // opcode 0x1C EXTNDD
77 EdbDisasmMOVxx
, // opcode 0x1D MOVBW
78 EdbDisasmMOVxx
, // opcode 0x1E MOVWW
79 EdbDisasmMOVxx
, // opcode 0x1F MOVDW
80 EdbDisasmMOVxx
, // opcode 0x20 MOVQW
81 EdbDisasmMOVxx
, // opcode 0x21 MOVBD
82 EdbDisasmMOVxx
, // opcode 0x22 MOVWD
83 EdbDisasmMOVxx
, // opcode 0x23 MOVDD
84 EdbDisasmMOVxx
, // opcode 0x24 MOVQD
85 EdbDisasmMOVsnw
, // opcode 0x25 MOVSNW
86 EdbDisasmMOVsnd
, // opcode 0x26 MOVSND
88 EdbDisasmMOVxx
, // opcode 0x28 MOVQQ
89 EdbDisasmLOADSP
, // opcode 0x29 LOADSP
90 EdbDisasmSTORESP
, // opcode 0x2A STORESP
91 EdbDisasmPUSH
, // opcode 0x2B PUSH
92 EdbDisasmPOP
, // opcode 0x2C POP
93 EdbDisasmCMPI
, // opcode 0x2D CMPIEQ
94 EdbDisasmCMPI
, // opcode 0x2E CMPILTE
95 EdbDisasmCMPI
, // opcode 0x2F CMPIGTE
96 EdbDisasmCMPI
, // opcode 0x30 CMPIULTE
97 EdbDisasmCMPI
, // opcode 0x31 CMPIUGTE
98 EdbDisasmMOVxx
, // opcode 0x32 MOVNW
99 EdbDisasmMOVxx
, // opcode 0x33 MOVND
101 EdbDisasmPUSHn
, // opcode 0x35 PUSHN
102 EdbDisasmPOPn
, // opcode 0x36 POPN
103 EdbDisasmMOVI
, // opcode 0x37 MOVI
104 EdbDisasmMOVIn
, // opcode 0x38 MOVIN
105 EdbDisasmMOVREL
, // opcode 0x39 MOVREL
110 Disasm instruction - BREAK.
112 @param InstructionAddress - The instruction address
113 @param SystemContext - EBC system context.
114 @param DisasmString - The instruction string
116 @return Instruction length
121 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
122 IN EFI_SYSTEM_CONTEXT SystemContext
,
123 OUT CHAR16
**DisasmString
126 ASSERT (GET_OPCODE (InstructionAddress
) == OPCODE_BREAK
);
128 if (*(UINT8
*)(UINTN
)(InstructionAddress
+ 1) > 6) {
133 // Construct Disasm String
135 if (DisasmString
!= NULL
) {
136 *DisasmString
= EdbPreInstructionString ();
138 EdbPrintInstructionName (L
"BREAK");
139 EdbPrintDatan (*(UINT8
*)(UINTN
)(InstructionAddress
+ 1));
141 EdbPostInstructionString ();
147 extern CONST UINT8 mJMPLen
[];
151 Disasm instruction - JMP.
153 @param InstructionAddress - The instruction address
154 @param SystemContext - EBC system context.
155 @param DisasmString - The instruction string
157 @return Instruction length
162 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
163 IN EFI_SYSTEM_CONTEXT SystemContext
,
164 OUT CHAR16
**DisasmString
173 ASSERT (GET_OPCODE (InstructionAddress
) == OPCODE_JMP
);
175 Modifiers
= GET_MODIFIERS (InstructionAddress
);
176 Operands
= GET_OPERANDS (InstructionAddress
);
177 Size
= (UINTN
)mJMPLen
[(Modifiers
>> 6) & 0x03];
180 // Construct Disasm String
182 if (DisasmString
!= NULL
) {
183 *DisasmString
= EdbPreInstructionString ();
185 EdbPrintInstructionName (L
"JMP");
186 // if (Modifiers & OPCODE_M_IMMDATA64) {
187 // EdbPrintInstructionName (L"64");
189 // EdbPrintInstructionName (L"32");
191 if ((Modifiers
& CONDITION_M_CONDITIONAL
) != 0) {
192 if ((Modifiers
& JMP_M_CS
) != 0) {
193 EdbPrintInstructionName (L
"cs");
195 EdbPrintInstructionName (L
"cc");
199 InstructionAddress
+= 2;
200 if ((Modifiers
& OPCODE_M_IMMDATA64
) != 0) {
201 CopyMem (&Data64
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof (UINT64
));
202 if ((Modifiers
& OPCODE_M_IMMDATA
) != 0) {
203 EdbPrintData64 (Data64
);
208 CopyMem (&Data32
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof (UINT32
));
209 EdbPrintRegister1 (Operands
);
211 if ((Operands
& OPERAND_M_INDIRECT1
) == 0) {
212 if ((Modifiers
& OPCODE_M_IMMDATA
) == 0) {
216 EdbPrintImmDatan (Data32
);
218 EdbPrintRawIndexData32 (Data32
);
222 EdbPostInstructionString ();
230 Disasm instruction - JMP8.
232 @param InstructionAddress - The instruction address
233 @param SystemContext - EBC system context.
234 @param DisasmString - The instruction string
236 @return Instruction length
241 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
242 IN EFI_SYSTEM_CONTEXT SystemContext
,
243 OUT CHAR16
**DisasmString
248 ASSERT (GET_OPCODE (InstructionAddress
) == OPCODE_JMP8
);
249 Modifiers
= GET_MODIFIERS (InstructionAddress
);
252 // Construct Disasm String
254 if (DisasmString
!= NULL
) {
255 *DisasmString
= EdbPreInstructionString ();
257 EdbPrintInstructionName (L
"JMP8");
258 if ((Modifiers
& CONDITION_M_CONDITIONAL
) != 0) {
259 if ((Modifiers
& JMP_M_CS
) != 0) {
260 EdbPrintInstructionName (L
"cs");
262 EdbPrintInstructionName (L
"cc");
266 EdbPrintData8 (*(UINT8
*)(UINTN
)(InstructionAddress
+ 1));
268 EdbPostInstructionString ();
276 Disasm instruction - CALL.
278 @param InstructionAddress - The instruction address
279 @param SystemContext - EBC system context.
280 @param DisasmString - The instruction string
282 @return Instruction length
287 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
288 IN EFI_SYSTEM_CONTEXT SystemContext
,
289 OUT CHAR16
**DisasmString
299 EFI_PHYSICAL_ADDRESS SavedInstructionAddress
;
301 ASSERT (GET_OPCODE (InstructionAddress
) == OPCODE_CALL
);
302 SavedInstructionAddress
= InstructionAddress
;
304 Modifiers
= GET_MODIFIERS (InstructionAddress
);
305 Operands
= GET_OPERANDS (InstructionAddress
);
306 Size
= (UINTN
)mJMPLen
[(Modifiers
>> 6) & 0x03];
309 // Construct Disasm String
311 if (DisasmString
!= NULL
) {
312 *DisasmString
= EdbPreInstructionString ();
314 EdbPrintInstructionName (L
"CALL");
315 // if (Modifiers & OPCODE_M_IMMDATA64) {
316 // EdbPrintInstructionName (L"64");
318 // EdbPrintInstructionName (L"32");
320 if ((Operands
& OPERAND_M_NATIVE_CALL
) != 0) {
321 EdbPrintInstructionName (L
"EX");
324 // if ((Operands & OPERAND_M_RELATIVE_ADDR) == 0) {
325 // EdbPrintInstructionName (L"a");
328 InstructionAddress
+= 2;
329 if ((Modifiers
& OPCODE_M_IMMDATA64
) != 0) {
330 CopyMem (&Data64
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof (UINT64
));
332 if ((Modifiers
& OPCODE_M_IMMDATA
) != 0) {
333 Result
= EdbFindAndPrintSymbol ((UINTN
)Ip
);
335 EdbPrintData64 (Data64
);
341 if ((Modifiers
& OPCODE_M_IMMDATA
) != 0) {
342 CopyMem (&Data32
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof (UINT32
));
347 if ((Operands
& OPERAND_M_OP1
) == 0) {
350 Ip
= GetRegisterValue (SystemContext
, (Operands
& OPERAND_M_OP1
));
353 if ((Operands
& OPERAND_M_INDIRECT1
) == 0) {
354 if ((Operands
& OPERAND_M_RELATIVE_ADDR
) != 0) {
355 Result
= EdbFindAndPrintSymbol ((UINTN
)(SavedInstructionAddress
+ Ip
+ Size
));
357 Result
= EdbFindAndPrintSymbol ((UINTN
)Ip
);
361 EdbPrintRegister1 (Operands
);
362 if ((Modifiers
& OPCODE_M_IMMDATA
) != 0) {
363 EdbPrintImmData32 (Data32
);
367 EdbPrintRegister1 (Operands
);
368 if ((Modifiers
& OPCODE_M_IMMDATA
) != 0) {
369 EdbPrintRawIndexData32 (Data32
);
374 EdbPostInstructionString ();
382 Disasm instruction - RET.
384 @param InstructionAddress - The instruction address
385 @param SystemContext - EBC system context.
386 @param DisasmString - The instruction string
388 @return Instruction length
393 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
394 IN EFI_SYSTEM_CONTEXT SystemContext
,
395 OUT CHAR16
**DisasmString
398 ASSERT (GET_OPCODE (InstructionAddress
) == OPCODE_RET
);
400 if (*(UINT8
*)(UINTN
)(InstructionAddress
+ 1) != 0) {
405 // Construct Disasm String
407 if (DisasmString
!= NULL
) {
408 *DisasmString
= EdbPreInstructionString ();
410 EdbPrintInstructionName (L
"RET");
412 EdbPostInstructionString ();
420 Disasm instruction - CMP.
422 @param InstructionAddress - The instruction address
423 @param SystemContext - EBC system context.
424 @param DisasmString - The instruction string
426 @return Instruction length
431 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
432 IN EFI_SYSTEM_CONTEXT SystemContext
,
433 OUT CHAR16
**DisasmString
443 (GET_OPCODE (InstructionAddress
) == OPCODE_CMPEQ
) ||
444 (GET_OPCODE (InstructionAddress
) == OPCODE_CMPLTE
) ||
445 (GET_OPCODE (InstructionAddress
) == OPCODE_CMPGTE
) ||
446 (GET_OPCODE (InstructionAddress
) == OPCODE_CMPULTE
) ||
447 (GET_OPCODE (InstructionAddress
) == OPCODE_CMPUGTE
)
450 Opcode
= GET_OPCODE (InstructionAddress
);
451 Modifiers
= GET_MODIFIERS (InstructionAddress
);
452 Operands
= GET_OPERANDS (InstructionAddress
);
453 if ((Modifiers
& OPCODE_M_IMMDATA
) != 0) {
460 // Construct Disasm String
462 if (DisasmString
!= NULL
) {
463 *DisasmString
= EdbPreInstructionString ();
465 EdbPrintInstructionName (L
"CMP");
466 // if (Modifiers & OPCODE_M_64BIT) {
467 // EdbPrintInstructionName (L"64");
469 // EdbPrintInstructionName (L"32");
473 EdbPrintInstructionName (L
"eq");
476 EdbPrintInstructionName (L
"lte");
479 EdbPrintInstructionName (L
"gte");
482 EdbPrintInstructionName (L
"ulte");
485 EdbPrintInstructionName (L
"ugte");
489 EdbPrintRegister1 (Operands
);
490 InstructionAddress
+= 2;
493 EdbPrintRegister2 (Operands
);
495 if ((Modifiers
& OPCODE_M_IMMDATA
) != 0) {
496 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof (UINT16
));
497 if ((Operands
& OPERAND_M_INDIRECT2
) != 0) {
498 EdbPrintRawIndexData16 (Data16
);
500 EdbPrintImmDatan (Data16
);
504 EdbPostInstructionString ();
512 Disasm instruction - Unsigned Data Manipulate.
514 @param InstructionAddress - The instruction address
515 @param SystemContext - EBC system context.
516 @param DisasmString - The instruction string
518 @return Instruction length
522 EdbDisasmUnsignedDataManip (
523 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
524 IN EFI_SYSTEM_CONTEXT SystemContext
,
525 OUT CHAR16
**DisasmString
535 (GET_OPCODE (InstructionAddress
) == OPCODE_NOT
) ||
536 (GET_OPCODE (InstructionAddress
) == OPCODE_MULU
) ||
537 (GET_OPCODE (InstructionAddress
) == OPCODE_DIVU
) ||
538 (GET_OPCODE (InstructionAddress
) == OPCODE_MODU
) ||
539 (GET_OPCODE (InstructionAddress
) == OPCODE_AND
) ||
540 (GET_OPCODE (InstructionAddress
) == OPCODE_OR
) ||
541 (GET_OPCODE (InstructionAddress
) == OPCODE_XOR
) ||
542 (GET_OPCODE (InstructionAddress
) == OPCODE_SHL
) ||
543 (GET_OPCODE (InstructionAddress
) == OPCODE_SHR
) ||
544 (GET_OPCODE (InstructionAddress
) == OPCODE_EXTNDB
) ||
545 (GET_OPCODE (InstructionAddress
) == OPCODE_EXTNDW
) ||
546 (GET_OPCODE (InstructionAddress
) == OPCODE_EXTNDD
)
549 Opcode
= GET_OPCODE (InstructionAddress
);
550 Operands
= GET_OPERANDS (InstructionAddress
);
551 Modifiers
= GET_MODIFIERS (InstructionAddress
);
552 if ((Modifiers
& DATAMANIP_M_IMMDATA
) != 0) {
559 // Construct Disasm String
561 if (DisasmString
!= NULL
) {
562 *DisasmString
= EdbPreInstructionString ();
566 EdbPrintInstructionName (L
"NOT");
569 EdbPrintInstructionName (L
"MULU");
572 EdbPrintInstructionName (L
"DIVU");
575 EdbPrintInstructionName (L
"MODU");
578 EdbPrintInstructionName (L
"AND");
581 EdbPrintInstructionName (L
"OR");
584 EdbPrintInstructionName (L
"XOR");
587 EdbPrintInstructionName (L
"SHL");
590 EdbPrintInstructionName (L
"SHR");
593 EdbPrintInstructionName (L
"EXTNDB");
596 EdbPrintInstructionName (L
"EXTNDW");
599 EdbPrintInstructionName (L
"EXTNDD");
603 // if (Modifiers & DATAMANIP_M_64) {
604 // EdbPrintInstructionName (L"64");
606 // EdbPrintInstructionName (L"32");
609 EdbPrintRegister1 (Operands
);
611 EdbPrintRegister2 (Operands
);
613 InstructionAddress
+= 2;
614 if ((Modifiers
& DATAMANIP_M_IMMDATA
) != 0) {
615 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof (UINT16
));
616 if ((Operands
& OPERAND_M_INDIRECT2
) != 0) {
617 EdbPrintRawIndexData16 (Data16
);
619 EdbPrintImmDatan (Data16
);
623 EdbPostInstructionString ();
631 Disasm instruction - Signed Data Manipulate,
633 @param InstructionAddress - The instruction address
634 @param SystemContext - EBC system context.
635 @param DisasmString - The instruction string
637 @return Instruction length
641 EdbDisasmSignedDataManip (
642 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
643 IN EFI_SYSTEM_CONTEXT SystemContext
,
644 OUT CHAR16
**DisasmString
654 (GET_OPCODE (InstructionAddress
) == OPCODE_NEG
) ||
655 (GET_OPCODE (InstructionAddress
) == OPCODE_ADD
) ||
656 (GET_OPCODE (InstructionAddress
) == OPCODE_SUB
) ||
657 (GET_OPCODE (InstructionAddress
) == OPCODE_MUL
) ||
658 (GET_OPCODE (InstructionAddress
) == OPCODE_DIV
) ||
659 (GET_OPCODE (InstructionAddress
) == OPCODE_MOD
) ||
660 (GET_OPCODE (InstructionAddress
) == OPCODE_ASHR
)
663 Opcode
= GET_OPCODE (InstructionAddress
);
664 Operands
= GET_OPERANDS (InstructionAddress
);
665 Modifiers
= GET_MODIFIERS (InstructionAddress
);
666 if ((Modifiers
& DATAMANIP_M_IMMDATA
) != 0) {
673 // Construct Disasm String
675 if (DisasmString
!= NULL
) {
676 *DisasmString
= EdbPreInstructionString ();
680 EdbPrintInstructionName (L
"NEG");
683 EdbPrintInstructionName (L
"ADD");
686 EdbPrintInstructionName (L
"SUB");
689 EdbPrintInstructionName (L
"MUL");
692 EdbPrintInstructionName (L
"DIV");
695 EdbPrintInstructionName (L
"MOD");
698 EdbPrintInstructionName (L
"ASHR");
702 // if (Modifiers & DATAMANIP_M_64) {
703 // EdbPrintInstructionName (L"64");
705 // EdbPrintInstructionName (L"32");
708 EdbPrintRegister1 (Operands
);
710 EdbPrintRegister2 (Operands
);
712 InstructionAddress
+= 2;
713 if ((Modifiers
& DATAMANIP_M_IMMDATA
) != 0) {
714 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof (UINT16
));
715 if ((Operands
& OPERAND_M_INDIRECT2
) != 0) {
716 EdbPrintRawIndexData16 (Data16
);
718 EdbPrintImmDatan (Data16
);
722 EdbPostInstructionString ();
730 Disasm instruction - MOVxx.
732 @param InstructionAddress - The instruction address
733 @param SystemContext - EBC system context.
734 @param DisasmString - The instruction string
736 @return Instruction length
741 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
742 IN EFI_SYSTEM_CONTEXT SystemContext
,
743 OUT CHAR16
**DisasmString
755 (GET_OPCODE (InstructionAddress
) == OPCODE_MOVBW
) ||
756 (GET_OPCODE (InstructionAddress
) == OPCODE_MOVWW
) ||
757 (GET_OPCODE (InstructionAddress
) == OPCODE_MOVDW
) ||
758 (GET_OPCODE (InstructionAddress
) == OPCODE_MOVQW
) ||
759 (GET_OPCODE (InstructionAddress
) == OPCODE_MOVBD
) ||
760 (GET_OPCODE (InstructionAddress
) == OPCODE_MOVWD
) ||
761 (GET_OPCODE (InstructionAddress
) == OPCODE_MOVDD
) ||
762 (GET_OPCODE (InstructionAddress
) == OPCODE_MOVQD
) ||
763 (GET_OPCODE (InstructionAddress
) == OPCODE_MOVQQ
) ||
764 (GET_OPCODE (InstructionAddress
) == OPCODE_MOVNW
) ||
765 (GET_OPCODE (InstructionAddress
) == OPCODE_MOVND
)
768 Opcode
= GET_OPCODE (InstructionAddress
);
769 Modifiers
= GET_MODIFIERS (InstructionAddress
);
770 Operands
= GET_OPERANDS (InstructionAddress
);
772 if ((Modifiers
& (OPCODE_M_IMMED_OP1
| OPCODE_M_IMMED_OP2
)) != 0) {
773 if ((Opcode
<= OPCODE_MOVQW
) || (Opcode
== OPCODE_MOVNW
)) {
774 if ((Modifiers
& OPCODE_M_IMMED_OP1
) != 0) {
778 if ((Modifiers
& OPCODE_M_IMMED_OP2
) != 0) {
781 } else if (((Opcode
<= OPCODE_MOVQD
) || (Opcode
== OPCODE_MOVND
)) != 0) {
782 if ((Modifiers
& OPCODE_M_IMMED_OP1
) != 0) {
786 if ((Modifiers
& OPCODE_M_IMMED_OP2
) != 0) {
789 } else if (Opcode
== OPCODE_MOVQQ
) {
790 if ((Modifiers
& OPCODE_M_IMMED_OP1
) != 0) {
794 if ((Modifiers
& OPCODE_M_IMMED_OP2
) != 0) {
801 // Construct Disasm String
803 if (DisasmString
!= NULL
) {
804 *DisasmString
= EdbPreInstructionString ();
806 EdbPrintInstructionName (L
"MOV");
809 EdbPrintInstructionName (L
"bw");
812 EdbPrintInstructionName (L
"ww");
815 EdbPrintInstructionName (L
"dw");
818 EdbPrintInstructionName (L
"qw");
821 EdbPrintInstructionName (L
"bd");
824 EdbPrintInstructionName (L
"wd");
827 EdbPrintInstructionName (L
"dd");
830 EdbPrintInstructionName (L
"qd");
833 EdbPrintInstructionName (L
"qq");
836 EdbPrintInstructionName (L
"nw");
839 EdbPrintInstructionName (L
"nd");
843 EdbPrintRegister1 (Operands
);
845 InstructionAddress
+= 2;
846 if ((Modifiers
& OPCODE_M_IMMED_OP1
) != 0) {
847 if ((Opcode
<= OPCODE_MOVQW
) || (Opcode
== OPCODE_MOVNW
)) {
848 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof (UINT16
));
849 InstructionAddress
+= 2;
850 EdbPrintRawIndexData16 (Data16
);
851 } else if ((Opcode
<= OPCODE_MOVQD
) || (Opcode
== OPCODE_MOVND
)) {
852 CopyMem (&Data32
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof (UINT32
));
853 InstructionAddress
+= 4;
854 EdbPrintRawIndexData32 (Data32
);
855 } else if (Opcode
== OPCODE_MOVQQ
) {
856 CopyMem (&Data64
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof (UINT64
));
857 InstructionAddress
+= 8;
858 EdbPrintRawIndexData64 (Data64
);
863 EdbPrintRegister2 (Operands
);
865 if ((Modifiers
& OPCODE_M_IMMED_OP2
) != 0) {
866 if ((Opcode
<= OPCODE_MOVQW
) || (Opcode
== OPCODE_MOVNW
)) {
867 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof (UINT16
));
868 EdbPrintRawIndexData16 (Data16
);
869 } else if ((Opcode
<= OPCODE_MOVQD
) || (Opcode
== OPCODE_MOVND
)) {
870 CopyMem (&Data32
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof (UINT32
));
871 EdbPrintRawIndexData32 (Data32
);
872 } else if (Opcode
== OPCODE_MOVQQ
) {
873 CopyMem (&Data64
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof (UINT64
));
874 EdbPrintRawIndexData64 (Data64
);
878 EdbPostInstructionString ();
886 Disasm instruction - MOVsnw.
888 @param InstructionAddress - The instruction address
889 @param SystemContext - EBC system context.
890 @param DisasmString - The instruction string
892 @return Instruction length
897 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
898 IN EFI_SYSTEM_CONTEXT SystemContext
,
899 OUT CHAR16
**DisasmString
907 ASSERT (GET_OPCODE (InstructionAddress
) == OPCODE_MOVSNW
);
909 Modifiers
= GET_MODIFIERS (InstructionAddress
);
910 Operands
= GET_OPERANDS (InstructionAddress
);
912 if ((Modifiers
& OPCODE_M_IMMED_OP1
) != 0) {
916 if ((Modifiers
& OPCODE_M_IMMED_OP2
) != 0) {
921 // Construct Disasm String
923 if (DisasmString
!= NULL
) {
924 *DisasmString
= EdbPreInstructionString ();
926 EdbPrintInstructionName (L
"MOVsnw");
928 EdbPrintRegister1 (Operands
);
930 InstructionAddress
+= 2;
931 if ((Modifiers
& OPCODE_M_IMMED_OP1
) != 0) {
932 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof (UINT16
));
933 InstructionAddress
+= 2;
934 EdbPrintRawIndexData16 (Data16
);
938 EdbPrintRegister2 (Operands
);
940 if ((Modifiers
& OPCODE_M_IMMED_OP2
) != 0) {
941 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof (UINT16
));
942 if ((Operands
& OPERAND_M_INDIRECT2
) != 0) {
943 EdbPrintRawIndexData16 (Data16
);
945 EdbPrintImmDatan (Data16
);
949 EdbPostInstructionString ();
957 Disasm instruction - MOVsnd.
959 @param InstructionAddress - The instruction address
960 @param SystemContext - EBC system context.
961 @param DisasmString - The instruction string
963 @return Instruction length
968 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
969 IN EFI_SYSTEM_CONTEXT SystemContext
,
970 OUT CHAR16
**DisasmString
978 ASSERT (GET_OPCODE (InstructionAddress
) == OPCODE_MOVSND
);
980 Modifiers
= GET_MODIFIERS (InstructionAddress
);
981 Operands
= GET_OPERANDS (InstructionAddress
);
983 if ((Modifiers
& OPCODE_M_IMMED_OP1
) != 0) {
987 if ((Modifiers
& OPCODE_M_IMMED_OP2
) != 0) {
992 // Construct Disasm String
994 if (DisasmString
!= NULL
) {
995 *DisasmString
= EdbPreInstructionString ();
997 EdbPrintInstructionName (L
"MOVsnd");
999 EdbPrintRegister1 (Operands
);
1001 InstructionAddress
+= 2;
1002 if ((Modifiers
& OPCODE_M_IMMED_OP1
) != 0) {
1003 CopyMem (&Data32
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof (UINT32
));
1004 InstructionAddress
+= 4;
1005 EdbPrintRawIndexData32 (Data32
);
1009 EdbPrintRegister2 (Operands
);
1011 if ((Modifiers
& OPCODE_M_IMMED_OP2
) != 0) {
1012 CopyMem (&Data32
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof (UINT32
));
1013 if ((Operands
& OPERAND_M_INDIRECT2
) != 0) {
1014 EdbPrintRawIndexData32 (Data32
);
1016 EdbPrintImmDatan (Data32
);
1020 EdbPostInstructionString ();
1028 Disasm instruction - LOADSP.
1030 @param InstructionAddress - The instruction address
1031 @param SystemContext - EBC system context.
1032 @param DisasmString - The instruction string
1034 @return Instruction length
1039 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
1040 IN EFI_SYSTEM_CONTEXT SystemContext
,
1041 OUT CHAR16
**DisasmString
1046 ASSERT (GET_OPCODE (InstructionAddress
) == OPCODE_LOADSP
);
1048 Operands
= GET_OPERANDS (InstructionAddress
);
1051 // Construct Disasm String
1053 if (DisasmString
!= NULL
) {
1054 *DisasmString
= EdbPreInstructionString ();
1056 EdbPrintInstructionName (L
"LOADSP");
1058 EdbPrintDedicatedRegister1 (Operands
);
1060 EdbPrintRegister2 (Operands
);
1062 EdbPostInstructionString ();
1070 Disasm instruction - STORESP.
1072 @param InstructionAddress - The instruction address
1073 @param SystemContext - EBC system context.
1074 @param DisasmString - The instruction string
1076 @return Instruction length
1081 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
1082 IN EFI_SYSTEM_CONTEXT SystemContext
,
1083 OUT CHAR16
**DisasmString
1088 ASSERT (GET_OPCODE (InstructionAddress
) == OPCODE_STORESP
);
1090 Operands
= GET_OPERANDS (InstructionAddress
);
1093 // Construct Disasm String
1095 if (DisasmString
!= NULL
) {
1096 *DisasmString
= EdbPreInstructionString ();
1098 EdbPrintInstructionName (L
"STORESP");
1100 EdbPrintRegister1 (Operands
);
1102 EdbPrintDedicatedRegister2 (Operands
);
1104 EdbPostInstructionString ();
1112 Disasm instruction - PUSH.
1114 @param InstructionAddress - The instruction address
1115 @param SystemContext - EBC system context.
1116 @param DisasmString - The instruction string
1118 @return Instruction length
1123 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
1124 IN EFI_SYSTEM_CONTEXT SystemContext
,
1125 OUT CHAR16
**DisasmString
1133 ASSERT (GET_OPCODE (InstructionAddress
) == OPCODE_PUSH
);
1135 Operands
= GET_OPERANDS (InstructionAddress
);
1136 Modifiers
= GET_MODIFIERS (InstructionAddress
);
1137 if ((Modifiers
& PUSHPOP_M_IMMDATA
) != 0) {
1144 // Construct Disasm String
1146 if (DisasmString
!= NULL
) {
1147 *DisasmString
= EdbPreInstructionString ();
1149 EdbPrintInstructionName (L
"PUSH");
1150 // if (Modifiers & PUSHPOP_M_64) {
1151 // EdbPrintInstructionName (L"64");
1153 // EdbPrintInstructionName (L"32");
1156 EdbPrintRegister1 (Operands
);
1158 InstructionAddress
+= 2;
1159 if ((Modifiers
& PUSHPOP_M_IMMDATA
) != 0) {
1160 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof (UINT16
));
1161 if ((Operands
& OPERAND_M_INDIRECT1
) != 0) {
1162 EdbPrintRawIndexData16 (Data16
);
1164 EdbPrintImmDatan (Data16
);
1168 EdbPostInstructionString ();
1176 Disasm instruction - POP.
1178 @param InstructionAddress - The instruction address
1179 @param SystemContext - EBC system context.
1180 @param DisasmString - The instruction string
1182 @return Instruction length
1187 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
1188 IN EFI_SYSTEM_CONTEXT SystemContext
,
1189 OUT CHAR16
**DisasmString
1197 ASSERT (GET_OPCODE (InstructionAddress
) == OPCODE_POP
);
1199 Operands
= GET_OPERANDS (InstructionAddress
);
1200 Modifiers
= GET_MODIFIERS (InstructionAddress
);
1201 if ((Modifiers
& PUSHPOP_M_IMMDATA
) != 0) {
1208 // Construct Disasm String
1210 if (DisasmString
!= NULL
) {
1211 *DisasmString
= EdbPreInstructionString ();
1213 EdbPrintInstructionName (L
"POP");
1214 // if (Modifiers & PUSHPOP_M_64) {
1215 // EdbPrintInstructionName (L"64");
1217 // EdbPrintInstructionName (L"32");
1220 EdbPrintRegister1 (Operands
);
1222 InstructionAddress
+= 2;
1223 if ((Modifiers
& PUSHPOP_M_IMMDATA
) != 0) {
1224 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof (UINT16
));
1225 if ((Operands
& OPERAND_M_INDIRECT1
) != 0) {
1226 EdbPrintRawIndexData16 (Data16
);
1228 EdbPrintImmDatan (Data16
);
1232 EdbPostInstructionString ();
1240 Disasm instruction - CMPI.
1242 @param InstructionAddress - The instruction address
1243 @param SystemContext - EBC system context.
1244 @param DisasmString - The instruction string
1246 @return Instruction length
1251 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
1252 IN EFI_SYSTEM_CONTEXT SystemContext
,
1253 OUT CHAR16
**DisasmString
1264 (GET_OPCODE (InstructionAddress
) == OPCODE_CMPIEQ
) ||
1265 (GET_OPCODE (InstructionAddress
) == OPCODE_CMPILTE
) ||
1266 (GET_OPCODE (InstructionAddress
) == OPCODE_CMPIGTE
) ||
1267 (GET_OPCODE (InstructionAddress
) == OPCODE_CMPIULTE
) ||
1268 (GET_OPCODE (InstructionAddress
) == OPCODE_CMPIUGTE
)
1271 Modifiers
= GET_MODIFIERS (InstructionAddress
);
1272 Opcode
= GET_OPCODE (InstructionAddress
);
1273 Operands
= GET_OPERANDS (InstructionAddress
);
1275 if ((Operands
& 0xE0) != 0) {
1280 if ((Operands
& OPERAND_M_CMPI_INDEX
) != 0) {
1284 if ((Modifiers
& OPCODE_M_CMPI32_DATA
) != 0) {
1291 // Construct Disasm String
1293 if (DisasmString
!= NULL
) {
1294 *DisasmString
= EdbPreInstructionString ();
1296 EdbPrintInstructionName (L
"CMPI");
1297 // if (Modifiers & OPCODE_M_CMPI64) {
1298 // EdbPrintInstructionName (L"64");
1300 // EdbPrintInstructionName (L"32");
1302 if ((Modifiers
& OPCODE_M_CMPI32_DATA
) != 0) {
1303 EdbPrintInstructionName (L
"d");
1305 EdbPrintInstructionName (L
"w");
1310 EdbPrintInstructionName (L
"eq");
1312 case OPCODE_CMPILTE
:
1313 EdbPrintInstructionName (L
"lte");
1315 case OPCODE_CMPIGTE
:
1316 EdbPrintInstructionName (L
"gte");
1318 case OPCODE_CMPIULTE
:
1319 EdbPrintInstructionName (L
"ulte");
1321 case OPCODE_CMPIUGTE
:
1322 EdbPrintInstructionName (L
"ugte");
1326 EdbPrintRegister1 (Operands
);
1328 InstructionAddress
+= 2;
1329 if ((Operands
& OPERAND_M_CMPI_INDEX
) != 0) {
1330 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof (UINT16
));
1331 InstructionAddress
+= 2;
1332 EdbPrintRawIndexData16 (Data16
);
1337 if ((Modifiers
& OPCODE_M_CMPI32_DATA
) != 0) {
1338 CopyMem (&Data32
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof (UINT32
));
1339 EdbPrintDatan (Data32
);
1341 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof (UINT16
));
1342 EdbPrintDatan (Data16
);
1345 EdbPostInstructionString ();
1353 Disasm instruction - PUSHn.
1355 @param InstructionAddress - The instruction address
1356 @param SystemContext - EBC system context.
1357 @param DisasmString - The instruction string
1359 @return Instruction length
1364 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
1365 IN EFI_SYSTEM_CONTEXT SystemContext
,
1366 OUT CHAR16
**DisasmString
1374 ASSERT (GET_OPCODE (InstructionAddress
) == OPCODE_PUSHN
);
1376 Operands
= GET_OPERANDS (InstructionAddress
);
1377 Modifiers
= GET_MODIFIERS (InstructionAddress
);
1378 if ((Modifiers
& PUSHPOP_M_IMMDATA
) != 0) {
1385 // Construct Disasm String
1387 if (DisasmString
!= NULL
) {
1388 *DisasmString
= EdbPreInstructionString ();
1390 EdbPrintInstructionName (L
"PUSHn");
1392 EdbPrintRegister1 (Operands
);
1394 InstructionAddress
+= 2;
1395 if ((Modifiers
& PUSHPOP_M_IMMDATA
) != 0) {
1396 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof (UINT16
));
1397 if ((Operands
& OPERAND_M_INDIRECT1
) != 0) {
1398 EdbPrintRawIndexData16 (Data16
);
1400 EdbPrintImmDatan (Data16
);
1404 EdbPostInstructionString ();
1412 Disasm instruction - POPn.
1414 @param InstructionAddress - The instruction address
1415 @param SystemContext - EBC system context.
1416 @param DisasmString - The instruction string
1418 @return Instruction length
1423 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
1424 IN EFI_SYSTEM_CONTEXT SystemContext
,
1425 OUT CHAR16
**DisasmString
1433 ASSERT (GET_OPCODE (InstructionAddress
) == OPCODE_POPN
);
1435 Operands
= GET_OPERANDS (InstructionAddress
);
1436 Modifiers
= GET_MODIFIERS (InstructionAddress
);
1437 if ((Modifiers
& PUSHPOP_M_IMMDATA
) != 0) {
1444 // Construct Disasm String
1446 if (DisasmString
!= NULL
) {
1447 *DisasmString
= EdbPreInstructionString ();
1449 EdbPrintInstructionName (L
"POPn");
1451 EdbPrintRegister1 (Operands
);
1453 InstructionAddress
+= 2;
1454 if ((Modifiers
& PUSHPOP_M_IMMDATA
) != 0) {
1455 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof (UINT16
));
1456 if ((Operands
& OPERAND_M_INDIRECT1
) != 0) {
1457 EdbPrintRawIndexData16 (Data16
);
1459 EdbPrintImmDatan (Data16
);
1463 EdbPostInstructionString ();
1471 Disasm instruction - MOVI.
1473 @param InstructionAddress - The instruction address
1474 @param SystemContext - EBC system context.
1475 @param DisasmString - The instruction string
1477 @return Instruction length
1482 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
1483 IN EFI_SYSTEM_CONTEXT SystemContext
,
1484 OUT CHAR16
**DisasmString
1494 ASSERT (GET_OPCODE (InstructionAddress
) == OPCODE_MOVI
);
1496 Modifiers
= GET_MODIFIERS (InstructionAddress
);
1497 Operands
= GET_OPERANDS (InstructionAddress
);
1499 if ((Operands
& MOVI_M_IMMDATA
) != 0) {
1505 if ((Modifiers
& MOVI_M_DATAWIDTH
) == MOVI_DATAWIDTH16
) {
1507 } else if ((Modifiers
& MOVI_M_DATAWIDTH
) == MOVI_DATAWIDTH32
) {
1509 } else if ((Modifiers
& MOVI_M_DATAWIDTH
) == MOVI_DATAWIDTH64
) {
1514 // Construct Disasm String
1516 if (DisasmString
!= NULL
) {
1517 *DisasmString
= EdbPreInstructionString ();
1519 EdbPrintInstructionName (L
"MOVI");
1520 switch (Operands
& MOVI_M_MOVEWIDTH
) {
1521 case MOVI_MOVEWIDTH8
:
1522 EdbPrintInstructionName (L
"b");
1524 case MOVI_MOVEWIDTH16
:
1525 EdbPrintInstructionName (L
"w");
1527 case MOVI_MOVEWIDTH32
:
1528 EdbPrintInstructionName (L
"d");
1530 case MOVI_MOVEWIDTH64
:
1531 EdbPrintInstructionName (L
"q");
1535 switch (Modifiers
& MOVI_M_DATAWIDTH
) {
1536 case MOVI_DATAWIDTH16
:
1537 EdbPrintInstructionName (L
"w");
1539 case MOVI_DATAWIDTH32
:
1540 EdbPrintInstructionName (L
"d");
1542 case MOVI_DATAWIDTH64
:
1543 EdbPrintInstructionName (L
"q");
1547 EdbPrintRegister1 (Operands
);
1549 InstructionAddress
+= 2;
1550 if ((Operands
& MOVI_M_IMMDATA
) != 0) {
1551 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof (UINT16
));
1552 InstructionAddress
+= 2;
1553 EdbPrintRawIndexData16 (Data16
);
1558 switch (Modifiers
& MOVI_M_DATAWIDTH
) {
1559 case MOVI_DATAWIDTH16
:
1560 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof (UINT16
));
1561 EdbPrintDatan (Data16
);
1563 case MOVI_DATAWIDTH32
:
1564 CopyMem (&Data32
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof (UINT32
));
1565 EdbPrintDatan (Data32
);
1567 case MOVI_DATAWIDTH64
:
1568 CopyMem (&Data64
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof (UINT64
));
1569 EdbPrintData64n (Data64
);
1573 EdbPostInstructionString ();
1581 Disasm instruction - MOVIn.
1583 @param InstructionAddress - The instruction address
1584 @param SystemContext - EBC system context.
1585 @param DisasmString - The instruction string
1587 @return Instruction length
1592 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
1593 IN EFI_SYSTEM_CONTEXT SystemContext
,
1594 OUT CHAR16
**DisasmString
1604 ASSERT (GET_OPCODE (InstructionAddress
) == OPCODE_MOVIN
);
1606 Modifiers
= GET_MODIFIERS (InstructionAddress
);
1607 Operands
= GET_OPERANDS (InstructionAddress
);
1609 if ((Operands
& MOVI_M_IMMDATA
) != 0) {
1615 if ((Modifiers
& MOVI_M_DATAWIDTH
) == MOVI_DATAWIDTH16
) {
1617 } else if ((Modifiers
& MOVI_M_DATAWIDTH
) == MOVI_DATAWIDTH32
) {
1619 } else if ((Modifiers
& MOVI_M_DATAWIDTH
) == MOVI_DATAWIDTH64
) {
1624 // Construct Disasm String
1626 if (DisasmString
!= NULL
) {
1627 *DisasmString
= EdbPreInstructionString ();
1629 EdbPrintInstructionName (L
"MOVIn");
1630 switch (Modifiers
& MOVI_M_DATAWIDTH
) {
1631 case MOVI_DATAWIDTH16
:
1632 EdbPrintInstructionName (L
"w");
1634 case MOVI_DATAWIDTH32
:
1635 EdbPrintInstructionName (L
"d");
1637 case MOVI_DATAWIDTH64
:
1638 EdbPrintInstructionName (L
"q");
1642 EdbPrintRegister1 (Operands
);
1644 InstructionAddress
+= 2;
1645 if ((Operands
& MOVI_M_IMMDATA
) != 0) {
1646 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof (UINT16
));
1647 InstructionAddress
+= 2;
1648 EdbPrintRawIndexData16 (Data16
);
1653 switch (Modifiers
& MOVI_M_DATAWIDTH
) {
1654 case MOVI_DATAWIDTH16
:
1655 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof (UINT16
));
1656 EdbPrintRawIndexData16 (Data16
);
1658 case MOVI_DATAWIDTH32
:
1659 CopyMem (&Data32
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof (UINT32
));
1660 EdbPrintRawIndexData32 (Data32
);
1662 case MOVI_DATAWIDTH64
:
1663 CopyMem (&Data64
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof (UINT64
));
1664 EdbPrintRawIndexData64 (Data64
);
1668 EdbPostInstructionString ();
1676 Disasm instruction - MOVREL.
1678 @param InstructionAddress - The instruction address
1679 @param SystemContext - EBC system context.
1680 @param DisasmString - The instruction string
1682 @return Instruction length
1687 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
1688 IN EFI_SYSTEM_CONTEXT SystemContext
,
1689 OUT CHAR16
**DisasmString
1699 EFI_PHYSICAL_ADDRESS SavedInstructionAddress
;
1701 ASSERT (GET_OPCODE (InstructionAddress
) == OPCODE_MOVREL
);
1702 SavedInstructionAddress
= InstructionAddress
;
1704 Modifiers
= GET_MODIFIERS (InstructionAddress
);
1705 Operands
= GET_OPERANDS (InstructionAddress
);
1707 if ((Operands
& MOVI_M_IMMDATA
) != 0) {
1713 if ((Modifiers
& MOVI_M_DATAWIDTH
) == MOVI_DATAWIDTH16
) {
1715 } else if ((Modifiers
& MOVI_M_DATAWIDTH
) == MOVI_DATAWIDTH32
) {
1717 } else if ((Modifiers
& MOVI_M_DATAWIDTH
) == MOVI_DATAWIDTH64
) {
1724 // Construct Disasm String
1726 if (DisasmString
!= NULL
) {
1727 *DisasmString
= EdbPreInstructionString ();
1729 EdbPrintInstructionName (L
"MOVrel");
1730 switch (Modifiers
& MOVI_M_DATAWIDTH
) {
1731 case MOVI_DATAWIDTH16
:
1732 EdbPrintInstructionName (L
"w");
1734 case MOVI_DATAWIDTH32
:
1735 EdbPrintInstructionName (L
"d");
1737 case MOVI_DATAWIDTH64
:
1738 EdbPrintInstructionName (L
"q");
1742 EdbPrintRegister1 (Operands
);
1744 InstructionAddress
+= 2;
1745 if ((Operands
& MOVI_M_IMMDATA
) != 0) {
1746 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof (UINT16
));
1747 InstructionAddress
+= 2;
1748 EdbPrintRawIndexData16 (Data16
);
1753 switch (Modifiers
& MOVI_M_DATAWIDTH
) {
1754 case MOVI_DATAWIDTH16
:
1755 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof (UINT16
));
1756 Result
= EdbFindAndPrintSymbol ((UINTN
)(SavedInstructionAddress
+ Size
+ (INT16
)Data16
));
1758 EdbPrintData16 (Data16
);
1762 case MOVI_DATAWIDTH32
:
1763 CopyMem (&Data32
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof (UINT32
));
1764 Result
= EdbFindAndPrintSymbol ((UINTN
)(SavedInstructionAddress
+ Size
+ (INT32
)Data32
));
1766 EdbPrintData32 (Data32
);
1770 case MOVI_DATAWIDTH64
:
1771 CopyMem (&Data64
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof (UINT64
));
1772 if (sizeof (UINTN
) == sizeof (UINT64
)) {
1773 Result
= EdbFindAndPrintSymbol ((UINTN
)(SavedInstructionAddress
+ Size
+ (INT64
)Data64
));
1779 EdbPrintData64 (Data64
);
1785 EdbPostInstructionString ();