X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FUniversal%2FEbcDxe%2FEbcDebugger%2FEdbDisasm.c;h=7d933cae76498d3fa5dba0f4c8034c24aedb80cf;hp=52800f7fd145e62e7f1cc2d24ce5604d775434e1;hb=9d510e61fceee7b92955ef9a3c20343752d8ce3f;hpb=748edcd5eb706b34ffd0af6900a8db19605b0ffd diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbDisasm.c b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbDisasm.c index 52800f7fd1..7d933cae76 100644 --- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbDisasm.c +++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbDisasm.c @@ -1,22 +1,10 @@ -/*++ +/** @file -Copyright (c) 2007, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php +Copyright (c) 2007, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -Module Name: - - EdbDisasm.c - -Abstract: - - ---*/ +**/ #include "Edb.h" @@ -117,29 +105,23 @@ EDB_DISASM_INSTRUCTION mEdbDisasmInstructionTable[] = { EdbDisasmMOVREL, // opcode 0x39 MOVREL }; +/** + + Disasm instruction - BREAK. + + @param InstructionAddress - The instruction address + @param SystemContext - EBC system context. + @param DisasmString - The instruction string + + @return Instruction length + +**/ UINTN EdbDisasmBREAK ( IN EFI_PHYSICAL_ADDRESS InstructionAddress, IN EFI_SYSTEM_CONTEXT SystemContext, OUT CHAR16 **DisasmString ) -/*++ - -Routine Description: - - Disasm instruction - BREAK - -Arguments: - - InstructionAddress - The instruction address - SystemContext - EBC system context. - DisasmString - The instruction string - -Returns: - - Instruction length - ---*/ { ASSERT (GET_OPCODE(InstructionAddress) == OPCODE_BREAK); @@ -164,29 +146,23 @@ Returns: extern CONST UINT8 mJMPLen[]; +/** + + Disasm instruction - JMP. + + @param InstructionAddress - The instruction address + @param SystemContext - EBC system context. + @param DisasmString - The instruction string + + @return Instruction length + +**/ UINTN EdbDisasmJMP ( IN EFI_PHYSICAL_ADDRESS InstructionAddress, IN EFI_SYSTEM_CONTEXT SystemContext, OUT CHAR16 **DisasmString ) -/*++ - -Routine Description: - - Disasm instruction - JMP - -Arguments: - - InstructionAddress - The instruction address - SystemContext - EBC system context. - DisasmString - The instruction string - -Returns: - - Instruction length - ---*/ { UINT8 Modifiers; UINT8 Operands; @@ -212,8 +188,8 @@ Returns: // } else { // EdbPrintInstructionName (L"32"); // } - if (Modifiers & CONDITION_M_CONDITIONAL) { - if (Modifiers & JMP_M_CS) { + if ((Modifiers & CONDITION_M_CONDITIONAL) != 0) { + if ((Modifiers & JMP_M_CS) != 0) { EdbPrintInstructionName (L"cs"); } else { EdbPrintInstructionName (L"cc"); @@ -221,9 +197,9 @@ Returns: } InstructionAddress += 2; - if (Modifiers & OPCODE_M_IMMDATA64) { + if ((Modifiers & OPCODE_M_IMMDATA64) != 0) { CopyMem (&Data64, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT64)); - if (Modifiers & OPCODE_M_IMMDATA) { + if ((Modifiers & OPCODE_M_IMMDATA) != 0) { EdbPrintData64 (Data64); } else { return 0; @@ -248,29 +224,23 @@ Returns: return Size; } +/** + + Disasm instruction - JMP8. + + @param InstructionAddress - The instruction address + @param SystemContext - EBC system context. + @param DisasmString - The instruction string + + @return Instruction length + +**/ UINTN EdbDisasmJMP8 ( IN EFI_PHYSICAL_ADDRESS InstructionAddress, IN EFI_SYSTEM_CONTEXT SystemContext, OUT CHAR16 **DisasmString ) -/*++ - -Routine Description: - - Disasm instruction - JMP8 - -Arguments: - - InstructionAddress - The instruction address - SystemContext - EBC system context. - DisasmString - The instruction string - -Returns: - - Instruction length - ---*/ { UINT8 Modifiers; @@ -284,8 +254,8 @@ Returns: *DisasmString = EdbPreInstructionString (); EdbPrintInstructionName (L"JMP8"); - if (Modifiers & CONDITION_M_CONDITIONAL) { - if (Modifiers & JMP_M_CS) { + if ((Modifiers & CONDITION_M_CONDITIONAL) != 0) { + if ((Modifiers & JMP_M_CS) != 0) { EdbPrintInstructionName (L"cs"); } else { EdbPrintInstructionName (L"cc"); @@ -300,29 +270,23 @@ Returns: return 2; } +/** + + Disasm instruction - CALL. + + @param InstructionAddress - The instruction address + @param SystemContext - EBC system context. + @param DisasmString - The instruction string + + @return Instruction length + +**/ UINTN EdbDisasmCALL ( IN EFI_PHYSICAL_ADDRESS InstructionAddress, IN EFI_SYSTEM_CONTEXT SystemContext, OUT CHAR16 **DisasmString ) -/*++ - -Routine Description: - - Disasm instruction - CALL - -Arguments: - - InstructionAddress - The instruction address - SystemContext - EBC system context. - DisasmString - The instruction string - -Returns: - - Instruction length - ---*/ { UINT8 Modifiers; UINT8 Operands; @@ -352,7 +316,7 @@ Returns: // } else { // EdbPrintInstructionName (L"32"); // } - if (Operands & OPERAND_M_NATIVE_CALL) { + if ((Operands & OPERAND_M_NATIVE_CALL) != 0) { EdbPrintInstructionName (L"EX"); } // if ((Operands & OPERAND_M_RELATIVE_ADDR) == 0) { @@ -360,10 +324,10 @@ Returns: // } InstructionAddress += 2; - if (Modifiers & OPCODE_M_IMMDATA64) { + if ((Modifiers & OPCODE_M_IMMDATA64) != 0) { CopyMem (&Data64, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT64)); Ip = Data64; - if (Modifiers & OPCODE_M_IMMDATA) { + if ((Modifiers & OPCODE_M_IMMDATA) != 0) { Result = EdbFindAndPrintSymbol ((UINTN)Ip); if (Result == 0) { EdbPrintData64 (Data64); @@ -372,7 +336,7 @@ Returns: return 0; } } else { - if (Modifiers & OPCODE_M_IMMDATA) { + if ((Modifiers & OPCODE_M_IMMDATA) != 0) { CopyMem (&Data32, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT32)); } else { Data32 = 0; @@ -385,20 +349,20 @@ Returns: } if ((Operands & OPERAND_M_INDIRECT1) == 0) { - if (Operands & OPERAND_M_RELATIVE_ADDR) { + if ((Operands & OPERAND_M_RELATIVE_ADDR) != 0) { Result = EdbFindAndPrintSymbol ((UINTN)(SavedInstructionAddress + Ip + Size)); } else { Result = EdbFindAndPrintSymbol ((UINTN)Ip); } if (Result == 0) { EdbPrintRegister1 (Operands); - if (Modifiers & OPCODE_M_IMMDATA) { + if ((Modifiers & OPCODE_M_IMMDATA) != 0) { EdbPrintImmData32 (Data32); } } } else { EdbPrintRegister1 (Operands); - if (Modifiers & OPCODE_M_IMMDATA) { + if ((Modifiers & OPCODE_M_IMMDATA) != 0) { EdbPrintRawIndexData32 (Data32); } } @@ -410,29 +374,23 @@ Returns: return Size; } +/** + + Disasm instruction - RET. + + @param InstructionAddress - The instruction address + @param SystemContext - EBC system context. + @param DisasmString - The instruction string + + @return Instruction length + +**/ UINTN EdbDisasmRET ( IN EFI_PHYSICAL_ADDRESS InstructionAddress, IN EFI_SYSTEM_CONTEXT SystemContext, OUT CHAR16 **DisasmString ) -/*++ - -Routine Description: - - Disasm instruction - RET - -Arguments: - - InstructionAddress - The instruction address - SystemContext - EBC system context. - DisasmString - The instruction string - -Returns: - - Instruction length - ---*/ { ASSERT (GET_OPCODE(InstructionAddress) == OPCODE_RET); @@ -454,29 +412,23 @@ Returns: return 2; } +/** + + Disasm instruction - CMP. + + @param InstructionAddress - The instruction address + @param SystemContext - EBC system context. + @param DisasmString - The instruction string + + @return Instruction length + +**/ UINTN EdbDisasmCMP ( IN EFI_PHYSICAL_ADDRESS InstructionAddress, IN EFI_SYSTEM_CONTEXT SystemContext, OUT CHAR16 **DisasmString ) -/*++ - -Routine Description: - - Disasm instruction - CMP - -Arguments: - - InstructionAddress - The instruction address - SystemContext - EBC system context. - DisasmString - The instruction string - -Returns: - - Instruction length - ---*/ { UINT8 Opcode; UINT8 Modifiers; @@ -495,7 +447,7 @@ Returns: Opcode = GET_OPCODE (InstructionAddress); Modifiers = GET_MODIFIERS (InstructionAddress); Operands = GET_OPERANDS (InstructionAddress); - if (Modifiers & OPCODE_M_IMMDATA) { + if ((Modifiers & OPCODE_M_IMMDATA) != 0) { Size = 4; } else { Size = 2; @@ -537,9 +489,9 @@ Returns: EdbPrintComma (); EdbPrintRegister2 (Operands); - if (Modifiers & OPCODE_M_IMMDATA) { + if ((Modifiers & OPCODE_M_IMMDATA) != 0) { CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT16)); - if (Operands & OPERAND_M_INDIRECT2) { + if ((Operands & OPERAND_M_INDIRECT2) != 0) { EdbPrintRawIndexData16 (Data16); } else { EdbPrintImmDatan (Data16); @@ -552,29 +504,23 @@ Returns: return Size; } +/** + + Disasm instruction - Unsigned Data Manipulate. + + @param InstructionAddress - The instruction address + @param SystemContext - EBC system context. + @param DisasmString - The instruction string + + @return Instruction length + +**/ UINTN EdbDisasmUnsignedDataManip ( IN EFI_PHYSICAL_ADDRESS InstructionAddress, IN EFI_SYSTEM_CONTEXT SystemContext, OUT CHAR16 **DisasmString ) -/*++ - -Routine Description: - - Disasm instruction - Unsigned Data Manipulate - -Arguments: - - InstructionAddress - The instruction address - SystemContext - EBC system context. - DisasmString - The instruction string - -Returns: - - Instruction length - ---*/ { UINT8 Modifiers; UINT8 Opcode; @@ -600,7 +546,7 @@ Returns: Opcode = GET_OPCODE (InstructionAddress); Operands = GET_OPERANDS (InstructionAddress); Modifiers = GET_MODIFIERS (InstructionAddress); - if (Modifiers & DATAMANIP_M_IMMDATA) { + if ((Modifiers & DATAMANIP_M_IMMDATA) != 0) { Size = 4; } else { Size = 2; @@ -661,9 +607,9 @@ Returns: EdbPrintRegister2 (Operands); InstructionAddress += 2; - if (Modifiers & DATAMANIP_M_IMMDATA) { + if ((Modifiers & DATAMANIP_M_IMMDATA) != 0) { CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT16)); - if (Operands & OPERAND_M_INDIRECT2) { + if ((Operands & OPERAND_M_INDIRECT2) != 0) { EdbPrintRawIndexData16 (Data16); } else { EdbPrintImmDatan (Data16); @@ -676,29 +622,23 @@ Returns: return Size; } +/** + + Disasm instruction - Signed Data Manipulate, + + @param InstructionAddress - The instruction address + @param SystemContext - EBC system context. + @param DisasmString - The instruction string + + @return Instruction length + +**/ UINTN EdbDisasmSignedDataManip ( IN EFI_PHYSICAL_ADDRESS InstructionAddress, IN EFI_SYSTEM_CONTEXT SystemContext, OUT CHAR16 **DisasmString ) -/*++ - -Routine Description: - - Disasm instruction - Signed Data Manipulate - -Arguments: - - InstructionAddress - The instruction address - SystemContext - EBC system context. - DisasmString - The instruction string - -Returns: - - Instruction length - ---*/ { UINT8 Modifiers; UINT8 Opcode; @@ -719,7 +659,7 @@ Returns: Opcode = GET_OPCODE (InstructionAddress); Operands = GET_OPERANDS (InstructionAddress); Modifiers = GET_MODIFIERS (InstructionAddress); - if (Modifiers & DATAMANIP_M_IMMDATA) { + if ((Modifiers & DATAMANIP_M_IMMDATA) != 0) { Size = 4; } else { Size = 2; @@ -765,9 +705,9 @@ Returns: EdbPrintRegister2 (Operands); InstructionAddress += 2; - if (Modifiers & DATAMANIP_M_IMMDATA) { + if ((Modifiers & DATAMANIP_M_IMMDATA) != 0) { CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT16)); - if (Operands & OPERAND_M_INDIRECT2) { + if ((Operands & OPERAND_M_INDIRECT2) != 0) { EdbPrintRawIndexData16 (Data16); } else { EdbPrintImmDatan (Data16); @@ -780,29 +720,23 @@ Returns: return Size; } +/** + + Disasm instruction - MOVxx. + + @param InstructionAddress - The instruction address + @param SystemContext - EBC system context. + @param DisasmString - The instruction string + + @return Instruction length + +**/ UINTN EdbDisasmMOVxx ( IN EFI_PHYSICAL_ADDRESS InstructionAddress, IN EFI_SYSTEM_CONTEXT SystemContext, OUT CHAR16 **DisasmString ) -/*++ - -Routine Description: - - Disasm instruction - MOVxx - -Arguments: - - InstructionAddress - The instruction address - SystemContext - EBC system context. - DisasmString - The instruction string - -Returns: - - Instruction length - ---*/ { UINT8 Modifiers; UINT8 Opcode; @@ -830,26 +764,26 @@ Returns: Modifiers = GET_MODIFIERS (InstructionAddress); Operands = GET_OPERANDS (InstructionAddress); Size = 2; - if (Modifiers & (OPCODE_M_IMMED_OP1 | OPCODE_M_IMMED_OP2)) { + if ((Modifiers & (OPCODE_M_IMMED_OP1 | OPCODE_M_IMMED_OP2)) != 0) { if ((Opcode <= OPCODE_MOVQW) || (Opcode == OPCODE_MOVNW)) { - if (Modifiers & OPCODE_M_IMMED_OP1) { + if ((Modifiers & OPCODE_M_IMMED_OP1) != 0) { Size += 2; } - if (Modifiers & OPCODE_M_IMMED_OP2) { + if ((Modifiers & OPCODE_M_IMMED_OP2) != 0) { Size += 2; } - } else if ((Opcode <= OPCODE_MOVQD) || (Opcode == OPCODE_MOVND)) { - if (Modifiers & OPCODE_M_IMMED_OP1) { + } else if (((Opcode <= OPCODE_MOVQD) || (Opcode == OPCODE_MOVND)) != 0) { + if ((Modifiers & OPCODE_M_IMMED_OP1) != 0) { Size += 4; } - if (Modifiers & OPCODE_M_IMMED_OP2) { + if ((Modifiers & OPCODE_M_IMMED_OP2) != 0) { Size += 4; } } else if (Opcode == OPCODE_MOVQQ) { - if (Modifiers & OPCODE_M_IMMED_OP1) { + if ((Modifiers & OPCODE_M_IMMED_OP1) != 0) { Size += 8; } - if (Modifiers & OPCODE_M_IMMED_OP2) { + if ((Modifiers & OPCODE_M_IMMED_OP2) != 0) { Size += 8; } } @@ -901,7 +835,7 @@ Returns: EdbPrintRegister1 (Operands); InstructionAddress += 2; - if (Modifiers & OPCODE_M_IMMED_OP1) { + if ((Modifiers & OPCODE_M_IMMED_OP1) != 0) { if ((Opcode <= OPCODE_MOVQW) || (Opcode == OPCODE_MOVNW)) { CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT16)); InstructionAddress += 2; @@ -920,7 +854,7 @@ Returns: EdbPrintComma (); EdbPrintRegister2 (Operands); - if (Modifiers & OPCODE_M_IMMED_OP2) { + if ((Modifiers & OPCODE_M_IMMED_OP2) != 0) { if ((Opcode <= OPCODE_MOVQW) || (Opcode == OPCODE_MOVNW)) { CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT16)); EdbPrintRawIndexData16 (Data16); @@ -939,29 +873,23 @@ Returns: return Size; } +/** + + Disasm instruction - MOVsnw. + + @param InstructionAddress - The instruction address + @param SystemContext - EBC system context. + @param DisasmString - The instruction string + + @return Instruction length + +**/ UINTN EdbDisasmMOVsnw ( IN EFI_PHYSICAL_ADDRESS InstructionAddress, IN EFI_SYSTEM_CONTEXT SystemContext, OUT CHAR16 **DisasmString ) -/*++ - -Routine Description: - - Disasm instruction - MOVsnw - -Arguments: - - InstructionAddress - The instruction address - SystemContext - EBC system context. - DisasmString - The instruction string - -Returns: - - Instruction length - ---*/ { UINT8 Modifiers; UINT8 Operands; @@ -973,10 +901,10 @@ Returns: Modifiers = GET_MODIFIERS (InstructionAddress); Operands = GET_OPERANDS (InstructionAddress); Size = 2; - if (Modifiers & OPCODE_M_IMMED_OP1) { + if ((Modifiers & OPCODE_M_IMMED_OP1) != 0) { Size += 2; } - if (Modifiers & OPCODE_M_IMMED_OP2) { + if ((Modifiers & OPCODE_M_IMMED_OP2) != 0) { Size += 2; } @@ -991,7 +919,7 @@ Returns: EdbPrintRegister1 (Operands); InstructionAddress += 2; - if (Modifiers & OPCODE_M_IMMED_OP1) { + if ((Modifiers & OPCODE_M_IMMED_OP1) != 0) { CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT16)); InstructionAddress += 2; EdbPrintRawIndexData16 (Data16); @@ -1000,9 +928,9 @@ Returns: EdbPrintComma (); EdbPrintRegister2 (Operands); - if (Modifiers & OPCODE_M_IMMED_OP2) { + if ((Modifiers & OPCODE_M_IMMED_OP2) != 0) { CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT16)); - if (Operands & OPERAND_M_INDIRECT2) { + if ((Operands & OPERAND_M_INDIRECT2) != 0) { EdbPrintRawIndexData16 (Data16); } else { EdbPrintImmDatan (Data16); @@ -1015,29 +943,23 @@ Returns: return Size; } +/** + + Disasm instruction - MOVsnd. + + @param InstructionAddress - The instruction address + @param SystemContext - EBC system context. + @param DisasmString - The instruction string + + @return Instruction length + +**/ UINTN EdbDisasmMOVsnd ( IN EFI_PHYSICAL_ADDRESS InstructionAddress, IN EFI_SYSTEM_CONTEXT SystemContext, OUT CHAR16 **DisasmString ) -/*++ - -Routine Description: - - Disasm instruction - MOVsnd - -Arguments: - - InstructionAddress - The instruction address - SystemContext - EBC system context. - DisasmString - The instruction string - -Returns: - - Instruction length - ---*/ { UINT8 Modifiers; UINT8 Operands; @@ -1049,10 +971,10 @@ Returns: Modifiers = GET_MODIFIERS (InstructionAddress); Operands = GET_OPERANDS (InstructionAddress); Size = 2; - if (Modifiers & OPCODE_M_IMMED_OP1) { + if ((Modifiers & OPCODE_M_IMMED_OP1) != 0) { Size += 4; } - if (Modifiers & OPCODE_M_IMMED_OP2) { + if ((Modifiers & OPCODE_M_IMMED_OP2) != 0) { Size += 4; } @@ -1067,7 +989,7 @@ Returns: EdbPrintRegister1 (Operands); InstructionAddress += 2; - if (Modifiers & OPCODE_M_IMMED_OP1) { + if ((Modifiers & OPCODE_M_IMMED_OP1) != 0) { CopyMem (&Data32, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT32)); InstructionAddress += 4; EdbPrintRawIndexData32 (Data32); @@ -1076,9 +998,9 @@ Returns: EdbPrintComma (); EdbPrintRegister2 (Operands); - if (Modifiers & OPCODE_M_IMMED_OP2) { + if ((Modifiers & OPCODE_M_IMMED_OP2) != 0) { CopyMem (&Data32, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT32)); - if (Operands & OPERAND_M_INDIRECT2) { + if ((Operands & OPERAND_M_INDIRECT2) != 0) { EdbPrintRawIndexData32 (Data32); } else { EdbPrintImmDatan (Data32); @@ -1091,29 +1013,23 @@ Returns: return Size; } +/** + + Disasm instruction - LOADSP. + + @param InstructionAddress - The instruction address + @param SystemContext - EBC system context. + @param DisasmString - The instruction string + + @return Instruction length + +**/ UINTN EdbDisasmLOADSP ( IN EFI_PHYSICAL_ADDRESS InstructionAddress, IN EFI_SYSTEM_CONTEXT SystemContext, OUT CHAR16 **DisasmString ) -/*++ - -Routine Description: - - Disasm instruction - LOADSP - -Arguments: - - InstructionAddress - The instruction address - SystemContext - EBC system context. - DisasmString - The instruction string - -Returns: - - Instruction length - ---*/ { UINT8 Operands; @@ -1139,29 +1055,23 @@ Returns: return 2; } +/** + + Disasm instruction - STORESP. + + @param InstructionAddress - The instruction address + @param SystemContext - EBC system context. + @param DisasmString - The instruction string + + @return Instruction length + +**/ UINTN EdbDisasmSTORESP ( IN EFI_PHYSICAL_ADDRESS InstructionAddress, IN EFI_SYSTEM_CONTEXT SystemContext, OUT CHAR16 **DisasmString ) -/*++ - -Routine Description: - - Disasm instruction - STORESP - -Arguments: - - InstructionAddress - The instruction address - SystemContext - EBC system context. - DisasmString - The instruction string - -Returns: - - Instruction length - ---*/ { UINT8 Operands; @@ -1187,29 +1097,24 @@ Returns: return 2; } + +/** + + Disasm instruction - PUSH. + + @param InstructionAddress - The instruction address + @param SystemContext - EBC system context. + @param DisasmString - The instruction string + + @return Instruction length + +**/ UINTN EdbDisasmPUSH ( IN EFI_PHYSICAL_ADDRESS InstructionAddress, IN EFI_SYSTEM_CONTEXT SystemContext, OUT CHAR16 **DisasmString ) -/*++ - -Routine Description: - - Disasm instruction - PUSH - -Arguments: - - InstructionAddress - The instruction address - SystemContext - EBC system context. - DisasmString - The instruction string - -Returns: - - Instruction length - ---*/ { UINT8 Modifiers; UINT8 Operands; @@ -1220,7 +1125,7 @@ Returns: Operands = GET_OPERANDS (InstructionAddress); Modifiers = GET_MODIFIERS (InstructionAddress); - if (Modifiers & PUSHPOP_M_IMMDATA) { + if ((Modifiers & PUSHPOP_M_IMMDATA) != 0) { Size = 4; } else { Size = 2; @@ -1242,9 +1147,9 @@ Returns: EdbPrintRegister1 (Operands); InstructionAddress += 2; - if (Modifiers & PUSHPOP_M_IMMDATA) { + if ((Modifiers & PUSHPOP_M_IMMDATA) != 0) { CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT16)); - if (Operands & OPERAND_M_INDIRECT1) { + if ((Operands & OPERAND_M_INDIRECT1) != 0) { EdbPrintRawIndexData16 (Data16); } else { EdbPrintImmDatan (Data16); @@ -1257,29 +1162,23 @@ Returns: return Size; } +/** + + Disasm instruction - POP. + + @param InstructionAddress - The instruction address + @param SystemContext - EBC system context. + @param DisasmString - The instruction string + + @return Instruction length + +**/ UINTN EdbDisasmPOP ( IN EFI_PHYSICAL_ADDRESS InstructionAddress, IN EFI_SYSTEM_CONTEXT SystemContext, OUT CHAR16 **DisasmString ) -/*++ - -Routine Description: - - Disasm instruction - POP - -Arguments: - - InstructionAddress - The instruction address - SystemContext - EBC system context. - DisasmString - The instruction string - -Returns: - - Instruction length - ---*/ { UINT8 Modifiers; UINT8 Operands; @@ -1290,7 +1189,7 @@ Returns: Operands = GET_OPERANDS (InstructionAddress); Modifiers = GET_MODIFIERS (InstructionAddress); - if (Modifiers & PUSHPOP_M_IMMDATA) { + if ((Modifiers & PUSHPOP_M_IMMDATA) != 0) { Size = 4; } else { Size = 2; @@ -1312,9 +1211,9 @@ Returns: EdbPrintRegister1 (Operands); InstructionAddress += 2; - if (Modifiers & PUSHPOP_M_IMMDATA) { + if ((Modifiers & PUSHPOP_M_IMMDATA) != 0) { CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT16)); - if (Operands & OPERAND_M_INDIRECT1) { + if ((Operands & OPERAND_M_INDIRECT1) != 0) { EdbPrintRawIndexData16 (Data16); } else { EdbPrintImmDatan (Data16); @@ -1327,29 +1226,23 @@ Returns: return Size; } +/** + + Disasm instruction - CMPI. + + @param InstructionAddress - The instruction address + @param SystemContext - EBC system context. + @param DisasmString - The instruction string + + @return Instruction length + +**/ UINTN EdbDisasmCMPI ( IN EFI_PHYSICAL_ADDRESS InstructionAddress, IN EFI_SYSTEM_CONTEXT SystemContext, OUT CHAR16 **DisasmString ) -/*++ - -Routine Description: - - Disasm instruction - CMPI - -Arguments: - - InstructionAddress - The instruction address - SystemContext - EBC system context. - DisasmString - The instruction string - -Returns: - - Instruction length - ---*/ { UINT8 Modifiers; UINT8 Opcode; @@ -1375,10 +1268,10 @@ Returns: } Size = 2; - if (Operands & OPERAND_M_CMPI_INDEX) { + if ((Operands & OPERAND_M_CMPI_INDEX) != 0) { Size += 2; } - if (Modifiers & OPCODE_M_CMPI32_DATA) { + if ((Modifiers & OPCODE_M_CMPI32_DATA) != 0) { Size += 4; } else { Size += 2; @@ -1396,7 +1289,7 @@ Returns: // } else { // EdbPrintInstructionName (L"32"); // } - if (Modifiers & OPCODE_M_CMPI32_DATA) { + if ((Modifiers & OPCODE_M_CMPI32_DATA) != 0) { EdbPrintInstructionName (L"d"); } else { EdbPrintInstructionName (L"w"); @@ -1422,7 +1315,7 @@ Returns: EdbPrintRegister1 (Operands); InstructionAddress += 2; - if (Operands & OPERAND_M_CMPI_INDEX) { + if ((Operands & OPERAND_M_CMPI_INDEX) != 0) { CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT16)); InstructionAddress += 2; EdbPrintRawIndexData16 (Data16); @@ -1430,7 +1323,7 @@ Returns: EdbPrintComma (); - if (Modifiers & OPCODE_M_CMPI32_DATA) { + if ((Modifiers & OPCODE_M_CMPI32_DATA) != 0) { CopyMem (&Data32, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT32)); EdbPrintDatan (Data32); } else { @@ -1444,29 +1337,23 @@ Returns: return Size; } +/** + + Disasm instruction - PUSHn. + + @param InstructionAddress - The instruction address + @param SystemContext - EBC system context. + @param DisasmString - The instruction string + + @return Instruction length + +**/ UINTN EdbDisasmPUSHn ( IN EFI_PHYSICAL_ADDRESS InstructionAddress, IN EFI_SYSTEM_CONTEXT SystemContext, OUT CHAR16 **DisasmString ) -/*++ - -Routine Description: - - Disasm instruction - PUSHn - -Arguments: - - InstructionAddress - The instruction address - SystemContext - EBC system context. - DisasmString - The instruction string - -Returns: - - Instruction length - ---*/ { UINT8 Modifiers; UINT8 Operands; @@ -1477,7 +1364,7 @@ Returns: Operands = GET_OPERANDS (InstructionAddress); Modifiers = GET_MODIFIERS (InstructionAddress); - if (Modifiers & PUSHPOP_M_IMMDATA) { + if ((Modifiers & PUSHPOP_M_IMMDATA) != 0) { Size = 4; } else { Size = 2; @@ -1494,9 +1381,9 @@ Returns: EdbPrintRegister1 (Operands); InstructionAddress += 2; - if (Modifiers & PUSHPOP_M_IMMDATA) { + if ((Modifiers & PUSHPOP_M_IMMDATA) != 0) { CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT16)); - if (Operands & OPERAND_M_INDIRECT1) { + if ((Operands & OPERAND_M_INDIRECT1) != 0) { EdbPrintRawIndexData16 (Data16); } else { EdbPrintImmDatan (Data16); @@ -1509,29 +1396,23 @@ Returns: return Size; } +/** + + Disasm instruction - POPn. + + @param InstructionAddress - The instruction address + @param SystemContext - EBC system context. + @param DisasmString - The instruction string + + @return Instruction length + +**/ UINTN EdbDisasmPOPn ( IN EFI_PHYSICAL_ADDRESS InstructionAddress, IN EFI_SYSTEM_CONTEXT SystemContext, OUT CHAR16 **DisasmString ) -/*++ - -Routine Description: - - Disasm instruction - POPn - -Arguments: - - InstructionAddress - The instruction address - SystemContext - EBC system context. - DisasmString - The instruction string - -Returns: - - Instruction length - ---*/ { UINT8 Modifiers; UINT8 Operands; @@ -1542,7 +1423,7 @@ Returns: Operands = GET_OPERANDS (InstructionAddress); Modifiers = GET_MODIFIERS (InstructionAddress); - if (Modifiers & PUSHPOP_M_IMMDATA) { + if ((Modifiers & PUSHPOP_M_IMMDATA) != 0) { Size = 4; } else { Size = 2; @@ -1559,9 +1440,9 @@ Returns: EdbPrintRegister1 (Operands); InstructionAddress += 2; - if (Modifiers & PUSHPOP_M_IMMDATA) { + if ((Modifiers & PUSHPOP_M_IMMDATA) != 0) { CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT16)); - if (Operands & OPERAND_M_INDIRECT1) { + if ((Operands & OPERAND_M_INDIRECT1) != 0) { EdbPrintRawIndexData16 (Data16); } else { EdbPrintImmDatan (Data16); @@ -1574,29 +1455,23 @@ Returns: return Size; } +/** + + Disasm instruction - MOVI. + + @param InstructionAddress - The instruction address + @param SystemContext - EBC system context. + @param DisasmString - The instruction string + + @return Instruction length + +**/ UINTN EdbDisasmMOVI ( IN EFI_PHYSICAL_ADDRESS InstructionAddress, IN EFI_SYSTEM_CONTEXT SystemContext, OUT CHAR16 **DisasmString ) -/*++ - -Routine Description: - - Disasm instruction - MOVI - -Arguments: - - InstructionAddress - The instruction address - SystemContext - EBC system context. - DisasmString - The instruction string - -Returns: - - Instruction length - ---*/ { UINT8 Modifiers; UINT8 Operands; @@ -1610,7 +1485,7 @@ Returns: Modifiers = GET_MODIFIERS (InstructionAddress); Operands = GET_OPERANDS (InstructionAddress); - if (Operands & MOVI_M_IMMDATA) { + if ((Operands & MOVI_M_IMMDATA) != 0) { Size = 4; } else { Size = 2; @@ -1659,7 +1534,7 @@ Returns: EdbPrintRegister1 (Operands); InstructionAddress += 2; - if (Operands & MOVI_M_IMMDATA) { + if ((Operands & MOVI_M_IMMDATA) != 0) { CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT16)); InstructionAddress += 2; EdbPrintRawIndexData16 (Data16); @@ -1688,29 +1563,23 @@ Returns: return Size; } +/** + + Disasm instruction - MOVIn. + + @param InstructionAddress - The instruction address + @param SystemContext - EBC system context. + @param DisasmString - The instruction string + + @return Instruction length + +**/ UINTN EdbDisasmMOVIn ( IN EFI_PHYSICAL_ADDRESS InstructionAddress, IN EFI_SYSTEM_CONTEXT SystemContext, OUT CHAR16 **DisasmString ) -/*++ - -Routine Description: - - Disasm instruction - MOVIn - -Arguments: - - InstructionAddress - The instruction address - SystemContext - EBC system context. - DisasmString - The instruction string - -Returns: - - Instruction length - ---*/ { UINT8 Modifiers; UINT8 Operands; @@ -1724,7 +1593,7 @@ Returns: Modifiers = GET_MODIFIERS (InstructionAddress); Operands = GET_OPERANDS (InstructionAddress); - if (Operands & MOVI_M_IMMDATA) { + if ((Operands & MOVI_M_IMMDATA) != 0) { Size = 4; } else { Size = 2; @@ -1759,7 +1628,7 @@ Returns: EdbPrintRegister1 (Operands); InstructionAddress += 2; - if (Operands & MOVI_M_IMMDATA) { + if ((Operands & MOVI_M_IMMDATA) != 0) { CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT16)); InstructionAddress += 2; EdbPrintRawIndexData16 (Data16); @@ -1788,29 +1657,23 @@ Returns: return Size; } +/** + + Disasm instruction - MOVREL. + + @param InstructionAddress - The instruction address + @param SystemContext - EBC system context. + @param DisasmString - The instruction string + + @return Instruction length + +**/ UINTN EdbDisasmMOVREL ( IN EFI_PHYSICAL_ADDRESS InstructionAddress, IN EFI_SYSTEM_CONTEXT SystemContext, OUT CHAR16 **DisasmString ) -/*++ - -Routine Description: - - Disasm instruction - MOVREL - -Arguments: - - InstructionAddress - The instruction address - SystemContext - EBC system context. - DisasmString - The instruction string - -Returns: - - Instruction length - ---*/ { UINT8 Modifiers; UINT8 Operands; @@ -1827,7 +1690,7 @@ Returns: Modifiers = GET_MODIFIERS (InstructionAddress); Operands = GET_OPERANDS (InstructionAddress); - if (Operands & MOVI_M_IMMDATA) { + if ((Operands & MOVI_M_IMMDATA) != 0) { Size = 4; } else { Size = 2; @@ -1864,7 +1727,7 @@ Returns: EdbPrintRegister1 (Operands); InstructionAddress += 2; - if (Operands & MOVI_M_IMMDATA) { + if ((Operands & MOVI_M_IMMDATA) != 0) { CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT16)); InstructionAddress += 2; EdbPrintRawIndexData16 (Data16);