VirtualBox

Changeset 60654 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Apr 22, 2016 3:16:45 PM (9 years ago)
Author:
vboxsync
Message:

VMM/APIC: Fix updating CPUID bits on APIC disable/enable. Fixes XP BSOD with intelppm.sys.

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

Legend:

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

    r60652 r60654  
    20162016                 *
    20172017                 * See Intel spec. 10.4.3 "Enabling or Disabling the Local APIC".
     2018                 *
     2019                 * We'll also manually manage the APIC base MSR here. We want a single-point of commit
     2020                 * at the end of this function rather than touching it in APICR3Reset. This means we also
     2021                 * need to update the CPUID leaf ourselves.
    20182022                 */
    20192023                APICR3Reset(pVCpu, false /* fResetApicBaseMsr */);
    20202024                uBaseMsr &= ~(MSR_APICBASE_XAPIC_ENABLE_BIT | MSR_APICBASE_X2APIC_ENABLE_BIT);
     2025
     2026                APICUpdateCpuIdForMode(pVCpu->CTX_SUFF(pVM), APICMODE_DISABLED);
    20212027                Log2(("APIC%u: Switched mode to disabled\n", pVCpu->idCpu));
    20222028                break;
     
    20302036                    return apicMsrAccessError(pVCpu, MSR_IA32_APICBASE, APICMSRACCESS_WRITE_INVALID);
    20312037                }
     2038
    20322039                uBaseMsr |= MSR_APICBASE_XAPIC_ENABLE_BIT;
     2040                APICUpdateCpuIdForMode(pVCpu->CTX_SUFF(pVM), APICMODE_XAPIC);
    20332041                Log2(("APIC%u: Switched mode to xApic\n", pVCpu->idCpu));
    20342042                break;
     
    20372045            case APICMODE_X2APIC:
    20382046            {
     2047                if (enmOldMode != APICMODE_XAPIC)
     2048                {
     2049                    Log(("APIC%u: Can only transition to x2APIC state from xAPIC state\n", pVCpu->idCpu));
     2050                    return apicMsrAccessError(pVCpu, MSR_IA32_APICBASE, APICMSRACCESS_WRITE_INVALID);
     2051                }
     2052
    20392053                uBaseMsr |= MSR_APICBASE_XAPIC_ENABLE_BIT | MSR_APICBASE_X2APIC_ENABLE_BIT;
    20402054
     
    20562070                pX2ApicPage->ldr.u32LogicalApicId = ((pX2ApicPage->id.u32ApicId & UINT32_C(0xffff0)) << 16)
    20572071                                                  | (UINT32_C(1) << pX2ApicPage->id.u32ApicId & UINT32_C(0xf));
     2072
    20582073                Log2(("APIC%u: Switched mode to x2Apic\n", pVCpu->idCpu));
    20592074                break;
     
    25442559VMM_INT_DECL(void) APICUpdateCpuIdForMode(PVM pVM, APICMODE enmMode)
    25452560{
     2561    LogFlow(("APIC: APICUpdateCpuIdForMode: enmMode=%d (%s)\n", enmMode, apicGetModeName(enmMode)));
     2562
    25462563    /* The CPUID bits being updated to reflect the current state is a bit vague. See @bugref{8245#c32}. */
    25472564    /** @todo This needs to be done on a per-VCPU basis! */
  • trunk/src/VBox/VMM/VMMR3/APIC.cpp

    r60652 r60654  
    241241     */
    242242    VMCPU_ASSERT_EMT_OR_NOT_RUNNING(pVCpu);
     243
     244    /* Construct. */
    243245    PAPICCPU pApicCpu = VMCPU_TO_APICCPU(pVCpu);
    244     pApicCpu->uApicBaseMsr = XAPIC_APICBASE_PHYSADDR
    245                            | MSR_APICBASE_XAPIC_ENABLE_BIT;
     246    uint64_t uApicBaseMsr = XAPIC_APICBASE_PHYSADDR
     247                          | MSR_APICBASE_XAPIC_ENABLE_BIT;
    246248    if (pVCpu->idCpu == 0)
    247         pApicCpu->uApicBaseMsr |= MSR_APICBASE_BOOTSTRAP_CPU_BIT;
     249        uApicBaseMsr |= MSR_APICBASE_BOOTSTRAP_CPU_BIT;
     250
     251    /* Update CPUID. */
     252    APICUpdateCpuIdForMode(pVCpu->CTX_SUFF(pVM), APICMODE_XAPIC);
     253
     254    /* Commit. */
     255    ASMAtomicWriteU64(&pApicCpu->uApicBaseMsr, uApicBaseMsr);
    248256}
    249257
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