VirtualBox

Changeset 41675 in vbox for trunk/src/VBox/VMM/VMMR3


Ignore:
Timestamp:
Jun 12, 2012 8:27:37 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
78482
Message:

DIS: The start of the scoping exercise... Fixed PREFIX_ADDRSIZE that I just busted in the previous commit.

Location:
trunk/src/VBox/VMM/VMMR3
Files:
8 edited

Legend:

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

    r41674 r41675  
    36313631            State.cbSegLimit      = pCtx->csHid.u32Limit;
    36323632            enmDisCpuMode         = (State.f64Bits)
    3633                                     ? CPUMODE_64BIT
     3633                                    ? DISCPUMODE_64BIT
    36343634                                    : pCtx->csHid.Attr.n.u1DefBig
    3635                                     ? CPUMODE_32BIT
    3636                                     : CPUMODE_16BIT;
     3635                                    ? DISCPUMODE_32BIT
     3636                                    : DISCPUMODE_16BIT;
    36373637        }
    36383638        else
     
    36593659            State.GCPtrSegEnd     = SelInfo.cbLimit + 1 + (RTGCUINTPTR)SelInfo.GCPtrBase;
    36603660            State.cbSegLimit      = SelInfo.cbLimit;
    3661             enmDisCpuMode         = SelInfo.u.Raw.Gen.u1DefBig ? CPUMODE_32BIT : CPUMODE_16BIT;
     3661            enmDisCpuMode         = SelInfo.u.Raw.Gen.u1DefBig ? DISCPUMODE_32BIT : DISCPUMODE_16BIT;
    36623662        }
    36633663    }
     
    36653665    {
    36663666        /* real or V86 mode */
    3667         enmDisCpuMode         = CPUMODE_16BIT;
     3667        enmDisCpuMode         = DISCPUMODE_16BIT;
    36683668        State.GCPtrSegBase    = pCtx->cs * 16;
    36693669        State.GCPtrSegEnd     = 0xFFFFFFFF;
  • trunk/src/VBox/VMM/VMMR3/CSAM.cpp

    r41674 r41675  
    870870                Assert(VALID_PTR(pCurInstrHC));
    871871
    872                 rc = CSAMR3DISInstr(pVM, pCurInstrGC, pCurInstrHC, (fCode32) ? CPUMODE_32BIT : CPUMODE_16BIT,
     872                rc = CSAMR3DISInstr(pVM, pCurInstrGC, pCurInstrHC, (fCode32) ? DISCPUMODE_32BIT : DISCPUMODE_16BIT,
    873873                                    &cpu, &opsize, NULL, 0);
    874874            }
     
    10531053                STAM_PROFILE_START(&pVM->csam.s.StatTimeDisasm, a);
    10541054#ifdef DEBUG
    1055                 rc2 = CSAMR3DISInstr(pVM, pCurInstrGC, pCurInstrHC, (fCode32) ? CPUMODE_32BIT : CPUMODE_16BIT,
     1055                rc2 = CSAMR3DISInstr(pVM, pCurInstrGC, pCurInstrHC, (fCode32) ? DISCPUMODE_32BIT : DISCPUMODE_16BIT,
    10561056                                     &cpu, &opsize, szOutput, sizeof(szOutput));
    10571057                if (RT_SUCCESS(rc2)) Log(("CSAM Call Analysis: %s", szOutput));
    10581058#else
    1059                 rc2 = CSAMR3DISInstr(pVM, pCurInstrGC, pCurInstrHC, (fCode32) ? CPUMODE_32BIT : CPUMODE_16BIT,
     1059                rc2 = CSAMR3DISInstr(pVM, pCurInstrGC, pCurInstrHC, (fCode32) ? DISCPUMODE_32BIT : DISCPUMODE_16BIT,
    10601060                                     &cpu, &opsize, NULL, 0);
    10611061#endif
     
    12661266            STAM_PROFILE_START(&pVM->csam.s.StatTimeDisasm, a);
    12671267#ifdef DEBUG
    1268             rc2 = CSAMR3DISInstr(pVM, pCurInstrGC, pCurInstrHC, fCode32 ? CPUMODE_32BIT : CPUMODE_16BIT,
     1268            rc2 = CSAMR3DISInstr(pVM, pCurInstrGC, pCurInstrHC, fCode32 ? DISCPUMODE_32BIT : DISCPUMODE_16BIT,
    12691269                                 &cpu, &opsize, szOutput, sizeof(szOutput));
    12701270            if (RT_SUCCESS(rc2)) Log(("CSAM Analysis: %s", szOutput));
    12711271#else
    1272             rc2 = CSAMR3DISInstr(pVM, pCurInstrGC, pCurInstrHC, fCode32 ? CPUMODE_32BIT : CPUMODE_16BIT,
     1272            rc2 = CSAMR3DISInstr(pVM, pCurInstrGC, pCurInstrHC, fCode32 ? DISCPUMODE_32BIT : DISCPUMODE_16BIT,
    12731273                                 &cpu, &opsize, NULL, 0);
    12741274#endif
     
    22612261    {
    22622262        /* Assuming 32 bits code for now. */
    2263         Assert(SELMGetCpuModeFromSelector(VMMGetCpu0(pVM), pCtxCore->eflags, pCtxCore->cs, &pCtxCore->csHid) == CPUMODE_32BIT);
     2263        Assert(SELMGetCpuModeFromSelector(VMMGetCpu0(pVM), pCtxCore->eflags, pCtxCore->cs, &pCtxCore->csHid) == DISCPUMODE_32BIT);
    22642264
    22652265        pInstrGC = SELMToFlat(pVM, DIS_SELREG_CS, pCtxCore, pInstrGC);
  • trunk/src/VBox/VMM/VMMR3/DBGFDisas.cpp

    r41674 r41675  
    122122        case DBGF_DISAS_FLAGS_DEFAULT_MODE:
    123123            enmCpuMode   = pState->f64Bits
    124                          ? CPUMODE_64BIT
     124                         ? DISCPUMODE_64BIT
    125125                         : pSelInfo->u.Raw.Gen.u1DefBig
    126                          ? CPUMODE_32BIT
    127                          : CPUMODE_16BIT;
     126                         ? DISCPUMODE_32BIT
     127                         : DISCPUMODE_16BIT;
    128128            break;
    129129        case DBGF_DISAS_FLAGS_16BIT_MODE:
    130130        case DBGF_DISAS_FLAGS_16BIT_REAL_MODE:
    131             enmCpuMode = CPUMODE_16BIT;
     131            enmCpuMode = DISCPUMODE_16BIT;
    132132            break;
    133133        case DBGF_DISAS_FLAGS_32BIT_MODE:
    134             enmCpuMode = CPUMODE_32BIT;
     134            enmCpuMode = DISCPUMODE_32BIT;
    135135            break;
    136136        case DBGF_DISAS_FLAGS_64BIT_MODE:
    137             enmCpuMode = CPUMODE_64BIT;
     137            enmCpuMode = DISCPUMODE_64BIT;
    138138            break;
    139139    }
  • trunk/src/VBox/VMM/VMMR3/EMHwaccm.cpp

    r40446 r41675  
    307307        rcStrict = VINF_EM_RAW_EMULATE_INSTR;
    308308
    309         if (!(Cpu.prefix & (PREFIX_REP | PREFIX_REPNE)))
     309        if (!(Cpu.prefix & (DISPREFIX_REP | DISPREFIX_REPNE)))
    310310        {
    311311            switch (Cpu.pCurInstr->opcode)
     
    326326            }
    327327        }
    328         else if (Cpu.prefix & PREFIX_REP)
     328        else if (Cpu.prefix & DISPREFIX_REP)
    329329        {
    330330            switch (Cpu.pCurInstr->opcode)
  • trunk/src/VBox/VMM/VMMR3/EMRaw.cpp

    r40451 r41675  
    428428        VBOXSTRICTRC rcStrict = VINF_EM_RAW_EMULATE_INSTR;
    429429
    430         if (!(Cpu.prefix & (PREFIX_REP | PREFIX_REPNE)))
     430        if (!(Cpu.prefix & (DISPREFIX_REP | DISPREFIX_REPNE)))
    431431        {
    432432            switch (Cpu.pCurInstr->opcode)
     
    447447            }
    448448        }
    449         else if (Cpu.prefix & PREFIX_REP)
     449        else if (Cpu.prefix & DISPREFIX_REP)
    450450        {
    451451            switch (Cpu.pCurInstr->opcode)
     
    684684            {
    685685                rc = PATMR3InstallPatch(pVM, SELMToFlat(pVM, DIS_SELREG_CS, CPUMCTX2CORE(pCtx), pCtx->eip),
    686                                         (SELMGetCpuModeFromSelector(pVCpu, pCtx->eflags, pCtx->cs, &pCtx->csHid) == CPUMODE_32BIT) ? PATMFL_CODE32 : 0);
     686                                        (SELMGetCpuModeFromSelector(pVCpu, pCtx->eflags, pCtx->cs, &pCtx->csHid) == DISCPUMODE_32BIT) ? PATMFL_CODE32 : 0);
    687687                if (RT_SUCCESS(rc))
    688688                {
     
    934934        {
    935935            int rc = PATMR3InstallPatch(pVM, SELMToFlat(pVM, DIS_SELREG_CS, CPUMCTX2CORE(pCtx), pCtx->eip),
    936                                         (SELMGetCpuModeFromSelector(pVCpu, pCtx->eflags, pCtx->cs, &pCtx->csHid) == CPUMODE_32BIT) ? PATMFL_CODE32 : 0);
     936                                        (SELMGetCpuModeFromSelector(pVCpu, pCtx->eflags, pCtx->cs, &pCtx->csHid) == DISCPUMODE_32BIT) ? PATMFL_CODE32 : 0);
    937937            if (RT_SUCCESS(rc))
    938938            {
     
    10411041        if (    (pCtx->ss & X86_SEL_RPL) == 0
    10421042            &&  !pCtx->eflags.Bits.u1VM
    1043             &&  SELMGetCpuModeFromSelector(pVCpu, pCtx->eflags, pCtx->cs, &pCtx->csHid) == CPUMODE_32BIT)
     1043            &&  SELMGetCpuModeFromSelector(pVCpu, pCtx->eflags, pCtx->cs, &pCtx->csHid) == DISCPUMODE_32BIT)
    10441044        {
    10451045            STAM_PROFILE_START(&pVCpu->em.s.StatPrivEmu, a);
  • trunk/src/VBox/VMM/VMMR3/PATM.cpp

    r41674 r41675  
    604604    disinfo.fReadFlags  = fReadFlags;
    605605    return RT_SUCCESS(DISInstrToStrWithReader(InstrGCPtr32,
    606                                               (pPatch->flags & PATMFL_CODE32) ? CPUMODE_32BIT : CPUMODE_16BIT,
     606                                              (pPatch->flags & PATMFL_CODE32) ? DISCPUMODE_32BIT : DISCPUMODE_16BIT,
    607607                                              patmReadBytes, &disinfo,
    608608                                              pCpu, pcbInstr, pszOutput, cbOutput));
     
    620620    disinfo.fReadFlags  = fReadFlags;
    621621    return RT_SUCCESS(DISInstrWithReader(InstrGCPtr32,
    622                                          (pPatch->flags & PATMFL_CODE32) ? CPUMODE_32BIT : CPUMODE_16BIT,
     622                                         (pPatch->flags & PATMFL_CODE32) ? DISCPUMODE_32BIT : DISCPUMODE_16BIT,
    623623                                         patmReadBytes, &disinfo,
    624624                                         pCpu, pcbInstr));
     
    16541654         */
    16551655        Log(("patmRecompileCallback: jump to code we've recompiled before %RRv!\n", pCurInstrGC));
    1656         return patmPatchGenRelJump(pVM, pPatch, pCurInstrGC, OP_JMP, !!(pCpu->prefix & PREFIX_OPSIZE));
     1656        return patmPatchGenRelJump(pVM, pPatch, pCurInstrGC, OP_JMP, !!(pCpu->prefix & DISPREFIX_OPSIZE));
    16571657    }
    16581658
     
    17131713        }
    17141714        else
    1715             rc = patmPatchGenRelJump(pVM, pPatch, pTargetGC, pCpu->pCurInstr->opcode, !!(pCpu->prefix & PREFIX_OPSIZE));
     1715            rc = patmPatchGenRelJump(pVM, pPatch, pTargetGC, pCpu->pCurInstr->opcode, !!(pCpu->prefix & DISPREFIX_OPSIZE));
    17161716
    17171717        if (RT_SUCCESS(rc))
     
    18551855            fGenerateJmpBack = false;
    18561856
    1857         rc = patmPatchGenPopf(pVM, pPatch, pCurInstrGC + pCpu->opsize, !!(pCpu->prefix & PREFIX_OPSIZE), fGenerateJmpBack);
     1857        rc = patmPatchGenPopf(pVM, pPatch, pCurInstrGC + pCpu->opsize, !!(pCpu->prefix & DISPREFIX_OPSIZE), fGenerateJmpBack);
    18581858        if (RT_SUCCESS(rc))
    18591859        {
     
    18731873
    18741874    case OP_PUSHF:
    1875         rc = patmPatchGenPushf(pVM, pPatch, !!(pCpu->prefix & PREFIX_OPSIZE));
     1875        rc = patmPatchGenPushf(pVM, pPatch, !!(pCpu->prefix & DISPREFIX_OPSIZE));
    18761876        if (RT_SUCCESS(rc))
    18771877            rc = VWRN_CONTINUE_RECOMPILE;
     
    18901890    case OP_IRET:
    18911891        Log(("IRET at %RRv\n", pCurInstrGC));
    1892         rc = patmPatchGenIret(pVM, pPatch, pCurInstrGC, !!(pCpu->prefix & PREFIX_OPSIZE));
     1892        rc = patmPatchGenIret(pVM, pPatch, pCurInstrGC, !!(pCpu->prefix & DISPREFIX_OPSIZE));
    18931893        if (RT_SUCCESS(rc))
    18941894        {
     
    32173217    pPatch->uCurPatchOffset   = 0;
    32183218
    3219     cpu.mode = (pPatch->flags & PATMFL_CODE32) ? CPUMODE_32BIT : CPUMODE_16BIT;
     3219    cpu.mode = (pPatch->flags & PATMFL_CODE32) ? DISCPUMODE_32BIT : DISCPUMODE_16BIT;
    32203220
    32213221    /* Note: Set the PATM interrupt flag here; it was cleared before the patched call. (!!!) */
     
    42124212    pPatchRec->patch.pPrivInstrGC = pInstrGC;
    42134213    pPatchRec->patch.flags   = flags;
    4214     pPatchRec->patch.uOpMode = (flags & PATMFL_CODE32) ? CPUMODE_32BIT : CPUMODE_16BIT;
     4214    pPatchRec->patch.uOpMode = (flags & PATMFL_CODE32) ? DISCPUMODE_32BIT : DISCPUMODE_16BIT;
    42154215    pPatchRec->patch.pTrampolinePatchesHead = NULL;
    42164216
     
    64576457        if (disret && (cpu.pCurInstr->opcode == OP_SYSEXIT || cpu.pCurInstr->opcode == OP_HLT || cpu.pCurInstr->opcode == OP_INT3))
    64586458        {
    6459             cpu.mode = (pPatch->patch.flags & PATMFL_CODE32) ? CPUMODE_32BIT : CPUMODE_16BIT;
     6459            cpu.mode = (pPatch->patch.flags & PATMFL_CODE32) ? DISCPUMODE_32BIT : DISCPUMODE_16BIT;
    64606460            disret = patmR3DisInstr(pVM, &pPatch->patch, pNewEip, PATMGCVirtToHCVirt(pVM, &cacheRec, pNewEip), PATMREAD_RAWCODE,
    64616461                                    &cpu, &opsize);
  • trunk/src/VBox/VMM/VMMR3/PATMPatch.cpp

    r41663 r41675  
    701701        offset = 0;
    702702        /* include prefix byte to make sure we don't use the incorrect selector register. */
    703         if (pCpu->prefix & PREFIX_SEG)
     703        if (pCpu->prefix & DISPREFIX_SEG)
    704704            pPB[offset++] = DISQuerySegPrefixByte(pCpu);
    705705        pPB[offset++] = 0xFF;              // push r/m32
    706706        pPB[offset++] = MAKE_MODRM(pCpu->ModRM.Bits.Mod, 6 /* group 5 */, pCpu->ModRM.Bits.Rm);
    707707        i = 2;  /* standard offset of modrm bytes */
    708         if (pCpu->prefix & PREFIX_OPSIZE)
     708        if (pCpu->prefix & DISPREFIX_OPSIZE)
    709709            i++;    //skip operand prefix
    710         if (pCpu->prefix & PREFIX_SEG)
     710        if (pCpu->prefix & DISPREFIX_SEG)
    711711            i++;    //skip segment prefix
    712712
     
    797797    offset = 0;
    798798    /* include prefix byte to make sure we don't use the incorrect selector register. */
    799     if (pCpu->prefix & PREFIX_SEG)
     799    if (pCpu->prefix & DISPREFIX_SEG)
    800800        pPB[offset++] = DISQuerySegPrefixByte(pCpu);
    801801
     
    803803    pPB[offset++] = MAKE_MODRM(pCpu->ModRM.Bits.Mod, 6 /* group 5 */, pCpu->ModRM.Bits.Rm);
    804804    i = 2;  /* standard offset of modrm bytes */
    805     if (pCpu->prefix & PREFIX_OPSIZE)
     805    if (pCpu->prefix & DISPREFIX_OPSIZE)
    806806        i++;    //skip operand prefix
    807     if (pCpu->prefix & PREFIX_SEG)
     807    if (pCpu->prefix & DISPREFIX_SEG)
    808808        i++;    //skip segment prefix
    809809
     
    12761276    PATCHGEN_PROLOG_NODEF(pVM, pPatch);
    12771277    offset = 0;
    1278     if (pCpu->prefix & PREFIX_OPSIZE)
     1278    if (pCpu->prefix & DISPREFIX_OPSIZE)
    12791279        pPB[offset++] = 0x66;       /* size override -> 16 bits push */
    12801280    pPB[offset++] = 0x16;
     
    12891289    PATCHGEN_PROLOG_NODEF(pVM, pPatch);
    12901290    offset = 0;
    1291     if (pCpu->prefix & PREFIX_OPSIZE)
     1291    if (pCpu->prefix & DISPREFIX_OPSIZE)
    12921292        pPB[offset++] = 0x66; /* size override -> 16 bits pop */
    12931293    pPB[offset++] = 0x58 + pCpu->param1.base.reg_gen;
     
    13201320
    13211321    /** @todo segment prefix (untested) */
    1322     Assert(pCpu->prefix == PREFIX_NONE || pCpu->prefix == PREFIX_OPSIZE);
     1322    Assert(pCpu->prefix == DISPREFIX_NONE || pCpu->prefix == DISPREFIX_OPSIZE);
    13231323
    13241324    PATCHGEN_PROLOG(pVM, pPatch);
     
    13291329        // 8B 15 [32 bits addr]   mov edx, CPUMCTX.tr/ldtr
    13301330
    1331         if (pCpu->prefix == PREFIX_OPSIZE)
     1331        if (pCpu->prefix == DISPREFIX_OPSIZE)
    13321332            pPB[offset++] = 0x66;
    13331333
     
    13601360        pPB[offset++] = 0x52;              // push      edx
    13611361
    1362         if (pCpu->prefix == PREFIX_SEG)
     1362        if (pCpu->prefix == DISPREFIX_SEG)
    13631363        {
    13641364            pPB[offset++] = DISQuerySegPrefixByte(pCpu);
     
    13691369
    13701370        i = 3;  /* standard offset of modrm bytes */
    1371         if (pCpu->prefix == PREFIX_OPSIZE)
     1371        if (pCpu->prefix == DISPREFIX_OPSIZE)
    13721372            i++;    //skip operand prefix
    1373         if (pCpu->prefix == PREFIX_SEG)
     1373        if (pCpu->prefix == DISPREFIX_SEG)
    13741374            i++;    //skip segment prefix
    13751375
     
    14201420
    14211421    /* @todo segment prefix (untested) */
    1422     Assert(pCpu->prefix == PREFIX_NONE);
     1422    Assert(pCpu->prefix == DISPREFIX_NONE);
    14231423
    14241424    // sgdt %Ms
     
    14551455    pPB[offset++] = 0x52;              // push      edx
    14561456
    1457     if (pCpu->prefix == PREFIX_SEG)
     1457    if (pCpu->prefix == DISPREFIX_SEG)
    14581458    {
    14591459        pPB[offset++] = DISQuerySegPrefixByte(pCpu);
     
    14641464
    14651465    i = 3;  /* standard offset of modrm bytes */
    1466     if (pCpu->prefix == PREFIX_OPSIZE)
     1466    if (pCpu->prefix == DISPREFIX_OPSIZE)
    14671467        i++;    //skip operand prefix
    1468     if (pCpu->prefix == PREFIX_SEG)
     1468    if (pCpu->prefix == DISPREFIX_SEG)
    14691469        i++;    //skip segment prefix
    14701470    rc = patmPatchReadBytes(pVM, &pPB[offset], (RTRCPTR)((RTGCUINTPTR32)pCurInstrGC + i), pCpu->opsize - i);
  • trunk/src/VBox/VMM/VMMR3/VMMSwitcher.cpp

    r41674 r41675  
    835835                DISCPUSTATE Cpu;
    836836                char        szDisas[256];
    837                 int rc = DISInstr(pu8CodeR3 + offCode, CPUMODE_32BIT, &Cpu, &cbInstr);
     837                int rc = DISInstr(pu8CodeR3 + offCode, DISCPUMODE_32BIT, &Cpu, &cbInstr);
    838838                if (RT_SUCCESS(rc))
    839839                {
Note: See TracChangeset for help on using the changeset viewer.

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