VirtualBox

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


Ignore:
Timestamp:
Sep 22, 2016 11:54:43 AM (8 years ago)
Author:
vboxsync
Message:

VMM/APIC: Actively remove the x2APIC MSR range if we are not using it (to override any CPU database entries which may or may not register the x2APIC MSR range).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/APIC.cpp

    r63908 r63944  
    5353# define X2APIC_MSRRANGE(a_uFirst, a_uLast, a_szName) \
    5454    { (a_uFirst), (a_uLast), kCpumMsrRdFn_Ia32X2ApicN, kCpumMsrWrFn_Ia32X2ApicN, 0, 0, 0, 0, 0, a_szName, { 0 }, { 0 }, { 0 }, { 0 } }
     55# define X2APIC_MSRRANGE_INVALID(a_uFirst, a_uLast, a_szName) \
     56    { (a_uFirst), (a_uLast), kCpumMsrRdFn_WriteOnly, kCpumMsrWrFn_ReadOnly, 0, 0, 0, 0, UINT64_MAX /*fWrGpMask*/, a_szName, { 0 }, { 0 }, { 0 }, { 0 } }
    5557#else
    5658# define X2APIC_MSRRANGE(a_uFirst, a_uLast, a_szName) \
    5759    { (a_uFirst), (a_uLast), kCpumMsrRdFn_Ia32X2ApicN, kCpumMsrWrFn_Ia32X2ApicN, 0, 0, 0, 0, 0, a_szName }
     60# define X2APIC_MSRRANGE_INVALID(a_uFirst, a_uLast, a_szName) \
     61    { (a_uFirst), (a_uLast), kCpumMsrRdFn_WriteOnly, kCpumMsrWrFn_ReadOnly, 0, 0, 0, 0, UINT64_MAX /*fWrGpMask*/, a_szName }
    5862#endif
    5963
     
    6771 */
    6872static CPUMMSRRANGE const g_MsrRange_x2Apic = X2APIC_MSRRANGE(MSR_IA32_X2APIC_START, MSR_IA32_X2APIC_END, "x2APIC range");
     73static CPUMMSRRANGE const g_MsrRange_x2Apic_Invalid = X2APIC_MSRRANGE_INVALID(MSR_IA32_X2APIC_START, MSR_IA32_X2APIC_END, "x2APIC range invalid");
    6974#undef X2APIC_MSRRANGE
     75#undef X2APIC_MSRRANGE_GP
    7076
    7177/** Saved state field descriptors for XAPICPAGE. */
     
    17211727     * Initialize the APIC state.
    17221728     */
    1723     /* First insert the MSR range of the x2APIC if enabled. */
     1729    /* First insert/remove the MSR range of the x2APIC. */
    17241730    if (pApic->enmMaxMode == PDMAPICMODE_X2APIC)
    17251731    {
    17261732        rc = CPUMR3MsrRangesInsert(pVM, &g_MsrRange_x2Apic);
    17271733        AssertLogRelRCReturn(rc, rc);
     1734    }
     1735    else
     1736    {
     1737        /* We currently don't have a function to remove the range, so we register an range which will cause a #GP. */
     1738        rc = CPUMR3MsrRangesInsert(pVM, &g_MsrRange_x2Apic_Invalid);
     1739        AssertLogRelRCReturn(rc, rc);
     1740        LogRel(("APIC: Removed x2APIC MSR range\n"));
    17281741    }
    17291742
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