Changeset 60718 in vbox
- Timestamp:
- Apr 27, 2016 2:14:57 PM (8 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 2 edited
-
VMMAll/APICAll.cpp (modified) (4 diffs)
-
include/APICInternal.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/APICAll.cpp
r60716 r60718 205 205 const char *pszBefore; /* The error message before printing the MSR index */ 206 206 const char *pszAfter; /* The error message after printing the MSR index */ 207 int rcR 0; /* The ring-0error code */207 int rcRZ; /* The RZ error code */ 208 208 } const s_aAccess[] = 209 209 { 210 { "read MSR", " while not in x2APIC mode", VINF_CPUM_R3_MSR_READ }, 211 { "write MSR", " while not in x2APIC mode", VINF_CPUM_R3_MSR_WRITE }, 212 { "read reserved/unknown MSR", "", VINF_CPUM_R3_MSR_READ }, 213 { "write reserved/unknown MSR", "", VINF_CPUM_R3_MSR_WRITE }, 214 { "read write-only MSR", "", VINF_CPUM_R3_MSR_READ }, 215 { "write read-only MSR", "", VINF_CPUM_R3_MSR_WRITE }, 216 { "read reserved bits of MSR", "", VINF_CPUM_R3_MSR_READ }, 217 { "write reserved bits of MSR", "", VINF_CPUM_R3_MSR_WRITE }, 218 { "write an invalid value to MSR", "", VINF_CPUM_R3_MSR_WRITE } 210 { "read MSR", " while not in x2APIC mode", VINF_CPUM_R3_MSR_READ }, 211 { "write MSR", " while not in x2APIC mode", VINF_CPUM_R3_MSR_WRITE }, 212 { "read reserved/unknown MSR", "", VINF_CPUM_R3_MSR_READ }, 213 { "write reserved/unknown MSR", "", VINF_CPUM_R3_MSR_WRITE }, 214 { "read write-only MSR", "", VINF_CPUM_R3_MSR_READ }, 215 { "write read-only MSR", "", VINF_CPUM_R3_MSR_WRITE }, 216 { "read reserved bits of MSR", "", VINF_CPUM_R3_MSR_READ }, 217 { "write reserved bits of MSR", "", VINF_CPUM_R3_MSR_WRITE }, 218 { "write an invalid value to MSR", "", VINF_CPUM_R3_MSR_WRITE }, 219 { "write MSR", "disallowed by configuration", VINF_CPUM_R3_MSR_WRITE } 219 220 }; 220 221 AssertCompile(RT_ELEMENTS(s_aAccess) == APICMSRACCESS_COUNT); … … 227 228 return VERR_CPUM_RAISE_GP_0; 228 229 #else 229 return s_aAccess[i].rcR 0;230 return s_aAccess[i].rcRZ; 230 231 #endif 231 232 } … … 2012 2013 } 2013 2014 2014 uBaseMsr |= MSR_APICBASE_XAPIC_ENABLE_BIT; 2015 APICUpdateCpuIdForMode(pVCpu->CTX_SUFF(pVM), APICMODE_XAPIC); 2016 LogRel(("APIC%u: Switched mode to xAPIC\n", pVCpu->idCpu)); 2015 /* Don't allow enabling xAPIC if the VM is configured with a APIC disabled. */ 2016 if (pApic->enmOriginalMode != APICMODE_DISABLED) 2017 { 2018 uBaseMsr |= MSR_APICBASE_XAPIC_ENABLE_BIT; 2019 APICUpdateCpuIdForMode(pVCpu->CTX_SUFF(pVM), APICMODE_XAPIC); 2020 LogRel(("APIC%u: Switched mode to xAPIC\n", pVCpu->idCpu)); 2021 } 2022 else 2023 return apicMsrAccessError(pVCpu, MSR_IA32_APICBASE, APICMSRACCESS_WRITE_DISALLOWED_CONFIG); 2017 2024 break; 2018 2025 } … … 2026 2033 } 2027 2034 2028 uBaseMsr |= MSR_APICBASE_XAPIC_ENABLE_BIT | MSR_APICBASE_X2APIC_ENABLE_BIT; 2029 2030 /* 2031 * The APIC ID needs updating when entering x2APIC mode. 2032 * Software written APIC ID in xAPIC mode isn't preseved. 2033 * The APIC ID becomes read-only to software in x2APIC mode. 2034 * 2035 * See Intel spec. 10.12.5.1 "x2APIC States". 2036 */ 2037 PX2APICPAGE pX2ApicPage = VMCPU_TO_X2APICPAGE(pVCpu); 2038 ASMMemZero32(&pX2ApicPage->id, sizeof(pX2ApicPage->id)); 2039 pX2ApicPage->id.u32ApicId = pVCpu->idCpu; 2040 2041 /* 2042 * LDR initialization occurs when entering x2APIC mode. 2043 * See Intel spec. 10.12.10.2 "Deriving Logical x2APIC ID from the Local x2APIC ID". 2044 */ 2045 pX2ApicPage->ldr.u32LogicalApicId = ((pX2ApicPage->id.u32ApicId & UINT32_C(0xffff0)) << 16) 2046 | (UINT32_C(1) << pX2ApicPage->id.u32ApicId & UINT32_C(0xf)); 2047 2048 LogRel(("APIC%u: Switched mode to x2APIC\n", pVCpu->idCpu)); 2035 /* Don't allow enabling x2APIC if the VM is configured with a APIC disabled. */ 2036 if (pApic->enmOriginalMode != APICMODE_DISABLED) 2037 { 2038 uBaseMsr |= MSR_APICBASE_XAPIC_ENABLE_BIT | MSR_APICBASE_X2APIC_ENABLE_BIT; 2039 2040 /* 2041 * The APIC ID needs updating when entering x2APIC mode. 2042 * Software written APIC ID in xAPIC mode isn't preseved. 2043 * The APIC ID becomes read-only to software in x2APIC mode. 2044 * 2045 * See Intel spec. 10.12.5.1 "x2APIC States". 2046 */ 2047 PX2APICPAGE pX2ApicPage = VMCPU_TO_X2APICPAGE(pVCpu); 2048 ASMMemZero32(&pX2ApicPage->id, sizeof(pX2ApicPage->id)); 2049 pX2ApicPage->id.u32ApicId = pVCpu->idCpu; 2050 2051 /* 2052 * LDR initialization occurs when entering x2APIC mode. 2053 * See Intel spec. 10.12.10.2 "Deriving Logical x2APIC ID from the Local x2APIC ID". 2054 */ 2055 pX2ApicPage->ldr.u32LogicalApicId = ((pX2ApicPage->id.u32ApicId & UINT32_C(0xffff0)) << 16) 2056 | (UINT32_C(1) << pX2ApicPage->id.u32ApicId & UINT32_C(0xf)); 2057 2058 LogRel(("APIC%u: Switched mode to x2APIC\n", pVCpu->idCpu)); 2059 } 2060 else 2061 return apicMsrAccessError(pVCpu, MSR_IA32_APICBASE, APICMSRACCESS_WRITE_DISALLOWED_CONFIG); 2049 2062 break; 2050 2063 } -
trunk/src/VBox/VMM/include/APICInternal.h
r60716 r60718 294 294 /* MSR write with invalid value. */ 295 295 APICMSRACCESS_WRITE_INVALID, 296 /** MSR write disallowed due to incompatible config. */ 297 APICMSRACCESS_WRITE_DISALLOWED_CONFIG, 296 298 /* Count of enum members (don't use). */ 297 299 APICMSRACCESS_COUNT
Note:
See TracChangeset
for help on using the changeset viewer.

