ia64/xen-unstable

diff tools/libxc/xc_load_aout9.c @ 6670:77d8b5e40da7

Small plan9 loader patch from Tim Newsham.
author kaf24@firebug.cl.cam.ac.uk
date Wed Sep 07 09:42:47 2005 +0000 (2005-09-07)
parents dd668f7527cb
children 7a36f58f64ee
line diff
     1.1 --- a/tools/libxc/xc_load_aout9.c	Wed Sep 07 02:31:24 2005 +0000
     1.2 +++ b/tools/libxc/xc_load_aout9.c	Wed Sep 07 09:42:47 2005 +0000
     1.3 @@ -14,7 +14,6 @@
     1.4  
     1.5  
     1.6  #define round_pgup(_p)    (((_p)+(PAGE_SIZE-1))&PAGE_MASK)
     1.7 -#define round_pgdown(_p)  ((_p)&PAGE_MASK)
     1.8  #define KZERO             0x80000000
     1.9  #define KOFFSET(_p)       ((_p)&~KZERO)
    1.10  
    1.11 @@ -49,7 +48,7 @@ parseaout9image(
    1.12      struct domain_setup_info *dsi)
    1.13  {
    1.14      struct Exec ehdr;
    1.15 -    unsigned long start, txtsz, end;
    1.16 +    unsigned long start, dstart, end;
    1.17  
    1.18      if (!get_header(image, image_size, &ehdr)) {
    1.19          ERROR("Kernel image does not have a a.out9 header.");
    1.20 @@ -61,9 +60,9 @@ parseaout9image(
    1.21          return -EINVAL;
    1.22      }
    1.23  
    1.24 -    start = round_pgdown(ehdr.entry);
    1.25 -    txtsz = round_pgup(ehdr.text);
    1.26 -    end = start + txtsz + ehdr.data + ehdr.bss;
    1.27 +    start = ehdr.entry;
    1.28 +    dstart = round_pgup(start + ehdr.text);
    1.29 +    end = dstart + ehdr.data + ehdr.bss;
    1.30  
    1.31      dsi->v_start	= KZERO;
    1.32      dsi->v_kernstart	= start;
    1.33 @@ -85,19 +84,18 @@ loadaout9image(
    1.34      struct domain_setup_info *dsi)
    1.35  {
    1.36      struct Exec ehdr;
    1.37 -    unsigned long start, txtsz;
    1.38 +    unsigned long start, dstart;
    1.39  
    1.40      if (!get_header(image, image_size, &ehdr)) {
    1.41          ERROR("Kernel image does not have a a.out9 header.");
    1.42          return -EINVAL;
    1.43      }
    1.44  
    1.45 -    start = round_pgdown(ehdr.entry);
    1.46 -    txtsz = round_pgup(ehdr.text);
    1.47 -    copyout(xch, dom, parray, 
    1.48 -            start, image, sizeof ehdr + ehdr.text);
    1.49 -    copyout(xch, dom, parray, 
    1.50 -            start+txtsz, image + sizeof ehdr + ehdr.text, ehdr.data);
    1.51 +    start = ehdr.entry;
    1.52 +    dstart = round_pgup(start + ehdr.text);
    1.53 +    copyout(xch, dom, parray, start, image + sizeof ehdr, ehdr.text);
    1.54 +    copyout(xch, dom, parray, dstart,
    1.55 +            image + sizeof ehdr + ehdr.text, ehdr.data);
    1.56  
    1.57      /* XXX load symbols */
    1.58