VirtualBox

Changeset 70913 in vbox for trunk/src/VBox/VMM/VMMAll


Ignore:
Timestamp:
Feb 8, 2018 3:11:15 PM (7 years ago)
Author:
vboxsync
Message:

CPUM: Infrastructure for speculative execution control.

File:
1 edited

Legend:

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

    r70071 r70913  
    14301430    return VINF_SUCCESS;
    14311431}
     1432
     1433
     1434/** @callback_method_impl{FNCPUMRDMSR} */
     1435static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32SpecCtrl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
     1436{
     1437    RT_NOREF_PV(pVCpu); RT_NOREF_PV(idMsr); RT_NOREF_PV(pRange);
     1438    *puValue = pVCpu->cpum.s.GuestMsrs.msr.SpecCtrl;
     1439    return VINF_SUCCESS;
     1440}
     1441
     1442
     1443/** @callback_method_impl{FNCPUMWRMSR} */
     1444static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32SpecCtrl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
     1445{
     1446    RT_NOREF_PV(pVCpu); RT_NOREF_PV(idMsr); RT_NOREF_PV(pRange); RT_NOREF_PV(uValue); RT_NOREF_PV(uRawValue);
     1447
     1448    /* NB: The STIBP bit can be set even when IBRS is present, regardless of whether STIBP is actually implemented. */
     1449    if (uValue & ~(MSR_IA32_SPEC_CTRL_F_IBRS | MSR_IA32_SPEC_CTRL_F_STIBP))
     1450    {
     1451        Log(("CPUM: Invalid IA32_SPEC_CTRL bits (trying to write %#llx)\n", uValue));
     1452        return VERR_CPUM_RAISE_GP_0;
     1453    }
     1454
     1455    pVCpu->cpum.s.GuestMsrs.msr.SpecCtrl = uValue;
     1456    return VINF_SUCCESS;
     1457}
     1458
     1459
     1460/** @callback_method_impl{FNCPUMWRMSR} */
     1461static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32PredCmd(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
     1462{
     1463    RT_NOREF_PV(pVCpu); RT_NOREF_PV(idMsr); RT_NOREF_PV(pRange); RT_NOREF_PV(uValue); RT_NOREF_PV(uRawValue);
     1464    return VINF_SUCCESS;
     1465}
     1466
     1467
     1468/** @callback_method_impl{FNCPUMRDMSR} */
     1469static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32ArchCapabilities(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
     1470{
     1471    RT_NOREF_PV(pVCpu); RT_NOREF_PV(idMsr); RT_NOREF_PV(pRange);
     1472    *puValue = pVCpu->cpum.s.GuestMsrs.msr.ArchCaps;
     1473    return VINF_SUCCESS;
     1474}
     1475
     1476
    14321477
    14331478
     
    49995044    cpumMsrRd_Ia32VmxTrueEntryCtls,
    50005045    cpumMsrRd_Ia32VmxVmFunc,
     5046    cpumMsrRd_Ia32SpecCtrl,
     5047    cpumMsrRd_Ia32ArchCapabilities,
    50015048
    50025049    cpumMsrRd_Amd64Efer,
     
    52425289    cpumMsrWr_Ia32X2ApicN,
    52435290    cpumMsrWr_Ia32DebugInterface,
     5291    cpumMsrWr_Ia32SpecCtrl,
     5292    cpumMsrWr_Ia32PredCmd,
    52445293
    52455294    cpumMsrWr_Amd64Efer,
     
    57125761    CPUM_ASSERT_RD_MSR_FN(Ia32VmxTrueEntryCtls);
    57135762    CPUM_ASSERT_RD_MSR_FN(Ia32VmxVmFunc);
     5763    CPUM_ASSERT_RD_MSR_FN(Ia32SpecCtrl);
     5764    CPUM_ASSERT_RD_MSR_FN(Ia32ArchCapabilities);
    57145765
    57155766    CPUM_ASSERT_RD_MSR_FN(Amd64Efer);
     
    59445995    CPUM_ASSERT_WR_MSR_FN(Ia32X2ApicN);
    59455996    CPUM_ASSERT_WR_MSR_FN(Ia32DebugInterface);
     5997    CPUM_ASSERT_WR_MSR_FN(Ia32SpecCtrl);
     5998    CPUM_ASSERT_WR_MSR_FN(Ia32PredCmd);
    59465999
    59476000    CPUM_ASSERT_WR_MSR_FN(Amd64Efer);
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