VirtualBox

Changeset 8952 in vbox for trunk/src/VBox/VMM/VMMR0


Ignore:
Timestamp:
May 20, 2008 1:16:09 PM (17 years ago)
Author:
vboxsync
Message:

Nested paging updates

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp

    r8948 r8952  
    278278    pVMCB->ctrl.u32InterceptException = HWACCM_SVM_TRAP_MASK;
    279279    if (pVM->hwaccm.s.svm.fNestedPaging)
    280         pVMCB->ctrl.u32InterceptException &= ~RT_BIT(14);   /* no longer need to intercept pagefaults. */
     280        pVMCB->ctrl.u32InterceptException &= ~RT_BIT(14);   /* no longer need to intercept #PF. */
    281281
    282282    pVMCB->ctrl.u32InterceptCtrl1 =   SVM_CTRL1_INTERCEPT_INTR
     
    297297                                    | SVM_CTRL1_INTERCEPT_FERR_FREEZE;  /* Legacy FPU FERR handling. */
    298298                                    ;
     299    /* With nested paging we don't care about invlpg anymore. */
     300    if (pVM->hwaccm.s.svm.fNestedPaging)
     301        pVMCB->ctrl.u32InterceptCtrl1 &= ~SVM_CTRL1_INTERCEPT_INVLPG;
     302
    299303    pVMCB->ctrl.u32InterceptCtrl2 =   SVM_CTRL2_INTERCEPT_VMRUN         /* required */
    300304                                    | SVM_CTRL2_INTERCEPT_VMMCALL
     
    590594
    591595        /* Note: WP is not relevant in nested paging mode as we catch accesses on the (host) physical level. */
    592         /* Note: In nested paging mode the guest is allowed to run with paging disabled; the guest physical to host physical translation is still active. */
     596        /* Note: In nested paging mode the guest is allowed to run with paging disabled; the guest physical to host physical translation will remain active. */
    593597        if (!pVM->hwaccm.s.svm.fNestedPaging)
    594598        {
     
    604608    {
    605609        /* Save our shadow CR3 register. */
    606         if (!pVM->hwaccm.s.svm.fNestedPaging)
    607             pVMCB->guest.u64CR3 = PGMGetHyperCR3(pVM);
     610        if (pVM->hwaccm.s.svm.fNestedPaging)
     611        {
     612            pVMCB->ctrl.u64NestedPagingCR3  = PGMGetHyperCR3(pVM);
     613            pVMCB->guest.u64CR3             = pCtx->cr3;
     614        }
    608615        else
    609             pVMCB->guest.u64CR3 = pCtx->cr3;
     616            pVMCB->guest.u64CR3             = PGMGetHyperCR3(pVM);
    610617    }
    611618
     
    636643                return VERR_PGM_UNSUPPORTED_HOST_PAGING_MODE;
    637644
    638             default:                   /* shut up gcc */
     645            default:                    /* shut up gcc */
    639646                AssertFailed();
    640647                return VERR_PGM_UNSUPPORTED_HOST_PAGING_MODE;
     
    10311038    SVM_READ_SELREG(GS, gs);
    10321039
    1033     /** @note no reason to sync back the CRx and DRx registers. They can't be changed by the guest. */
     1040    /* Note: no reason to sync back the CRx and DRx registers. They can't be changed by the guest. */
     1041    /* Note: only in the nested paging case can CR3 & CR4 be changed by the guest. */
     1042    if (pVM->hwaccm.s.svm.fNestedPaging)
     1043    {
     1044        CPUMSetGuestCR3(pVM, pVMCB->guest.u64CR3);
     1045        CPUMSetGuestCR4(pVM, pVMCB->guest.u64CR4);
     1046    }
    10341047
    10351048    /** @note NOW IT'S SAFE FOR LOGGING! */
     
    13351348        STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitInvpg);
    13361349
     1350        Assert(!pVM->hwaccm.s.svm.fNestedPaging);
     1351
    13371352        /* Truly a pita. Why can't SVM give the same information as VMX? */
    13381353        rc = SVMR0InterpretInvpg(pVM, CPUMCTX2CORE(pCtx), pVMCB->ctrl.TLBCtrl.n.u32ASID);
     
    13641379            break;
    13651380        case 3:
     1381            Assert(!pVM->hwaccm.s.svm.fNestedPaging);
    13661382            pVM->hwaccm.s.fContextUseFlags |= HWACCM_CHANGED_GUEST_CR3;
    13671383            break;
    13681384        case 4:
     1385            Assert(!pVM->hwaccm.s.svm.fNestedPaging);
    13691386            pVM->hwaccm.s.fContextUseFlags |= HWACCM_CHANGED_GUEST_CR4;
    13701387            break;
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