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) {
215 EdbPrintImmDatan (Data32
);
217 EdbPrintRawIndexData32 (Data32
);
221 EdbPostInstructionString ();
229 Disasm instruction - JMP8.
231 @param InstructionAddress - The instruction address
232 @param SystemContext - EBC system context.
233 @param DisasmString - The instruction string
235 @return Instruction length
240 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
241 IN EFI_SYSTEM_CONTEXT SystemContext
,
242 OUT CHAR16
**DisasmString
247 ASSERT (GET_OPCODE(InstructionAddress
) == OPCODE_JMP8
);
248 Modifiers
= GET_MODIFIERS (InstructionAddress
);
251 // Construct Disasm String
253 if (DisasmString
!= NULL
) {
254 *DisasmString
= EdbPreInstructionString ();
256 EdbPrintInstructionName (L
"JMP8");
257 if ((Modifiers
& CONDITION_M_CONDITIONAL
) != 0) {
258 if ((Modifiers
& JMP_M_CS
) != 0) {
259 EdbPrintInstructionName (L
"cs");
261 EdbPrintInstructionName (L
"cc");
265 EdbPrintData8 (*(UINT8
*)(UINTN
)(InstructionAddress
+ 1));
267 EdbPostInstructionString ();
275 Disasm instruction - CALL.
277 @param InstructionAddress - The instruction address
278 @param SystemContext - EBC system context.
279 @param DisasmString - The instruction string
281 @return Instruction length
286 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
287 IN EFI_SYSTEM_CONTEXT SystemContext
,
288 OUT CHAR16
**DisasmString
298 EFI_PHYSICAL_ADDRESS SavedInstructionAddress
;
300 ASSERT (GET_OPCODE(InstructionAddress
) == OPCODE_CALL
);
301 SavedInstructionAddress
= InstructionAddress
;
303 Modifiers
= GET_MODIFIERS (InstructionAddress
);
304 Operands
= GET_OPERANDS (InstructionAddress
);
305 Size
= (UINTN
)mJMPLen
[(Modifiers
>> 6) & 0x03];
308 // Construct Disasm String
310 if (DisasmString
!= NULL
) {
311 *DisasmString
= EdbPreInstructionString ();
313 EdbPrintInstructionName (L
"CALL");
314 // if (Modifiers & OPCODE_M_IMMDATA64) {
315 // EdbPrintInstructionName (L"64");
317 // EdbPrintInstructionName (L"32");
319 if ((Operands
& OPERAND_M_NATIVE_CALL
) != 0) {
320 EdbPrintInstructionName (L
"EX");
322 // if ((Operands & OPERAND_M_RELATIVE_ADDR) == 0) {
323 // EdbPrintInstructionName (L"a");
326 InstructionAddress
+= 2;
327 if ((Modifiers
& OPCODE_M_IMMDATA64
) != 0) {
328 CopyMem (&Data64
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT64
));
330 if ((Modifiers
& OPCODE_M_IMMDATA
) != 0) {
331 Result
= EdbFindAndPrintSymbol ((UINTN
)Ip
);
333 EdbPrintData64 (Data64
);
339 if ((Modifiers
& OPCODE_M_IMMDATA
) != 0) {
340 CopyMem (&Data32
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT32
));
345 if ((Operands
& OPERAND_M_OP1
) == 0) {
348 Ip
= GetRegisterValue (SystemContext
, (Operands
& OPERAND_M_OP1
));
351 if ((Operands
& OPERAND_M_INDIRECT1
) == 0) {
352 if ((Operands
& OPERAND_M_RELATIVE_ADDR
) != 0) {
353 Result
= EdbFindAndPrintSymbol ((UINTN
)(SavedInstructionAddress
+ Ip
+ Size
));
355 Result
= EdbFindAndPrintSymbol ((UINTN
)Ip
);
358 EdbPrintRegister1 (Operands
);
359 if ((Modifiers
& OPCODE_M_IMMDATA
) != 0) {
360 EdbPrintImmData32 (Data32
);
364 EdbPrintRegister1 (Operands
);
365 if ((Modifiers
& OPCODE_M_IMMDATA
) != 0) {
366 EdbPrintRawIndexData32 (Data32
);
371 EdbPostInstructionString ();
379 Disasm instruction - RET.
381 @param InstructionAddress - The instruction address
382 @param SystemContext - EBC system context.
383 @param DisasmString - The instruction string
385 @return Instruction length
390 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
391 IN EFI_SYSTEM_CONTEXT SystemContext
,
392 OUT CHAR16
**DisasmString
395 ASSERT (GET_OPCODE(InstructionAddress
) == OPCODE_RET
);
397 if (*(UINT8
*)(UINTN
)(InstructionAddress
+ 1) != 0) {
402 // Construct Disasm String
404 if (DisasmString
!= NULL
) {
405 *DisasmString
= EdbPreInstructionString ();
407 EdbPrintInstructionName (L
"RET");
409 EdbPostInstructionString ();
417 Disasm instruction - CMP.
419 @param InstructionAddress - The instruction address
420 @param SystemContext - EBC system context.
421 @param DisasmString - The instruction string
423 @return Instruction length
428 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
429 IN EFI_SYSTEM_CONTEXT SystemContext
,
430 OUT CHAR16
**DisasmString
440 (GET_OPCODE(InstructionAddress
) == OPCODE_CMPEQ
) ||
441 (GET_OPCODE(InstructionAddress
) == OPCODE_CMPLTE
) ||
442 (GET_OPCODE(InstructionAddress
) == OPCODE_CMPGTE
) ||
443 (GET_OPCODE(InstructionAddress
) == OPCODE_CMPULTE
) ||
444 (GET_OPCODE(InstructionAddress
) == OPCODE_CMPUGTE
)
447 Opcode
= GET_OPCODE (InstructionAddress
);
448 Modifiers
= GET_MODIFIERS (InstructionAddress
);
449 Operands
= GET_OPERANDS (InstructionAddress
);
450 if ((Modifiers
& OPCODE_M_IMMDATA
) != 0) {
457 // Construct Disasm String
459 if (DisasmString
!= NULL
) {
460 *DisasmString
= EdbPreInstructionString ();
462 EdbPrintInstructionName (L
"CMP");
463 // if (Modifiers & OPCODE_M_64BIT) {
464 // EdbPrintInstructionName (L"64");
466 // EdbPrintInstructionName (L"32");
470 EdbPrintInstructionName (L
"eq");
473 EdbPrintInstructionName (L
"lte");
476 EdbPrintInstructionName (L
"gte");
479 EdbPrintInstructionName (L
"ulte");
482 EdbPrintInstructionName (L
"ugte");
486 EdbPrintRegister1 (Operands
);
487 InstructionAddress
+= 2;
490 EdbPrintRegister2 (Operands
);
492 if ((Modifiers
& OPCODE_M_IMMDATA
) != 0) {
493 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT16
));
494 if ((Operands
& OPERAND_M_INDIRECT2
) != 0) {
495 EdbPrintRawIndexData16 (Data16
);
497 EdbPrintImmDatan (Data16
);
501 EdbPostInstructionString ();
509 Disasm instruction - Unsigned Data Manipulate.
511 @param InstructionAddress - The instruction address
512 @param SystemContext - EBC system context.
513 @param DisasmString - The instruction string
515 @return Instruction length
519 EdbDisasmUnsignedDataManip (
520 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
521 IN EFI_SYSTEM_CONTEXT SystemContext
,
522 OUT CHAR16
**DisasmString
532 (GET_OPCODE(InstructionAddress
) == OPCODE_NOT
) ||
533 (GET_OPCODE(InstructionAddress
) == OPCODE_MULU
) ||
534 (GET_OPCODE(InstructionAddress
) == OPCODE_DIVU
) ||
535 (GET_OPCODE(InstructionAddress
) == OPCODE_MODU
) ||
536 (GET_OPCODE(InstructionAddress
) == OPCODE_AND
) ||
537 (GET_OPCODE(InstructionAddress
) == OPCODE_OR
) ||
538 (GET_OPCODE(InstructionAddress
) == OPCODE_XOR
) ||
539 (GET_OPCODE(InstructionAddress
) == OPCODE_SHL
) ||
540 (GET_OPCODE(InstructionAddress
) == OPCODE_SHR
) ||
541 (GET_OPCODE(InstructionAddress
) == OPCODE_EXTNDB
) ||
542 (GET_OPCODE(InstructionAddress
) == OPCODE_EXTNDW
) ||
543 (GET_OPCODE(InstructionAddress
) == OPCODE_EXTNDD
)
546 Opcode
= GET_OPCODE (InstructionAddress
);
547 Operands
= GET_OPERANDS (InstructionAddress
);
548 Modifiers
= GET_MODIFIERS (InstructionAddress
);
549 if ((Modifiers
& DATAMANIP_M_IMMDATA
) != 0) {
556 // Construct Disasm String
558 if (DisasmString
!= NULL
) {
559 *DisasmString
= EdbPreInstructionString ();
563 EdbPrintInstructionName (L
"NOT");
566 EdbPrintInstructionName (L
"MULU");
569 EdbPrintInstructionName (L
"DIVU");
572 EdbPrintInstructionName (L
"MODU");
575 EdbPrintInstructionName (L
"AND");
578 EdbPrintInstructionName (L
"OR");
581 EdbPrintInstructionName (L
"XOR");
584 EdbPrintInstructionName (L
"SHL");
587 EdbPrintInstructionName (L
"SHR");
590 EdbPrintInstructionName (L
"EXTNDB");
593 EdbPrintInstructionName (L
"EXTNDW");
596 EdbPrintInstructionName (L
"EXTNDD");
599 // if (Modifiers & DATAMANIP_M_64) {
600 // EdbPrintInstructionName (L"64");
602 // EdbPrintInstructionName (L"32");
605 EdbPrintRegister1 (Operands
);
607 EdbPrintRegister2 (Operands
);
609 InstructionAddress
+= 2;
610 if ((Modifiers
& DATAMANIP_M_IMMDATA
) != 0) {
611 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT16
));
612 if ((Operands
& OPERAND_M_INDIRECT2
) != 0) {
613 EdbPrintRawIndexData16 (Data16
);
615 EdbPrintImmDatan (Data16
);
619 EdbPostInstructionString ();
627 Disasm instruction - Signed Data Manipulate,
629 @param InstructionAddress - The instruction address
630 @param SystemContext - EBC system context.
631 @param DisasmString - The instruction string
633 @return Instruction length
637 EdbDisasmSignedDataManip (
638 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
639 IN EFI_SYSTEM_CONTEXT SystemContext
,
640 OUT CHAR16
**DisasmString
650 (GET_OPCODE(InstructionAddress
) == OPCODE_NEG
) ||
651 (GET_OPCODE(InstructionAddress
) == OPCODE_ADD
) ||
652 (GET_OPCODE(InstructionAddress
) == OPCODE_SUB
) ||
653 (GET_OPCODE(InstructionAddress
) == OPCODE_MUL
) ||
654 (GET_OPCODE(InstructionAddress
) == OPCODE_DIV
) ||
655 (GET_OPCODE(InstructionAddress
) == OPCODE_MOD
) ||
656 (GET_OPCODE(InstructionAddress
) == OPCODE_ASHR
)
659 Opcode
= GET_OPCODE (InstructionAddress
);
660 Operands
= GET_OPERANDS (InstructionAddress
);
661 Modifiers
= GET_MODIFIERS (InstructionAddress
);
662 if ((Modifiers
& DATAMANIP_M_IMMDATA
) != 0) {
669 // Construct Disasm String
671 if (DisasmString
!= NULL
) {
672 *DisasmString
= EdbPreInstructionString ();
676 EdbPrintInstructionName (L
"NEG");
679 EdbPrintInstructionName (L
"ADD");
682 EdbPrintInstructionName (L
"SUB");
685 EdbPrintInstructionName (L
"MUL");
688 EdbPrintInstructionName (L
"DIV");
691 EdbPrintInstructionName (L
"MOD");
694 EdbPrintInstructionName (L
"ASHR");
697 // if (Modifiers & DATAMANIP_M_64) {
698 // EdbPrintInstructionName (L"64");
700 // EdbPrintInstructionName (L"32");
703 EdbPrintRegister1 (Operands
);
705 EdbPrintRegister2 (Operands
);
707 InstructionAddress
+= 2;
708 if ((Modifiers
& DATAMANIP_M_IMMDATA
) != 0) {
709 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT16
));
710 if ((Operands
& OPERAND_M_INDIRECT2
) != 0) {
711 EdbPrintRawIndexData16 (Data16
);
713 EdbPrintImmDatan (Data16
);
717 EdbPostInstructionString ();
725 Disasm instruction - MOVxx.
727 @param InstructionAddress - The instruction address
728 @param SystemContext - EBC system context.
729 @param DisasmString - The instruction string
731 @return Instruction length
736 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
737 IN EFI_SYSTEM_CONTEXT SystemContext
,
738 OUT CHAR16
**DisasmString
750 (GET_OPCODE(InstructionAddress
) == OPCODE_MOVBW
) ||
751 (GET_OPCODE(InstructionAddress
) == OPCODE_MOVWW
) ||
752 (GET_OPCODE(InstructionAddress
) == OPCODE_MOVDW
) ||
753 (GET_OPCODE(InstructionAddress
) == OPCODE_MOVQW
) ||
754 (GET_OPCODE(InstructionAddress
) == OPCODE_MOVBD
) ||
755 (GET_OPCODE(InstructionAddress
) == OPCODE_MOVWD
) ||
756 (GET_OPCODE(InstructionAddress
) == OPCODE_MOVDD
) ||
757 (GET_OPCODE(InstructionAddress
) == OPCODE_MOVQD
) ||
758 (GET_OPCODE(InstructionAddress
) == OPCODE_MOVQQ
) ||
759 (GET_OPCODE(InstructionAddress
) == OPCODE_MOVNW
) ||
760 (GET_OPCODE(InstructionAddress
) == OPCODE_MOVND
)
763 Opcode
= GET_OPCODE (InstructionAddress
);
764 Modifiers
= GET_MODIFIERS (InstructionAddress
);
765 Operands
= GET_OPERANDS (InstructionAddress
);
767 if ((Modifiers
& (OPCODE_M_IMMED_OP1
| OPCODE_M_IMMED_OP2
)) != 0) {
768 if ((Opcode
<= OPCODE_MOVQW
) || (Opcode
== OPCODE_MOVNW
)) {
769 if ((Modifiers
& OPCODE_M_IMMED_OP1
) != 0) {
772 if ((Modifiers
& OPCODE_M_IMMED_OP2
) != 0) {
775 } else if (((Opcode
<= OPCODE_MOVQD
) || (Opcode
== OPCODE_MOVND
)) != 0) {
776 if ((Modifiers
& OPCODE_M_IMMED_OP1
) != 0) {
779 if ((Modifiers
& OPCODE_M_IMMED_OP2
) != 0) {
782 } else if (Opcode
== OPCODE_MOVQQ
) {
783 if ((Modifiers
& OPCODE_M_IMMED_OP1
) != 0) {
786 if ((Modifiers
& OPCODE_M_IMMED_OP2
) != 0) {
793 // Construct Disasm String
795 if (DisasmString
!= NULL
) {
796 *DisasmString
= EdbPreInstructionString ();
798 EdbPrintInstructionName (L
"MOV");
801 EdbPrintInstructionName (L
"bw");
804 EdbPrintInstructionName (L
"ww");
807 EdbPrintInstructionName (L
"dw");
810 EdbPrintInstructionName (L
"qw");
813 EdbPrintInstructionName (L
"bd");
816 EdbPrintInstructionName (L
"wd");
819 EdbPrintInstructionName (L
"dd");
822 EdbPrintInstructionName (L
"qd");
825 EdbPrintInstructionName (L
"qq");
828 EdbPrintInstructionName (L
"nw");
831 EdbPrintInstructionName (L
"nd");
835 EdbPrintRegister1 (Operands
);
837 InstructionAddress
+= 2;
838 if ((Modifiers
& OPCODE_M_IMMED_OP1
) != 0) {
839 if ((Opcode
<= OPCODE_MOVQW
) || (Opcode
== OPCODE_MOVNW
)) {
840 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT16
));
841 InstructionAddress
+= 2;
842 EdbPrintRawIndexData16 (Data16
);
843 } else if ((Opcode
<= OPCODE_MOVQD
) || (Opcode
== OPCODE_MOVND
)) {
844 CopyMem (&Data32
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT32
));
845 InstructionAddress
+= 4;
846 EdbPrintRawIndexData32 (Data32
);
847 } else if (Opcode
== OPCODE_MOVQQ
) {
848 CopyMem (&Data64
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT64
));
849 InstructionAddress
+= 8;
850 EdbPrintRawIndexData64 (Data64
);
855 EdbPrintRegister2 (Operands
);
857 if ((Modifiers
& OPCODE_M_IMMED_OP2
) != 0) {
858 if ((Opcode
<= OPCODE_MOVQW
) || (Opcode
== OPCODE_MOVNW
)) {
859 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT16
));
860 EdbPrintRawIndexData16 (Data16
);
861 } else if ((Opcode
<= OPCODE_MOVQD
) || (Opcode
== OPCODE_MOVND
)) {
862 CopyMem (&Data32
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT32
));
863 EdbPrintRawIndexData32 (Data32
);
864 } else if (Opcode
== OPCODE_MOVQQ
) {
865 CopyMem (&Data64
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT64
));
866 EdbPrintRawIndexData64 (Data64
);
870 EdbPostInstructionString ();
878 Disasm instruction - MOVsnw.
880 @param InstructionAddress - The instruction address
881 @param SystemContext - EBC system context.
882 @param DisasmString - The instruction string
884 @return Instruction length
889 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
890 IN EFI_SYSTEM_CONTEXT SystemContext
,
891 OUT CHAR16
**DisasmString
899 ASSERT (GET_OPCODE(InstructionAddress
) == OPCODE_MOVSNW
);
901 Modifiers
= GET_MODIFIERS (InstructionAddress
);
902 Operands
= GET_OPERANDS (InstructionAddress
);
904 if ((Modifiers
& OPCODE_M_IMMED_OP1
) != 0) {
907 if ((Modifiers
& OPCODE_M_IMMED_OP2
) != 0) {
912 // Construct Disasm String
914 if (DisasmString
!= NULL
) {
915 *DisasmString
= EdbPreInstructionString ();
917 EdbPrintInstructionName (L
"MOVsnw");
919 EdbPrintRegister1 (Operands
);
921 InstructionAddress
+= 2;
922 if ((Modifiers
& OPCODE_M_IMMED_OP1
) != 0) {
923 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT16
));
924 InstructionAddress
+= 2;
925 EdbPrintRawIndexData16 (Data16
);
929 EdbPrintRegister2 (Operands
);
931 if ((Modifiers
& OPCODE_M_IMMED_OP2
) != 0) {
932 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT16
));
933 if ((Operands
& OPERAND_M_INDIRECT2
) != 0) {
934 EdbPrintRawIndexData16 (Data16
);
936 EdbPrintImmDatan (Data16
);
940 EdbPostInstructionString ();
948 Disasm instruction - MOVsnd.
950 @param InstructionAddress - The instruction address
951 @param SystemContext - EBC system context.
952 @param DisasmString - The instruction string
954 @return Instruction length
959 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
960 IN EFI_SYSTEM_CONTEXT SystemContext
,
961 OUT CHAR16
**DisasmString
969 ASSERT (GET_OPCODE(InstructionAddress
) == OPCODE_MOVSND
);
971 Modifiers
= GET_MODIFIERS (InstructionAddress
);
972 Operands
= GET_OPERANDS (InstructionAddress
);
974 if ((Modifiers
& OPCODE_M_IMMED_OP1
) != 0) {
977 if ((Modifiers
& OPCODE_M_IMMED_OP2
) != 0) {
982 // Construct Disasm String
984 if (DisasmString
!= NULL
) {
985 *DisasmString
= EdbPreInstructionString ();
987 EdbPrintInstructionName (L
"MOVsnd");
989 EdbPrintRegister1 (Operands
);
991 InstructionAddress
+= 2;
992 if ((Modifiers
& OPCODE_M_IMMED_OP1
) != 0) {
993 CopyMem (&Data32
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT32
));
994 InstructionAddress
+= 4;
995 EdbPrintRawIndexData32 (Data32
);
999 EdbPrintRegister2 (Operands
);
1001 if ((Modifiers
& OPCODE_M_IMMED_OP2
) != 0) {
1002 CopyMem (&Data32
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT32
));
1003 if ((Operands
& OPERAND_M_INDIRECT2
) != 0) {
1004 EdbPrintRawIndexData32 (Data32
);
1006 EdbPrintImmDatan (Data32
);
1010 EdbPostInstructionString ();
1018 Disasm instruction - LOADSP.
1020 @param InstructionAddress - The instruction address
1021 @param SystemContext - EBC system context.
1022 @param DisasmString - The instruction string
1024 @return Instruction length
1029 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
1030 IN EFI_SYSTEM_CONTEXT SystemContext
,
1031 OUT CHAR16
**DisasmString
1036 ASSERT (GET_OPCODE(InstructionAddress
) == OPCODE_LOADSP
);
1038 Operands
= GET_OPERANDS (InstructionAddress
);
1041 // Construct Disasm String
1043 if (DisasmString
!= NULL
) {
1044 *DisasmString
= EdbPreInstructionString ();
1046 EdbPrintInstructionName (L
"LOADSP");
1048 EdbPrintDedicatedRegister1 (Operands
);
1050 EdbPrintRegister2 (Operands
);
1052 EdbPostInstructionString ();
1060 Disasm instruction - STORESP.
1062 @param InstructionAddress - The instruction address
1063 @param SystemContext - EBC system context.
1064 @param DisasmString - The instruction string
1066 @return Instruction length
1071 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
1072 IN EFI_SYSTEM_CONTEXT SystemContext
,
1073 OUT CHAR16
**DisasmString
1078 ASSERT (GET_OPCODE(InstructionAddress
) == OPCODE_STORESP
);
1080 Operands
= GET_OPERANDS (InstructionAddress
);
1083 // Construct Disasm String
1085 if (DisasmString
!= NULL
) {
1086 *DisasmString
= EdbPreInstructionString ();
1088 EdbPrintInstructionName (L
"STORESP");
1090 EdbPrintRegister1 (Operands
);
1092 EdbPrintDedicatedRegister2 (Operands
);
1094 EdbPostInstructionString ();
1103 Disasm instruction - PUSH.
1105 @param InstructionAddress - The instruction address
1106 @param SystemContext - EBC system context.
1107 @param DisasmString - The instruction string
1109 @return Instruction length
1114 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
1115 IN EFI_SYSTEM_CONTEXT SystemContext
,
1116 OUT CHAR16
**DisasmString
1124 ASSERT (GET_OPCODE(InstructionAddress
) == OPCODE_PUSH
);
1126 Operands
= GET_OPERANDS (InstructionAddress
);
1127 Modifiers
= GET_MODIFIERS (InstructionAddress
);
1128 if ((Modifiers
& PUSHPOP_M_IMMDATA
) != 0) {
1135 // Construct Disasm String
1137 if (DisasmString
!= NULL
) {
1138 *DisasmString
= EdbPreInstructionString ();
1140 EdbPrintInstructionName (L
"PUSH");
1141 // if (Modifiers & PUSHPOP_M_64) {
1142 // EdbPrintInstructionName (L"64");
1144 // EdbPrintInstructionName (L"32");
1147 EdbPrintRegister1 (Operands
);
1149 InstructionAddress
+= 2;
1150 if ((Modifiers
& PUSHPOP_M_IMMDATA
) != 0) {
1151 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT16
));
1152 if ((Operands
& OPERAND_M_INDIRECT1
) != 0) {
1153 EdbPrintRawIndexData16 (Data16
);
1155 EdbPrintImmDatan (Data16
);
1159 EdbPostInstructionString ();
1167 Disasm instruction - POP.
1169 @param InstructionAddress - The instruction address
1170 @param SystemContext - EBC system context.
1171 @param DisasmString - The instruction string
1173 @return Instruction length
1178 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
1179 IN EFI_SYSTEM_CONTEXT SystemContext
,
1180 OUT CHAR16
**DisasmString
1188 ASSERT (GET_OPCODE(InstructionAddress
) == OPCODE_POP
);
1190 Operands
= GET_OPERANDS (InstructionAddress
);
1191 Modifiers
= GET_MODIFIERS (InstructionAddress
);
1192 if ((Modifiers
& PUSHPOP_M_IMMDATA
) != 0) {
1199 // Construct Disasm String
1201 if (DisasmString
!= NULL
) {
1202 *DisasmString
= EdbPreInstructionString ();
1204 EdbPrintInstructionName (L
"POP");
1205 // if (Modifiers & PUSHPOP_M_64) {
1206 // EdbPrintInstructionName (L"64");
1208 // EdbPrintInstructionName (L"32");
1211 EdbPrintRegister1 (Operands
);
1213 InstructionAddress
+= 2;
1214 if ((Modifiers
& PUSHPOP_M_IMMDATA
) != 0) {
1215 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT16
));
1216 if ((Operands
& OPERAND_M_INDIRECT1
) != 0) {
1217 EdbPrintRawIndexData16 (Data16
);
1219 EdbPrintImmDatan (Data16
);
1223 EdbPostInstructionString ();
1231 Disasm instruction - CMPI.
1233 @param InstructionAddress - The instruction address
1234 @param SystemContext - EBC system context.
1235 @param DisasmString - The instruction string
1237 @return Instruction length
1242 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
1243 IN EFI_SYSTEM_CONTEXT SystemContext
,
1244 OUT CHAR16
**DisasmString
1255 (GET_OPCODE(InstructionAddress
) == OPCODE_CMPIEQ
) ||
1256 (GET_OPCODE(InstructionAddress
) == OPCODE_CMPILTE
) ||
1257 (GET_OPCODE(InstructionAddress
) == OPCODE_CMPIGTE
) ||
1258 (GET_OPCODE(InstructionAddress
) == OPCODE_CMPIULTE
) ||
1259 (GET_OPCODE(InstructionAddress
) == OPCODE_CMPIUGTE
)
1262 Modifiers
= GET_MODIFIERS (InstructionAddress
);
1263 Opcode
= GET_OPCODE (InstructionAddress
);
1264 Operands
= GET_OPERANDS (InstructionAddress
);
1266 if ((Operands
& 0xE0) != 0) {
1271 if ((Operands
& OPERAND_M_CMPI_INDEX
) != 0) {
1274 if ((Modifiers
& OPCODE_M_CMPI32_DATA
) != 0) {
1281 // Construct Disasm String
1283 if (DisasmString
!= NULL
) {
1284 *DisasmString
= EdbPreInstructionString ();
1286 EdbPrintInstructionName (L
"CMPI");
1287 // if (Modifiers & OPCODE_M_CMPI64) {
1288 // EdbPrintInstructionName (L"64");
1290 // EdbPrintInstructionName (L"32");
1292 if ((Modifiers
& OPCODE_M_CMPI32_DATA
) != 0) {
1293 EdbPrintInstructionName (L
"d");
1295 EdbPrintInstructionName (L
"w");
1299 EdbPrintInstructionName (L
"eq");
1301 case OPCODE_CMPILTE
:
1302 EdbPrintInstructionName (L
"lte");
1304 case OPCODE_CMPIGTE
:
1305 EdbPrintInstructionName (L
"gte");
1307 case OPCODE_CMPIULTE
:
1308 EdbPrintInstructionName (L
"ulte");
1310 case OPCODE_CMPIUGTE
:
1311 EdbPrintInstructionName (L
"ugte");
1315 EdbPrintRegister1 (Operands
);
1317 InstructionAddress
+= 2;
1318 if ((Operands
& OPERAND_M_CMPI_INDEX
) != 0) {
1319 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT16
));
1320 InstructionAddress
+= 2;
1321 EdbPrintRawIndexData16 (Data16
);
1326 if ((Modifiers
& OPCODE_M_CMPI32_DATA
) != 0) {
1327 CopyMem (&Data32
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT32
));
1328 EdbPrintDatan (Data32
);
1330 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT16
));
1331 EdbPrintDatan (Data16
);
1334 EdbPostInstructionString ();
1342 Disasm instruction - PUSHn.
1344 @param InstructionAddress - The instruction address
1345 @param SystemContext - EBC system context.
1346 @param DisasmString - The instruction string
1348 @return Instruction length
1353 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
1354 IN EFI_SYSTEM_CONTEXT SystemContext
,
1355 OUT CHAR16
**DisasmString
1363 ASSERT (GET_OPCODE(InstructionAddress
) == OPCODE_PUSHN
);
1365 Operands
= GET_OPERANDS (InstructionAddress
);
1366 Modifiers
= GET_MODIFIERS (InstructionAddress
);
1367 if ((Modifiers
& PUSHPOP_M_IMMDATA
) != 0) {
1374 // Construct Disasm String
1376 if (DisasmString
!= NULL
) {
1377 *DisasmString
= EdbPreInstructionString ();
1379 EdbPrintInstructionName (L
"PUSHn");
1381 EdbPrintRegister1 (Operands
);
1383 InstructionAddress
+= 2;
1384 if ((Modifiers
& PUSHPOP_M_IMMDATA
) != 0) {
1385 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT16
));
1386 if ((Operands
& OPERAND_M_INDIRECT1
) != 0) {
1387 EdbPrintRawIndexData16 (Data16
);
1389 EdbPrintImmDatan (Data16
);
1393 EdbPostInstructionString ();
1401 Disasm instruction - POPn.
1403 @param InstructionAddress - The instruction address
1404 @param SystemContext - EBC system context.
1405 @param DisasmString - The instruction string
1407 @return Instruction length
1412 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
1413 IN EFI_SYSTEM_CONTEXT SystemContext
,
1414 OUT CHAR16
**DisasmString
1422 ASSERT (GET_OPCODE(InstructionAddress
) == OPCODE_POPN
);
1424 Operands
= GET_OPERANDS (InstructionAddress
);
1425 Modifiers
= GET_MODIFIERS (InstructionAddress
);
1426 if ((Modifiers
& PUSHPOP_M_IMMDATA
) != 0) {
1433 // Construct Disasm String
1435 if (DisasmString
!= NULL
) {
1436 *DisasmString
= EdbPreInstructionString ();
1438 EdbPrintInstructionName (L
"POPn");
1440 EdbPrintRegister1 (Operands
);
1442 InstructionAddress
+= 2;
1443 if ((Modifiers
& PUSHPOP_M_IMMDATA
) != 0) {
1444 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT16
));
1445 if ((Operands
& OPERAND_M_INDIRECT1
) != 0) {
1446 EdbPrintRawIndexData16 (Data16
);
1448 EdbPrintImmDatan (Data16
);
1452 EdbPostInstructionString ();
1460 Disasm instruction - MOVI.
1462 @param InstructionAddress - The instruction address
1463 @param SystemContext - EBC system context.
1464 @param DisasmString - The instruction string
1466 @return Instruction length
1471 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
1472 IN EFI_SYSTEM_CONTEXT SystemContext
,
1473 OUT CHAR16
**DisasmString
1483 ASSERT (GET_OPCODE(InstructionAddress
) == OPCODE_MOVI
);
1485 Modifiers
= GET_MODIFIERS (InstructionAddress
);
1486 Operands
= GET_OPERANDS (InstructionAddress
);
1488 if ((Operands
& MOVI_M_IMMDATA
) != 0) {
1493 if ((Modifiers
& MOVI_M_DATAWIDTH
) == MOVI_DATAWIDTH16
) {
1495 } else if ((Modifiers
& MOVI_M_DATAWIDTH
) == MOVI_DATAWIDTH32
) {
1497 } else if ((Modifiers
& MOVI_M_DATAWIDTH
) == MOVI_DATAWIDTH64
) {
1502 // Construct Disasm String
1504 if (DisasmString
!= NULL
) {
1505 *DisasmString
= EdbPreInstructionString ();
1507 EdbPrintInstructionName (L
"MOVI");
1508 switch (Operands
& MOVI_M_MOVEWIDTH
) {
1509 case MOVI_MOVEWIDTH8
:
1510 EdbPrintInstructionName (L
"b");
1512 case MOVI_MOVEWIDTH16
:
1513 EdbPrintInstructionName (L
"w");
1515 case MOVI_MOVEWIDTH32
:
1516 EdbPrintInstructionName (L
"d");
1518 case MOVI_MOVEWIDTH64
:
1519 EdbPrintInstructionName (L
"q");
1522 switch (Modifiers
& MOVI_M_DATAWIDTH
) {
1523 case MOVI_DATAWIDTH16
:
1524 EdbPrintInstructionName (L
"w");
1526 case MOVI_DATAWIDTH32
:
1527 EdbPrintInstructionName (L
"d");
1529 case MOVI_DATAWIDTH64
:
1530 EdbPrintInstructionName (L
"q");
1534 EdbPrintRegister1 (Operands
);
1536 InstructionAddress
+= 2;
1537 if ((Operands
& MOVI_M_IMMDATA
) != 0) {
1538 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT16
));
1539 InstructionAddress
+= 2;
1540 EdbPrintRawIndexData16 (Data16
);
1545 switch (Modifiers
& MOVI_M_DATAWIDTH
) {
1546 case MOVI_DATAWIDTH16
:
1547 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT16
));
1548 EdbPrintDatan (Data16
);
1550 case MOVI_DATAWIDTH32
:
1551 CopyMem (&Data32
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT32
));
1552 EdbPrintDatan (Data32
);
1554 case MOVI_DATAWIDTH64
:
1555 CopyMem (&Data64
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT64
));
1556 EdbPrintData64n (Data64
);
1560 EdbPostInstructionString ();
1568 Disasm instruction - MOVIn.
1570 @param InstructionAddress - The instruction address
1571 @param SystemContext - EBC system context.
1572 @param DisasmString - The instruction string
1574 @return Instruction length
1579 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
1580 IN EFI_SYSTEM_CONTEXT SystemContext
,
1581 OUT CHAR16
**DisasmString
1591 ASSERT (GET_OPCODE(InstructionAddress
) == OPCODE_MOVIN
);
1593 Modifiers
= GET_MODIFIERS (InstructionAddress
);
1594 Operands
= GET_OPERANDS (InstructionAddress
);
1596 if ((Operands
& MOVI_M_IMMDATA
) != 0) {
1601 if ((Modifiers
& MOVI_M_DATAWIDTH
) == MOVI_DATAWIDTH16
) {
1603 } else if ((Modifiers
& MOVI_M_DATAWIDTH
) == MOVI_DATAWIDTH32
) {
1605 } else if ((Modifiers
& MOVI_M_DATAWIDTH
) == MOVI_DATAWIDTH64
) {
1610 // Construct Disasm String
1612 if (DisasmString
!= NULL
) {
1613 *DisasmString
= EdbPreInstructionString ();
1615 EdbPrintInstructionName (L
"MOVIn");
1616 switch (Modifiers
& MOVI_M_DATAWIDTH
) {
1617 case MOVI_DATAWIDTH16
:
1618 EdbPrintInstructionName (L
"w");
1620 case MOVI_DATAWIDTH32
:
1621 EdbPrintInstructionName (L
"d");
1623 case MOVI_DATAWIDTH64
:
1624 EdbPrintInstructionName (L
"q");
1628 EdbPrintRegister1 (Operands
);
1630 InstructionAddress
+= 2;
1631 if ((Operands
& MOVI_M_IMMDATA
) != 0) {
1632 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT16
));
1633 InstructionAddress
+= 2;
1634 EdbPrintRawIndexData16 (Data16
);
1639 switch (Modifiers
& MOVI_M_DATAWIDTH
) {
1640 case MOVI_DATAWIDTH16
:
1641 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT16
));
1642 EdbPrintRawIndexData16 (Data16
);
1644 case MOVI_DATAWIDTH32
:
1645 CopyMem (&Data32
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT32
));
1646 EdbPrintRawIndexData32 (Data32
);
1648 case MOVI_DATAWIDTH64
:
1649 CopyMem (&Data64
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT64
));
1650 EdbPrintRawIndexData64 (Data64
);
1654 EdbPostInstructionString ();
1662 Disasm instruction - MOVREL.
1664 @param InstructionAddress - The instruction address
1665 @param SystemContext - EBC system context.
1666 @param DisasmString - The instruction string
1668 @return Instruction length
1673 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
1674 IN EFI_SYSTEM_CONTEXT SystemContext
,
1675 OUT CHAR16
**DisasmString
1685 EFI_PHYSICAL_ADDRESS SavedInstructionAddress
;
1687 ASSERT (GET_OPCODE(InstructionAddress
) == OPCODE_MOVREL
);
1688 SavedInstructionAddress
= InstructionAddress
;
1690 Modifiers
= GET_MODIFIERS (InstructionAddress
);
1691 Operands
= GET_OPERANDS (InstructionAddress
);
1693 if ((Operands
& MOVI_M_IMMDATA
) != 0) {
1698 if ((Modifiers
& MOVI_M_DATAWIDTH
) == MOVI_DATAWIDTH16
) {
1700 } else if ((Modifiers
& MOVI_M_DATAWIDTH
) == MOVI_DATAWIDTH32
) {
1702 } else if ((Modifiers
& MOVI_M_DATAWIDTH
) == MOVI_DATAWIDTH64
) {
1709 // Construct Disasm String
1711 if (DisasmString
!= NULL
) {
1712 *DisasmString
= EdbPreInstructionString ();
1714 EdbPrintInstructionName (L
"MOVrel");
1715 switch (Modifiers
& MOVI_M_DATAWIDTH
) {
1716 case MOVI_DATAWIDTH16
:
1717 EdbPrintInstructionName (L
"w");
1719 case MOVI_DATAWIDTH32
:
1720 EdbPrintInstructionName (L
"d");
1722 case MOVI_DATAWIDTH64
:
1723 EdbPrintInstructionName (L
"q");
1727 EdbPrintRegister1 (Operands
);
1729 InstructionAddress
+= 2;
1730 if ((Operands
& MOVI_M_IMMDATA
) != 0) {
1731 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT16
));
1732 InstructionAddress
+= 2;
1733 EdbPrintRawIndexData16 (Data16
);
1738 switch (Modifiers
& MOVI_M_DATAWIDTH
) {
1739 case MOVI_DATAWIDTH16
:
1740 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT16
));
1741 Result
= EdbFindAndPrintSymbol ((UINTN
)(SavedInstructionAddress
+ Size
+ (INT16
)Data16
));
1743 EdbPrintData16 (Data16
);
1746 case MOVI_DATAWIDTH32
:
1747 CopyMem (&Data32
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT32
));
1748 Result
= EdbFindAndPrintSymbol ((UINTN
)(SavedInstructionAddress
+ Size
+ (INT32
)Data32
));
1750 EdbPrintData32 (Data32
);
1753 case MOVI_DATAWIDTH64
:
1754 CopyMem (&Data64
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT64
));
1755 if (sizeof(UINTN
) == sizeof(UINT64
)) {
1756 Result
= EdbFindAndPrintSymbol ((UINTN
)(SavedInstructionAddress
+ Size
+ (INT64
)Data64
));
1761 EdbPrintData64 (Data64
);
1766 EdbPostInstructionString ();