VirtualBox

vbox的更動 4492 路徑 trunk/src/VBox/Devices/VMMDev


忽略:
時間撮記:
2007-9-3 下午12:10:30 (17 年 以前)
作者:
vboxsync
訊息:

Continued Main-VMMDev work on memory ballooning.

位置:
trunk/src/VBox/Devices/VMMDev
檔案:
修改 2 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/Devices/VMMDev/VBoxDev.cpp

    r4194 r4492  
    11791179
    11801180
     1181        case VMMDevReq_GetMemBalloonChangeRequest:
     1182        {
     1183            Log(("VMMDevReq_GetMemBalloonChangeRequest\n"));
     1184            if (requestHeader->size != sizeof(VMMDevGetMemBalloonChangeRequest))
     1185            {
     1186                requestHeader->rc = VERR_INVALID_PARAMETER;
     1187            }
     1188            else
     1189            {
     1190                VMMDevGetMemBalloonChangeRequest *memBalloonChangeRequest = (VMMDevGetMemBalloonChangeRequest*)requestHeader;
     1191                /* just pass on the information */
     1192                Log(("VMMDev: returning memory balloon size =%d\n", pData->u32MemoryBalloonSize));
     1193                memBalloonChangeRequest->u32BalloonSize = pData->u32MemoryBalloonSize;
     1194
     1195                if (memBalloonChangeRequest->eventAck == VMMDEV_EVENT_BALLOON_CHANGE_REQUEST)
     1196                {
     1197                    /* Remember which mode the client has queried. */
     1198                    pData->u32LastMemoryBalloonSize = pData->u32MemoryBalloonSize;
     1199                }
     1200
     1201                requestHeader->rc = VINF_SUCCESS;
     1202            }
     1203            break;
     1204        }
     1205
     1206        case VMMDevReq_ReportGuestStats:
     1207        {
     1208            Log(("VMMDevReq_ReportGuestStats\n"));
     1209            if (requestHeader->size != sizeof(VMMDevReportGuestStats))
     1210            {
     1211                requestHeader->rc = VERR_INVALID_PARAMETER;
     1212            }
     1213            else
     1214            {
     1215                VMMDevReportGuestStats *stats = (VMMDevReportGuestStats*)requestHeader;
     1216
     1217                /* Update the last known memory balloon size */
     1218                if (stats->guestStats.u32StatCaps & VBOX_GUEST_STAT_PHYS_MEM_BALLOON)
     1219                    pData->u32LastMemoryBalloonSize = stats->guestStats.u32PhysMemBalloon;
     1220
     1221                /* forward the call */
     1222                requestHeader->rc = pData->pDrv->pfnReportStatistics(pData->pDrv, &stats->guestStats);
     1223            }
     1224            break;
     1225        }
     1226
    11811227        case VMMDevReq_QueryCredentials:
    11821228        {
     
    16251671        /* IRQ so the guest knows what's going on */
    16261672        VMMDevNotifyGuest (pData, VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST);
     1673    }
     1674
     1675    return VINF_SUCCESS;
     1676}
     1677
     1678static DECLCALLBACK(int) vmmdevSetMemoryBalloon(PPDMIVMMDEVPORT pInterface, uint32_t ulBalloonSize)
     1679{
     1680    VMMDevState *pData = IVMMDEVPORT_2_VMMDEVSTATE(pInterface);
     1681
     1682    /* Verify that the new resolution is different and that guest does not yet know about it. */
     1683    bool fSame = (pData->u32LastMemoryBalloonSize == ulBalloonSize);
     1684
     1685    Log(("vmmdevSetMemoryBalloon: old=%d. new=%d\n", pData->u32LastMemoryBalloonSize, ulBalloonSize));
     1686
     1687    if (!fSame)
     1688    {
     1689        /* we could validate the information here but hey, the guest can do that as well! */
     1690        pData->u32MemoryBalloonSize = ulBalloonSize;
     1691
     1692        /* IRQ so the guest knows what's going on */
     1693        VMMDevNotifyGuest (pData, VMMDEV_EVENT_BALLOON_CHANGE_REQUEST);
    16271694    }
    16281695
     
    19171984    pData->Port.pfnVBVAChange             = vmmdevVBVAChange;
    19181985    pData->Port.pfnRequestSeamlessChange  = vmmdevRequestSeamlessChange;
     1986    pData->Port.pfnSetMemoryBalloon       = vmmdevSetMemoryBalloon;
    19191987
    19201988    /* Shared folder LED */
     
    20452113    /* disable seamless mode */
    20462114    pData->fLastSeamlessEnabled = false;
     2115
     2116    /* disabled memory ballooning */
     2117    pData->u32LastMemoryBalloonSize = 0;
    20472118
    20482119    /* Clear the event variables.
  • trunk/src/VBox/Devices/VMMDev/VMMDevState.h

    r4071 r4492  
    132132    } credentialsJudge;
    133133
     134    /* memory balloon change request */
     135    uint32_t    u32MemoryBalloonSize, u32LastMemoryBalloonSize;
     136
    134137    /* seamless mode change request */
    135138    bool fLastSeamlessEnabled, fSeamlessEnabled;
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette