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.
18 // Debugger Disasm definition
20 #define EDB_DISASM_DEFINE(func) \
23 IN EFI_PHYSICAL_ADDRESS InstructionAddress, \
24 IN EFI_SYSTEM_CONTEXT SystemContext, \
25 OUT CHAR16 **DisasmString \
28 EDB_DISASM_DEFINE (EdbDisasmBREAK
);
29 EDB_DISASM_DEFINE (EdbDisasmJMP
);
30 EDB_DISASM_DEFINE (EdbDisasmJMP8
);
31 EDB_DISASM_DEFINE (EdbDisasmCALL
);
32 EDB_DISASM_DEFINE (EdbDisasmRET
);
33 EDB_DISASM_DEFINE (EdbDisasmCMP
);
34 EDB_DISASM_DEFINE (EdbDisasmUnsignedDataManip
);
35 EDB_DISASM_DEFINE (EdbDisasmSignedDataManip
);
36 EDB_DISASM_DEFINE (EdbDisasmMOVxx
);
37 EDB_DISASM_DEFINE (EdbDisasmMOVsnw
);
38 EDB_DISASM_DEFINE (EdbDisasmMOVsnd
);
39 EDB_DISASM_DEFINE (EdbDisasmLOADSP
);
40 EDB_DISASM_DEFINE (EdbDisasmSTORESP
);
41 EDB_DISASM_DEFINE (EdbDisasmPUSH
);
42 EDB_DISASM_DEFINE (EdbDisasmPOP
);
43 EDB_DISASM_DEFINE (EdbDisasmCMPI
);
44 EDB_DISASM_DEFINE (EdbDisasmPUSHn
);
45 EDB_DISASM_DEFINE (EdbDisasmPOPn
);
46 EDB_DISASM_DEFINE (EdbDisasmMOVI
);
47 EDB_DISASM_DEFINE (EdbDisasmMOVIn
);
48 EDB_DISASM_DEFINE (EdbDisasmMOVREL
);
51 // Debugger Disasm Table
53 EDB_DISASM_INSTRUCTION mEdbDisasmInstructionTable
[] = {
54 EdbDisasmBREAK
, // opcode 0x00 BREAK
55 EdbDisasmJMP
, // opcode 0x01 JMP
56 EdbDisasmJMP8
, // opcode 0x02 JMP8
57 EdbDisasmCALL
, // opcode 0x03 CALL
58 EdbDisasmRET
, // opcode 0x04 RET
59 EdbDisasmCMP
, // opcode 0x05 CMPEQ
60 EdbDisasmCMP
, // opcode 0x06 CMPLTE
61 EdbDisasmCMP
, // opcode 0x07 CMPGTE
62 EdbDisasmCMP
, // opcode 0x08 CMPULTE
63 EdbDisasmCMP
, // opcode 0x09 CMPUGTE
64 EdbDisasmUnsignedDataManip
, // opcode 0x0A NOT
65 EdbDisasmSignedDataManip
, // opcode 0x0B NEG
66 EdbDisasmSignedDataManip
, // opcode 0x0C ADD
67 EdbDisasmSignedDataManip
, // opcode 0x0D SUB
68 EdbDisasmSignedDataManip
, // opcode 0x0E MUL
69 EdbDisasmUnsignedDataManip
, // opcode 0x0F MULU
70 EdbDisasmSignedDataManip
, // opcode 0x10 DIV
71 EdbDisasmUnsignedDataManip
, // opcode 0x11 DIVU
72 EdbDisasmSignedDataManip
, // opcode 0x12 MOD
73 EdbDisasmUnsignedDataManip
, // opcode 0x13 MODU
74 EdbDisasmUnsignedDataManip
, // opcode 0x14 AND
75 EdbDisasmUnsignedDataManip
, // opcode 0x15 OR
76 EdbDisasmUnsignedDataManip
, // opcode 0x16 XOR
77 EdbDisasmUnsignedDataManip
, // opcode 0x17 SHL
78 EdbDisasmUnsignedDataManip
, // opcode 0x18 SHR
79 EdbDisasmSignedDataManip
, // opcode 0x19 ASHR
80 EdbDisasmUnsignedDataManip
, // opcode 0x1A EXTNDB
81 EdbDisasmUnsignedDataManip
, // opcode 0x1B EXTNDW
82 EdbDisasmUnsignedDataManip
, // opcode 0x1C EXTNDD
83 EdbDisasmMOVxx
, // opcode 0x1D MOVBW
84 EdbDisasmMOVxx
, // opcode 0x1E MOVWW
85 EdbDisasmMOVxx
, // opcode 0x1F MOVDW
86 EdbDisasmMOVxx
, // opcode 0x20 MOVQW
87 EdbDisasmMOVxx
, // opcode 0x21 MOVBD
88 EdbDisasmMOVxx
, // opcode 0x22 MOVWD
89 EdbDisasmMOVxx
, // opcode 0x23 MOVDD
90 EdbDisasmMOVxx
, // opcode 0x24 MOVQD
91 EdbDisasmMOVsnw
, // opcode 0x25 MOVSNW
92 EdbDisasmMOVsnd
, // opcode 0x26 MOVSND
94 EdbDisasmMOVxx
, // opcode 0x28 MOVQQ
95 EdbDisasmLOADSP
, // opcode 0x29 LOADSP
96 EdbDisasmSTORESP
, // opcode 0x2A STORESP
97 EdbDisasmPUSH
, // opcode 0x2B PUSH
98 EdbDisasmPOP
, // opcode 0x2C POP
99 EdbDisasmCMPI
, // opcode 0x2D CMPIEQ
100 EdbDisasmCMPI
, // opcode 0x2E CMPILTE
101 EdbDisasmCMPI
, // opcode 0x2F CMPIGTE
102 EdbDisasmCMPI
, // opcode 0x30 CMPIULTE
103 EdbDisasmCMPI
, // opcode 0x31 CMPIUGTE
104 EdbDisasmMOVxx
, // opcode 0x32 MOVNW
105 EdbDisasmMOVxx
, // opcode 0x33 MOVND
107 EdbDisasmPUSHn
, // opcode 0x35 PUSHN
108 EdbDisasmPOPn
, // opcode 0x36 POPN
109 EdbDisasmMOVI
, // opcode 0x37 MOVI
110 EdbDisasmMOVIn
, // opcode 0x38 MOVIN
111 EdbDisasmMOVREL
, // opcode 0x39 MOVREL
116 Disasm instruction - BREAK.
118 @param InstructionAddress - The instruction address
119 @param SystemContext - EBC system context.
120 @param DisasmString - The instruction string
122 @return Instruction length
127 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
128 IN EFI_SYSTEM_CONTEXT SystemContext
,
129 OUT CHAR16
**DisasmString
132 ASSERT (GET_OPCODE(InstructionAddress
) == OPCODE_BREAK
);
134 if (*(UINT8
*)(UINTN
)(InstructionAddress
+ 1) > 6) {
139 // Construct Disasm String
141 if (DisasmString
!= NULL
) {
142 *DisasmString
= EdbPreInstructionString ();
144 EdbPrintInstructionName (L
"BREAK");
145 EdbPrintDatan (*(UINT8
*)(UINTN
)(InstructionAddress
+ 1));
147 EdbPostInstructionString ();
153 extern CONST UINT8 mJMPLen
[];
157 Disasm instruction - JMP.
159 @param InstructionAddress - The instruction address
160 @param SystemContext - EBC system context.
161 @param DisasmString - The instruction string
163 @return Instruction length
168 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
169 IN EFI_SYSTEM_CONTEXT SystemContext
,
170 OUT CHAR16
**DisasmString
179 ASSERT (GET_OPCODE(InstructionAddress
) == OPCODE_JMP
);
181 Modifiers
= GET_MODIFIERS (InstructionAddress
);
182 Operands
= GET_OPERANDS (InstructionAddress
);
183 Size
= (UINTN
)mJMPLen
[(Modifiers
>> 6) & 0x03];
186 // Construct Disasm String
188 if (DisasmString
!= NULL
) {
189 *DisasmString
= EdbPreInstructionString ();
191 EdbPrintInstructionName (L
"JMP");
192 // if (Modifiers & OPCODE_M_IMMDATA64) {
193 // EdbPrintInstructionName (L"64");
195 // EdbPrintInstructionName (L"32");
197 if ((Modifiers
& CONDITION_M_CONDITIONAL
) != 0) {
198 if ((Modifiers
& JMP_M_CS
) != 0) {
199 EdbPrintInstructionName (L
"cs");
201 EdbPrintInstructionName (L
"cc");
205 InstructionAddress
+= 2;
206 if ((Modifiers
& OPCODE_M_IMMDATA64
) != 0) {
207 CopyMem (&Data64
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT64
));
208 if ((Modifiers
& OPCODE_M_IMMDATA
) != 0) {
209 EdbPrintData64 (Data64
);
214 CopyMem (&Data32
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT32
));
215 EdbPrintRegister1 (Operands
);
217 if ((Operands
& OPERAND_M_INDIRECT1
) == 0) {
218 if ((Modifiers
& OPCODE_M_IMMDATA
) == 0) {
221 EdbPrintImmDatan (Data32
);
223 EdbPrintRawIndexData32 (Data32
);
227 EdbPostInstructionString ();
235 Disasm instruction - JMP8.
237 @param InstructionAddress - The instruction address
238 @param SystemContext - EBC system context.
239 @param DisasmString - The instruction string
241 @return Instruction length
246 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
247 IN EFI_SYSTEM_CONTEXT SystemContext
,
248 OUT CHAR16
**DisasmString
253 ASSERT (GET_OPCODE(InstructionAddress
) == OPCODE_JMP8
);
254 Modifiers
= GET_MODIFIERS (InstructionAddress
);
257 // Construct Disasm String
259 if (DisasmString
!= NULL
) {
260 *DisasmString
= EdbPreInstructionString ();
262 EdbPrintInstructionName (L
"JMP8");
263 if ((Modifiers
& CONDITION_M_CONDITIONAL
) != 0) {
264 if ((Modifiers
& JMP_M_CS
) != 0) {
265 EdbPrintInstructionName (L
"cs");
267 EdbPrintInstructionName (L
"cc");
271 EdbPrintData8 (*(UINT8
*)(UINTN
)(InstructionAddress
+ 1));
273 EdbPostInstructionString ();
281 Disasm instruction - CALL.
283 @param InstructionAddress - The instruction address
284 @param SystemContext - EBC system context.
285 @param DisasmString - The instruction string
287 @return Instruction length
292 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
293 IN EFI_SYSTEM_CONTEXT SystemContext
,
294 OUT CHAR16
**DisasmString
304 EFI_PHYSICAL_ADDRESS SavedInstructionAddress
;
306 ASSERT (GET_OPCODE(InstructionAddress
) == OPCODE_CALL
);
307 SavedInstructionAddress
= InstructionAddress
;
309 Modifiers
= GET_MODIFIERS (InstructionAddress
);
310 Operands
= GET_OPERANDS (InstructionAddress
);
311 Size
= (UINTN
)mJMPLen
[(Modifiers
>> 6) & 0x03];
314 // Construct Disasm String
316 if (DisasmString
!= NULL
) {
317 *DisasmString
= EdbPreInstructionString ();
319 EdbPrintInstructionName (L
"CALL");
320 // if (Modifiers & OPCODE_M_IMMDATA64) {
321 // EdbPrintInstructionName (L"64");
323 // EdbPrintInstructionName (L"32");
325 if ((Operands
& OPERAND_M_NATIVE_CALL
) != 0) {
326 EdbPrintInstructionName (L
"EX");
328 // if ((Operands & OPERAND_M_RELATIVE_ADDR) == 0) {
329 // EdbPrintInstructionName (L"a");
332 InstructionAddress
+= 2;
333 if ((Modifiers
& OPCODE_M_IMMDATA64
) != 0) {
334 CopyMem (&Data64
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT64
));
336 if ((Modifiers
& OPCODE_M_IMMDATA
) != 0) {
337 Result
= EdbFindAndPrintSymbol ((UINTN
)Ip
);
339 EdbPrintData64 (Data64
);
345 if ((Modifiers
& OPCODE_M_IMMDATA
) != 0) {
346 CopyMem (&Data32
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT32
));
351 if ((Operands
& OPERAND_M_OP1
) == 0) {
354 Ip
= GetRegisterValue (SystemContext
, (Operands
& OPERAND_M_OP1
));
357 if ((Operands
& OPERAND_M_INDIRECT1
) == 0) {
358 if ((Operands
& OPERAND_M_RELATIVE_ADDR
) != 0) {
359 Result
= EdbFindAndPrintSymbol ((UINTN
)(SavedInstructionAddress
+ Ip
+ Size
));
361 Result
= EdbFindAndPrintSymbol ((UINTN
)Ip
);
364 EdbPrintRegister1 (Operands
);
365 if ((Modifiers
& OPCODE_M_IMMDATA
) != 0) {
366 EdbPrintImmData32 (Data32
);
370 EdbPrintRegister1 (Operands
);
371 if ((Modifiers
& OPCODE_M_IMMDATA
) != 0) {
372 EdbPrintRawIndexData32 (Data32
);
377 EdbPostInstructionString ();
385 Disasm instruction - RET.
387 @param InstructionAddress - The instruction address
388 @param SystemContext - EBC system context.
389 @param DisasmString - The instruction string
391 @return Instruction length
396 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
397 IN EFI_SYSTEM_CONTEXT SystemContext
,
398 OUT CHAR16
**DisasmString
401 ASSERT (GET_OPCODE(InstructionAddress
) == OPCODE_RET
);
403 if (*(UINT8
*)(UINTN
)(InstructionAddress
+ 1) != 0) {
408 // Construct Disasm String
410 if (DisasmString
!= NULL
) {
411 *DisasmString
= EdbPreInstructionString ();
413 EdbPrintInstructionName (L
"RET");
415 EdbPostInstructionString ();
423 Disasm instruction - CMP.
425 @param InstructionAddress - The instruction address
426 @param SystemContext - EBC system context.
427 @param DisasmString - The instruction string
429 @return Instruction length
434 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
435 IN EFI_SYSTEM_CONTEXT SystemContext
,
436 OUT CHAR16
**DisasmString
446 (GET_OPCODE(InstructionAddress
) == OPCODE_CMPEQ
) ||
447 (GET_OPCODE(InstructionAddress
) == OPCODE_CMPLTE
) ||
448 (GET_OPCODE(InstructionAddress
) == OPCODE_CMPGTE
) ||
449 (GET_OPCODE(InstructionAddress
) == OPCODE_CMPULTE
) ||
450 (GET_OPCODE(InstructionAddress
) == OPCODE_CMPUGTE
)
453 Opcode
= GET_OPCODE (InstructionAddress
);
454 Modifiers
= GET_MODIFIERS (InstructionAddress
);
455 Operands
= GET_OPERANDS (InstructionAddress
);
456 if ((Modifiers
& OPCODE_M_IMMDATA
) != 0) {
463 // Construct Disasm String
465 if (DisasmString
!= NULL
) {
466 *DisasmString
= EdbPreInstructionString ();
468 EdbPrintInstructionName (L
"CMP");
469 // if (Modifiers & OPCODE_M_64BIT) {
470 // EdbPrintInstructionName (L"64");
472 // EdbPrintInstructionName (L"32");
476 EdbPrintInstructionName (L
"eq");
479 EdbPrintInstructionName (L
"lte");
482 EdbPrintInstructionName (L
"gte");
485 EdbPrintInstructionName (L
"ulte");
488 EdbPrintInstructionName (L
"ugte");
492 EdbPrintRegister1 (Operands
);
493 InstructionAddress
+= 2;
496 EdbPrintRegister2 (Operands
);
498 if ((Modifiers
& OPCODE_M_IMMDATA
) != 0) {
499 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT16
));
500 if ((Operands
& OPERAND_M_INDIRECT2
) != 0) {
501 EdbPrintRawIndexData16 (Data16
);
503 EdbPrintImmDatan (Data16
);
507 EdbPostInstructionString ();
515 Disasm instruction - Unsigned Data Manipulate.
517 @param InstructionAddress - The instruction address
518 @param SystemContext - EBC system context.
519 @param DisasmString - The instruction string
521 @return Instruction length
525 EdbDisasmUnsignedDataManip (
526 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
527 IN EFI_SYSTEM_CONTEXT SystemContext
,
528 OUT CHAR16
**DisasmString
538 (GET_OPCODE(InstructionAddress
) == OPCODE_NOT
) ||
539 (GET_OPCODE(InstructionAddress
) == OPCODE_MULU
) ||
540 (GET_OPCODE(InstructionAddress
) == OPCODE_DIVU
) ||
541 (GET_OPCODE(InstructionAddress
) == OPCODE_MODU
) ||
542 (GET_OPCODE(InstructionAddress
) == OPCODE_AND
) ||
543 (GET_OPCODE(InstructionAddress
) == OPCODE_OR
) ||
544 (GET_OPCODE(InstructionAddress
) == OPCODE_XOR
) ||
545 (GET_OPCODE(InstructionAddress
) == OPCODE_SHL
) ||
546 (GET_OPCODE(InstructionAddress
) == OPCODE_SHR
) ||
547 (GET_OPCODE(InstructionAddress
) == OPCODE_EXTNDB
) ||
548 (GET_OPCODE(InstructionAddress
) == OPCODE_EXTNDW
) ||
549 (GET_OPCODE(InstructionAddress
) == OPCODE_EXTNDD
)
552 Opcode
= GET_OPCODE (InstructionAddress
);
553 Operands
= GET_OPERANDS (InstructionAddress
);
554 Modifiers
= GET_MODIFIERS (InstructionAddress
);
555 if ((Modifiers
& DATAMANIP_M_IMMDATA
) != 0) {
562 // Construct Disasm String
564 if (DisasmString
!= NULL
) {
565 *DisasmString
= EdbPreInstructionString ();
569 EdbPrintInstructionName (L
"NOT");
572 EdbPrintInstructionName (L
"MULU");
575 EdbPrintInstructionName (L
"DIVU");
578 EdbPrintInstructionName (L
"MODU");
581 EdbPrintInstructionName (L
"AND");
584 EdbPrintInstructionName (L
"OR");
587 EdbPrintInstructionName (L
"XOR");
590 EdbPrintInstructionName (L
"SHL");
593 EdbPrintInstructionName (L
"SHR");
596 EdbPrintInstructionName (L
"EXTNDB");
599 EdbPrintInstructionName (L
"EXTNDW");
602 EdbPrintInstructionName (L
"EXTNDD");
605 // if (Modifiers & DATAMANIP_M_64) {
606 // EdbPrintInstructionName (L"64");
608 // EdbPrintInstructionName (L"32");
611 EdbPrintRegister1 (Operands
);
613 EdbPrintRegister2 (Operands
);
615 InstructionAddress
+= 2;
616 if ((Modifiers
& DATAMANIP_M_IMMDATA
) != 0) {
617 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT16
));
618 if ((Operands
& OPERAND_M_INDIRECT2
) != 0) {
619 EdbPrintRawIndexData16 (Data16
);
621 EdbPrintImmDatan (Data16
);
625 EdbPostInstructionString ();
633 Disasm instruction - Signed Data Manipulate,
635 @param InstructionAddress - The instruction address
636 @param SystemContext - EBC system context.
637 @param DisasmString - The instruction string
639 @return Instruction length
643 EdbDisasmSignedDataManip (
644 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
645 IN EFI_SYSTEM_CONTEXT SystemContext
,
646 OUT CHAR16
**DisasmString
656 (GET_OPCODE(InstructionAddress
) == OPCODE_NEG
) ||
657 (GET_OPCODE(InstructionAddress
) == OPCODE_ADD
) ||
658 (GET_OPCODE(InstructionAddress
) == OPCODE_SUB
) ||
659 (GET_OPCODE(InstructionAddress
) == OPCODE_MUL
) ||
660 (GET_OPCODE(InstructionAddress
) == OPCODE_DIV
) ||
661 (GET_OPCODE(InstructionAddress
) == OPCODE_MOD
) ||
662 (GET_OPCODE(InstructionAddress
) == OPCODE_ASHR
)
665 Opcode
= GET_OPCODE (InstructionAddress
);
666 Operands
= GET_OPERANDS (InstructionAddress
);
667 Modifiers
= GET_MODIFIERS (InstructionAddress
);
668 if ((Modifiers
& DATAMANIP_M_IMMDATA
) != 0) {
675 // Construct Disasm String
677 if (DisasmString
!= NULL
) {
678 *DisasmString
= EdbPreInstructionString ();
682 EdbPrintInstructionName (L
"NEG");
685 EdbPrintInstructionName (L
"ADD");
688 EdbPrintInstructionName (L
"SUB");
691 EdbPrintInstructionName (L
"MUL");
694 EdbPrintInstructionName (L
"DIV");
697 EdbPrintInstructionName (L
"MOD");
700 EdbPrintInstructionName (L
"ASHR");
703 // if (Modifiers & DATAMANIP_M_64) {
704 // EdbPrintInstructionName (L"64");
706 // EdbPrintInstructionName (L"32");
709 EdbPrintRegister1 (Operands
);
711 EdbPrintRegister2 (Operands
);
713 InstructionAddress
+= 2;
714 if ((Modifiers
& DATAMANIP_M_IMMDATA
) != 0) {
715 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT16
));
716 if ((Operands
& OPERAND_M_INDIRECT2
) != 0) {
717 EdbPrintRawIndexData16 (Data16
);
719 EdbPrintImmDatan (Data16
);
723 EdbPostInstructionString ();
731 Disasm instruction - MOVxx.
733 @param InstructionAddress - The instruction address
734 @param SystemContext - EBC system context.
735 @param DisasmString - The instruction string
737 @return Instruction length
742 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
743 IN EFI_SYSTEM_CONTEXT SystemContext
,
744 OUT CHAR16
**DisasmString
756 (GET_OPCODE(InstructionAddress
) == OPCODE_MOVBW
) ||
757 (GET_OPCODE(InstructionAddress
) == OPCODE_MOVWW
) ||
758 (GET_OPCODE(InstructionAddress
) == OPCODE_MOVDW
) ||
759 (GET_OPCODE(InstructionAddress
) == OPCODE_MOVQW
) ||
760 (GET_OPCODE(InstructionAddress
) == OPCODE_MOVBD
) ||
761 (GET_OPCODE(InstructionAddress
) == OPCODE_MOVWD
) ||
762 (GET_OPCODE(InstructionAddress
) == OPCODE_MOVDD
) ||
763 (GET_OPCODE(InstructionAddress
) == OPCODE_MOVQD
) ||
764 (GET_OPCODE(InstructionAddress
) == OPCODE_MOVQQ
) ||
765 (GET_OPCODE(InstructionAddress
) == OPCODE_MOVNW
) ||
766 (GET_OPCODE(InstructionAddress
) == OPCODE_MOVND
)
769 Opcode
= GET_OPCODE (InstructionAddress
);
770 Modifiers
= GET_MODIFIERS (InstructionAddress
);
771 Operands
= GET_OPERANDS (InstructionAddress
);
773 if ((Modifiers
& (OPCODE_M_IMMED_OP1
| OPCODE_M_IMMED_OP2
)) != 0) {
774 if ((Opcode
<= OPCODE_MOVQW
) || (Opcode
== OPCODE_MOVNW
)) {
775 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) {
785 if ((Modifiers
& OPCODE_M_IMMED_OP2
) != 0) {
788 } else if (Opcode
== OPCODE_MOVQQ
) {
789 if ((Modifiers
& OPCODE_M_IMMED_OP1
) != 0) {
792 if ((Modifiers
& OPCODE_M_IMMED_OP2
) != 0) {
799 // Construct Disasm String
801 if (DisasmString
!= NULL
) {
802 *DisasmString
= EdbPreInstructionString ();
804 EdbPrintInstructionName (L
"MOV");
807 EdbPrintInstructionName (L
"bw");
810 EdbPrintInstructionName (L
"ww");
813 EdbPrintInstructionName (L
"dw");
816 EdbPrintInstructionName (L
"qw");
819 EdbPrintInstructionName (L
"bd");
822 EdbPrintInstructionName (L
"wd");
825 EdbPrintInstructionName (L
"dd");
828 EdbPrintInstructionName (L
"qd");
831 EdbPrintInstructionName (L
"qq");
834 EdbPrintInstructionName (L
"nw");
837 EdbPrintInstructionName (L
"nd");
841 EdbPrintRegister1 (Operands
);
843 InstructionAddress
+= 2;
844 if ((Modifiers
& OPCODE_M_IMMED_OP1
) != 0) {
845 if ((Opcode
<= OPCODE_MOVQW
) || (Opcode
== OPCODE_MOVNW
)) {
846 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT16
));
847 InstructionAddress
+= 2;
848 EdbPrintRawIndexData16 (Data16
);
849 } else if ((Opcode
<= OPCODE_MOVQD
) || (Opcode
== OPCODE_MOVND
)) {
850 CopyMem (&Data32
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT32
));
851 InstructionAddress
+= 4;
852 EdbPrintRawIndexData32 (Data32
);
853 } else if (Opcode
== OPCODE_MOVQQ
) {
854 CopyMem (&Data64
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT64
));
855 InstructionAddress
+= 8;
856 EdbPrintRawIndexData64 (Data64
);
861 EdbPrintRegister2 (Operands
);
863 if ((Modifiers
& OPCODE_M_IMMED_OP2
) != 0) {
864 if ((Opcode
<= OPCODE_MOVQW
) || (Opcode
== OPCODE_MOVNW
)) {
865 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT16
));
866 EdbPrintRawIndexData16 (Data16
);
867 } else if ((Opcode
<= OPCODE_MOVQD
) || (Opcode
== OPCODE_MOVND
)) {
868 CopyMem (&Data32
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT32
));
869 EdbPrintRawIndexData32 (Data32
);
870 } else if (Opcode
== OPCODE_MOVQQ
) {
871 CopyMem (&Data64
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT64
));
872 EdbPrintRawIndexData64 (Data64
);
876 EdbPostInstructionString ();
884 Disasm instruction - MOVsnw.
886 @param InstructionAddress - The instruction address
887 @param SystemContext - EBC system context.
888 @param DisasmString - The instruction string
890 @return Instruction length
895 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
896 IN EFI_SYSTEM_CONTEXT SystemContext
,
897 OUT CHAR16
**DisasmString
905 ASSERT (GET_OPCODE(InstructionAddress
) == OPCODE_MOVSNW
);
907 Modifiers
= GET_MODIFIERS (InstructionAddress
);
908 Operands
= GET_OPERANDS (InstructionAddress
);
910 if ((Modifiers
& OPCODE_M_IMMED_OP1
) != 0) {
913 if ((Modifiers
& OPCODE_M_IMMED_OP2
) != 0) {
918 // Construct Disasm String
920 if (DisasmString
!= NULL
) {
921 *DisasmString
= EdbPreInstructionString ();
923 EdbPrintInstructionName (L
"MOVsnw");
925 EdbPrintRegister1 (Operands
);
927 InstructionAddress
+= 2;
928 if ((Modifiers
& OPCODE_M_IMMED_OP1
) != 0) {
929 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT16
));
930 InstructionAddress
+= 2;
931 EdbPrintRawIndexData16 (Data16
);
935 EdbPrintRegister2 (Operands
);
937 if ((Modifiers
& OPCODE_M_IMMED_OP2
) != 0) {
938 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT16
));
939 if ((Operands
& OPERAND_M_INDIRECT2
) != 0) {
940 EdbPrintRawIndexData16 (Data16
);
942 EdbPrintImmDatan (Data16
);
946 EdbPostInstructionString ();
954 Disasm instruction - MOVsnd.
956 @param InstructionAddress - The instruction address
957 @param SystemContext - EBC system context.
958 @param DisasmString - The instruction string
960 @return Instruction length
965 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
966 IN EFI_SYSTEM_CONTEXT SystemContext
,
967 OUT CHAR16
**DisasmString
975 ASSERT (GET_OPCODE(InstructionAddress
) == OPCODE_MOVSND
);
977 Modifiers
= GET_MODIFIERS (InstructionAddress
);
978 Operands
= GET_OPERANDS (InstructionAddress
);
980 if ((Modifiers
& OPCODE_M_IMMED_OP1
) != 0) {
983 if ((Modifiers
& OPCODE_M_IMMED_OP2
) != 0) {
988 // Construct Disasm String
990 if (DisasmString
!= NULL
) {
991 *DisasmString
= EdbPreInstructionString ();
993 EdbPrintInstructionName (L
"MOVsnd");
995 EdbPrintRegister1 (Operands
);
997 InstructionAddress
+= 2;
998 if ((Modifiers
& OPCODE_M_IMMED_OP1
) != 0) {
999 CopyMem (&Data32
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT32
));
1000 InstructionAddress
+= 4;
1001 EdbPrintRawIndexData32 (Data32
);
1005 EdbPrintRegister2 (Operands
);
1007 if ((Modifiers
& OPCODE_M_IMMED_OP2
) != 0) {
1008 CopyMem (&Data32
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT32
));
1009 if ((Operands
& OPERAND_M_INDIRECT2
) != 0) {
1010 EdbPrintRawIndexData32 (Data32
);
1012 EdbPrintImmDatan (Data32
);
1016 EdbPostInstructionString ();
1024 Disasm instruction - LOADSP.
1026 @param InstructionAddress - The instruction address
1027 @param SystemContext - EBC system context.
1028 @param DisasmString - The instruction string
1030 @return Instruction length
1035 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
1036 IN EFI_SYSTEM_CONTEXT SystemContext
,
1037 OUT CHAR16
**DisasmString
1042 ASSERT (GET_OPCODE(InstructionAddress
) == OPCODE_LOADSP
);
1044 Operands
= GET_OPERANDS (InstructionAddress
);
1047 // Construct Disasm String
1049 if (DisasmString
!= NULL
) {
1050 *DisasmString
= EdbPreInstructionString ();
1052 EdbPrintInstructionName (L
"LOADSP");
1054 EdbPrintDedicatedRegister1 (Operands
);
1056 EdbPrintRegister2 (Operands
);
1058 EdbPostInstructionString ();
1066 Disasm instruction - STORESP.
1068 @param InstructionAddress - The instruction address
1069 @param SystemContext - EBC system context.
1070 @param DisasmString - The instruction string
1072 @return Instruction length
1077 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
1078 IN EFI_SYSTEM_CONTEXT SystemContext
,
1079 OUT CHAR16
**DisasmString
1084 ASSERT (GET_OPCODE(InstructionAddress
) == OPCODE_STORESP
);
1086 Operands
= GET_OPERANDS (InstructionAddress
);
1089 // Construct Disasm String
1091 if (DisasmString
!= NULL
) {
1092 *DisasmString
= EdbPreInstructionString ();
1094 EdbPrintInstructionName (L
"STORESP");
1096 EdbPrintRegister1 (Operands
);
1098 EdbPrintDedicatedRegister2 (Operands
);
1100 EdbPostInstructionString ();
1109 Disasm instruction - PUSH.
1111 @param InstructionAddress - The instruction address
1112 @param SystemContext - EBC system context.
1113 @param DisasmString - The instruction string
1115 @return Instruction length
1120 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
1121 IN EFI_SYSTEM_CONTEXT SystemContext
,
1122 OUT CHAR16
**DisasmString
1130 ASSERT (GET_OPCODE(InstructionAddress
) == OPCODE_PUSH
);
1132 Operands
= GET_OPERANDS (InstructionAddress
);
1133 Modifiers
= GET_MODIFIERS (InstructionAddress
);
1134 if ((Modifiers
& PUSHPOP_M_IMMDATA
) != 0) {
1141 // Construct Disasm String
1143 if (DisasmString
!= NULL
) {
1144 *DisasmString
= EdbPreInstructionString ();
1146 EdbPrintInstructionName (L
"PUSH");
1147 // if (Modifiers & PUSHPOP_M_64) {
1148 // EdbPrintInstructionName (L"64");
1150 // EdbPrintInstructionName (L"32");
1153 EdbPrintRegister1 (Operands
);
1155 InstructionAddress
+= 2;
1156 if ((Modifiers
& PUSHPOP_M_IMMDATA
) != 0) {
1157 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT16
));
1158 if ((Operands
& OPERAND_M_INDIRECT1
) != 0) {
1159 EdbPrintRawIndexData16 (Data16
);
1161 EdbPrintImmDatan (Data16
);
1165 EdbPostInstructionString ();
1173 Disasm instruction - POP.
1175 @param InstructionAddress - The instruction address
1176 @param SystemContext - EBC system context.
1177 @param DisasmString - The instruction string
1179 @return Instruction length
1184 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
1185 IN EFI_SYSTEM_CONTEXT SystemContext
,
1186 OUT CHAR16
**DisasmString
1194 ASSERT (GET_OPCODE(InstructionAddress
) == OPCODE_POP
);
1196 Operands
= GET_OPERANDS (InstructionAddress
);
1197 Modifiers
= GET_MODIFIERS (InstructionAddress
);
1198 if ((Modifiers
& PUSHPOP_M_IMMDATA
) != 0) {
1205 // Construct Disasm String
1207 if (DisasmString
!= NULL
) {
1208 *DisasmString
= EdbPreInstructionString ();
1210 EdbPrintInstructionName (L
"POP");
1211 // if (Modifiers & PUSHPOP_M_64) {
1212 // EdbPrintInstructionName (L"64");
1214 // EdbPrintInstructionName (L"32");
1217 EdbPrintRegister1 (Operands
);
1219 InstructionAddress
+= 2;
1220 if ((Modifiers
& PUSHPOP_M_IMMDATA
) != 0) {
1221 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT16
));
1222 if ((Operands
& OPERAND_M_INDIRECT1
) != 0) {
1223 EdbPrintRawIndexData16 (Data16
);
1225 EdbPrintImmDatan (Data16
);
1229 EdbPostInstructionString ();
1237 Disasm instruction - CMPI.
1239 @param InstructionAddress - The instruction address
1240 @param SystemContext - EBC system context.
1241 @param DisasmString - The instruction string
1243 @return Instruction length
1248 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
1249 IN EFI_SYSTEM_CONTEXT SystemContext
,
1250 OUT CHAR16
**DisasmString
1261 (GET_OPCODE(InstructionAddress
) == OPCODE_CMPIEQ
) ||
1262 (GET_OPCODE(InstructionAddress
) == OPCODE_CMPILTE
) ||
1263 (GET_OPCODE(InstructionAddress
) == OPCODE_CMPIGTE
) ||
1264 (GET_OPCODE(InstructionAddress
) == OPCODE_CMPIULTE
) ||
1265 (GET_OPCODE(InstructionAddress
) == OPCODE_CMPIUGTE
)
1268 Modifiers
= GET_MODIFIERS (InstructionAddress
);
1269 Opcode
= GET_OPCODE (InstructionAddress
);
1270 Operands
= GET_OPERANDS (InstructionAddress
);
1272 if ((Operands
& 0xE0) != 0) {
1277 if ((Operands
& OPERAND_M_CMPI_INDEX
) != 0) {
1280 if ((Modifiers
& OPCODE_M_CMPI32_DATA
) != 0) {
1287 // Construct Disasm String
1289 if (DisasmString
!= NULL
) {
1290 *DisasmString
= EdbPreInstructionString ();
1292 EdbPrintInstructionName (L
"CMPI");
1293 // if (Modifiers & OPCODE_M_CMPI64) {
1294 // EdbPrintInstructionName (L"64");
1296 // EdbPrintInstructionName (L"32");
1298 if ((Modifiers
& OPCODE_M_CMPI32_DATA
) != 0) {
1299 EdbPrintInstructionName (L
"d");
1301 EdbPrintInstructionName (L
"w");
1305 EdbPrintInstructionName (L
"eq");
1307 case OPCODE_CMPILTE
:
1308 EdbPrintInstructionName (L
"lte");
1310 case OPCODE_CMPIGTE
:
1311 EdbPrintInstructionName (L
"gte");
1313 case OPCODE_CMPIULTE
:
1314 EdbPrintInstructionName (L
"ulte");
1316 case OPCODE_CMPIUGTE
:
1317 EdbPrintInstructionName (L
"ugte");
1321 EdbPrintRegister1 (Operands
);
1323 InstructionAddress
+= 2;
1324 if ((Operands
& OPERAND_M_CMPI_INDEX
) != 0) {
1325 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT16
));
1326 InstructionAddress
+= 2;
1327 EdbPrintRawIndexData16 (Data16
);
1332 if ((Modifiers
& OPCODE_M_CMPI32_DATA
) != 0) {
1333 CopyMem (&Data32
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT32
));
1334 EdbPrintDatan (Data32
);
1336 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT16
));
1337 EdbPrintDatan (Data16
);
1340 EdbPostInstructionString ();
1348 Disasm instruction - PUSHn.
1350 @param InstructionAddress - The instruction address
1351 @param SystemContext - EBC system context.
1352 @param DisasmString - The instruction string
1354 @return Instruction length
1359 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
1360 IN EFI_SYSTEM_CONTEXT SystemContext
,
1361 OUT CHAR16
**DisasmString
1369 ASSERT (GET_OPCODE(InstructionAddress
) == OPCODE_PUSHN
);
1371 Operands
= GET_OPERANDS (InstructionAddress
);
1372 Modifiers
= GET_MODIFIERS (InstructionAddress
);
1373 if ((Modifiers
& PUSHPOP_M_IMMDATA
) != 0) {
1380 // Construct Disasm String
1382 if (DisasmString
!= NULL
) {
1383 *DisasmString
= EdbPreInstructionString ();
1385 EdbPrintInstructionName (L
"PUSHn");
1387 EdbPrintRegister1 (Operands
);
1389 InstructionAddress
+= 2;
1390 if ((Modifiers
& PUSHPOP_M_IMMDATA
) != 0) {
1391 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT16
));
1392 if ((Operands
& OPERAND_M_INDIRECT1
) != 0) {
1393 EdbPrintRawIndexData16 (Data16
);
1395 EdbPrintImmDatan (Data16
);
1399 EdbPostInstructionString ();
1407 Disasm instruction - POPn.
1409 @param InstructionAddress - The instruction address
1410 @param SystemContext - EBC system context.
1411 @param DisasmString - The instruction string
1413 @return Instruction length
1418 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
1419 IN EFI_SYSTEM_CONTEXT SystemContext
,
1420 OUT CHAR16
**DisasmString
1428 ASSERT (GET_OPCODE(InstructionAddress
) == OPCODE_POPN
);
1430 Operands
= GET_OPERANDS (InstructionAddress
);
1431 Modifiers
= GET_MODIFIERS (InstructionAddress
);
1432 if ((Modifiers
& PUSHPOP_M_IMMDATA
) != 0) {
1439 // Construct Disasm String
1441 if (DisasmString
!= NULL
) {
1442 *DisasmString
= EdbPreInstructionString ();
1444 EdbPrintInstructionName (L
"POPn");
1446 EdbPrintRegister1 (Operands
);
1448 InstructionAddress
+= 2;
1449 if ((Modifiers
& PUSHPOP_M_IMMDATA
) != 0) {
1450 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT16
));
1451 if ((Operands
& OPERAND_M_INDIRECT1
) != 0) {
1452 EdbPrintRawIndexData16 (Data16
);
1454 EdbPrintImmDatan (Data16
);
1458 EdbPostInstructionString ();
1466 Disasm instruction - MOVI.
1468 @param InstructionAddress - The instruction address
1469 @param SystemContext - EBC system context.
1470 @param DisasmString - The instruction string
1472 @return Instruction length
1477 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
1478 IN EFI_SYSTEM_CONTEXT SystemContext
,
1479 OUT CHAR16
**DisasmString
1489 ASSERT (GET_OPCODE(InstructionAddress
) == OPCODE_MOVI
);
1491 Modifiers
= GET_MODIFIERS (InstructionAddress
);
1492 Operands
= GET_OPERANDS (InstructionAddress
);
1494 if ((Operands
& MOVI_M_IMMDATA
) != 0) {
1499 if ((Modifiers
& MOVI_M_DATAWIDTH
) == MOVI_DATAWIDTH16
) {
1501 } else if ((Modifiers
& MOVI_M_DATAWIDTH
) == MOVI_DATAWIDTH32
) {
1503 } else if ((Modifiers
& MOVI_M_DATAWIDTH
) == MOVI_DATAWIDTH64
) {
1508 // Construct Disasm String
1510 if (DisasmString
!= NULL
) {
1511 *DisasmString
= EdbPreInstructionString ();
1513 EdbPrintInstructionName (L
"MOVI");
1514 switch (Operands
& MOVI_M_MOVEWIDTH
) {
1515 case MOVI_MOVEWIDTH8
:
1516 EdbPrintInstructionName (L
"b");
1518 case MOVI_MOVEWIDTH16
:
1519 EdbPrintInstructionName (L
"w");
1521 case MOVI_MOVEWIDTH32
:
1522 EdbPrintInstructionName (L
"d");
1524 case MOVI_MOVEWIDTH64
:
1525 EdbPrintInstructionName (L
"q");
1528 switch (Modifiers
& MOVI_M_DATAWIDTH
) {
1529 case MOVI_DATAWIDTH16
:
1530 EdbPrintInstructionName (L
"w");
1532 case MOVI_DATAWIDTH32
:
1533 EdbPrintInstructionName (L
"d");
1535 case MOVI_DATAWIDTH64
:
1536 EdbPrintInstructionName (L
"q");
1540 EdbPrintRegister1 (Operands
);
1542 InstructionAddress
+= 2;
1543 if ((Operands
& MOVI_M_IMMDATA
) != 0) {
1544 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT16
));
1545 InstructionAddress
+= 2;
1546 EdbPrintRawIndexData16 (Data16
);
1551 switch (Modifiers
& MOVI_M_DATAWIDTH
) {
1552 case MOVI_DATAWIDTH16
:
1553 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT16
));
1554 EdbPrintDatan (Data16
);
1556 case MOVI_DATAWIDTH32
:
1557 CopyMem (&Data32
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT32
));
1558 EdbPrintDatan (Data32
);
1560 case MOVI_DATAWIDTH64
:
1561 CopyMem (&Data64
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT64
));
1562 EdbPrintData64n (Data64
);
1566 EdbPostInstructionString ();
1574 Disasm instruction - MOVIn.
1576 @param InstructionAddress - The instruction address
1577 @param SystemContext - EBC system context.
1578 @param DisasmString - The instruction string
1580 @return Instruction length
1585 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
1586 IN EFI_SYSTEM_CONTEXT SystemContext
,
1587 OUT CHAR16
**DisasmString
1597 ASSERT (GET_OPCODE(InstructionAddress
) == OPCODE_MOVIN
);
1599 Modifiers
= GET_MODIFIERS (InstructionAddress
);
1600 Operands
= GET_OPERANDS (InstructionAddress
);
1602 if ((Operands
& MOVI_M_IMMDATA
) != 0) {
1607 if ((Modifiers
& MOVI_M_DATAWIDTH
) == MOVI_DATAWIDTH16
) {
1609 } else if ((Modifiers
& MOVI_M_DATAWIDTH
) == MOVI_DATAWIDTH32
) {
1611 } else if ((Modifiers
& MOVI_M_DATAWIDTH
) == MOVI_DATAWIDTH64
) {
1616 // Construct Disasm String
1618 if (DisasmString
!= NULL
) {
1619 *DisasmString
= EdbPreInstructionString ();
1621 EdbPrintInstructionName (L
"MOVIn");
1622 switch (Modifiers
& MOVI_M_DATAWIDTH
) {
1623 case MOVI_DATAWIDTH16
:
1624 EdbPrintInstructionName (L
"w");
1626 case MOVI_DATAWIDTH32
:
1627 EdbPrintInstructionName (L
"d");
1629 case MOVI_DATAWIDTH64
:
1630 EdbPrintInstructionName (L
"q");
1634 EdbPrintRegister1 (Operands
);
1636 InstructionAddress
+= 2;
1637 if ((Operands
& MOVI_M_IMMDATA
) != 0) {
1638 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT16
));
1639 InstructionAddress
+= 2;
1640 EdbPrintRawIndexData16 (Data16
);
1645 switch (Modifiers
& MOVI_M_DATAWIDTH
) {
1646 case MOVI_DATAWIDTH16
:
1647 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT16
));
1648 EdbPrintRawIndexData16 (Data16
);
1650 case MOVI_DATAWIDTH32
:
1651 CopyMem (&Data32
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT32
));
1652 EdbPrintRawIndexData32 (Data32
);
1654 case MOVI_DATAWIDTH64
:
1655 CopyMem (&Data64
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT64
));
1656 EdbPrintRawIndexData64 (Data64
);
1660 EdbPostInstructionString ();
1668 Disasm instruction - MOVREL.
1670 @param InstructionAddress - The instruction address
1671 @param SystemContext - EBC system context.
1672 @param DisasmString - The instruction string
1674 @return Instruction length
1679 IN EFI_PHYSICAL_ADDRESS InstructionAddress
,
1680 IN EFI_SYSTEM_CONTEXT SystemContext
,
1681 OUT CHAR16
**DisasmString
1691 EFI_PHYSICAL_ADDRESS SavedInstructionAddress
;
1693 ASSERT (GET_OPCODE(InstructionAddress
) == OPCODE_MOVREL
);
1694 SavedInstructionAddress
= InstructionAddress
;
1696 Modifiers
= GET_MODIFIERS (InstructionAddress
);
1697 Operands
= GET_OPERANDS (InstructionAddress
);
1699 if ((Operands
& MOVI_M_IMMDATA
) != 0) {
1704 if ((Modifiers
& MOVI_M_DATAWIDTH
) == MOVI_DATAWIDTH16
) {
1706 } else if ((Modifiers
& MOVI_M_DATAWIDTH
) == MOVI_DATAWIDTH32
) {
1708 } else if ((Modifiers
& MOVI_M_DATAWIDTH
) == MOVI_DATAWIDTH64
) {
1715 // Construct Disasm String
1717 if (DisasmString
!= NULL
) {
1718 *DisasmString
= EdbPreInstructionString ();
1720 EdbPrintInstructionName (L
"MOVrel");
1721 switch (Modifiers
& MOVI_M_DATAWIDTH
) {
1722 case MOVI_DATAWIDTH16
:
1723 EdbPrintInstructionName (L
"w");
1725 case MOVI_DATAWIDTH32
:
1726 EdbPrintInstructionName (L
"d");
1728 case MOVI_DATAWIDTH64
:
1729 EdbPrintInstructionName (L
"q");
1733 EdbPrintRegister1 (Operands
);
1735 InstructionAddress
+= 2;
1736 if ((Operands
& MOVI_M_IMMDATA
) != 0) {
1737 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT16
));
1738 InstructionAddress
+= 2;
1739 EdbPrintRawIndexData16 (Data16
);
1744 switch (Modifiers
& MOVI_M_DATAWIDTH
) {
1745 case MOVI_DATAWIDTH16
:
1746 CopyMem (&Data16
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT16
));
1747 Result
= EdbFindAndPrintSymbol ((UINTN
)(SavedInstructionAddress
+ Size
+ (INT16
)Data16
));
1749 EdbPrintData16 (Data16
);
1752 case MOVI_DATAWIDTH32
:
1753 CopyMem (&Data32
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT32
));
1754 Result
= EdbFindAndPrintSymbol ((UINTN
)(SavedInstructionAddress
+ Size
+ (INT32
)Data32
));
1756 EdbPrintData32 (Data32
);
1759 case MOVI_DATAWIDTH64
:
1760 CopyMem (&Data64
, (VOID
*)(UINTN
)(InstructionAddress
), sizeof(UINT64
));
1761 if (sizeof(UINTN
) == sizeof(UINT64
)) {
1762 Result
= EdbFindAndPrintSymbol ((UINTN
)(SavedInstructionAddress
+ Size
+ (INT64
)Data64
));
1767 EdbPrintData64 (Data64
);
1772 EdbPostInstructionString ();