VirtualBox

Changeset 72893 in vbox


Ignore:
Timestamp:
Jul 4, 2018 4:55:53 PM (6 years ago)
Author:
vboxsync
Message:

HM: Use IEMExecOne in hmR0SvmExitInvlpg rather than elaborate manual interpretation ending up in EMInterpretInvlpg.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp

    r72891 r72893  
    58705870
    58715871/**
    5872  * Worker for hmR0SvmInterpretInvlpg().
    5873  *
    5874  * @return VBox status code.
    5875  * @param   pVCpu           The cross context virtual CPU structure.
    5876  * @param   pCpu            Pointer to the disassembler state.
    5877  * @param   pCtx            The guest CPU context.
    5878  */
    5879 static int hmR0SvmInterpretInvlPgEx(PVMCPU pVCpu, PDISCPUSTATE pCpu, PCPUMCTX pCtx)
    5880 {
    5881     DISQPVPARAMVAL Param1;
    5882     RTGCPTR        GCPtrPage;
    5883 
    5884     int rc = DISQueryParamVal(CPUMCTX2CORE(pCtx), pCpu, &pCpu->Param1, &Param1, DISQPVWHICH_SRC);
    5885     if (RT_FAILURE(rc))
    5886         return VERR_EM_INTERPRETER;
    5887 
    5888     if (   Param1.type == DISQPV_TYPE_IMMEDIATE
    5889         || Param1.type == DISQPV_TYPE_ADDRESS)
    5890     {
    5891         if (!(Param1.flags & (DISQPV_FLAG_32 | DISQPV_FLAG_64)))
    5892             return VERR_EM_INTERPRETER;
    5893 
    5894         GCPtrPage = Param1.val.val64;
    5895         VBOXSTRICTRC rc2 = EMInterpretInvlpg(pVCpu->CTX_SUFF(pVM), pVCpu, CPUMCTX2CORE(pCtx), GCPtrPage);
    5896         rc = VBOXSTRICTRC_VAL(rc2);
    5897     }
    5898     else
    5899     {
    5900         Log4Func(("Invalid parameter type %#x\n", Param1.type));
    5901         rc = VERR_EM_INTERPRETER;
    5902     }
    5903 
    5904     return rc;
    5905 }
    5906 
    5907 
    5908 /**
    5909  * Interprets INVLPG.
    5910  *
    5911  * @returns VBox status code.
    5912  * @retval  VINF_*                  Scheduling instructions.
    5913  * @retval  VERR_EM_INTERPRETER     Something we can't cope with.
    5914  * @retval  VERR_*                  Fatal errors.
    5915  *
    5916  * @param   pVCpu       The cross context virtual CPU structure.
    5917  * @param   pCtx        The guest CPU context.
    5918  *
    5919  * @remarks Updates the RIP if the instruction was executed successfully.
    5920  */
    5921 static int hmR0SvmInterpretInvlpg(PVMCPU pVCpu, PCPUMCTX pCtx)
    5922 {
    5923     /* Only allow 32 & 64 bit code. */
    5924     if (CPUMGetGuestCodeBits(pVCpu) != 16)
    5925     {
    5926         PDISSTATE pDis = &pVCpu->hm.s.DisState;
    5927         int rc = EMInterpretDisasCurrent(pVCpu->CTX_SUFF(pVM), pVCpu, pDis, NULL /* pcbInstr */);
    5928         if (   RT_SUCCESS(rc)
    5929             && pDis->pCurInstr->uOpcode == OP_INVLPG)
    5930         {
    5931             rc = hmR0SvmInterpretInvlPgEx(pVCpu, pDis, pCtx);
    5932             if (RT_SUCCESS(rc))
    5933                 pCtx->rip += pDis->cbInstr;
    5934             return rc;
    5935         }
    5936         else
    5937             Log4Func(("EMInterpretDisasCurrent failed! rc=%Rrc uOpCode=%#x\n", rc, pDis->pCurInstr->uOpcode));
    5938     }
    5939     return VERR_EM_INTERPRETER;
    5940 }
    5941 
    5942 
    5943 /**
    59445872 * Gets the IEM exception flags for the specified SVM event.
    59455873 *
     
    63956323    Assert(!pVCpu->CTX_SUFF(pVM)->hm.s.fNestedPaging);
    63966324
     6325    VBOXSTRICTRC rcStrict;
    63976326    bool const fSupportsDecodeAssists = hmR0SvmSupportsDecodeAssists(pVCpu, pCtx);
    63986327    bool const fSupportsNextRipSave   = hmR0SvmSupportsNextRipSave(pVCpu, pCtx);
     
    64046333        uint8_t const cbInstr   = pVmcb->ctrl.u64NextRIP - pCtx->rip;
    64056334        RTGCPTR const GCPtrPage = pVmcb->ctrl.u64ExitInfo1;
    6406         VBOXSTRICTRC rcStrict = IEMExecDecodedInvlpg(pVCpu, cbInstr, GCPtrPage);
    6407         HMSVM_CHECK_SINGLE_STEP(pVCpu, rcStrict);
    6408         return VBOXSTRICTRC_VAL(rcStrict);
    6409     }
    6410 
    6411     HMSVM_CPUMCTX_IMPORT_STATE(pVCpu, HMSVM_CPUMCTX_EXTRN_ALL);
    6412     int rc = hmR0SvmInterpretInvlpg(pVCpu, pCtx);    /* Updates RIP if successful. */
    6413     Assert(rc == VINF_SUCCESS || rc == VERR_EM_INTERPRETER);
    6414     HMSVM_CHECK_SINGLE_STEP(pVCpu, rc);
    6415     return rc;
     6335        rcStrict = IEMExecDecodedInvlpg(pVCpu, cbInstr, GCPtrPage);
     6336    }
     6337    else
     6338    {
     6339        HMSVM_CPUMCTX_IMPORT_STATE(pVCpu, IEM_CPUMCTX_EXTRN_MUST_MASK);
     6340        rcStrict = IEMExecOne(pVCpu);
     6341    }
     6342
     6343    HMSVM_CHECK_SINGLE_STEP(pVCpu, rcStrict);     /* RIP updated by IEMExecDecodedInvlpg() or IEMExecOne(). */
     6344    return VBOXSTRICTRC_VAL(rcStrict);
    64166345}
    64176346
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