Changeset 60654 in vbox for trunk/src/VBox
- Timestamp:
- Apr 22, 2016 3:16:45 PM (9 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/APICAll.cpp
r60652 r60654 2016 2016 * 2017 2017 * 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. 2018 2022 */ 2019 2023 APICR3Reset(pVCpu, false /* fResetApicBaseMsr */); 2020 2024 uBaseMsr &= ~(MSR_APICBASE_XAPIC_ENABLE_BIT | MSR_APICBASE_X2APIC_ENABLE_BIT); 2025 2026 APICUpdateCpuIdForMode(pVCpu->CTX_SUFF(pVM), APICMODE_DISABLED); 2021 2027 Log2(("APIC%u: Switched mode to disabled\n", pVCpu->idCpu)); 2022 2028 break; … … 2030 2036 return apicMsrAccessError(pVCpu, MSR_IA32_APICBASE, APICMSRACCESS_WRITE_INVALID); 2031 2037 } 2038 2032 2039 uBaseMsr |= MSR_APICBASE_XAPIC_ENABLE_BIT; 2040 APICUpdateCpuIdForMode(pVCpu->CTX_SUFF(pVM), APICMODE_XAPIC); 2033 2041 Log2(("APIC%u: Switched mode to xApic\n", pVCpu->idCpu)); 2034 2042 break; … … 2037 2045 case APICMODE_X2APIC: 2038 2046 { 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 2039 2053 uBaseMsr |= MSR_APICBASE_XAPIC_ENABLE_BIT | MSR_APICBASE_X2APIC_ENABLE_BIT; 2040 2054 … … 2056 2070 pX2ApicPage->ldr.u32LogicalApicId = ((pX2ApicPage->id.u32ApicId & UINT32_C(0xffff0)) << 16) 2057 2071 | (UINT32_C(1) << pX2ApicPage->id.u32ApicId & UINT32_C(0xf)); 2072 2058 2073 Log2(("APIC%u: Switched mode to x2Apic\n", pVCpu->idCpu)); 2059 2074 break; … … 2544 2559 VMM_INT_DECL(void) APICUpdateCpuIdForMode(PVM pVM, APICMODE enmMode) 2545 2560 { 2561 LogFlow(("APIC: APICUpdateCpuIdForMode: enmMode=%d (%s)\n", enmMode, apicGetModeName(enmMode))); 2562 2546 2563 /* The CPUID bits being updated to reflect the current state is a bit vague. See @bugref{8245#c32}. */ 2547 2564 /** @todo This needs to be done on a per-VCPU basis! */ -
trunk/src/VBox/VMM/VMMR3/APIC.cpp
r60652 r60654 241 241 */ 242 242 VMCPU_ASSERT_EMT_OR_NOT_RUNNING(pVCpu); 243 244 /* Construct. */ 243 245 PAPICCPU pApicCpu = VMCPU_TO_APICCPU(pVCpu); 244 pApicCpu->uApicBaseMsr = XAPIC_APICBASE_PHYSADDR245 246 uint64_t uApicBaseMsr = XAPIC_APICBASE_PHYSADDR 247 | MSR_APICBASE_XAPIC_ENABLE_BIT; 246 248 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); 248 256 } 249 257
Note:
See TracChangeset
for help on using the changeset viewer.