VirtualBox

Changeset 68275 in vbox for trunk/src


Ignore:
Timestamp:
Aug 3, 2017 10:12:28 AM (7 years ago)
Author:
vboxsync
Message:

VMM/HMSVMR0,HMSVMAll: Nested Hw.virt bits.

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

Legend:

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

    r68226 r68275  
    248248    {
    249249        /* AMD Seventh and Eighth Generation Processor MSRs. */
    250         *pbOffMsrpm += 0x1000;
     250        *pbOffMsrpm = 0x1000;
    251251        *puMsrpmBit = (idMsr - 0xc0001000) << 1;
    252252        return VINF_SUCCESS;
  • trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp

    r68262 r68275  
    42234223    Assert(pSvmTransient->u64ExitCode <= SVM_EXIT_MAX);
    42244224
     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     */
    42254229    PSVMVMCB            pVmcbNstGst      = pCtx->hwvirt.svm.CTX_SUFF(pVmcb);
     4230    PSVMVMCBCTRL        pVmcbNstGstCtrl  = &pVmcbNstGst->ctrl;
    42264231    PSVMNESTEDVMCBCACHE pVmcbNstGstCache = &pVCpu->hm.s.svm.NstGstVmcbCache;
    42274232    switch (pSvmTransient->u64ExitCode)
    42284233    {
    4229         //case SVM_EXIT_NPF:
     4234#if 0
     4235        case SVM_EXIT_NPF:
    42304236        {
    42314237            /** @todo. */
    42324238            break;
    42334239        }
     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        }
    42344295
    42354296        case SVM_EXIT_IOIO:
    42364297        {
    42374298            /*
    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.
    42404300             */
    42414301            if (pVmcbNstGstCache->u64InterceptCtrl & SVM_CTRL_INTERCEPT_IOIO_PROT)
     
    42514311        }
    42524312
    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. */
    42644314        case SVM_EXIT_EXCEPTION_14:  /* X86_XCPT_PF */
    42654315            return hmR0SvmExitXcptPF(pVCpu, pCtx, pSvmTransient);
     
    43164366        case SVM_EXIT_NMI:
    43174367            return hmR0SvmExitIntr(pVCpu, pCtx, pSvmTransient);
    4318 
    4319         case SVM_EXIT_MSR:
    4320             return hmR0SvmExitMsr(pVCpu, pCtx, pSvmTransient);
    43214368
    43224369        case SVM_EXIT_INVLPG:
     
    43674414                     * we want to know about it so log the exit code and bail.
    43684415                     */
    4369                     AssertMsgFailed(("hmR0SvmHandleExit: Unexpected exit %#RX32\n", (uint32_t)pSvmTransient->u64ExitCode));
     4416                    AssertMsgFailed(("hmR0SvmHandleExitNested: Unexpected exit %#RX32\n", (uint32_t)pSvmTransient->u64ExitCode));
    43704417                    pVCpu->hm.s.u32HMError = (uint32_t)pSvmTransient->u64ExitCode;
    43714418                    return VERR_SVM_UNEXPECTED_EXIT;
     
    44524499
    44534500                        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));
    44554502                            pVCpu->hm.s.u32HMError = Event.n.u8Vector;
    44564503                            return VERR_SVM_UNEXPECTED_XCPT_EXIT;
     
    44654512                default:
    44664513                {
    4467                     AssertMsgFailed(("hmR0SvmHandleExit: Unknown exit code %#x\n", pSvmTransient->u64ExitCode));
     4514                    AssertMsgFailed(("hmR0SvmHandleExitNested: Unknown exit code %#x\n", pSvmTransient->u64ExitCode));
    44684515                    pVCpu->hm.s.u32HMError = pSvmTransient->u64ExitCode;
    44694516                    return VERR_SVM_UNKNOWN_EXIT;
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