VirtualBox

Changeset 4692 in vbox


Ignore:
Timestamp:
Sep 11, 2007 9:53:55 AM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
24353
Message:

Changed API for converting guest memory into CCPtrs.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/pgm.h

    r4689 r4692  
    784784
    785785/**
     786 * Page mapping lock.
     787 *
     788 * @remarks This doesn't work in structures shared between
     789 *          ring-3, ring-0 and/or GC.
     790 */
     791typedef struct PGMPAGEMAPLOCK
     792{
     793#ifdef IN_GC
     794    /** Just a dummy for the time being. */
     795    uint32_t    u32Dummy;
     796#else
     797    /** Just a dummy for the time being. */
     798    uint32_t    u32Dummy;
     799#endif
     800} PGMPAGEMAPLOCK;
     801/** Pointer to a page mapping lock. */
     802typedef PGMPAGEMAPLOCK *PPGMPAGEMAPLOCK;
     803
     804/**
    786805 * Requests the mapping of a guest page into the current context.
    787  * 
     806 *
    788807 * This API should only be used for very short term, as it will consume
    789  * scarse resources (R0 and GC) in the mapping cache. When you're done 
    790  * with the page, call PGMPhysGCPhys2CCPtrRelease() ASAP to release it.
    791  * 
     808 * scarse resources (R0 and GC) in the mapping cache. When you're done
     809 * with the page, call PGMPhysReleasePageMappingLock() ASAP to release it.
     810 *
    792811 * @returns VBox status code.
    793812 * @retval  VINF_SUCCESS on success.
    794813 * @retval  VERR_PGM_PHYS_PAGE_RESERVED it it's a valid page but has no physical backing.
    795814 * @retval  VERR_PGM_INVALID_GC_PHYSICAL_ADDRESS if it's not a valid physical address.
    796  * 
     815 *
    797816 * @param   pVM         The VM handle.
    798817 * @param   GCPhys      The guest physical address of the page that should be mapped.
    799818 * @param   ppv         Where to store the address corresponding to GCPhys.
    800  *
    801  * @remark  Avoid calling this API from within critical sections (other than
     819 * @param   pLock       Where to store the lock information that PGMPhysReleasePageMappingLock needs.
     820 *
     821 * @remark  Avoid calling this API from within critical sections (other than
    802822 *          the PGM one) because of the deadlock risk.
    803823 */
    804 PGMDECL(int) PGMPhysGCPhys2CCPtr(PVM pVM, RTGCPHYS GCPhys, void **ppv);
    805 
    806 /** 
     824PGMDECL(int) PGMPhysGCPhys2CCPtr(PVM pVM, RTGCPHYS GCPhys, void **ppv, PPGMPAGEMAPLOCK pLock);
     825
     826/**
    807827 * Release the mapping of a guest page.
    808828 *
    809  * This is the counterpart to the PGMPhysGCPhys2CCPtr.
    810  * 
     829 * This is the counter part of PGMPhysGCPhys2CCPtr.
     830 *
    811831 * @param   pVM         The VM handle.
    812  * @param   GCPhys      The address that was mapped using PGMPhysGCPhys2CCPtr.
    813  * @param   pv          The address that PGMPhysGCPhys2CCPtr returned.
    814  */
    815 PGMDECL(void) PGMPhysGCPhys2CCPtrRelease(PVM pVM, RTGCPHYS GCPhys, void *pv);
     832 * @param   pLock       The lock structure initialized by the mapping function.
     833 */
     834PGMDECL(void) PGMPhysReleasePageMappingLock(PVM pVM, PPGMPAGEMAPLOCK pLock);
    816835
    817836/**
  • trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp

    r4689 r4692  
    378378 * This API should only be used for very short term, as it will consume
    379379 * scarse resources (R0 and GC) in the mapping cache. When you're done
    380  * with the page, call PGMPhysGCPhys2CCPtrRelease() ASAP to release it.
     380 * with the page, call PGMPhysReleasePageMappingLock() ASAP to release it.
    381381 *
    382382 * @returns VBox status code.
     
    388388 * @param   GCPhys      The guest physical address of the page that should be mapped.
    389389 * @param   ppv         Where to store the address corresponding to GCPhys.
     390 * @param   pLock       Where to store the lock information that PGMPhysReleasePageMappingLock needs.
    390391 *
    391392 * @remark  Avoid calling this API from within critical sections (other than
    392393 *          the PGM one) because of the deadlock risk.
    393394 */
    394 PGMDECL(int) PGMPhysGCPhys2CCPtr(PVM pVM, RTGCPHYS GCPhys, void **ppv)
     395PGMDECL(int) PGMPhysGCPhys2CCPtr(PVM pVM, RTGCPHYS GCPhys, void **ppv, PPGMPAGEMAPLOCK pLock)
    395396{
    396397# ifdef NEW_PHYS_CODE
     
    455456/**
    456457 * Release the mapping of a guest page.
    457  *
    458  * This is the counterpart to the PGMPhysGCPhys2CCPtr.
     458 * 
     459 * This is the counter part of PGMPhysGCPhys2CCPtr.
    459460 *
    460461 * @param   pVM         The VM handle.
    461  * @param   GCPhys      The address that was mapped using PGMPhysGCPhys2CCPtr.
    462  * @param   pv          The address that PGMPhysGCPhys2CCPtr returned.
    463  */
    464 PGMDECL(void) PGMPhysGCPhys2CCPtrRelease(PVM pVM, RTGCPHYS GCPhys, void *pv)
     462 * @param   pLock       The lock structure initialized by the mapping function.
     463 */
     464PGMDECL(void) PGMPhysReleasePageMappingLock(PVM pVM, PPGMPAGEMAPLOCK pLock)
    465465{
    466466#ifdef NEW_PHYS_CODE
     
    536536#else
    537537    NOREF(pVM);
    538     NOREF(GCPhys);
    539     NOREF(pv);
     538    NOREF(pLock);
    540539#endif
    541540}
  • trunk/src/VBox/VMM/VMMAll/TRPMAll.cpp

    r4680 r4692  
    592592                    goto failure;
    593593
     594                /** @todo add PGMPhysGCPtr2CCPtr */
     595                PGMPAGEMAPLOCK PageMappingLock;
    594596                RTGCPHYS GCPhysStack;
    595597                rc = PGMPhysGCPtr2GCPhys(pVM, pTrapStackGC, &GCPhysStack);
    596598                if (VBOX_SUCCESS(rc))
    597                     rc = PGMPhysGCPhys2CCPtr(pVM, GCPhysStack, (void **)&pTrapStack);
     599                    rc = PGMPhysGCPhys2CCPtr(pVM, GCPhysStack, (void **)&pTrapStack, &PageMappingLock);
    598600                if (VBOX_FAILURE(rc))
    599601                {
     
    710712                    pRegFrame->ss         = ss_r0 & ~X86_SEL_RPL;     /* set rpl to ring 0 */
    711713                    STAM_PROFILE_ADV_STOP(CTXSUFF(&pVM->trpm.s.StatForwardProf), a);
    712                     PGMPhysGCPhys2CCPtrRelease(pVM, GCPhysStack, pTrapStack);
     714                    PGMPhysReleasePageMappingLock(pVM, &PageMappingLock);
    713715                    return VINF_SUCCESS;
    714716#endif
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