VirtualBox

Changeset 99208 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Mar 29, 2023 2:13:56 PM (22 months ago)
Author:
vboxsync
Message:

Disassembler,VMM,Runtime: Get rid of deprecated DISCPUSTATE types (preparation for architecture specific separation in order to support ARMv8), bugref:10394

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/BiosCommonCode/MakeAlternativeSource.cpp

    r98103 r99208  
    910910
    911911
    912 static bool disAccessesMemory(PCDISCPUSTATE pCpuState)
    913 {
    914     PCDISOPCODE pCurInstr = pCpuState->pCurInstr;
    915     return disIsMemoryParameter(&pCpuState->Param1, pCurInstr->fParam1)
    916         || disIsMemoryParameter(&pCpuState->Param2, pCurInstr->fParam2)
    917         || disIsMemoryParameter(&pCpuState->Param3, pCurInstr->fParam3)
    918         || disIsMemoryParameter(&pCpuState->Param4, pCurInstr->fParam4);
     912static 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);
    919919}
    920920
     
    923923 * Deals with instructions that YASM will assemble differently than WASM/WCC.
    924924 */
    925 static size_t disHandleYasmDifferences(PDISCPUSTATE pCpuState, uint32_t uFlatAddr, uint32_t cbInstr,
     925static size_t disHandleYasmDifferences(PDISSTATE pDis, uint32_t uFlatAddr, uint32_t cbInstr,
    926926                                       char *pszBuf, size_t cbBuf, size_t cchUsed)
    927927{
    928     bool fDifferent = DISFormatYasmIsOddEncoding(pCpuState);
     928    bool fDifferent = DISFormatYasmIsOddEncoding(pDis);
    929929    uint8_t const  *pb = &g_pbImg[uFlatAddr - g_uBiosFlatBase];
    930930
     
    935935     *        modrm.reg != 0. Those encodings should be invalid AFAICT. */
    936936
    937     if (   (   pCpuState->bOpCode  == 0x8f            /* group 1a */
    938             || pCpuState->bOpCode  == 0xc7            /* group 11 */
    939             || pCpuState->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 */
    940940           )
    941         && pCpuState->ModRM.Bits.Reg != 0)
     941        && pDis->ModRM.Bits.Reg != 0)
    942942        fDifferent = true;
    943943    /*
     
    986986 * @remarks @a uSrcAddr is the flat address.
    987987 */
    988 static DECLCALLBACK(int) disReadOpcodeBytes(PDISCPUSTATE pDis, uint8_t offInstr, uint8_t cbMinRead, uint8_t cbMaxRead)
     988static DECLCALLBACK(int) disReadOpcodeBytes(PDISSTATE pDis, uint8_t offInstr, uint8_t cbMinRead, uint8_t cbMaxRead)
    989989{
    990990    RT_NOREF_PV(cbMinRead);
     
    11361136        else
    11371137        {
    1138             unsigned    cbInstr;
    1139             DISCPUSTATE CpuState;
    1140             CpuState.ModRM.Bits.Mod = 3;
     1138            unsigned cbInstr;
     1139            DISSTATE Dis;
     1140            Dis.ModRM.Bits.Mod = 3;
    11411141            int rc = DISInstrWithReader(uFlatAddr, fIs16Bit ? DISCPUMODE_16BIT : DISCPUMODE_32BIT,
    1142                                         disReadOpcodeBytes, NULL, &CpuState, &cbInstr);
     1142                                        disReadOpcodeBytes, NULL, &Dis, &cbInstr);
    11431143            if (   RT_SUCCESS(rc)
    11441144                && cbInstr <= cb
    1145                 && CpuState.pCurInstr
    1146                 && CpuState.pCurInstr->uOpcode != OP_INVALID
    1147                 && CpuState.pCurInstr->uOpcode != OP_ILLUD2
    1148                 && (   !(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)))
    11501150            {
    11511151                char szTmp[4096];
    1152                 size_t cch = DISFormatYasmEx(&CpuState, szTmp, sizeof(szTmp),
     1152                size_t cch = DISFormatYasmEx(&Dis, szTmp, sizeof(szTmp),
    11531153                                             DIS_FMT_FLAGS_STRICT
    11541154                                             | DIS_FMT_FLAGS_BYTES_RIGHT | DIS_FMT_FLAGS_BYTES_COMMENT | DIS_FMT_FLAGS_BYTES_SPACED,
    11551155                                             NULL, NULL);
    1156                 cch = disHandleYasmDifferences(&CpuState, uFlatAddr, cbInstr, szTmp, sizeof(szTmp), cch);
     1156                cch = disHandleYasmDifferences(&Dis, uFlatAddr, cbInstr, szTmp, sizeof(szTmp), cch);
    11571157                Assert(cch < sizeof(szTmp));
    11581158
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette