VirtualBox

Changeset 73756 in vbox


Ignore:
Timestamp:
Aug 18, 2018 5:13:26 AM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
124439
Message:

VMM/IEM: Nested VMX: bugref:9180 VMCLEAR skeleton.

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/hm_vmx.h

    r73752 r73756  
    27752775    kVmxVInstrDiag_Vmptrst_Cpl,
    27762776    kVmxVInstrDiag_Vmptrst_PtrMap,
     2777    /* VMCLEAR. */
     2778    kVmxVInstrDiag_Vmclear_Cpl,
    27772779    /* Last member for determining array index limit. */
    27782780    kVmxVInstrDiag_Last
  • trunk/include/VBox/vmm/iem.h

    r73752 r73756  
    324324VMM_INT_DECL(VBOXSTRICTRC)  IEMExecDecodedVmptrst(PVMCPU pVCpu, uint8_t cbInstr, RTGCPHYS GCPtrVmcs, uint32_t uExitInstrInfo,
    325325                                                  RTGCPTR GCPtrDisp);
     326VMM_INT_DECL(VBOXSTRICTRC)  IEMExecDecodedVmclear(PVMCPU pVCpu, uint8_t cbInstr, RTGCPHYS GCPtrVmcs, uint32_t uExitInstrInfo,
     327                                                  RTGCPTR GCPtrDisp);
    326328VMM_INT_DECL(VBOXSTRICTRC)  IEMExecDecodedVmxon(PVMCPU pVCpu, uint8_t cbInstr, RTGCPTR GCPtrVmxon, uint32_t uExitInstrInfo,
    327329                                                RTGCPTR GCPtrDisp);
  • trunk/src/VBox/VMM/VMMAll/HMVMXAll.cpp

    r73752 r73756  
    8484    /* VMPTRST. */
    8585    VMX_INSTR_DIAG_DESC(kVmxVInstrDiag_Vmptrst_Cpl         , "Cpl"          ),
    86     VMX_INSTR_DIAG_DESC(kVmxVInstrDiag_Vmptrst_PtrMap      , "PtrMap"       )
     86    VMX_INSTR_DIAG_DESC(kVmxVInstrDiag_Vmptrst_PtrMap      , "PtrMap"       ),
     87    /* VMCLEAR. */
     88    VMX_INSTR_DIAG_DESC(kVmxVInstrDiag_Vmclear_Cpl         , "Cpl"          )
    8789    /* kVmxVInstrDiag_Last */
    8890};
  • trunk/src/VBox/VMM/VMMAll/IEMAll.cpp

    r73752 r73756  
    1558315583
    1558415584/**
     15585 * Interface for HM and EM to emulate the VMCLEAR instruction.
     15586 *
     15587 * @returns Strict VBox status code.
     15588 * @param   pVCpu           The cross context virtual CPU structure of the calling EMT.
     15589 * @param   cbInstr         The instruction length in bytes.
     15590 * @param   GCPtrVmxon      The linear address of the VMCS pointer.
     15591 * @param   uExitInstrInfo  The VM-exit instruction information field.
     15592 * @param   GCPtrDisp       The displacement field for @a GCPtrVmcs if any.
     15593 * @thread  EMT(pVCpu)
     15594 */
     15595VMM_INT_DECL(VBOXSTRICTRC) IEMExecDecodedVmclear(PVMCPU pVCpu, uint8_t cbInstr, RTGCPHYS GCPtrVmcs, uint32_t uExitInstrInfo,
     15596                                                 RTGCPTR GCPtrDisp)
     15597{
     15598    IEMEXEC_ASSERT_INSTR_LEN_RETURN(cbInstr, 3);
     15599    IEM_CTX_ASSERT(pVCpu, CPUMCTX_EXTRN_HWVIRT);
     15600
     15601    iemInitExec(pVCpu, false /*fBypassHandlers*/);
     15602    PCVMXEXITINSTRINFO pExitInstrInfo = (PCVMXEXITINSTRINFO)&uExitInstrInfo;
     15603    VBOXSTRICTRC rcStrict = iemVmxVmclear(pVCpu, cbInstr, GCPtrVmcs, pExitInstrInfo, GCPtrDisp);
     15604    if (pVCpu->iem.s.cActiveMappings)
     15605        iemMemRollback(pVCpu);
     15606    return iemExecStatusCodeFiddling(pVCpu, rcStrict);
     15607}
     15608
     15609
     15610/**
    1558515611 * Interface for HM and EM to emulate the VMXON instruction.
    1558615612 *
  • trunk/src/VBox/VMM/VMMAll/IEMAllCImplVmxInstr.cpp.h

    r73755 r73756  
    481481
    482482/**
     483 * VMCLEAR instruction execution worker.
     484 *
     485 * @param   pVCpu           The cross context virtual CPU structure.
     486 * @param   cbInstr         The instruction length.
     487 * @param   GCPtrVmcs       The linear address of the VMCS pointer.
     488 * @param   pExitInstrInfo  Pointer to the VM-exit instruction information field.
     489 * @param   GCPtrDisp       The displacement field for @a GCPtrVmcs if any.
     490 *
     491 * @remarks Common VMX instruction checks are already expected to by the caller,
     492 *          i.e. VMX operation, CR4.VMXE, Real/V86 mode, EFER/CS.L checks.
     493 */
     494IEM_STATIC VBOXSTRICTRC iemVmxVmclear(PVMCPU pVCpu, uint8_t cbInstr, RTGCPHYS GCPtrVmcs, PCVMXEXITINSTRINFO pExitInstrInfo,
     495                                      RTGCPTR GCPtrDisp)
     496{
     497    if (IEM_IS_VMX_NON_ROOT_MODE(pVCpu))
     498    {
     499        RT_NOREF(GCPtrDisp);
     500        /** @todo NSTVMX: intercept. */
     501    }
     502    Assert(IEM_IS_VMX_ROOT_MODE(pVCpu));
     503
     504    /* CPL. */
     505    if (CPUMGetGuestCPL(pVCpu) > 0)
     506    {
     507        Log(("vmclear: CPL %u -> #GP(0)\n", pVCpu->iem.s.uCpl));
     508        pVCpu->cpum.GstCtx.hwvirt.vmx.enmInstrDiag = kVmxVInstrDiag_Vmclear_Cpl;
     509        return iemRaiseGeneralProtectionFault0(pVCpu);
     510    }
     511
     512    /** @todo NSTVMX: VMCLEAR impl.  */
     513    RT_NOREF(GCPtrVmcs); RT_NOREF(pExitInstrInfo); RT_NOREF(cbInstr);
     514    return VINF_SUCCESS;
     515}
     516
     517
     518/**
    483519 * VMPTRST instruction execution worker.
    484520 *
     
    928964}
    929965
     966
     967/**
     968 * Implements 'VMCLEAR'.
     969 */
     970IEM_CIMPL_DEF_1(iemCImpl_vmclear, RTGCPTR, GCPtrVmcs)
     971{
     972    RTGCPTR GCPtrDisp;
     973    VMXEXITINSTRINFO ExitInstrInfo;
     974    ExitInstrInfo.u = iemVmxGetExitInstrInfo(pVCpu, VMX_EXIT_VMCLEAR, VMX_INSTR_ID_NONE, &GCPtrDisp);
     975    return iemVmxVmclear(pVCpu, cbInstr, GCPtrVmcs, &ExitInstrInfo, GCPtrDisp);
     976}
     977
    930978#endif
    931979
  • trunk/src/VBox/VMM/VMMAll/IEMAllInstructionsTwoByte0f.cpp.h

    r73755 r73756  
    84408440
    84418441/** Opcode 0x66 0x0f 0xc7 !11/6. */
     8442#ifdef VBOX_WITH_NESTED_HWVIRT_VMX
     8443FNIEMOP_DEF_1(iemOp_Grp9_vmclear_Mq, uint8_t, bRm)
     8444{
     8445    IEMOP_MNEMONIC(vmclear, "vmclear");
     8446    IEMOP_HLP_IN_VMX_OPERATION();
     8447    IEMOP_HLP_VMX_INSTR();
     8448    IEM_MC_BEGIN(1, 0);
     8449    IEM_MC_ARG(RTGCPTR, GCPtrEffDst, 0);
     8450    IEM_MC_CALC_RM_EFF_ADDR(GCPtrEffDst, bRm, 0);
     8451    IEMOP_HLP_DONE_DECODING();
     8452    IEM_MC_CALL_CIMPL_1(iemCImpl_vmclear, GCPtrEffDst);
     8453    IEM_MC_END();
     8454    return VINF_SUCCESS;
     8455}
     8456#else
    84428457FNIEMOP_UD_STUB_1(iemOp_Grp9_vmclear_Mq, uint8_t, bRm);
     8458#endif
    84438459
    84448460/** Opcode 0xf3 0x0f 0xc7 !11/6. */
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