VirtualBox

Changeset 39974 in vbox for trunk


Ignore:
Timestamp:
Feb 2, 2012 9:59:25 PM (13 years ago)
Author:
vboxsync
Message:

IEM: Implemented rdmsr.

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

Legend:

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

    r39971 r39974  
    28782878
    28792879
    2880 
    28812880/**
    28822881 * Implements RDTSC.
     
    29082907    pIemCpu->fIgnoreRaxRdx = true;
    29092908#endif
     2909
     2910    iemRegAddToRip(pIemCpu, cbInstr);
     2911    return VINF_SUCCESS;
     2912}
     2913
     2914
     2915/**
     2916 * Implements RDMSR.
     2917 */
     2918IEM_CIMPL_DEF_0(iemCImpl_rdmsr)
     2919{
     2920    PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx);
     2921
     2922    /*
     2923     * Check preconditions.
     2924     */
     2925    if (!IEM_IS_INTEL_CPUID_FEATURE_PRESENT_EDX(X86_CPUID_FEATURE_EDX_MSR))
     2926        return iemRaiseUndefinedOpcode(pIemCpu);
     2927    if (pIemCpu->uCpl != 0)
     2928        return iemRaiseGeneralProtectionFault0(pIemCpu);
     2929
     2930    /*
     2931     * Do the job.
     2932     */
     2933    RTUINT64U uValue;
     2934    int rc = CPUMQueryGuestMsr(IEMCPU_TO_VMCPU(pIemCpu), pCtx->ecx, &uValue.u);
     2935    if (rc != VINF_SUCCESS)
     2936    {
     2937        AssertMsgReturn(rc == VERR_CPUM_RAISE_GP_0, ("%Rrc\n", rc), VERR_IPE_UNEXPECTED_STATUS);
     2938        return iemRaiseGeneralProtectionFault0(pIemCpu);
     2939    }
     2940
     2941    pCtx->rax = uValue.au32[0];
     2942    pCtx->rdx = uValue.au32[1];
    29102943
    29112944    iemRegAddToRip(pIemCpu, cbInstr);
  • trunk/src/VBox/VMM/VMMAll/IEMAllInstructions.cpp.h

    r39971 r39974  
    11101110
    11111111/** Opcode 0x0f 0x33. */
    1112 FNIEMOP_STUB(iemOp_rdmsr);
     1112FNIEMOP_DEF(iemOp_rdmsr)
     1113{
     1114    IEMOP_MNEMONIC("rdmsr");
     1115    IEMOP_HLP_NO_LOCK_PREFIX();
     1116    return IEM_MC_DEFER_TO_CIMPL_0(iemCImpl_rdmsr);
     1117}
     1118
     1119
    11131120/** Opcode 0x0f 0x34. */
    11141121FNIEMOP_STUB(iemOp_rdpmc);
     
    32593266
    32603267/** Opcode 0x0f 0xae. */
    3261 FNIEMOP_STUB(iemOp_Grp15);
     3268FNIEMOP_STUB(iemOp_Grp15); /** @todo next up: fxrstor */
    32623269
    32633270
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