VirtualBox

Ignore:
Timestamp:
Dec 4, 2024 3:20:14 PM (6 weeks ago)
Author:
vboxsync
Message:

VMM: Cleaning up ARMv8 / x86 split. jiraref:VBP-1470

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/DBGFDisas.cpp

    r106743 r107227  
    6868    /** The address space for resolving symbol. */
    6969    RTDBGAS         hDbgAs;
    70 #if !defined(VBOX_VMM_TARGET_ARMV8)
     70#ifdef VBOX_VMM_TARGET_X86
    7171    /** Pointer to the first byte in the segment. */
    7272    RTGCUINTPTR     GCPtrSegBase;
     
    115115                                 RTGCPTR GCPtr, uint32_t fFlags, PDBGFDISASSTATE pState)
    116116{
    117 #if !defined(VBOX_VMM_TARGET_ARMV8)
     117#ifndef VBOX_VMM_TARGET_X86
     118    RT_NOREF_PV(pSelInfo);
     119    pState->f64Bits         = CPUMIsGuestIn64BitCode(pVCpu);
     120#else
    118121    pState->GCPtrSegBase    = pSelInfo->GCPtrBase;
    119122    pState->GCPtrSegEnd     = pSelInfo->cbLimit + 1 + (RTGCUINTPTR)pSelInfo->GCPtrBase;
    120123    pState->cbSegLimit      = pSelInfo->cbLimit;
    121124    pState->f64Bits         = enmMode >= PGMMODE_AMD64 && pSelInfo->u.Raw.Gen.u1Long;
    122 #else
    123     RT_NOREF(pSelInfo);
    124 
    125     pState->f64Bits         = CPUMGetGuestCodeBits(pVCpu) == 64;
    126125#endif
    127126    pState->enmMode         = enmMode;
     
    142141            enmCpuMode = CPUMGetGuestDisMode(pVCpu);
    143142            break;
    144 #if !defined(VBOX_VMM_TARGET_ARMV8)
     143#ifdef VBOX_VMM_TARGET_X86
    145144        case DBGF_DISAS_FLAGS_16BIT_MODE:
    146145        case DBGF_DISAS_FLAGS_16BIT_REAL_MODE:
     
    153152            enmCpuMode = DISCPUMODE_64BIT;
    154153            break;
    155 #else
     154#elif defined(VBOX_VMM_TARGET_ARMV8)
    156155        case DBGF_DISAS_FLAGS_16BIT_MODE: /** @todo r=aeichner This is a bit abusive... */
    157156        case DBGF_DISAS_FLAGS_16BIT_REAL_MODE:
     
    164163            enmCpuMode = DISCPUMODE_ARMV8_A64;
    165164            break;
     165#else
     166# error "port me"
    166167#endif
    167168    }
     
    237238    for (;;)
    238239    {
    239 #if !defined(VBOX_VMM_TARGET_ARMV8)
     240#ifdef VBOX_VMM_TARGET_X86
    240241        RTGCUINTPTR GCPtr = pDis->uInstrAddr + offInstr + pState->GCPtrSegBase;
    241242#else
     
    269270        }
    270271
    271         uint32_t cb = GUEST_PAGE_SIZE - (GCPtr & GUEST_PAGE_OFFSET_MASK);
    272 #if !defined(VBOX_VMM_TARGET_ARMV8)
     272#ifdef VBOX_VMM_TARGET_X86
    273273        /*
    274274         * Check the segment limit.
     
    276276        if (!pState->f64Bits && pDis->uInstrAddr + offInstr > pState->cbSegLimit)
    277277            return VERR_OUT_OF_SELECTOR_BOUNDS;
     278#endif
    278279
    279280        /*
    280281         * Calc how much we can read, maxing out the read.
    281282         */
     283        uint32_t cb = GUEST_PAGE_SIZE - (GCPtr & GUEST_PAGE_OFFSET_MASK);
     284#ifdef VBOX_VMM_TARGET_X86
    282285        if (!pState->f64Bits)
    283286        {
     
    313316{
    314317    PDBGFDISASSTATE pState   = (PDBGFDISASSTATE)pDis;
    315     PCDBGFSELINFO   pSelInfo = (PCDBGFSELINFO)pvUser;
    316318
    317319    /*
     
    320322    DBGFADDRESS     Addr;
    321323    int             rc;
    322 #if !defined(VBOX_VMM_TARGET_ARMV8)
     324#ifdef VBOX_VMM_TARGET_X86
     325    PCDBGFSELINFO   pSelInfo = (PCDBGFSELINFO)pvUser;
     326
    323327    /* Start with CS. */
    324328    if (   DIS_FMT_SEL_IS_REG(u32Sel)
     
    349353        rc = VERR_SYMBOL_NOT_FOUND;
    350354    }
     355
    351356#else
    352     RT_NOREF(pSelInfo, u32Sel);
    353 
     357    RT_NOREF(pvUser, u32Sel);
    354358    DBGFR3AddrFromFlat(pState->pVM->pUVM, &Addr, uAddress);
    355359    rc = VINF_SUCCESS;
     
    410414    int     rc;
    411415
    412 #if defined(VBOX_VMM_TARGET_ARMV8)
    413     DBGFSELINFO     SelInfo; RT_ZERO(SelInfo);
    414     const PGMMODE   enmMode = PGMGetGuestMode(pVCpu);
    415     const bool      fRealModeAddress = false;
    416     if (fFlags & DBGF_DISAS_FLAGS_CURRENT_GUEST)
    417         GCPtr = CPUMGetGuestFlatPC(pVCpu);
    418 #else
     416#ifdef VBOX_VMM_TARGET_X86
    419417    /*
    420418     * Get the Sel and GCPtr if fFlags requests that.
     
    542540        }
    543541    }
    544 #endif
     542
     543#else  /* !VBOX_VMM_TARGET_X86 */
     544    const PGMMODE   enmMode = PGMGetGuestMode(pVCpu);
     545    const bool      fRealModeAddress = false;
     546    if (fFlags & DBGF_DISAS_FLAGS_CURRENT_GUEST)
     547        GCPtr = CPUMGetGuestFlatPC(pVCpu);
     548#endif /* !VBOX_VMM_TARGET_X86 */
    545549
    546550    /*
     
    548552     */
    549553    DBGFDISASSTATE State;
     554#ifdef VBOX_VMM_TARGET_X86
    550555    rc = dbgfR3DisasInstrFirst(pVM, pVCpu, &SelInfo, enmMode, GCPtr, fFlags, &State);
     556#else
     557    rc = dbgfR3DisasInstrFirst(pVM, pVCpu, NULL, enmMode, GCPtr, fFlags, &State);
     558#endif
    551559    if (RT_FAILURE(rc))
    552560    {
     
    562570     */
    563571    char szBuf[512];
    564 #if defined(VBOX_VMM_TARGET_ARMV8)
     572#ifdef VBOX_VMM_TARGET_ARMV8
    565573    DISFormatArmV8Ex(&State.Dis, szBuf, sizeof(szBuf),
    566574                     DIS_FMT_FLAGS_RELATIVE_BRANCH,
    567575                     fFlags & DBGF_DISAS_FLAGS_NO_SYMBOLS ? NULL : dbgfR3DisasGetSymbol,
    568576                     NULL);
    569 #else
     577#elif defined(VBOX_VMM_TARGET_X86)
    570578    DISFormatYasmEx(&State.Dis, szBuf, sizeof(szBuf),
    571579                    DIS_FMT_FLAGS_RELATIVE_BRANCH,
    572580                    fFlags & DBGF_DISAS_FLAGS_NO_SYMBOLS ? NULL : dbgfR3DisasGetSymbol,
    573581                    &SelInfo);
     582#else
     583# error "port me"
    574584#endif
    575585
     
    651661        pDisState->Param3    = State.Dis.aParams[2];
    652662        pDisState->Param4    = State.Dis.aParams[3];
    653 #if defined(VBOX_VMM_TARGET_ARMV8)
     663#ifdef VBOX_VMM_TARGET_ARMV8
    654664        memcpy(&pDisState->armv8, &State.Dis.armv8, sizeof(State.Dis.armv8));
     665#elif defined(VBOX_VMM_TARGET_X86)
     666        memcpy(&pDisState->x86, &State.Dis.x86, sizeof(State.Dis.x86));
    655667#else
    656         memcpy(&pDisState->x86, &State.Dis.x86, sizeof(State.Dis.x86));
     668# error "port me"
    657669#endif
    658670    }
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