VirtualBox

Changeset 107194 in vbox for trunk/src/VBox/VMM/VMMAll


Ignore:
Timestamp:
Nov 29, 2024 2:47:06 PM (4 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
166196
Message:

VMM: More adjustments for VBOX_WITH_ONLY_PGM_NEM_MODE, VBOX_WITH_MINIMAL_R0, VBOX_WITH_HWVIRT and such. jiraref:VBP-1466

File:
1 edited

Legend:

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

    r107179 r107194  
    20652065}
    20662066
     2067#ifndef VBOX_WITH_ONLY_PGM_NEM_MODE
    20672068
    20682069/**
     
    20872088     * Do we need to do anything special?
    20882089     */
    2089 #ifdef IN_RING3
     2090# ifdef IN_RING3
    20902091    if (pVM->pgm.s.cHandyPages <= RT_MAX(PGM_HANDY_PAGES_SET_FF, PGM_HANDY_PAGES_R3_ALLOC))
    2091 #else
     2092# else
    20922093    if (pVM->pgm.s.cHandyPages <= RT_MAX(PGM_HANDY_PAGES_SET_FF, PGM_HANDY_PAGES_RZ_TO_R3))
    2093 #endif
     2094# endif
    20942095    {
    20952096        /*
    20962097         * Allocate pages only if we're out of them, or in ring-3, almost out.
    20972098         */
    2098 #ifdef IN_RING3
     2099# ifdef IN_RING3
    20992100        if (pVM->pgm.s.cHandyPages <= PGM_HANDY_PAGES_R3_ALLOC)
    2100 #else
     2101# else
    21012102        if (pVM->pgm.s.cHandyPages <= PGM_HANDY_PAGES_RZ_ALLOC)
    2102 #endif
     2103# endif
    21032104        {
    21042105            Log(("PGM: cHandyPages=%u out of %u -> allocate more; VM_FF_PGM_NO_MEMORY=%RTbool\n",
    21052106                 pVM->pgm.s.cHandyPages, RT_ELEMENTS(pVM->pgm.s.aHandyPages), VM_FF_IS_SET(pVM, VM_FF_PGM_NO_MEMORY) ));
    2106 #ifdef IN_RING3
     2107# ifdef IN_RING3
    21072108            int rc = PGMR3PhysAllocateHandyPages(pVM);
    2108 #else
     2109# else
    21092110            int rc = pgmR0PhysAllocateHandyPages(pVM, VMMGetCpuId(pVM), false /*fRing3*/);
    2110 #endif
     2111# endif
    21112112            if (RT_UNLIKELY(rc != VINF_SUCCESS))
    21122113            {
     
    21212122                Assert(VM_FF_IS_SET(pVM, VM_FF_PGM_NEED_HANDY_PAGES));
    21222123                Assert(VM_FF_IS_SET(pVM, VM_FF_PGM_NO_MEMORY));
    2123 #ifndef IN_RING3
     2124# ifndef IN_RING3
    21242125                VMCPU_FF_SET(VMMGetCpu(pVM), VMCPU_FF_TO_R3); /* paranoia */
    2125 #endif
     2126# endif
    21262127            }
    21272128            AssertMsgReturn(    pVM->pgm.s.cHandyPages > 0
     
    21342135            if (pVM->pgm.s.cHandyPages <= PGM_HANDY_PAGES_SET_FF)
    21352136                VM_FF_SET(pVM, VM_FF_PGM_NEED_HANDY_PAGES);
    2136 #ifndef IN_RING3
     2137# ifndef IN_RING3
    21372138            if (pVM->pgm.s.cHandyPages <= PGM_HANDY_PAGES_RZ_TO_R3)
    21382139            {
     
    21402141                VMCPU_FF_SET(VMMGetCpu(pVM), VMCPU_FF_TO_R3);
    21412142            }
    2142 #endif
     2143# endif
    21432144        }
    21442145    }
     
    23312332}
    23322333
    2333 #ifdef PGM_WITH_LARGE_PAGES
     2334# ifdef PGM_WITH_LARGE_PAGES
    23342335
    23352336/**
     
    24082409             * Do the allocation.
    24092410             */
    2410 # ifdef IN_RING3
     2411#  ifdef IN_RING3
    24112412            rc = VMMR3CallR0(pVM, VMMR0_DO_PGM_ALLOCATE_LARGE_PAGE, GCPhysBase, NULL);
    2412 # elif defined(IN_RING0)
     2413#  elif defined(IN_RING0)
    24132414            rc = pgmR0PhysAllocateLargePage(pVM, VMMGetCpuId(pVM), GCPhysBase);
    2414 # else
    2415 error "Port me"
    2416 # endif
     2415#  else
     2416 error "Port me"
     2417#  endif
    24172418            if (RT_SUCCESS(rc))
    24182419            {
     
    24962497}
    24972498
    2498 #endif /* PGM_WITH_LARGE_PAGES */
     2499# endif /* PGM_WITH_LARGE_PAGES */
     2500#endif /* !VBOX_WITH_ONLY_PGM_NEM_MODE */
     2501
    24992502
    25002503
     
    25852588            RT_FALL_THRU();
    25862589        case PGM_PAGE_STATE_SHARED:
     2590#ifndef VBOX_WITH_ONLY_PGM_NEM_MODE
    25872591            return pgmPhysAllocPage(pVM, pPage, GCPhys);
     2592#else
     2593            AssertFailed(); /** @todo not sure if we make use of ZERO pages or not in NEM-mode, but I can't see how pgmPhysAllocPage would work. */
     2594            return VERR_PGM_NOT_SUPPORTED_FOR_NEM_MODE;
     2595#endif
    25882596
    25892597        /* Not allowed to write to ballooned pages. */
     
    25932601}
    25942602
    2595 
     2603#if 0 /* unused */
    25962604/**
    25972605 * Internal usage: Map the page specified by its GMM ID.
     
    26652673#endif
    26662674}
    2667 
     2675#endif /* unused */
    26682676
    26692677/**
     
    30783086        AssertMsg(rc == VINF_SUCCESS || rc == VINF_PGM_SYNC_CR3 /* not returned */, ("%Rrc\n", rc));
    30793087    }
    3080     Assert(PGM_PAGE_GET_HCPHYS(pPage) != 0);
     3088    Assert(PGM_PAGE_GET_HCPHYS(pPage) != 0 || PGM_IS_IN_NEM_MODE(pVM));
    30813089
    30823090    /*
     
    32133221        AssertMsg(rc == VINF_SUCCESS || rc == VINF_PGM_SYNC_CR3 /* not returned */, ("%Rrc\n", rc));
    32143222    }
    3215     Assert(PGM_PAGE_GET_HCPHYS(pPage) != 0);
     3223    Assert(PGM_PAGE_GET_HCPHYS(pPage) != 0 || PGM_IS_IN_NEM_MODE(pVM));
    32163224
    32173225    /*
     
    32503258    AssertReturn(pPage, VERR_PGM_PHYS_NULL_PAGE_PARAM);
    32513259    PGM_LOCK_ASSERT_OWNER(pVM);
    3252     Assert(PGM_PAGE_GET_HCPHYS(pPage) != 0);
     3260    Assert(PGM_PAGE_GET_HCPHYS(pPage) != 0 || PGM_IS_IN_NEM_MODE(pVM));
    32533261
    32543262    /*
     
    37363744            AssertMsg(rc == VINF_SUCCESS || rc == VINF_PGM_SYNC_CR3 /* not returned */, ("%Rrc\n", rc));
    37373745        }
    3738         Assert(PGM_PAGE_GET_HCPHYS(pPage) != 0);
     3746        Assert(PGM_PAGE_GET_HCPHYS(pPage) != 0 || PGM_IS_IN_NEM_MODE(pVM));
    37393747
    37403748        /*
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette