VirtualBox

Changeset 97206 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Oct 18, 2022 12:48:35 PM (2 years ago)
Author:
vboxsync
Message:

VMM/EM,HMVMXR0: Replaced EMInterpretRdpmc with IEMExecDecodedRdpmc (not really tested as none of my guests use it).

Location:
trunk/src/VBox/VMM/VMMAll
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/EMAll.cpp

    r97200 r97206  
    10301030 */
    10311031
    1032 
    1033 /**
    1034  * Interpret RDPMC.
    1035  *
    1036  * @returns VBox status code.
    1037  * @param   pVM         The cross context VM structure.
    1038  * @param   pVCpu       The cross context virtual CPU structure.
    1039  * @param   pRegFrame   The register frame.
    1040  *
    1041  */
    1042 VMM_INT_DECL(int) EMInterpretRdpmc(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame)
    1043 {
    1044     Assert(pRegFrame == CPUMGetGuestCtxCore(pVCpu));
    1045     uint32_t uCR4 = CPUMGetGuestCR4(pVCpu);
    1046 
    1047     /* If X86_CR4_PCE is not set, then CPL must be zero. */
    1048     if (    !(uCR4 & X86_CR4_PCE)
    1049         &&  CPUMGetGuestCPL(pVCpu) != 0)
    1050     {
    1051         Assert(CPUMGetGuestCR0(pVCpu) & X86_CR0_PE);
    1052         return VERR_EM_INTERPRETER; /* genuine #GP */
    1053     }
    1054 
    1055     /* Just return zero here; rather tricky to properly emulate this, especially as the specs are a mess. */
    1056     pRegFrame->rax = 0;
    1057     pRegFrame->rdx = 0;
    1058     /** @todo We should trigger a \#GP here if the CPU doesn't support the index in
    1059      *        ecx but see @bugref{3472}! */
    1060 
    1061     NOREF(pVM);
    1062     return VINF_SUCCESS;
    1063 }
    1064 
    1065 
    10661032/* VT-x only: */
    10671033
  • trunk/src/VBox/VMM/VMMAll/VMXAllTemplate.cpp.h

    r97202 r97206  
    78277827
    78287828    PVMXVMCSINFO pVmcsInfo = pVmxTransient->pVmcsInfo;
    7829     int rc = vmxHCImportGuestState<  CPUMCTX_EXTRN_CR4
    7830                                    | CPUMCTX_EXTRN_CR0
    7831                                    | CPUMCTX_EXTRN_RFLAGS
    7832                                    | CPUMCTX_EXTRN_RIP
    7833                                    | CPUMCTX_EXTRN_SS>(pVCpu, pVmcsInfo, __FUNCTION__);
     7829    vmxHCReadToTransient<HMVMX_READ_EXIT_INSTR_LEN>(pVCpu, pVmxTransient);
     7830    int rc = vmxHCImportGuestState<IEM_CPUMCTX_EXTRN_EXEC_DECODED_NO_MEM_MASK | CPUMCTX_EXTRN_CR4>(pVCpu, pVmcsInfo, __FUNCTION__);
    78347831    AssertRCReturn(rc, rc);
    78357832
    7836     PCPUMCTX pCtx = &pVCpu->cpum.GstCtx;
    7837     rc = EMInterpretRdpmc(pVCpu->CTX_SUFF(pVM), pVCpu, CPUMCTX2CORE(pCtx));
    7838     if (RT_LIKELY(rc == VINF_SUCCESS))
    7839     {
    7840         rc = vmxHCAdvanceGuestRip(pVCpu, pVmxTransient);
    7841         Assert(pVmxTransient->cbExitInstr == 2);
    7842     }
    7843     else
    7844     {
    7845         AssertMsgFailed(("vmxHCExitRdpmc: EMInterpretRdpmc failed with %Rrc\n", rc));
    7846         rc = VERR_EM_INTERPRETER;
    7847     }
    7848     return rc;
     7833    VBOXSTRICTRC rcStrict = IEMExecDecodedRdpmc(pVCpu, pVmxTransient->cbExitInstr);
     7834    if (RT_LIKELY(rcStrict == VINF_SUCCESS))
     7835        ASMAtomicUoOrU64(&VCPU_2_VMXSTATE(pVCpu).fCtxChanged, HM_CHANGED_GUEST_RIP | HM_CHANGED_GUEST_RFLAGS);
     7836    else if (rcStrict == VINF_IEM_RAISED_XCPT)
     7837    {
     7838        ASMAtomicUoOrU64(&VCPU_2_VMXSTATE(pVCpu).fCtxChanged, HM_CHANGED_RAISED_XCPT_MASK);
     7839        rcStrict = VINF_SUCCESS;
     7840    }
     7841    return rcStrict;
    78497842}
    78507843
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