VirtualBox

儲存庫 vbox 的更動 65935


忽略:
時間撮記:
2017-3-3 下午02:22:21 (8 年 以前)
作者:
vboxsync
訊息:

VMM: Nested Hw.virt: Get instr. length from the hardware if possible (NRIP) before calling into IEM instr. handlers.

檔案:
修改 1 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp

    r65934 r65935  
    42464246}
    42474247
     4248
    42484249/**
    42494250 * Updates interrupt shadow for the current RIP.
     
    42574258    } while (0)
    42584259
     4260
    42594261/**
    42604262 * Advances the guest RIP making use of the CPU's NRIP_SAVE feature if
     
    42744276    if (pVCpu->CTX_SUFF(pVM)->hm.s.svm.u32Features & AMD_CPUID_SVM_FEATURE_EDX_NRIP_SAVE)
    42754277    {
    4276         PSVMVMCB pVmcb = (PSVMVMCB)pVCpu->hm.s.svm.pvVmcb;
     4278        PCSVMVMCB pVmcb = (PCSVMVMCB)pVCpu->hm.s.svm.pvVmcb;
    42774279        Assert(pVmcb->ctrl.u64NextRIP);
    42784280        Assert(pVmcb->ctrl.u64NextRIP - pCtx->rip == cb);
     
    42854287}
    42864288
     4289/* Currently only used by nested hw.virt instructions, so ifdef'd as such, otherwise compilers start whining. */
     4290#ifdef VBOX_WITH_NESTED_HWVIRT
     4291/**
     4292 * Gets the length of the current instruction if the CPU supports the NRIP_SAVE
     4293 * feature. Otherwise, returns the value in @a cbLikely.
     4294 *
     4295 * @param   pVCpu       The cross context virtual CPU structure.
     4296 * @param   pCtx        Pointer to the guest-CPU context.
     4297 * @param   cbLikely    The likely instruction length.
     4298 */
     4299DECLINLINE(uint8_t) hmR0SvmGetInstrLengthHwAssist(PVMCPU pVCpu, PCPUMCTX pCtx, uint8_t cbLikely)
     4300{
     4301    Assert(cbLikely <= 15);   /* See Intel spec. 2.3.11 "AVX Instruction Length" */
     4302    if (pVCpu->CTX_SUFF(pVM)->hm.s.svm.u32Features & AMD_CPUID_SVM_FEATURE_EDX_NRIP_SAVE)
     4303    {
     4304        PCSVMVMCB pVmcb = (PCSVMVMCB)pVCpu->hm.s.svm.pvVmcb;
     4305        uint8_t const cbInstr = pVmcb->ctrl.u64NextRIP - pCtx->rip;
     4306        Assert(cbInstr == cbLikely);
     4307        return cbInstr;
     4308    }
     4309    return cbLikely;
     4310}
     4311#endif
    42874312
    42884313/**
     
    56725697    /** @todo Stat. */
    56735698    /* STAM_COUNTER_INC(&pVCpu->hm.s.StatExitClgi); */
    5674     /** @todo Decode Assist. */
    5675     VBOXSTRICTRC rcStrict = IEMExecDecodedClgi(pVCpu, 3);
     5699    uint8_t const cbInstr = hmR0SvmGetInstrLengthHwAssist(pVCpu, pCtx, 3);
     5700    VBOXSTRICTRC rcStrict = IEMExecDecodedClgi(pVCpu, cbInstr);
    56765701    return VBOXSTRICTRC_VAL(rcStrict);
    56775702}
     
    56865711    /** @todo Stat. */
    56875712    /* STAM_COUNTER_INC(&pVCpu->hm.s.StatExitStgi); */
    5688     /** @todo Decode Assist. */
    5689     VBOXSTRICTRC rcStrict = IEMExecDecodedStgi(pVCpu, 3);
     5713    uint8_t const cbInstr = hmR0SvmGetInstrLengthHwAssist(pVCpu, pCtx, 3);
     5714    VBOXSTRICTRC rcStrict = IEMExecDecodedStgi(pVCpu, cbInstr);
    56905715    return VBOXSTRICTRC_VAL(rcStrict);
    56915716}
     
    57005725    /** @todo Stat. */
    57015726    /* STAM_COUNTER_INC(&pVCpu->hm.s.StatExitVmload); */
    5702     /** @todo Decode Assist. */
    5703     VBOXSTRICTRC rcStrict = IEMExecDecodedVmload(pVCpu, 3);
     5727    uint8_t const cbInstr = hmR0SvmGetInstrLengthHwAssist(pVCpu, pCtx, 3);
     5728    VBOXSTRICTRC rcStrict = IEMExecDecodedVmload(pVCpu, cbInstr);
    57045729    return VBOXSTRICTRC_VAL(rcStrict);
    57055730}
     
    57145739    /** @todo Stat. */
    57155740    /* STAM_COUNTER_INC(&pVCpu->hm.s.StatExitVmsave); */
    5716     /** @todo Decode Assist. */
    5717     VBOXSTRICTRC rcStrict = IEMExecDecodedVmsave(pVCpu, 3);
     5741    uint8_t const cbInstr = hmR0SvmGetInstrLengthHwAssist(pVCpu, pCtx, 3);
     5742    VBOXSTRICTRC rcStrict = IEMExecDecodedVmsave(pVCpu, cbInstr);
    57185743    return VBOXSTRICTRC_VAL(rcStrict);
    57195744}
     
    57285753    /** @todo Stat. */
    57295754    /* STAM_COUNTER_INC(&pVCpu->hm.s.StatExitInvlpga); */
    5730     /** @todo Decode Assist. */
    5731     VBOXSTRICTRC rcStrict = IEMExecDecodedInvlpga(pVCpu, 3);
     5755    uint8_t const cbInstr = hmR0SvmGetInstrLengthHwAssist(pVCpu, pCtx, 3);
     5756    VBOXSTRICTRC rcStrict = IEMExecDecodedInvlpga(pVCpu, cbInstr);
    57325757    return VBOXSTRICTRC_VAL(rcStrict);
    57335758}
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

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