VirtualBox

Changeset 74014 in vbox for trunk/src


Ignore:
Timestamp:
Sep 1, 2018 2:12:29 AM (6 years ago)
Author:
vboxsync
Message:

VMM/HMVMXR0: Nested VMX: bugref:9180 Make use of IEM decoded APIs for vmclear, vmptrld, vmptrst.

File:
1 edited

Legend:

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

    r74005 r74014  
    1317513175}
    1317613176
     13177
    1317713178/**
    1317813179 * VM-exit exception handler for \#GP (General-protection exception).
     
    1337813379
    1337913380#ifdef VBOX_WITH_NESTED_HWVIRT_VMX
    13380 
    1338113381/** @name Nested-guest VM-exit handlers.
    1338213382 * @{
     
    1339313393    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
    1339413394
    13395     /** @todo NSTVMX: Vmclear. */
    13396     hmR0VmxSetPendingXcptUD(pVCpu);
    13397     return VINF_SUCCESS;
     13395    int rc = hmR0VmxReadExitInstrLenVmcs(pVmxTransient);
     13396    rc    |= hmR0VmxImportGuestState(pVCpu, CPUMCTX_EXTRN_RSP | CPUMCTX_EXTRN_SREG_MASK
     13397                                          | IEM_CPUMCTX_EXTRN_EXEC_DECODED_MEM_MASK);
     13398    rc    |= hmR0VmxReadExitInstrInfoVmcs(pVmxTransient);
     13399    rc    |= hmR0VmxReadExitQualVmcs(pVCpu, pVmxTransient);
     13400    AssertRCReturn(rc, rc);
     13401
     13402    HMVMX_CHECK_EXIT_DUE_TO_VMX_INSTR(pVCpu, pVmxTransient->uExitReason);
     13403
     13404    VMXVEXITINFO ExitInfo;
     13405    RT_ZERO(ExitInfo);
     13406    ExitInfo.uReason     = pVmxTransient->uExitReason;
     13407    ExitInfo.u64Qual     = pVmxTransient->uExitQual;
     13408    ExitInfo.InstrInfo.u = pVmxTransient->ExitInstrInfo.u;
     13409    ExitInfo.cbInstr     = pVmxTransient->cbInstr;
     13410    HMVMX_DECODE_MEM_OPERAND(pVCpu, ExitInfo.InstrInfo.u, ExitInfo.u64Qual, VMXMEMACCESS_READ, &ExitInfo.GCPtrEffAddr);
     13411
     13412    VBOXSTRICTRC rcStrict = IEMExecDecodedVmclear(pVCpu, &ExitInfo);
     13413    if (RT_LIKELY(rcStrict == VINF_SUCCESS))
     13414        ASMAtomicUoOrU64(&pVCpu->hm.s.fCtxChanged, HM_CHANGED_GUEST_RIP | HM_CHANGED_GUEST_RFLAGS | HM_CHANGED_GUEST_HWVIRT);
     13415    else if (rcStrict == VINF_IEM_RAISED_XCPT)
     13416    {
     13417        ASMAtomicUoOrU64(&pVCpu->hm.s.fCtxChanged, HM_CHANGED_RAISED_XCPT_MASK);
     13418        rcStrict = VINF_SUCCESS;
     13419    }
     13420    return rcStrict;
    1339813421}
    1339913422
     
    1341913442    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
    1342013443
    13421     /** @todo NSTVMX: Vmptrld. */
    13422     hmR0VmxSetPendingXcptUD(pVCpu);
    13423     return VINF_SUCCESS;
     13444    int rc = hmR0VmxReadExitInstrLenVmcs(pVmxTransient);
     13445    rc    |= hmR0VmxImportGuestState(pVCpu, CPUMCTX_EXTRN_RSP | CPUMCTX_EXTRN_SREG_MASK
     13446                                          | IEM_CPUMCTX_EXTRN_EXEC_DECODED_MEM_MASK);
     13447    rc    |= hmR0VmxReadExitInstrInfoVmcs(pVmxTransient);
     13448    rc    |= hmR0VmxReadExitQualVmcs(pVCpu, pVmxTransient);
     13449    AssertRCReturn(rc, rc);
     13450
     13451    HMVMX_CHECK_EXIT_DUE_TO_VMX_INSTR(pVCpu, pVmxTransient->uExitReason);
     13452
     13453    VMXVEXITINFO ExitInfo;
     13454    RT_ZERO(ExitInfo);
     13455    ExitInfo.uReason     = pVmxTransient->uExitReason;
     13456    ExitInfo.u64Qual     = pVmxTransient->uExitQual;
     13457    ExitInfo.InstrInfo.u = pVmxTransient->ExitInstrInfo.u;
     13458    ExitInfo.cbInstr     = pVmxTransient->cbInstr;
     13459    HMVMX_DECODE_MEM_OPERAND(pVCpu, ExitInfo.InstrInfo.u, ExitInfo.u64Qual, VMXMEMACCESS_READ, &ExitInfo.GCPtrEffAddr);
     13460
     13461    VBOXSTRICTRC rcStrict = IEMExecDecodedVmptrld(pVCpu, &ExitInfo);
     13462    if (RT_LIKELY(rcStrict == VINF_SUCCESS))
     13463        ASMAtomicUoOrU64(&pVCpu->hm.s.fCtxChanged, HM_CHANGED_GUEST_RIP | HM_CHANGED_GUEST_RFLAGS | HM_CHANGED_GUEST_HWVIRT);
     13464    else if (rcStrict == VINF_IEM_RAISED_XCPT)
     13465    {
     13466        ASMAtomicUoOrU64(&pVCpu->hm.s.fCtxChanged, HM_CHANGED_RAISED_XCPT_MASK);
     13467        rcStrict = VINF_SUCCESS;
     13468    }
     13469    return rcStrict;
    1342413470}
    1342513471
     
    1343213478    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
    1343313479
    13434     /** @todo NSTVMX: Vmptrst. */
    13435     hmR0VmxSetPendingXcptUD(pVCpu);
    13436     return VINF_SUCCESS;
     13480    int rc = hmR0VmxReadExitInstrLenVmcs(pVmxTransient);
     13481    rc    |= hmR0VmxImportGuestState(pVCpu, CPUMCTX_EXTRN_RSP | CPUMCTX_EXTRN_SREG_MASK
     13482                                          | IEM_CPUMCTX_EXTRN_EXEC_DECODED_MEM_MASK);
     13483    rc    |= hmR0VmxReadExitInstrInfoVmcs(pVmxTransient);
     13484    rc    |= hmR0VmxReadExitQualVmcs(pVCpu, pVmxTransient);
     13485    AssertRCReturn(rc, rc);
     13486
     13487    HMVMX_CHECK_EXIT_DUE_TO_VMX_INSTR(pVCpu, pVmxTransient->uExitReason);
     13488
     13489    VMXVEXITINFO ExitInfo;
     13490    RT_ZERO(ExitInfo);
     13491    ExitInfo.uReason     = pVmxTransient->uExitReason;
     13492    ExitInfo.u64Qual     = pVmxTransient->uExitQual;
     13493    ExitInfo.InstrInfo.u = pVmxTransient->ExitInstrInfo.u;
     13494    ExitInfo.cbInstr     = pVmxTransient->cbInstr;
     13495    HMVMX_DECODE_MEM_OPERAND(pVCpu, ExitInfo.InstrInfo.u, ExitInfo.u64Qual, VMXMEMACCESS_WRITE, &ExitInfo.GCPtrEffAddr);
     13496
     13497    VBOXSTRICTRC rcStrict = IEMExecDecodedVmptrst(pVCpu, &ExitInfo);
     13498    if (RT_LIKELY(rcStrict == VINF_SUCCESS))
     13499        ASMAtomicUoOrU64(&pVCpu->hm.s.fCtxChanged, HM_CHANGED_GUEST_RIP | HM_CHANGED_GUEST_RFLAGS | HM_CHANGED_GUEST_HWVIRT);
     13500    else if (rcStrict == VINF_IEM_RAISED_XCPT)
     13501    {
     13502        ASMAtomicUoOrU64(&pVCpu->hm.s.fCtxChanged, HM_CHANGED_RAISED_XCPT_MASK);
     13503        rcStrict = VINF_SUCCESS;
     13504    }
     13505    return rcStrict;
    1343713506}
    1343813507
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