Changeset 99208 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Mar 29, 2023 2:13:56 PM (22 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/BiosCommonCode/MakeAlternativeSource.cpp
r98103 r99208 910 910 911 911 912 static bool disAccessesMemory(PCDIS CPUSTATE pCpuState)913 { 914 PCDISOPCODE pCurInstr = p CpuState->pCurInstr;915 return disIsMemoryParameter(&p CpuState->Param1, pCurInstr->fParam1)916 || disIsMemoryParameter(&p CpuState->Param2, pCurInstr->fParam2)917 || disIsMemoryParameter(&p CpuState->Param3, pCurInstr->fParam3)918 || disIsMemoryParameter(&p CpuState->Param4, pCurInstr->fParam4);912 static bool disAccessesMemory(PCDISSTATE pDis) 913 { 914 PCDISOPCODE pCurInstr = pDis->pCurInstr; 915 return disIsMemoryParameter(&pDis->Param1, pCurInstr->fParam1) 916 || disIsMemoryParameter(&pDis->Param2, pCurInstr->fParam2) 917 || disIsMemoryParameter(&pDis->Param3, pCurInstr->fParam3) 918 || disIsMemoryParameter(&pDis->Param4, pCurInstr->fParam4); 919 919 } 920 920 … … 923 923 * Deals with instructions that YASM will assemble differently than WASM/WCC. 924 924 */ 925 static size_t disHandleYasmDifferences(PDIS CPUSTATE pCpuState, uint32_t uFlatAddr, uint32_t cbInstr,925 static size_t disHandleYasmDifferences(PDISSTATE pDis, uint32_t uFlatAddr, uint32_t cbInstr, 926 926 char *pszBuf, size_t cbBuf, size_t cchUsed) 927 927 { 928 bool fDifferent = DISFormatYasmIsOddEncoding(p CpuState);928 bool fDifferent = DISFormatYasmIsOddEncoding(pDis); 929 929 uint8_t const *pb = &g_pbImg[uFlatAddr - g_uBiosFlatBase]; 930 930 … … 935 935 * modrm.reg != 0. Those encodings should be invalid AFAICT. */ 936 936 937 if ( ( p CpuState->bOpCode == 0x8f /* group 1a */938 || p CpuState->bOpCode == 0xc7 /* group 11 */939 || p CpuState->bOpCode == 0xc6 /* group 11 - not verified */937 if ( ( pDis->bOpCode == 0x8f /* group 1a */ 938 || pDis->bOpCode == 0xc7 /* group 11 */ 939 || pDis->bOpCode == 0xc6 /* group 11 - not verified */ 940 940 ) 941 && p CpuState->ModRM.Bits.Reg != 0)941 && pDis->ModRM.Bits.Reg != 0) 942 942 fDifferent = true; 943 943 /* … … 986 986 * @remarks @a uSrcAddr is the flat address. 987 987 */ 988 static DECLCALLBACK(int) disReadOpcodeBytes(PDIS CPUSTATE pDis, uint8_t offInstr, uint8_t cbMinRead, uint8_t cbMaxRead)988 static DECLCALLBACK(int) disReadOpcodeBytes(PDISSTATE pDis, uint8_t offInstr, uint8_t cbMinRead, uint8_t cbMaxRead) 989 989 { 990 990 RT_NOREF_PV(cbMinRead); … … 1136 1136 else 1137 1137 { 1138 unsigned 1139 DIS CPUSTATE CpuState;1140 CpuState.ModRM.Bits.Mod = 3;1138 unsigned cbInstr; 1139 DISSTATE Dis; 1140 Dis.ModRM.Bits.Mod = 3; 1141 1141 int rc = DISInstrWithReader(uFlatAddr, fIs16Bit ? DISCPUMODE_16BIT : DISCPUMODE_32BIT, 1142 disReadOpcodeBytes, NULL, & CpuState, &cbInstr);1142 disReadOpcodeBytes, NULL, &Dis, &cbInstr); 1143 1143 if ( RT_SUCCESS(rc) 1144 1144 && cbInstr <= cb 1145 && CpuState.pCurInstr1146 && CpuState.pCurInstr->uOpcode != OP_INVALID1147 && CpuState.pCurInstr->uOpcode != OP_ILLUD21148 && ( !( CpuState.fPrefix & DISPREFIX_ADDRSIZE)1149 || disAccessesMemory(& CpuState)))1145 && Dis.pCurInstr 1146 && Dis.pCurInstr->uOpcode != OP_INVALID 1147 && Dis.pCurInstr->uOpcode != OP_ILLUD2 1148 && ( !(Dis.fPrefix & DISPREFIX_ADDRSIZE) 1149 || disAccessesMemory(&Dis))) 1150 1150 { 1151 1151 char szTmp[4096]; 1152 size_t cch = DISFormatYasmEx(& CpuState, szTmp, sizeof(szTmp),1152 size_t cch = DISFormatYasmEx(&Dis, szTmp, sizeof(szTmp), 1153 1153 DIS_FMT_FLAGS_STRICT 1154 1154 | DIS_FMT_FLAGS_BYTES_RIGHT | DIS_FMT_FLAGS_BYTES_COMMENT | DIS_FMT_FLAGS_BYTES_SPACED, 1155 1155 NULL, NULL); 1156 cch = disHandleYasmDifferences(& CpuState, uFlatAddr, cbInstr, szTmp, sizeof(szTmp), cch);1156 cch = disHandleYasmDifferences(&Dis, uFlatAddr, cbInstr, szTmp, sizeof(szTmp), cch); 1157 1157 Assert(cch < sizeof(szTmp)); 1158 1158
Note:
See TracChangeset
for help on using the changeset viewer.