ia64/xen-unstable

changeset 12380:93d7d0025408

[IA64] fix ia64 linux domain builder broken by 12009:4a320d26fc24 of xen-unstable.hg.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author awilliam@xenbuild.aw
date Fri Nov 10 11:14:26 2006 -0700 (2006-11-10)
parents ebed72718263
children 5c5af79e7272
files tools/libxc/xc_linux_build.c
line diff
     1.1 --- a/tools/libxc/xc_linux_build.c	Fri Nov 10 11:11:04 2006 -0700
     1.2 +++ b/tools/libxc/xc_linux_build.c	Fri Nov 10 11:14:26 2006 -0700
     1.3 @@ -496,18 +496,10 @@ static int setup_guest(int xc_handle,
     1.4      if ( rc != 0 )
     1.5          goto error_out;
     1.6  
     1.7 -    dsi.v_start = round_pgdown(dsi.v_start);
     1.8 -    (load_funcs.loadimage)(image, image_size, xc_handle, dom, page_array,
     1.9 -                           &dsi);
    1.10 -
    1.11 -    vinitrd_start = round_pgup(dsi.v_end);
    1.12 -    if ( load_initrd(xc_handle, dom, initrd,
    1.13 -                     vinitrd_start - dsi.v_start, page_array) )
    1.14 -        goto error_out;
    1.15 -
    1.16 -    vinitrd_end    = vinitrd_start + initrd->len;
    1.17 -    v_end          = round_pgup(vinitrd_end);
    1.18 +    dsi.v_start    = round_pgdown(dsi.v_start);
    1.19 +    vinitrd_start  = round_pgup(dsi.v_end);
    1.20      start_info_mpa = (nr_pages - 3) << PAGE_SHIFT;
    1.21 +    *pvke          = dsi.v_kernentry;
    1.22  
    1.23      /* Build firmware.  */
    1.24      memset(&domctl.u.arch_setup, 0, sizeof(domctl.u.arch_setup));
    1.25 @@ -519,21 +511,44 @@ static int setup_guest(int xc_handle,
    1.26      if ( xc_domctl(xc_handle, &domctl) )
    1.27          goto error_out;
    1.28  
    1.29 -    start_page = dsi.v_start >> PAGE_SHIFT;
    1.30 -    pgnr = (v_end - dsi.v_start) >> PAGE_SHIFT;
    1.31 -    if ( (page_array = malloc(pgnr * sizeof(xen_pfn_t))) == NULL )
    1.32 +    if ( (page_array = malloc(nr_pages * sizeof(xen_pfn_t))) == NULL )
    1.33      {
    1.34          PERROR("Could not allocate memory");
    1.35          goto error_out;
    1.36      }
    1.37  
    1.38 +    start_page = dsi.v_start >> PAGE_SHIFT;
    1.39      if ( xc_ia64_get_pfn_list(xc_handle, dom, page_array,
    1.40 -                              start_page, pgnr) != pgnr )
    1.41 +                              start_page, nr_pages) != nr_pages )
    1.42      {
    1.43          PERROR("Could not get the page frame list");
    1.44          goto error_out;
    1.45      }
    1.46  
    1.47 +    /* in order to get initrd->len, we need to load initrd image at first */
    1.48 +    if ( load_initrd(xc_handle, dom, initrd,
    1.49 +                     vinitrd_start - dsi.v_start, page_array) )
    1.50 +        goto error_out;
    1.51 +
    1.52 +    vinitrd_end    = vinitrd_start + initrd->len;
    1.53 +    v_end          = round_pgup(vinitrd_end);
    1.54 +    pgnr = (v_end - dsi.v_start) >> PAGE_SHIFT;
    1.55 +    if ( pgnr > nr_pages )
    1.56 +    {
    1.57 +        free(page_array);
    1.58 +        if ( (page_array = malloc(pgnr * sizeof(xen_pfn_t))) == NULL )
    1.59 +        {
    1.60 +            PERROR("Could not reallocate memory");
    1.61 +            goto error_out;
    1.62 +        }
    1.63 +        if ( xc_ia64_get_pfn_list(xc_handle, dom, page_array,
    1.64 +                                  start_page, pgnr) != pgnr )
    1.65 +        {
    1.66 +                PERROR("Could not get the page frame list");
    1.67 +                goto error_out;
    1.68 +        }
    1.69 +    }
    1.70 +
    1.71      IPRINTF("VIRTUAL MEMORY ARRANGEMENT:\n"
    1.72             " Loaded kernel: %p->%p\n"
    1.73             " Init. ramdisk: %p->%p\n"
    1.74 @@ -543,7 +558,8 @@ static int setup_guest(int xc_handle,
    1.75             _p(dsi.v_start),     _p(v_end));
    1.76      IPRINTF(" ENTRY ADDRESS: %p\n", _p(dsi.v_kernentry));
    1.77  
    1.78 -    *pvke = dsi.v_kernentry;
    1.79 +    (load_funcs.loadimage)(image, image_size, xc_handle, dom, page_array,
    1.80 +                           &dsi);
    1.81  
    1.82      /* Now need to retrieve machine pfn for system pages:
    1.83       *  start_info/store/console