Changeset 10465 in vbox
- Timestamp:
- Jul 10, 2008 11:51:19 AM (17 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/HWACCM.cpp
r9986 r10465 297 297 LogRel(("HWACCM: Dual monitor treatment = %d\n", MSR_IA32_VMX_BASIC_INFO_VMCS_DUAL_MON(pVM->hwaccm.s.vmx.msr.vmx_basic_info))); 298 298 299 LogRel(("HWACCM: MSR_IA32_VMX_PINBASED_CTLS = %VX64\n", pVM->hwaccm.s.vmx.msr.vmx_pin_ctls ));300 val = pVM->hwaccm.s.vmx.msr.vmx_pin_ctls >> 32ULL;299 LogRel(("HWACCM: MSR_IA32_VMX_PINBASED_CTLS = %VX64\n", pVM->hwaccm.s.vmx.msr.vmx_pin_ctls.u)); 300 val = pVM->hwaccm.s.vmx.msr.vmx_pin_ctls.n.allowed1; 301 301 if (val & VMX_VMCS_CTRL_PIN_EXEC_CONTROLS_EXT_INT_EXIT) 302 302 LogRel(("HWACCM: VMX_VMCS_CTRL_PIN_EXEC_CONTROLS_EXT_INT_EXIT\n")); 303 303 if (val & VMX_VMCS_CTRL_PIN_EXEC_CONTROLS_NMI_EXIT) 304 304 LogRel(("HWACCM: VMX_VMCS_CTRL_PIN_EXEC_CONTROLS_NMI_EXIT\n")); 305 val = pVM->hwaccm.s.vmx.msr.vmx_pin_ctls ;305 val = pVM->hwaccm.s.vmx.msr.vmx_pin_ctls.n.disallowed0; 306 306 if (val & VMX_VMCS_CTRL_PIN_EXEC_CONTROLS_EXT_INT_EXIT) 307 307 LogRel(("HWACCM: VMX_VMCS_CTRL_PIN_EXEC_CONTROLS_EXT_INT_EXIT *must* be set\n")); … … 309 309 LogRel(("HWACCM: VMX_VMCS_CTRL_PIN_EXEC_CONTROLS_NMI_EXIT *must* be set\n")); 310 310 311 LogRel(("HWACCM: MSR_IA32_VMX_PROCBASED_CTLS = %VX64\n", pVM->hwaccm.s.vmx.msr.vmx_proc_ctls ));312 val = pVM->hwaccm.s.vmx.msr.vmx_proc_ctls >> 32ULL;311 LogRel(("HWACCM: MSR_IA32_VMX_PROCBASED_CTLS = %VX64\n", pVM->hwaccm.s.vmx.msr.vmx_proc_ctls.u)); 312 val = pVM->hwaccm.s.vmx.msr.vmx_proc_ctls.n.allowed1; 313 313 if (val & VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_IRQ_WINDOW_EXIT) 314 314 LogRel(("HWACCM: VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_IRQ_WINDOW_EXIT\n")); … … 343 343 if (val & VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_PAUSE_EXIT) 344 344 LogRel(("HWACCM: VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_PAUSE_EXIT\n")); 345 val = pVM->hwaccm.s.vmx.msr.vmx_proc_ctls; 345 346 val = pVM->hwaccm.s.vmx.msr.vmx_proc_ctls.n.disallowed0; 346 347 if (val & VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_IRQ_WINDOW_EXIT) 347 348 LogRel(("HWACCM: VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_IRQ_WINDOW_EXIT *must* be set\n")); … … 377 378 LogRel(("HWACCM: VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_PAUSE_EXIT *must* be set\n")); 378 379 379 LogRel(("HWACCM: MSR_IA32_VMX_ENTRY_CTLS = %VX64\n", pVM->hwaccm.s.vmx.msr.vmx_entry ));380 val = pVM->hwaccm.s.vmx.msr.vmx_entry >> 32ULL;380 LogRel(("HWACCM: MSR_IA32_VMX_ENTRY_CTLS = %VX64\n", pVM->hwaccm.s.vmx.msr.vmx_entry.u)); 381 val = pVM->hwaccm.s.vmx.msr.vmx_entry.n.allowed1; 381 382 if (val & VMX_VMCS_CTRL_ENTRY_CONTROLS_IA64_MODE) 382 383 LogRel(("HWACCM: VMX_VMCS_CTRL_ENTRY_CONTROLS_IA64_MODE\n")); … … 385 386 if (val & VMX_VMCS_CTRL_ENTRY_CONTROLS_DEACTIVATE_DUALMON) 386 387 LogRel(("HWACCM: VMX_VMCS_CTRL_ENTRY_CONTROLS_DEACTIVATE_DUALMON\n")); 387 val = pVM->hwaccm.s.vmx.msr.vmx_entry ;388 val = pVM->hwaccm.s.vmx.msr.vmx_entry.n.disallowed0; 388 389 if (val & VMX_VMCS_CTRL_ENTRY_CONTROLS_IA64_MODE) 389 390 LogRel(("HWACCM: VMX_VMCS_CTRL_ENTRY_CONTROLS_IA64_MODE *must* be set\n")); … … 393 394 LogRel(("HWACCM: VMX_VMCS_CTRL_ENTRY_CONTROLS_DEACTIVATE_DUALMON *must* be set\n")); 394 395 395 LogRel(("HWACCM: MSR_IA32_VMX_EXIT_CTLS = %VX64\n", pVM->hwaccm.s.vmx.msr.vmx_exit ));396 val = pVM->hwaccm.s.vmx.msr.vmx_exit >> 32ULL;396 LogRel(("HWACCM: MSR_IA32_VMX_EXIT_CTLS = %VX64\n", pVM->hwaccm.s.vmx.msr.vmx_exit.u)); 397 val = pVM->hwaccm.s.vmx.msr.vmx_exit.n.allowed1; 397 398 if (val & VMX_VMCS_CTRL_EXIT_CONTROLS_HOST_AMD64) 398 399 LogRel(("HWACCM: VMX_VMCS_CTRL_EXIT_CONTROLS_HOST_AMD64\n")); 399 400 if (val & VMX_VMCS_CTRL_EXIT_CONTROLS_ACK_EXTERNAL_IRQ) 400 401 LogRel(("HWACCM: VMX_VMCS_CTRL_EXIT_CONTROLS_ACK_EXTERNAL_IRQ\n")); 401 val = pVM->hwaccm.s.vmx.msr.vmx_exit ;402 val = pVM->hwaccm.s.vmx.msr.vmx_exit.n.disallowed0; 402 403 if (val & VMX_VMCS_CTRL_EXIT_CONTROLS_HOST_AMD64) 403 404 LogRel(("HWACCM: VMX_VMCS_CTRL_EXIT_CONTROLS_HOST_AMD64 *must* be set\n")); -
trunk/src/VBox/VMM/HWACCMInternal.h
r10359 r10465 143 143 typedef HWACCM_CPUINFO *PHWACCM_CPUINFO; 144 144 145 /* VT-x capability qword. */ 146 typedef union 147 { 148 struct 149 { 150 uint32_t disallowed0; 151 uint32_t allowed1; 152 } n; 153 uint64_t u; 154 } VMX_CAPABILITY; 155 145 156 /** 146 157 * HWACCM VM Instance data. … … 223 234 uint64_t feature_ctrl; 224 235 uint64_t vmx_basic_info; 225 uint64_tvmx_pin_ctls;226 uint64_tvmx_proc_ctls;227 uint64_tvmx_exit;228 uint64_tvmx_entry;236 VMX_CAPABILITY vmx_pin_ctls; 237 VMX_CAPABILITY vmx_proc_ctls; 238 VMX_CAPABILITY vmx_exit; 239 VMX_CAPABILITY vmx_entry; 229 240 uint64_t vmx_misc; 230 241 uint64_t vmx_cr0_fixed0; -
trunk/src/VBox/VMM/VMMR0/HWACCMR0.cpp
r10301 r10465 87 87 uint64_t feature_ctrl; 88 88 uint64_t vmx_basic_info; 89 uint64_tvmx_pin_ctls;90 uint64_tvmx_proc_ctls;91 uint64_tvmx_exit;92 uint64_tvmx_entry;89 VMX_CAPABILITY vmx_pin_ctls; 90 VMX_CAPABILITY vmx_proc_ctls; 91 VMX_CAPABILITY vmx_exit; 92 VMX_CAPABILITY vmx_entry; 93 93 uint64_t vmx_misc; 94 94 uint64_t vmx_cr0_fixed0; … … 210 210 211 211 HWACCMR0Globals.vmx.msr.vmx_basic_info = ASMRdMsr(MSR_IA32_VMX_BASIC_INFO); 212 HWACCMR0Globals.vmx.msr.vmx_pin_ctls 213 HWACCMR0Globals.vmx.msr.vmx_proc_ctls 214 HWACCMR0Globals.vmx.msr.vmx_exit 215 HWACCMR0Globals.vmx.msr.vmx_entry 212 HWACCMR0Globals.vmx.msr.vmx_pin_ctls.u = ASMRdMsr(MSR_IA32_VMX_PINBASED_CTLS); 213 HWACCMR0Globals.vmx.msr.vmx_proc_ctls.u = ASMRdMsr(MSR_IA32_VMX_PROCBASED_CTLS); 214 HWACCMR0Globals.vmx.msr.vmx_exit.u = ASMRdMsr(MSR_IA32_VMX_EXIT_CTLS); 215 HWACCMR0Globals.vmx.msr.vmx_entry.u = ASMRdMsr(MSR_IA32_VMX_ENTRY_CTLS); 216 216 HWACCMR0Globals.vmx.msr.vmx_misc = ASMRdMsr(MSR_IA32_VMX_MISC); 217 217 HWACCMR0Globals.vmx.msr.vmx_cr0_fixed0 = ASMRdMsr(MSR_IA32_VMX_CR0_FIXED0); -
trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp
r10464 r10465 166 166 memset(pVM->hwaccm.s.vmx.pRealModeTSS->IntRedirBitmap, 0x0, sizeof(pVM->hwaccm.s.vmx.pRealModeTSS->IntRedirBitmap)); 167 167 168 if (pVM->hwaccm.s.vmx.msr.vmx_proc_ctls & VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_USE_TPR_SHADOW)168 if (pVM->hwaccm.s.vmx.msr.vmx_proc_ctls.n.allowed1 & VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_USE_TPR_SHADOW) 169 169 { 170 170 /* Allocate one page for the virtual APIC mmio cache. */ … … 254 254 * Set required bits to one and zero according to the MSR capabilities. 255 255 */ 256 val = (pVM->hwaccm.s.vmx.msr.vmx_pin_ctls & 0xFFFFFFFF);256 val = pVM->hwaccm.s.vmx.msr.vmx_pin_ctls.n.disallowed0; 257 257 /* External and non-maskable interrupts cause VM-exits. */ 258 258 val = val | VMX_VMCS_CTRL_PIN_EXEC_CONTROLS_EXT_INT_EXIT | VMX_VMCS_CTRL_PIN_EXEC_CONTROLS_NMI_EXIT; 259 val &= (pVM->hwaccm.s.vmx.msr.vmx_pin_ctls >> 32ULL);259 val &= pVM->hwaccm.s.vmx.msr.vmx_pin_ctls.n.allowed1; 260 260 261 261 rc = VMXWriteVMCS(VMX_VMCS_CTRL_PIN_EXEC_CONTROLS, val); … … 265 265 * Set required bits to one and zero according to the MSR capabilities. 266 266 */ 267 val = (pVM->hwaccm.s.vmx.msr.vmx_proc_ctls & 0xFFFFFFFF);267 val = pVM->hwaccm.s.vmx.msr.vmx_proc_ctls.n.disallowed0; 268 268 /* Program which event cause VM-exits and which features we want to use. */ 269 269 val = val | VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_HLT_EXIT … … 277 277 278 278 #if HC_ARCH_BITS == 64 279 if (pVM->hwaccm.s.vmx.msr.vmx_proc_ctls & VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_USE_TPR_SHADOW)279 if (pVM->hwaccm.s.vmx.msr.vmx_proc_ctls.n.allowed1 & VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_USE_TPR_SHADOW) 280 280 { 281 281 /* CR8 reads from the APIC shadow page; writes cause an exit is they lower the TPR below the threshold */ … … 289 289 /* Mask away the bits that the CPU doesn't support */ 290 290 /** @todo make sure they don't conflict with the above requirements. */ 291 val &= (pVM->hwaccm.s.vmx.msr.vmx_proc_ctls >> 32ULL);291 val &= pVM->hwaccm.s.vmx.msr.vmx_proc_ctls.n.allowed1; 292 292 pVM->hwaccm.s.vmx.proc_ctls = val; 293 293 … … 304 304 * Set required bits to one and zero according to the MSR capabilities. 305 305 */ 306 val = (pVM->hwaccm.s.vmx.msr.vmx_exit & 0xFFFFFFFF);306 val = pVM->hwaccm.s.vmx.msr.vmx_exit.n.disallowed0; 307 307 #if HC_ARCH_BITS == 64 308 308 val |= VMX_VMCS_CTRL_EXIT_CONTROLS_HOST_AMD64; … … 310 310 /* else Must be zero when AMD64 is not available. */ 311 311 #endif 312 val &= (pVM->hwaccm.s.vmx.msr.vmx_exit >> 32ULL);312 val &= pVM->hwaccm.s.vmx.msr.vmx_exit.n.allowed1; 313 313 /* Don't acknowledge external interrupts on VM-exit. */ 314 314 rc = VMXWriteVMCS(VMX_VMCS_CTRL_EXIT_CONTROLS, val); … … 356 356 357 357 /* Clear MSR controls. */ 358 if (pVM->hwaccm.s.vmx.msr.vmx_proc_ctls & VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_USE_MSR_BITMAPS)358 if (pVM->hwaccm.s.vmx.msr.vmx_proc_ctls.n.allowed1 & VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_USE_MSR_BITMAPS) 359 359 { 360 360 /* Optional */ … … 377 377 AssertRC(rc); 378 378 379 if (pVM->hwaccm.s.vmx.msr.vmx_proc_ctls & VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_USE_TPR_SHADOW)379 if (pVM->hwaccm.s.vmx.msr.vmx_proc_ctls.n.allowed1 & VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_USE_TPR_SHADOW) 380 380 { 381 381 Assert(pVM->hwaccm.s.vmx.pMemObjAPIC); … … 978 978 * Set required bits to one and zero according to the MSR capabilities. 979 979 */ 980 val = (pVM->hwaccm.s.vmx.msr.vmx_entry & 0xFFFFFFFF);980 val = pVM->hwaccm.s.vmx.msr.vmx_entry.n.disallowed0; 981 981 /* 64 bits guest mode? */ 982 982 if (pCtx->msrEFER & MSR_K6_EFER_LMA) … … 985 985 986 986 /* Mask away the bits that the CPU doesn't support */ 987 val &= (pVM->hwaccm.s.vmx.msr.vmx_entry >> 32ULL);987 val &= pVM->hwaccm.s.vmx.msr.vmx_entry.n.allowed1; 988 988 rc = VMXWriteVMCS(VMX_VMCS_CTRL_ENTRY_CONTROLS, val); 989 989 AssertRC(rc); … … 1047 1047 1048 1048 /* allowed zero */ 1049 if ((val & (pVM->hwaccm.s.vmx.msr.vmx_pin_ctls & 0xFFFFFFFF)) != (pVM->hwaccm.s.vmx.msr.vmx_pin_ctls & 0xFFFFFFFF))1049 if ((val & pVM->hwaccm.s.vmx.msr.vmx_pin_ctls.n.disallowed0) != pVM->hwaccm.s.vmx.msr.vmx_pin_ctls.n.disallowed0) 1050 1050 Log(("Invalid VMX_VMCS_CTRL_PIN_EXEC_CONTROLS: zero\n")); 1051 1051 1052 1052 /* allowed one */ 1053 if ((val & ~ (pVM->hwaccm.s.vmx.msr.vmx_pin_ctls >> 32ULL)) != 0)1053 if ((val & ~pVM->hwaccm.s.vmx.msr.vmx_pin_ctls.n.allowed1) != 0) 1054 1054 Log(("Invalid VMX_VMCS_CTRL_PIN_EXEC_CONTROLS: one\n")); 1055 1055 … … 1059 1059 1060 1060 /* allowed zero */ 1061 if ((val & (pVM->hwaccm.s.vmx.msr.vmx_proc_ctls & 0xFFFFFFFF)) != (pVM->hwaccm.s.vmx.msr.vmx_proc_ctls & 0xFFFFFFFF))1061 if ((val & pVM->hwaccm.s.vmx.msr.vmx_proc_ctls.n.disallowed0) != pVM->hwaccm.s.vmx.msr.vmx_proc_ctls.n.disallowed0) 1062 1062 Log(("Invalid VMX_VMCS_CTRL_PROC_EXEC_CONTROLS: zero\n")); 1063 1063 1064 1064 /* allowed one */ 1065 if ((val & ~ (pVM->hwaccm.s.vmx.msr.vmx_proc_ctls >> 32ULL)) != 0)1065 if ((val & ~pVM->hwaccm.s.vmx.msr.vmx_proc_ctls.n.allowed1) != 0) 1066 1066 Log(("Invalid VMX_VMCS_CTRL_PROC_EXEC_CONTROLS: one\n")); 1067 1067 … … 1071 1071 1072 1072 /* allowed zero */ 1073 if ((val & (pVM->hwaccm.s.vmx.msr.vmx_entry & 0xFFFFFFFF)) != (pVM->hwaccm.s.vmx.msr.vmx_entry & 0xFFFFFFFF))1073 if ((val & pVM->hwaccm.s.vmx.msr.vmx_entry.n.disallowed0) != pVM->hwaccm.s.vmx.msr.vmx_entry.n.disallowed0) 1074 1074 Log(("Invalid VMX_VMCS_CTRL_ENTRY_CONTROLS: zero\n")); 1075 1075 1076 1076 /* allowed one */ 1077 if ((val & ~ (pVM->hwaccm.s.vmx.msr.vmx_entry >> 32ULL)) != 0)1077 if ((val & ~pVM->hwaccm.s.vmx.msr.vmx_entry.n.allowed1) != 0) 1078 1078 Log(("Invalid VMX_VMCS_CTRL_ENTRY_CONTROLS: one\n")); 1079 1079 … … 1083 1083 1084 1084 /* allowed zero */ 1085 if ((val & (pVM->hwaccm.s.vmx.msr.vmx_exit & 0xFFFFFFFF)) != (pVM->hwaccm.s.vmx.msr.vmx_exit & 0xFFFFFFFF))1085 if ((val & pVM->hwaccm.s.vmx.msr.vmx_exit.n.disallowed0) != pVM->hwaccm.s.vmx.msr.vmx_exit.n.disallowed0) 1086 1086 Log(("Invalid VMX_VMCS_CTRL_EXIT_CONTROLS: zero\n")); 1087 1087 1088 1088 /* allowed one */ 1089 if ((val & ~ (pVM->hwaccm.s.vmx.msr.vmx_exit >> 32ULL)) != 0)1089 if ((val & ~pVM->hwaccm.s.vmx.msr.vmx_exit.n.allowed1) != 0) 1090 1090 Log(("Invalid VMX_VMCS_CTRL_EXIT_CONTROLS: one\n")); 1091 1091 #endif … … 1795 1795 case 8: 1796 1796 /* CR8 contains the APIC TPR */ 1797 Assert(!(pVM->hwaccm.s.vmx.msr.vmx_proc_ctls & VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_USE_TPR_SHADOW));1797 Assert(!(pVM->hwaccm.s.vmx.msr.vmx_proc_ctls.n.allowed1 & VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_USE_TPR_SHADOW)); 1798 1798 break; 1799 1799 … … 1816 1816 1817 1817 /* CR8 reads only cause an exit when the TPR shadow feature isn't present. */ 1818 Assert(VMX_EXIT_QUALIFICATION_CRX_REGISTER(exitQualification) != 8 || !(pVM->hwaccm.s.vmx.msr.vmx_proc_ctls & VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_USE_TPR_SHADOW));1818 Assert(VMX_EXIT_QUALIFICATION_CRX_REGISTER(exitQualification) != 8 || !(pVM->hwaccm.s.vmx.msr.vmx_proc_ctls.n.allowed1 & VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_USE_TPR_SHADOW)); 1819 1819 1820 1820 rc = EMInterpretCRxRead(pVM, CPUMCTX2CORE(pCtx),
Note:
See TracChangeset
for help on using the changeset viewer.