VirtualBox

Changeset 9720 in vbox


Ignore:
Timestamp:
Jun 16, 2008 1:12:04 PM (17 years ago)
Author:
vboxsync
Message:

Emulate rdmsr & wrmsr.
Note that Intel mentions a (slightly different) REX.W version of RDMSR.

Location:
trunk/src/VBox/VMM
Files:
3 edited

Legend:

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

    r9713 r9720  
    21442144    int      rc;
    21452145
    2146     /* Note: works the same in 32 and 64 bits modes. */
     2146    /** @todo According to the Intel manuals, there's a REX version of RDMSR that is slightly different.
     2147     *  That version clears the high dwords of both RDX & RAX */
    21472148    rc = CPUMQueryGuestCtxPtr(pVM, &pCtx);
    21482149    AssertRC(rc);
     
    22282229static int emInterpretRdmsr(PVM pVM, PDISCPUSTATE pCpu, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, uint32_t *pcbSize)
    22292230{
     2231    Assert(!(pCpu->prefix & PREFIX_REX));
    22302232    return EMInterpretRdmsr(pVM, pRegFrame);
    22312233}
  • trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp

    r9718 r9720  
    17141714    /* Emulate in ring 3. */
    17151715    case SVM_EXIT_MSR:
    1716         /* Note: If we decide to emulate them here, then we must sync the MSRs that could have been changed (sysenter, fs/gs base)!!! */
    1717         rc = VERR_EM_INTERPRETER;
     1716    {
     1717        uint32_t cbSize;
     1718
     1719        /* Note: the intel manual claims there's a REX version of RDMSR that's slightly different, so we play safe by completely disassembling the instruction. */
     1720        Log(("SVM: %s\n", (pVMCB->ctrl.u64ExitInfo1 == 0) ? "rdmsr" : "wrmsr"));
     1721        rc = EMInterpretInstruction(pVM, CPUMCTX2CORE(pCtx), 0, &cbSize);
     1722        if (rc == VINF_SUCCESS)
     1723        {
     1724            /* EIP has been updated already. */
     1725
     1726            /* Only resume if successful. */
     1727            STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     1728            goto ResumeExecution;
     1729        }
     1730        AssertMsg(rc == VERR_EM_INTERPRETER, ("EMU: %s failed with %Vrc\n", (pVMCB->ctrl.u64ExitInfo1 == 0) ? "rdmsr" : "wrmsr", rc));
    17181731        break;
     1732    }
    17191733
    17201734    case SVM_EXIT_MONITOR:
  • trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp

    r9719 r9720  
    16991699    }
    17001700
     1701    case VMX_EXIT_RDMSR:                /* 31 RDMSR. Guest software attempted to execute RDMSR. */
     1702    case VMX_EXIT_WRMSR:                /* 32 WRMSR. Guest software attempted to execute WRMSR. */
     1703    {
     1704        uint32_t cbSize;
     1705
     1706        /* Note: the intel manual claims there's a REX version of RDMSR that's slightly different, so we play safe by completely disassembling the instruction. */
     1707        Log2(("VMX: %s\n", (exitReason == VMX_EXIT_RDMSR) ? "rdmsr" : "wrmsr"));
     1708        rc = EMInterpretInstruction(pVM, CPUMCTX2CORE(pCtx), 0, &cbSize);
     1709        if (rc == VINF_SUCCESS)
     1710        {
     1711            /* EIP has been updated already. */
     1712
     1713            /* Only resume if successful. */
     1714            STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     1715            goto ResumeExecution;
     1716        }
     1717        AssertMsg(rc == VERR_EM_INTERPRETER, ("EMU: %s failed with %Vrc\n", (exitReason == VMX_EXIT_RDMSR) ? "rdmsr" : "wrmsr", rc));
     1718        break;
     1719    }
     1720
    17011721    case VMX_EXIT_CRX_MOVE:             /* 28 Control-register accesses. */
    17021722    {
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