win-pvdrivers

changeset 861:16af5a68a3e1 0.11.0.271

DriverEntry allocated memory now passed to balloon thread
author James Harper <james.harper@bendigoit.com.au>
date Sun Feb 27 16:08:02 2011 +1100 (2011-02-27)
parents 95159ee58473
children b18d89506753
files xenpci/xenpci.c xenpci/xenpci_fdo.c
line diff
     1.1 --- a/xenpci/xenpci.c	Sun Feb 27 14:28:41 2011 +1100
     1.2 +++ b/xenpci/xenpci.c	Sun Feb 27 16:08:02 2011 +1100
     1.3 @@ -28,6 +28,8 @@ Foundation, Inc., 51 Franklin Street, Fi
     1.4  
     1.5  #pragma warning(disable : 4200) // zero-sized array
     1.6  
     1.7 +PMDL balloon_mdl_head = NULL;
     1.8 +
     1.9  /* Not really necessary but keeps PREfast happy */
    1.10  DRIVER_INITIALIZE DriverEntry;
    1.11  static EVT_WDF_DRIVER_UNLOAD XenPci_EvtDriverUnload;
    1.12 @@ -699,7 +701,8 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
    1.13    XenPci_HookDbgPrint();
    1.14    #endif
    1.15  
    1.16 -  XenPci_InitialBalloonDown();
    1.17 +  ASSERT(!balloon_mdl_head);
    1.18 +  balloon_mdl_head = XenPci_InitialBalloonDown();
    1.19      
    1.20    dump_page = ExAllocatePoolWithTag(NonPagedPool, PAGE_SIZE, XENPCI_POOL_TAG);
    1.21    status = KeInitializeCrashDumpHeader(DUMP_TYPE_FULL, 0, dump_page, PAGE_SIZE, &dump_header_size);
     2.1 --- a/xenpci/xenpci_fdo.c	Sun Feb 27 14:28:41 2011 +1100
     2.2 +++ b/xenpci/xenpci_fdo.c	Sun Feb 27 16:08:02 2011 +1100
     2.3 @@ -25,6 +25,8 @@ Foundation, Inc., 51 Franklin Street, Fi
     2.4  #define SHUTDOWN_PATH "control/shutdown"
     2.5  #define BALLOON_PATH "memory/target"
     2.6  
     2.7 +extern PMDL balloon_mdl_head;
     2.8 +
     2.9  /* Not really necessary but keeps PREfast happy */
    2.10  static EVT_WDF_WORKITEM XenPci_SuspendResume;
    2.11  #if (NTDDI_VERSION >= NTDDI_WINXP)
    2.12 @@ -231,7 +233,7 @@ XenPci_BalloonThreadProc(PVOID StartCont
    2.13    ULONG new_target = xpdd->current_memory;
    2.14    LARGE_INTEGER timeout;
    2.15    PLARGE_INTEGER ptimeout;
    2.16 -  PMDL head = NULL;
    2.17 +  PMDL head;
    2.18    PMDL mdl;      
    2.19    struct xen_memory_reservation reservation;
    2.20    xen_pfn_t *pfns;
    2.21 @@ -241,6 +243,9 @@ XenPci_BalloonThreadProc(PVOID StartCont
    2.22    int timeout_ms = 1000;
    2.23    
    2.24    FUNCTION_ENTER();
    2.25 +  
    2.26 +  head = balloon_mdl_head;
    2.27 +  balloon_mdl_head = NULL;
    2.28  
    2.29    for(;;)
    2.30    {