VirtualBox

Changeset 27999 in vbox for trunk/src


Ignore:
Timestamp:
Apr 6, 2010 12:24:02 PM (15 years ago)
Author:
vboxsync
Message:

Introducing PGMR3QueryBalloonSize

Location:
trunk/src/VBox/VMM
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/GMM.cpp

    r27102 r27999  
    290290}
    291291
     292/**
     293 * @see GMMR0QueryTotalBalloonSizeReq
     294 */
     295GMMR3DECL(int)  GMMR3QueryTotalBalloonSize(PVM pVM, uint64_t *pcTotalBalloonedPages)
     296{
     297    GMMBALLOONEDPAGESREQ Req;
     298    Req.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC;
     299    Req.Hdr.cbReq = sizeof(Req);
     300    Req.cBalloonedPages = 0;
     301
     302    *pcTotalBalloonedPages = 0;
     303    int rc = VMMR3CallR0(pVM, VMMR0_DO_GMM_QUERY_TOTAL_BALLOON_SIZE, 0, &Req.Hdr);
     304    if (rc == VINF_SUCCESS)
     305        *pcTotalBalloonedPages = Req.cBalloonedPages;
     306
     307    return rc;
     308}
    292309
    293310/**
  • trunk/src/VBox/VMM/PGMPhys.cpp

    r27750 r27999  
    953953}
    954954
     955/**
     956 * Query the VM and host balloon sizes
     957 *
     958 * @returns VBox status code.
     959 * @param   pVM             The VM handle.
     960 * @param   puBalloonVM     Pointer to VM balloon size
     961 * @param   puBalloonAllVMs Pointer to total balloon size of all VMs
     962 */
     963VMMR3DECL(int) PGMR3QueryBalloonSize(PVM pVM, uint64_t *puBalloonVM, uint64_t *puBalloonAllVMs)
     964{
     965    int rc = VINF_SUCCESS;
     966
     967    if (puBalloonVM)
     968        *puBalloonVM = pVM->pgm.s.cBalloonedPages;
     969
     970    if (puBalloonAllVMs)
     971    {
     972        *puBalloonAllVMs = 0;
     973        rc = GMMR3QueryTotalBalloonSize(pVM, puBalloonAllVMs);
     974        AssertRC(rc);
     975    }
     976
     977    return rc;
     978}
    955979
    956980/**
  • trunk/src/VBox/VMM/VMMR0/GMMR0.cpp

    r27976 r27999  
    28622862             pVM, enmAction, cBalloonedPages));
    28632863
     2864    AssertMsgReturn(cBalloonedPages < RT_BIT(32 - PAGE_SHIFT), ("%#x\n", cBalloonedPages), VERR_INVALID_PARAMETER);
     2865
    28642866    /*
    28652867     * Validate input and get the basics.
     
    28712873    if (RT_FAILURE(rc))
    28722874        return rc;
    2873 
    2874     AssertMsgReturn(cBalloonedPages < RT_BIT(32 - PAGE_SHIFT), ("%#x\n", cBalloonedPages), VERR_INVALID_PARAMETER);
    28752875
    28762876    /*
     
    29912991}
    29922992
     2993/**
     2994 * Return the total amount of ballooned pages for all VMs
     2995 *
     2996 * @returns VBox status code:
     2997 * @param   pVM             Pointer to the shared VM structure.
     2998 * @param   pReq            The request packet.
     2999 */
     3000GMMR0DECL(int) GMMR0QueryTotalBalloonSizeReq(PVM pVM, PGMMBALLOONQUERYREQ pReq)
     3001{
     3002    /*
     3003     * Validate input and pass it on.
     3004     */
     3005    AssertPtrReturn(pVM, VERR_INVALID_POINTER);
     3006    AssertPtrReturn(pReq, VERR_INVALID_POINTER);
     3007    AssertMsgReturn(pReq->Hdr.cbReq == sizeof(GMMBALLOONQUERYREQ),
     3008                    ("%#x < %#x\n", pReq->Hdr.cbReq, sizeof(GMMBALLOONQUERYREQ)),
     3009                    VERR_INVALID_PARAMETER);
     3010
     3011    /*
     3012     * Validate input and get the basics.
     3013     */
     3014    PGMM pGMM;
     3015    GMM_GET_VALID_INSTANCE(pGMM, VERR_INTERNAL_ERROR);
     3016    pReq->cBalloonedPages = pGMM->cBalloonedPages;
     3017    GMM_CHECK_SANITY_UPON_LEAVING(pGMM);
     3018
     3019    return VINF_SUCCESS;
     3020}
    29933021
    29943022/**
  • trunk/src/VBox/VMM/VMMR0/VMMR0.cpp

    r27084 r27999  
    915915            return GMMR0BalloonedPagesReq(pVM, idCpu, (PGMMBALLOONEDPAGESREQ)pReqHdr);
    916916
     917        case VMMR0_DO_GMM_QUERY_TOTAL_BALLOON_SIZE:
     918            if (u64Arg)
     919                return VERR_INVALID_PARAMETER;
     920            return GMMR0QueryTotalBalloonSizeReq(pVM, (PGMMBALLOONQUERYREQ)pReqHdr);
     921
    917922        case VMMR0_DO_GMM_MAP_UNMAP_CHUNK:
    918923            if (u64Arg)
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