VirtualBox

Changeset 4978 in vbox for trunk/src


Ignore:
Timestamp:
Sep 22, 2007 12:02:40 AM (17 years ago)
Author:
vboxsync
Message:

Backed out most of 24659.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/PGMInternal.h

    r4953 r4978  
    468468
    469469
    470 /** 
     470/**
    471471 * A Physical Guest Page tracking structure.
    472  * 
    473  * The format of this structure is complicated because we have to fit a lot 
    474  * of information into as few bits as possible. The format is also subject 
    475  * to change (there is one comming up soon). Which means that for we'll be 
     472 *
     473 * The format of this structure is complicated because we have to fit a lot
     474 * of information into as few bits as possible. The format is also subject
     475 * to change (there is one comming up soon). Which means that for we'll be
    476476 * using PGM_PAGE_GET_* and PGM_PAGE_SET_* macros for all accessess to the
    477477 * structure.
     
    509509#define PGM_PAGE_STATE_ALLOCATED        1
    510510/** A allocated page that's being monitored for writes.
    511  * The shadow page table mappings are read-only. When a write occurs, the 
     511 * The shadow page table mappings are read-only. When a write occurs, the
    512512 * fWrittenTo member is set, the page remapped as read-write and the state
    513513 * moved back to allocated. */
     
    515515/** The page is shared, aka. copy-on-write.
    516516 * This is a page that's shared with other VMs. */
    517 #define PGM_PAGE_STATE_SHARED           3   
     517#define PGM_PAGE_STATE_SHARED           3
    518518/** @} */
    519519
     
    577577 */
    578578#define PGM_PAGE_SET_PAGEID(pPage, _idPage)  do { (pPage)->idPage = (_idPage); } while (0)
    579 /* later: 
     579/* later:
    580580#define PGM_PAGE_SET_PAGEID(pPage, _idPage)  do { (pPage)->HCPhys = (((pPage)->HCPhys) & UINT64_C(0x0000fffffffff000)) \
    581581                                                                  | ((_idPage) & 0xfff) \
     
    724724/**
    725725 * Ring-3 tracking structore for an allocation chunk ring-3 mapping.
    726  * 
     726 *
    727727 * The primary tree (Core) uses the chunk id as key.
    728728 * The secondary tree (AgeCore) is used for ageing and uses ageing sequence number as key.
     
    753753#if HC_ARCH_BITS == 64
    754754    uint32_t                            u32Padding; /**< alignment padding. */
    755 #endif 
     755#endif
    756756    /** The chunk map. */
    757757    R3R0PTRTYPE(PPGMCHUNKR3MAP) volatile  pChunk;
     
    760760typedef PGMCHUNKR3MAPTLBE *PPGMCHUNKR3MAPTLBE;
    761761
    762 /** The number of TLB entries in PGMCHUNKR3MAPTLB. 
     762/** The number of TLB entries in PGMCHUNKR3MAPTLB.
    763763 * @remark Must be a power of two value. */
    764764#define PGM_CHUNKR3MAPTLB_ENTRIES   32
     
    766766/**
    767767 * Allocation chunk ring-3 mapping TLB.
    768  * 
     768 *
    769769 * @remarks We use a TLB to speed up lookups by avoiding walking the AVL.
    770  *          At first glance this might look kinda odd since AVL trees are 
     770 *          At first glance this might look kinda odd since AVL trees are
    771771 *          supposed to give the most optimial lookup times of all trees
    772  *          due to their balancing. However, take a tree with 1023 nodes 
     772 *          due to their balancing. However, take a tree with 1023 nodes
    773773 *          in it, that's 10 levels, meaning that most searches has to go
    774774 *          down 9 levels before they find what they want. This isn't fast
     
    776776 *          and of course the problem with trees and branch prediction.
    777777 *          This is why we use TLBs in front of most of the trees.
    778  * 
    779  * @todo    Generalize this TLB + AVL stuff, shouldn't be all that 
     778 *
     779 * @todo    Generalize this TLB + AVL stuff, shouldn't be all that
    780780 *          difficult when we switch to inlined AVL trees (from kStuff).
    781781 */
     
    804804#if HC_ARCH_BITS == 64
    805805    uint32_t                             u32Padding; /**< alignment padding. */
    806 #endif 
     806#endif
    807807    /** The guest page. */
    808808    R3R0PTRTYPE(PPGMPAGE) volatile       pPage;
     
    816816
    817817
    818 /** The number of entries in the ring-3 guest page mapping TLB. 
     818/** The number of entries in the ring-3 guest page mapping TLB.
    819819 * @remarks The value must be a power of two. */
    820820#define PGM_PAGER3MAPTLB_ENTRIES 64
    821          
     821
    822822/**
    823823 * Ring-3 guest page mapping TLB.
     
    833833
    834834/**
    835  * Calculates the index of the TLB entry for the specified guest page. 
     835 * Calculates the index of the TLB entry for the specified guest page.
    836836 * @returns Physical TLB index.
    837837 * @param   GCPhys      The guest physical address.
     
    840840
    841841
    842 /** @name Context neutrual page mapper TLB. 
    843  * 
     842/** @name Context neutrual page mapper TLB.
     843 *
    844844 * Hoping to avoid some code and bug duplication parts of the GCxxx->CCPtr
    845  * code is writting in a kind of context neutrual way. Time will show whether 
     845 * code is writting in a kind of context neutrual way. Time will show whether
    846846 * this actually makes sense or not...
    847  * 
     847 *
    848848 * @{ */
    849849/** @typedef PPGMPAGEMAPTLB
     
    868868// typedef PPGMPAGEGCMAPTLBE     *PPPGMPAGEMAPTLBE;
    869869# define PGM_PAGEMAPTLB_ENTRIES     PGM_PAGEGCMAPTLB_ENTRIES
    870 # define PGM_PAGEMAPTLB_IDX(GCPhys) PGM_PAGEGCMAPTLB_IDX(GCPhys)     
     870# define PGM_PAGEMAPTLB_IDX(GCPhys) PGM_PAGEGCMAPTLB_IDX(GCPhys)
    871871 typedef void *                 PPGMPAGEMAP;
    872872 typedef void **                PPPGMPAGEMAP;
     
    876876// typedef PPGMPAGER0MAPTLBE     *PPPGMPAGEMAPTLBE;
    877877//# define PGM_PAGEMAPTLB_ENTRIES     PGM_PAGER0MAPTLB_ENTRIES
    878 //# define PGM_PAGEMAPTLB_IDX(GCPhys) PGM_PAGER0MAPTLB_IDX(GCPhys)     
     878//# define PGM_PAGEMAPTLB_IDX(GCPhys) PGM_PAGER0MAPTLB_IDX(GCPhys)
    879879// typedef PPGMCHUNKR0MAP         PPGMPAGEMAP;
    880880// typedef PPPGMCHUNKR0MAP        PPPGMPAGEMAP;
     
    884884 typedef PPGMPAGER3MAPTLBE     *PPPGMPAGEMAPTLBE;
    885885# define PGM_PAGEMAPTLB_ENTRIES     PGM_PAGER3MAPTLB_ENTRIES
    886 # define PGM_PAGEMAPTLB_IDX(GCPhys) PGM_PAGER3MAPTLB_IDX(GCPhys)     
     886# define PGM_PAGEMAPTLB_IDX(GCPhys) PGM_PAGER3MAPTLB_IDX(GCPhys)
    887887 typedef PPGMCHUNKR3MAP         PPGMPAGEMAP;
    888888 typedef PPPGMCHUNKR3MAP        PPPGMPAGEMAP;
    889 #endif 
     889#endif
    890890/** @} */
    891891
     
    18151815    PGMPHYSCACHE                    pgmphyswritecache;
    18161816
    1817     /** 
     1817    /**
    18181818     * Data associated with managing the ring-3 mappings of the allocation chunks.
    18191819     */
    1820     struct 
     1820    struct
    18211821    {
    18221822        /** The chunk tree, ordered by chunk id. */
     
    18261826        /** The number of mapped chunks. */
    18271827        uint32_t                    c;
    1828         /** The maximum number of mapped chunks. 
     1828        /** The maximum number of mapped chunks.
    18291829         * @cfgm    PGM/MaxRing3Chunks */
    18301830        uint32_t                    cMax;
     
    18371837    }                               ChunkR3Map;
    18381838
    1839     /** 
     1839    /**
    18401840     * The page mapping TLB for ring-3 and (for the time being) ring-0.
    18411841     */
     
    18461846    /** The host physical address of the zero page. */
    18471847    RTHCPHYS                        HCPhysZeroPg;
    1848     /** The ring-3 mapping of the zero page. */ 
     1848    /** The ring-3 mapping of the zero page. */
    18491849    RTR3PTR                         pvZeroPgR3;
    1850     /** The ring-0 mapping of the zero page. */ 
     1850    /** The ring-0 mapping of the zero page. */
    18511851    RTR0PTR                         pvZeroPgR0;
    1852     /** The GC mapping of the zero page. */ 
     1852    /** The GC mapping of the zero page. */
    18531853    RTGCPTR                         pvZeroPgGC;
    18541854#if GC_ARCH_BITS != 32
     
    18591859    /** The number of handy pages. */
    18601860    uint32_t                        cHandyPages;
    1861     /** 
     1861    /**
    18621862     * Array of handy pages.
    1863      * 
    1864      * This array is used in a two way communication between pgmPhysAllocPage 
     1863     *
     1864     * This array is used in a two way communication between pgmPhysAllocPage
    18651865     * and GMMR0AllocateHandyPages, with PGMR3PhysAllocateHandyPages serving as
    18661866     * an intermediary.
    1867      * 
     1867     *
    18681868     * The size of this array is important, see pgmPhysEnsureHandyPage for details.
    18691869     * (The current size of 32 pages, means 128 KB of memory.)
    18701870     */
    1871     struct 
     1871    struct
    18721872    {
    18731873        /** The host physical address before pgmPhysAllocPage uses it,
     
    18851885
    18861886    /** @name Release Statistics
    1887      * @{ */                                                     
     1887     * @{ */
    18881888    uint32_t                        cAllPages;          /**< The total number of pages. (Should be Private + Shared + Zero.) */
    18891889    uint32_t                        cPrivatePages;      /**< The number of private pages. */
     
    22532253 * @returns Pointer to the page on success.
    22542254 * @returns NULL on a VERR_PGM_INVALID_GC_PHYSICAL_ADDRESS condition.
    2255  * 
     2255 *
    22562256 * @param   pPGM        PGM handle.
    22572257 * @param   GCPhys      The GC physical address.
     
    22802280/**
    22812281 * Gets the PGMPAGE structure for a guest page.
    2282  * 
     2282 *
    22832283 * Old Phys code: Will make sure the page is present.
    2284  * 
     2284 *
    22852285 * @returns VBox status code.
    22862286 * @retval  VINF_SUCCESS and a valid *ppPage on success.
    22872287 * @retval  VERR_PGM_INVALID_GC_PHYSICAL_ADDRESS if the address isn't valid.
    2288  * 
     2288 *
    22892289 * @param   pPGM        PGM handle.
    22902290 * @param   GCPhys      The GC physical address.
     
    23322332        Assert(rc == VINF_SUCCESS);
    23332333    }
    2334 #endif 
     2334#endif
    23352335    return VINF_SUCCESS;
    23362336}
     
    23412341/**
    23422342 * Gets the PGMPAGE structure for a guest page.
    2343  * 
     2343 *
    23442344 * Old Phys code: Will make sure the page is present.
    2345  * 
     2345 *
    23462346 * @returns VBox status code.
    23472347 * @retval  VINF_SUCCESS and a valid *ppPage on success.
    23482348 * @retval  VERR_PGM_INVALID_GC_PHYSICAL_ADDRESS if the address isn't valid.
    2349  * 
     2349 *
    23502350 * @param   pPGM        PGM handle.
    23512351 * @param   GCPhys      The GC physical address.
     
    23992399        Assert(rc == VINF_SUCCESS);
    24002400    }
    2401 #endif 
     2401#endif
    24022402    return VINF_SUCCESS;
    24032403}
     
    24092409 * @returns Pointer to the page on success.
    24102410 * @returns NULL on a VERR_PGM_INVALID_GC_PHYSICAL_ADDRESS condition.
    2411  * 
     2411 *
    24122412 * @param   pPGM        PGM handle.
    24132413 * @param   GCPhys      The GC physical address.
     
    24432443 * @returns Pointer to the page on success.
    24442444 * @returns NULL on a VERR_PGM_INVALID_GC_PHYSICAL_ADDRESS condition.
    2445  * 
     2445 *
    24462446 * @param   pPGM        PGM handle.
    24472447 * @param   GCPhys      The GC physical address.
     
    24942494
    24952495    }
    2496 #endif 
     2496#endif
    24972497    return VINF_SUCCESS;
    24982498}
     
    25062506 * @param   GCPhys      The GC physical address.
    25072507 * @param   pHCPhys     Where to store the corresponding HC physical address.
    2508  * 
    2509  * @deprecated  Doesn't deal with zero, shared or write monitored pages. 
     2508 *
     2509 * @deprecated  Doesn't deal with zero, shared or write monitored pages.
    25102510 *              Avoid when writing new code!
    25112511 */
     
    25332533 * @param   ppTlbe      Where to store the pointer to the TLB entry.
    25342534 */
    2535  
     2535
    25362536DECLINLINE(int) pgmPhysPageQueryTlbe(PPGM pPGM, RTGCPHYS GCPhys, PPPGMPAGEMAPTLBE ppTlbe)
    25372537{
     
    25592559 * @param   GCPhys      The GC physical address.
    25602560 * @param   pHCPtr      Where to store the corresponding HC virtual address.
    2561  * 
     2561 *
    25622562 * @deprecated  This will be eliminated by PGMPhysGCPhys2CCPtr.
    25632563 */
     
    25992599 * @param   GCPhys      The GC physical address.
    26002600 * @param   pHCPtr      Where to store the corresponding HC virtual address.
    2601  * 
     2601 *
    26022602 * @deprecated  This will be eliminated. Don't use it.
    26032603 */
     
    26192619#endif
    26202620            if (rc != VINF_SUCCESS)
    2621             {   
     2621            {
    26222622                *pHCPtr = 0; /* GCC crap */
    26232623                return rc;
     
    26452645 * @param   pHCPtr      Where to store the corresponding HC virtual address.
    26462646 * @param   pHCPhys     Where to store the HC Physical address and its flags.
    2647  * 
    2648  * @deprecated  Will go away or be changed. Only user is MapCR3. MapCR3 will have to do ring-3 
     2647 *
     2648 * @deprecated  Will go away or be changed. Only user is MapCR3. MapCR3 will have to do ring-3
    26492649 *              and ring-0 locking of the CR3 in a lazy fashion I'm fear... or perhaps not. we'll see.
    26502650 */
     
    28722872 *
    28732873 * @returns The ram flags.
    2874  * @param   pVM     The VM handle.
    28752874 * @param   pCur    The physical handler in question.
    28762875 */
    2877 DECLINLINE(unsigned) pgmHandlerPhysicalCalcFlags(PVM pVM, PPGMPHYSHANDLER pCur)
     2876DECLINLINE(unsigned) pgmHandlerPhysicalCalcFlags(PPGMPHYSHANDLER pCur)
    28782877{
    28792878    switch (pCur->enmType)
     
    28982897 * Clears one physical page of a virtual handler
    28992898 *
    2900  * @param   pVM     The VM handle.
     2899 * @param   pPGM    Pointer to the PGM instance.
    29012900 * @param   pCur    Virtual handler structure
    29022901 * @param   iPage   Physical page index
    29032902 */
    2904 DECLINLINE(void) pgmHandlerVirtualClearPage(PVM pVM, PPGM pPGM, PPGMVIRTHANDLER pCur, unsigned iPage)
     2903DECLINLINE(void) pgmHandlerVirtualClearPage(PPGM pPGM, PPGMVIRTHANDLER pCur, unsigned iPage)
    29052904{
    29062905    const PPGMPHYS2VIRTHANDLER pPhys2Virt = &pCur->aPhysToVirt[iPage];
     
    30013000 *
    30023001 * @returns Pointer to the shadow page structure.
    3003  * @param   pVM         The VM handle.
    30043002 * @param   pPool       The pool.
    30053003 * @param   HCPhys      The HC physical address of the shadow page.
    30063004 */
    3007 DECLINLINE(PPGMPOOLPAGE) pgmPoolGetPage(PVM pVM, PPGMPOOL pPool, RTHCPHYS HCPhys)
     3005DECLINLINE(PPGMPOOLPAGE) pgmPoolGetPage(PPGMPOOL pPool, RTHCPHYS HCPhys)
    30083006{
    30093007    /*
     
    30203018 *
    30213019 * @returns Pointer to the shadow page structure.
    3022  * @param   pVM         The VM handle.
    30233020 * @param   pPool       The pool.
    30243021 * @param   idx         The pool page index.
    30253022 */
    3026 DECLINLINE(PPGMPOOLPAGE) pgmPoolGetPageByIdx(PVM pVM, PPGMPOOL pPool, unsigned idx)
     3023DECLINLINE(PPGMPOOLPAGE) pgmPoolGetPageByIdx(PPGMPOOL pPool, unsigned idx)
    30273024{
    30283025    AssertFatalMsg(idx >= PGMPOOL_IDX_FIRST && idx < pPool->cCurPages, ("idx=%d\n", idx));
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