VirtualBox

Ignore:
Timestamp:
Mar 4, 2010 1:32:45 PM (15 years ago)
Author:
vboxsync
Message:

Guest Additions: memory ballooning for guests without support for RTR0MemObjAllocPhysNC()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibMisc.cpp

    r26999 r27023  
    237237 * @returns IPRT status code
    238238 * @param   pu32Size    Memory balloon size in MBs (out)
    239  */
    240 VBGLR3DECL(int) VbglR3MemBalloonRefresh(uint32_t *pu32Size)
    241 {
    242     return vbglR3DoIOCtl(VBOXGUEST_IOCTL_CHECK_BALLOON, pu32Size, sizeof(*pu32Size));
    243 }
    244 
    245 
    246 /**
    247  *
     239 * @param   pfHandleInR3 Allocating of memory in R3 required (out)
     240 */
     241VBGLR3DECL(int) VbglR3MemBalloonRefresh(uint32_t *pcChunks, bool *pfHandleInR3)
     242{
     243    VBoxGuestCheckBalloonInfo Info;
     244    int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_CHECK_BALLOON, &Info, sizeof(Info));
     245    *pcChunks = Info.cBalloonChunks;
     246    *pfHandleInR3 = Info.fHandleInR3;
     247    return rc;
     248}
     249
     250
     251/**
     252 * Change the memory by granting/reclaiming memory to/from R0.
     253 *
     254 * @returns IPRT status code
     255 * @param   pv          Memory chunk (1MB)
     256 * @param   fInflate    true = inflate balloon (grant memory)
     257 *                      false = deflate balloon (reclaim memory)
    248258 */
    249259VBGLR3DECL(int) VbglR3MemBalloonChange(void *pv, bool fInflate)
    250260{
    251261    VBoxGuestChangeBalloonInfo Info;
    252     Info.u64ChunkAddr = (uint64_t)pv;
     262    Info.u64ChunkAddr = (uint64_t)((uintptr_t)pv);
    253263    Info.fInflate = fInflate;
    254264    return vbglR3DoIOCtl(VBOXGUEST_IOCTL_CHANGE_BALLOON, &Info, sizeof(Info));
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