VirtualBox

Changeset 67924 in vbox for trunk/src/VBox/VMM/VMMR3


Ignore:
Timestamp:
Jul 12, 2017 11:12:15 AM (7 years ago)
Author:
vboxsync
Message:

VMM/CPUM: Nested Hw.virt: Allocate the nested-guest VMCB (controls and state-save area) dynamically.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/CPUM.cpp

    r67723 r67924  
    762762    {
    763763        PVMCPU pVCpu = &pVM->aCpus[i];
     764        if (pVCpu->cpum.s.Guest.hwvirt.svm.pVmcbR3)
     765        {
     766            SUPR3PageFreeEx(pVCpu->cpum.s.Guest.hwvirt.svm.pVmcbR3, SVM_VMCB_PAGES);
     767            pVCpu->cpum.s.Guest.hwvirt.svm.pVmcbR3 = NULL;
     768        }
     769
    764770        if (pVCpu->cpum.s.Guest.hwvirt.svm.pvMsrBitmapR3)
    765771        {
     
    793799    {
    794800        PVMCPU pVCpu = &pVM->aCpus[i];
     801
     802        /*
     803         * Allocate the nested-guest VMCB.
     804         */
     805        Assert(!pVCpu->cpum.s.Guest.hwvirt.svm.pVmcbR3);
     806        rc = SUPR3PageAllocEx(SVM_VMCB_PAGES, 0 /* fFlags */, (void **)&pVCpu->cpum.s.Guest.hwvirt.svm.pVmcbR3,
     807                              (PRTR0PTR)pVCpu->cpum.s.Guest.hwvirt.svm.pVmcbR0, NULL /* paPages */);
     808        if (RT_FAILURE(rc))
     809        {
     810            Assert(!pVCpu->cpum.s.Guest.hwvirt.svm.pVmcbR3);
     811            LogRel(("CPUM%u: Failed to alloc %u pages for the nested-guest's VMCB\n", pVCpu->idCpu, SVM_VMCB_PAGES));
     812            break;
     813        }
    795814
    796815        /*
     
    12501269     */
    12511270    /* SVM. */
    1252     RT_ZERO(pCtx->hwvirt.svm.VmcbCtrl);
     1271    memset(&pCtx->hwvirt.svm, 0, sizeof(pCtx->hwvirt.svm));
    12531272    pCtx->hwvirt.svm.fGif = 1;
    12541273}
     
    22252244        pHlp->pfnPrintf(pHlp, "  GCPhysVmcb                 = %#RGp\n",     pCtx->hwvirt.svm.GCPhysVmcb);
    22262245        pHlp->pfnPrintf(pHlp, "  VmcbCtrl:\n");
    2227         HMR3InfoSvmVmcbCtrl(pHlp, &pCtx->hwvirt.svm.VmcbCtrl, "    " /* pszPrefix */);
     2246        HMR3InfoSvmVmcbCtrl(pHlp, &pCtx->hwvirt.svm.pVmcbR3->ctrl, "    " /* pszPrefix */);
     2247        /** @todo HMR3InfoSvmVmcbStateSave. */
    22282248        pHlp->pfnPrintf(pHlp, "  HostState:\n");
    22292249        pHlp->pfnPrintf(pHlp, "    uEferMsr                   = %#RX64\n",  pCtx->hwvirt.svm.HostState.uEferMsr);
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