ia64/xen-unstable

changeset 18400:ab50f558a6f3

stubdom: make xc_map_foreign_ranges use malloc instead of stack space

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Aug 28 09:40:10 2008 +0100 (2008-08-28)
parents b4bde79b7ba0
children c8377b335fbe
files tools/libxc/xc_minios.c
line diff
     1.1 --- a/tools/libxc/xc_minios.c	Wed Aug 27 16:23:10 2008 +0100
     1.2 +++ b/tools/libxc/xc_minios.c	Thu Aug 28 09:40:10 2008 +0100
     1.3 @@ -80,9 +80,10 @@ void *xc_map_foreign_ranges(int xc_handl
     1.4                              size_t size, int prot, size_t chunksize,
     1.5                              privcmd_mmap_entry_t entries[], int nentries)
     1.6  {
     1.7 -    unsigned long mfns[size / PAGE_SIZE];
     1.8 +    unsigned long *mfns;
     1.9      int i, j, n;
    1.10      unsigned long pt_prot = 0;
    1.11 +    void *ret;
    1.12  #ifdef __ia64__
    1.13      /* TODO */
    1.14  #else
    1.15 @@ -92,12 +93,16 @@ void *xc_map_foreign_ranges(int xc_handl
    1.16  	pt_prot = L1_PROT;
    1.17  #endif
    1.18  
    1.19 +    mfns = malloc((size / PAGE_SIZE) * sizeof(*mfns));
    1.20 +
    1.21      n = 0;
    1.22      for (i = 0; i < nentries; i++)
    1.23          for (j = 0; j < chunksize / PAGE_SIZE; j++)
    1.24              mfns[n++] = entries[i].mfn + j;
    1.25  
    1.26 -    return map_frames_ex(mfns, n, 1, 0, 1, dom, 0, pt_prot);
    1.27 +    ret = map_frames_ex(mfns, n, 1, 0, 1, dom, 0, pt_prot);
    1.28 +    free(mfns);
    1.29 +    return ret;
    1.30  }
    1.31  
    1.32