VirtualBox

Changeset 92249 in vbox for trunk


Ignore:
Timestamp:
Nov 6, 2021 3:39:24 PM (3 years ago)
Author:
vboxsync
Message:

VMM/GMM: Removed special hacks for 32-bit hosts, making the code 64-bit only. bugref:10093

File:
1 edited

Legend:

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

    r92248 r92249  
    181181#include <iprt/time.h>
    182182
     183/* This is 64-bit only code now. */
     184#if HC_ARCH_BITS != 64 || ARCH_BITS != 64
     185# error "This is 64-bit only code"
     186#endif
     187
    183188
    184189/*********************************************************************************************************************************
     
    204209 * The per-page tracking structure employed by the GMM.
    205210 *
    206  * On 32-bit hosts we'll some trickery is necessary to compress all
    207  * the information into 32-bits. When the fSharedFree member is set,
    208  * the 30th bit decides whether it's a free page or not.
    209  *
    210  * Because of the different layout on 32-bit and 64-bit hosts, macros
    211  * are used to get and set some of the data.
     211 * Because of the different layout on 32-bit and 64-bit hosts in earlier
     212 * versions of the code, macros are used to get and set some of the data.
    212213 */
    213214typedef union GMMPAGE
    214215{
    215 #if HC_ARCH_BITS == 64
    216216    /** Unsigned integer view. */
    217217    uint64_t u;
     
    264264        uint32_t    u2State : 2;
    265265    } Free;
    266 
    267 #else /* 32-bit */
    268     /** Unsigned integer view. */
    269     uint32_t u;
    270 
    271     /** The common view. */
    272     struct GMMPAGECOMMON
    273     {
    274         uint32_t    uStuff : 30;
    275         /** The page state. */
    276         uint32_t    u2State : 2;
    277     } Common;
    278 
    279     /** The view of a private page. */
    280     struct GMMPAGEPRIVATE
    281     {
    282         /** The guest page frame number. (Max addressable: 2 ^ 36) */
    283         uint32_t    pfn : 24;
    284         /** The GVM handle. (127 VMs) */
    285         uint32_t    hGVM : 7;
    286         /** The top page state bit, MBZ. */
    287         uint32_t    fZero : 1;
    288     } Private;
    289 
    290     /** The view of a shared page. */
    291     struct GMMPAGESHARED
    292     {
    293         /** The reference count. */
    294         uint32_t    cRefs : 30;
    295         /** The page state. */
    296         uint32_t    u2State : 2;
    297     } Shared;
    298 
    299     /** The view of a free page. */
    300     struct GMMPAGEFREE
    301     {
    302         /** The index of the next page in the free list. UINT16_MAX is NIL. */
    303         uint32_t    iNext : 16;
    304         /** Reserved. Checksum or something? */
    305         uint32_t    u14Reserved : 14;
    306         /** The page state. */
    307         uint32_t    u2State : 2;
    308     } Free;
    309 #endif
    310266} GMMPAGE;
    311267AssertCompileSize(GMMPAGE, sizeof(RTHCUINTPTR));
     
    318274/** A private page. */
    319275#define GMM_PAGE_STATE_PRIVATE          0
    320 /** A private page - alternative value used on the 32-bit implementation.
    321  * This will never be used on 64-bit hosts. */
    322 #define GMM_PAGE_STATE_PRIVATE_32       1
    323276/** A shared page. */
    324277#define GMM_PAGE_STATE_SHARED           2
     
    333286 * @param   pPage       The GMM page.
    334287 */
    335 #if HC_ARCH_BITS == 64
    336 # define GMM_PAGE_IS_PRIVATE(pPage) ( (pPage)->Common.u2State == GMM_PAGE_STATE_PRIVATE )
    337 #else
    338 # define GMM_PAGE_IS_PRIVATE(pPage) ( (pPage)->Private.fZero == 0 )
    339 #endif
     288#define GMM_PAGE_IS_PRIVATE(pPage)  ( (pPage)->Common.u2State == GMM_PAGE_STATE_PRIVATE )
    340289
    341290/** @def GMM_PAGE_IS_SHARED
     
    358307 *         see GMM_PAGE_PFN_UNSHAREABLE.
    359308 */
    360 #if HC_ARCH_BITS == 64
    361 # define GMM_PAGE_PFN_LAST           UINT32_C(0xfffffff0)
    362 #else
    363 # define GMM_PAGE_PFN_LAST           UINT32_C(0x00fffff0)
    364 #endif
    365 AssertCompile(GMM_PAGE_PFN_LAST        == (GMM_GCPHYS_LAST >> PAGE_SHIFT));
     309#define GMM_PAGE_PFN_LAST            UINT32_C(0xfffffff0)
     310AssertCompile(GMM_PAGE_PFN_LAST == (GMM_GCPHYS_LAST >> PAGE_SHIFT));
    366311
    367312/** @def GMM_PAGE_PFN_UNSHAREABLE
    368313 * Indicates that this page isn't used for normal guest memory and thus isn't shareable.
    369314 */
    370 #if HC_ARCH_BITS == 64
    371 # define GMM_PAGE_PFN_UNSHAREABLE   UINT32_C(0xfffffff1)
    372 #else
    373 # define GMM_PAGE_PFN_UNSHAREABLE   UINT32_C(0x00fffff1)
    374 #endif
     315#define GMM_PAGE_PFN_UNSHAREABLE    UINT32_C(0xfffffff1)
    375316AssertCompile(GMM_PAGE_PFN_UNSHAREABLE == (GMM_GCPHYS_UNSHAREABLE >> PAGE_SHIFT));
    376317
     
    36463587                Assert(pGVM->gmm.s.Stats.cSharedPages);
    36473588                Assert(pPage->Shared.cRefs);
    3648 #if defined(VBOX_WITH_PAGE_SHARING) && defined(VBOX_STRICT) && HC_ARCH_BITS == 64
     3589#if defined(VBOX_WITH_PAGE_SHARING) && defined(VBOX_STRICT)
    36493590                if (pPage->Shared.u14Checksum)
    36503591                {
     
    42104151
    42114152
    4212 #if defined(VBOX_WITH_PAGE_SHARING) || (defined(VBOX_STRICT) && HC_ARCH_BITS == 64)
     4153#if defined(VBOX_WITH_PAGE_SHARING) || defined(VBOX_STRICT)
    42134154/**
    42144155 * Check if a chunk is mapped into the specified VM
     
    42384179    return false;
    42394180}
    4240 #endif /* VBOX_WITH_PAGE_SHARING || (VBOX_STRICT && 64-BIT) */
     4181#endif /* VBOX_WITH_PAGE_SHARING || VBOX_STRICT */
    42414182
    42424183
     
    53395280}
    53405281
    5341 #if defined(VBOX_STRICT) && HC_ARCH_BITS == 64
     5282#ifdef VBOX_STRICT
    53425283
    53435284/**
     
    54495390}
    54505391
    5451 #endif /* VBOX_STRICT && HC_ARCH_BITS == 64 */
     5392#endif /* VBOX_STRICT */
    54525393
    54535394
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