- Timestamp:
- Aug 3, 2017 10:12:28 AM (7 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/HMSVMAll.cpp
r68226 r68275 248 248 { 249 249 /* AMD Seventh and Eighth Generation Processor MSRs. */ 250 *pbOffMsrpm += 0x1000;250 *pbOffMsrpm = 0x1000; 251 251 *puMsrpmBit = (idMsr - 0xc0001000) << 1; 252 252 return VINF_SUCCESS; -
trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp
r68262 r68275 4223 4223 Assert(pSvmTransient->u64ExitCode <= SVM_EXIT_MAX); 4224 4224 4225 /* 4226 * For all the #VMEXITs here we primarily figure out if the #VMEXIT is expected 4227 * by the nested-guest. If it isn't, it should be handled by the (outer) guest. 4228 */ 4225 4229 PSVMVMCB pVmcbNstGst = pCtx->hwvirt.svm.CTX_SUFF(pVmcb); 4230 PSVMVMCBCTRL pVmcbNstGstCtrl = &pVmcbNstGst->ctrl; 4226 4231 PSVMNESTEDVMCBCACHE pVmcbNstGstCache = &pVCpu->hm.s.svm.NstGstVmcbCache; 4227 4232 switch (pSvmTransient->u64ExitCode) 4228 4233 { 4229 //case SVM_EXIT_NPF: 4234 #if 0 4235 case SVM_EXIT_NPF: 4230 4236 { 4231 4237 /** @todo. */ 4232 4238 break; 4233 4239 } 4240 #endif 4241 4242 case SVM_EXIT_CPUID: 4243 { 4244 if (pVmcbNstGstCache->u64InterceptCtrl & SVM_CTRL_INTERCEPT_CPUID) 4245 return hmR0SvmExecVmexit(pVCpu, pCtx); 4246 return hmR0SvmExitCpuid(pVCpu, pCtx, pSvmTransient); 4247 } 4248 4249 case SVM_EXIT_RDTSC: 4250 { 4251 if (pVmcbNstGstCache->u64InterceptCtrl & SVM_CTRL_INTERCEPT_RDTSC) 4252 return hmR0SvmExecVmexit(pVCpu, pCtx); 4253 return hmR0SvmExitRdtsc(pVCpu, pCtx, pSvmTransient); 4254 } 4255 4256 case SVM_EXIT_RDTSCP: 4257 { 4258 if (pVmcbNstGstCache->u64InterceptCtrl & SVM_CTRL_INTERCEPT_RDTSCP) 4259 return hmR0SvmExecVmexit(pVCpu, pCtx); 4260 return hmR0SvmExitRdtscp(pVCpu, pCtx, pSvmTransient); 4261 } 4262 4263 case SVM_EXIT_MSR: 4264 { 4265 if (pVmcbNstGstCache->u64InterceptCtrl & SVM_CTRL_INTERCEPT_MSR_PROT) 4266 { 4267 uint32_t const idMsr = pCtx->ecx; 4268 uint16_t offMsrpm; 4269 uint32_t uMsrpmBit; 4270 int rc = HMSvmGetMsrpmOffsetAndBit(idMsr, &offMsrpm, &uMsrpmBit); 4271 if (RT_SUCCESS(rc)) 4272 { 4273 void const *pvMsrBitmap = pCtx->hwvirt.svm.CTX_SUFF(pvMsrBitmap); 4274 bool const fInterceptRd = ASMBitTest(pvMsrBitmap, (offMsrpm << 3) + uMsrpmBit); 4275 bool const fInterceptWr = ASMBitTest(pvMsrBitmap, (offMsrpm << 3) + uMsrpmBit + 1); 4276 4277 if ( (pVmcbNstGstCtrl->u64ExitInfo1 == SVM_EXIT1_MSR_WRITE && fInterceptWr) 4278 || (pVmcbNstGstCtrl->u64ExitInfo1 == SVM_EXIT1_MSR_READ && fInterceptRd)) 4279 { 4280 return hmR0SvmExecVmexit(pVCpu, pCtx); 4281 } 4282 } 4283 else 4284 { 4285 /* 4286 * MSRs not covered by the MSRPM automatically cause an #VMEXIT. 4287 * See AMD-V spec. "15.11 MSR Intercepts". 4288 */ 4289 Assert(rc == VERR_OUT_OF_RANGE); 4290 return hmR0SvmExecVmexit(pVCpu, pCtx); 4291 } 4292 } 4293 return hmR0SvmExitMsr(pVCpu, pCtx, pSvmTransient); 4294 } 4234 4295 4235 4296 case SVM_EXIT_IOIO: 4236 4297 { 4237 4298 /* 4238 * Figure out if the IO port access is intercepted by the nested-guest. If not, 4239 * we pass it to the outer guest. 4299 * Figure out if the IO port access is intercepted by the nested-guest. 4240 4300 */ 4241 4301 if (pVmcbNstGstCache->u64InterceptCtrl & SVM_CTRL_INTERCEPT_IOIO_PROT) … … 4251 4311 } 4252 4312 4253 case SVM_EXIT_RDTSC: 4254 { 4255 return hmR0SvmExitRdtsc(pVCpu, pCtx, pSvmTransient); 4256 } 4257 4258 case SVM_EXIT_RDTSCP: 4259 return hmR0SvmExitRdtscp(pVCpu, pCtx, pSvmTransient); 4260 4261 case SVM_EXIT_CPUID: 4262 return hmR0SvmExitCpuid(pVCpu, pCtx, pSvmTransient); 4263 4313 /** @todo Exceptions. */ 4264 4314 case SVM_EXIT_EXCEPTION_14: /* X86_XCPT_PF */ 4265 4315 return hmR0SvmExitXcptPF(pVCpu, pCtx, pSvmTransient); … … 4316 4366 case SVM_EXIT_NMI: 4317 4367 return hmR0SvmExitIntr(pVCpu, pCtx, pSvmTransient); 4318 4319 case SVM_EXIT_MSR:4320 return hmR0SvmExitMsr(pVCpu, pCtx, pSvmTransient);4321 4368 4322 4369 case SVM_EXIT_INVLPG: … … 4367 4414 * we want to know about it so log the exit code and bail. 4368 4415 */ 4369 AssertMsgFailed(("hmR0SvmHandleExit : Unexpected exit %#RX32\n", (uint32_t)pSvmTransient->u64ExitCode));4416 AssertMsgFailed(("hmR0SvmHandleExitNested: Unexpected exit %#RX32\n", (uint32_t)pSvmTransient->u64ExitCode)); 4370 4417 pVCpu->hm.s.u32HMError = (uint32_t)pSvmTransient->u64ExitCode; 4371 4418 return VERR_SVM_UNEXPECTED_EXIT; … … 4452 4499 4453 4500 default: 4454 AssertMsgFailed(("hmR0SvmHandleExit : Unexpected exit caused by exception %#x\n", Event.n.u8Vector));4501 AssertMsgFailed(("hmR0SvmHandleExitNested: Unexpected exit caused by exception %#x\n", Event.n.u8Vector)); 4455 4502 pVCpu->hm.s.u32HMError = Event.n.u8Vector; 4456 4503 return VERR_SVM_UNEXPECTED_XCPT_EXIT; … … 4465 4512 default: 4466 4513 { 4467 AssertMsgFailed(("hmR0SvmHandleExit : Unknown exit code %#x\n", pSvmTransient->u64ExitCode));4514 AssertMsgFailed(("hmR0SvmHandleExitNested: Unknown exit code %#x\n", pSvmTransient->u64ExitCode)); 4468 4515 pVCpu->hm.s.u32HMError = pSvmTransient->u64ExitCode; 4469 4516 return VERR_SVM_UNKNOWN_EXIT;
Note:
See TracChangeset
for help on using the changeset viewer.