VirtualBox

Ignore:
Timestamp:
Dec 7, 2018 8:36:12 AM (6 years ago)
Author:
vboxsync
Message:

VMM/HMVMXR0: Nested VMX: bugref:9180 Guest/nested-guest state fixes and missing VMLAUNCH/VMRESUME calls to IEM.

File:
1 edited

Legend:

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

    r76015 r76042  
    58985898    Assert(pGCPtrMem);
    58995899    Assert(!CPUMIsGuestInRealOrV86Mode(pVCpu));
    5900     HMVMX_CPUMCTX_ASSERT(pVCpu, CPUMCTX_EXTRN_RSP | CPUMCTX_EXTRN_SREG_MASK | CPUMCTX_EXTRN_EFER | CPUMCTX_EXTRN_CR0);
     5900    HMVMX_CPUMCTX_ASSERT(pVCpu, CPUMCTX_EXTRN_RIP | CPUMCTX_EXTRN_RSP | CPUMCTX_EXTRN_SREG_MASK | CPUMCTX_EXTRN_EFER
     5901                              | CPUMCTX_EXTRN_CR0);
    59015902
    59025903    static uint64_t const s_auAddrSizeMasks[]   = { UINT64_C(0xffff), UINT64_C(0xffffffff), UINT64_C(0xffffffffffffffff) };
     
    60816082{
    60826083    HMVMX_CPUMCTX_ASSERT(pVCpu, CPUMCTX_EXTRN_CR4 | CPUMCTX_EXTRN_CR0 | CPUMCTX_EXTRN_RFLAGS | CPUMCTX_EXTRN_SS
    6083                               | CPUMCTX_EXTRN_HWVIRT);
     6084                              | CPUMCTX_EXTRN_CS  | CPUMCTX_EXTRN_EFER);
    60846085
    60856086    if (   CPUMIsGuestInRealOrV86ModeEx(&pVCpu->cpum.GstCtx)
     
    1345713458    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
    1345813459
    13459     /** @todo NSTVMX: Vmlaunch. */
    13460     hmR0VmxSetPendingXcptUD(pVCpu);
    13461     return VINF_SUCCESS;
     13460    int rc = hmR0VmxReadExitInstrLenVmcs(pVmxTransient);
     13461    rc    |= HMVMX_CPUMCTX_IMPORT_STATE(pVCpu, IEM_CPUMCTX_EXTRN_VMX_VMENTRY_MASK);
     13462    AssertRCReturn(rc, rc);
     13463
     13464    HMVMX_CHECK_EXIT_DUE_TO_VMX_INSTR(pVCpu, pVmxTransient->uExitReason);
     13465
     13466    VBOXSTRICTRC rcStrict = IEMExecDecodedVmlaunchVmresume(pVCpu, pVmxTransient->cbInstr, VMXINSTRID_VMLAUNCH);
     13467    if (RT_LIKELY(rcStrict == VINF_SUCCESS))
     13468        ASMAtomicUoOrU64(&pVCpu->hm.s.fCtxChanged, HM_CHANGED_ALL_GUEST);
     13469    Assert(rcStrict != VINF_IEM_RAISED_XCPT);
     13470    return rcStrict;
    1346213471}
    1346313472
     
    1357913588    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
    1358013589
    13581     /** @todo NSTVMX: Vmresume. */
    13582     hmR0VmxSetPendingXcptUD(pVCpu);
    13583     return VINF_SUCCESS;
     13590    int rc = hmR0VmxReadExitInstrLenVmcs(pVmxTransient);
     13591    rc    |= HMVMX_CPUMCTX_IMPORT_STATE(pVCpu, IEM_CPUMCTX_EXTRN_VMX_VMENTRY_MASK);
     13592    AssertRCReturn(rc, rc);
     13593
     13594    HMVMX_CHECK_EXIT_DUE_TO_VMX_INSTR(pVCpu, pVmxTransient->uExitReason);
     13595
     13596    VBOXSTRICTRC rcStrict = IEMExecDecodedVmlaunchVmresume(pVCpu, pVmxTransient->cbInstr, VMXINSTRID_VMRESUME);
     13597    if (RT_LIKELY(rcStrict == VINF_SUCCESS))
     13598        ASMAtomicUoOrU64(&pVCpu->hm.s.fCtxChanged, HM_CHANGED_ALL_GUEST);
     13599    Assert(rcStrict != VINF_IEM_RAISED_XCPT);
     13600    return rcStrict;
    1358413601}
    1358513602
     
    1363013647
    1363113648    int rc = hmR0VmxReadExitInstrLenVmcs(pVmxTransient);
    13632     rc    |= HMVMX_CPUMCTX_IMPORT_STATE(pVCpu, IEM_CPUMCTX_EXTRN_EXEC_DECODED_NO_MEM_MASK);
     13649    rc    |= HMVMX_CPUMCTX_IMPORT_STATE(pVCpu, CPUMCTX_EXTRN_CR4 | IEM_CPUMCTX_EXTRN_EXEC_DECODED_NO_MEM_MASK);
    1363313650    AssertRCReturn(rc, rc);
    1363413651
     
    1363813655    if (RT_LIKELY(rcStrict == VINF_SUCCESS))
    1363913656    {
    13640         /* VMXOFF on success changes the internal hwvirt state but not anything that's visible to the guest. */
    13641         ASMAtomicUoOrU64(&pVCpu->hm.s.fCtxChanged, HM_CHANGED_GUEST_HWVIRT);
     13657        /* VMXOFF changes the internal hwvirt. state but not anything that's visible to the guest other than RIP. */
     13658        ASMAtomicUoOrU64(&pVCpu->hm.s.fCtxChanged, HM_CHANGED_GUEST_RIP | HM_CHANGED_GUEST_HWVIRT);
    1364213659    }
    1364313660    else if (rcStrict == VINF_IEM_RAISED_XCPT)
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