ia64/xen-unstable

changeset 6564:7032428bc820

This patch adjusts the plan9 loader to start "physical" ram at
0x80000000 virtual rather than the virtual address of the kernel
image (which is higher).

Tim Newsham
author kaf24@firebug.cl.cam.ac.uk
date Wed Aug 31 08:45:10 2005 +0000 (2005-08-31)
parents 331c256d8e5c
children f41f8d753b7a
files tools/libxc/xc_load_aout9.c
line diff
     1.1 --- a/tools/libxc/xc_load_aout9.c	Wed Aug 31 08:43:57 2005 +0000
     1.2 +++ b/tools/libxc/xc_load_aout9.c	Wed Aug 31 08:45:10 2005 +0000
     1.3 @@ -15,6 +15,8 @@
     1.4  
     1.5  #define round_pgup(_p)    (((_p)+(PAGE_SIZE-1))&PAGE_MASK)
     1.6  #define round_pgdown(_p)  ((_p)&PAGE_MASK)
     1.7 +#define KZERO             0x80000000
     1.8 +#define KOFFSET(_p)       ((_p)&~KZERO)
     1.9  
    1.10  static int parseaout9image(char *, unsigned long, struct domain_setup_info *);
    1.11  static int loadaout9image(char *, unsigned long, int, u32, unsigned long *, struct domain_setup_info *);
    1.12 @@ -63,7 +65,7 @@ parseaout9image(
    1.13      txtsz = round_pgup(ehdr.text);
    1.14      end = start + txtsz + ehdr.data + ehdr.bss;
    1.15  
    1.16 -    dsi->v_start	= start;
    1.17 +    dsi->v_start	= KZERO;
    1.18      dsi->v_kernstart	= start;
    1.19      dsi->v_kernend	= end;
    1.20      dsi->v_kernentry	= ehdr.entry;
    1.21 @@ -83,19 +85,19 @@ loadaout9image(
    1.22      struct domain_setup_info *dsi)
    1.23  {
    1.24      struct Exec ehdr;
    1.25 -    unsigned long txtsz;
    1.26 +    unsigned long start, txtsz;
    1.27  
    1.28      if (!get_header(image, image_size, &ehdr)) {
    1.29          ERROR("Kernel image does not have a a.out9 header.");
    1.30          return -EINVAL;
    1.31      }
    1.32  
    1.33 +    start = round_pgdown(ehdr.entry);
    1.34      txtsz = round_pgup(ehdr.text);
    1.35      copyout(xch, dom, parray, 
    1.36 -            0, image, sizeof ehdr + ehdr.text);
    1.37 +            start, image, sizeof ehdr + ehdr.text);
    1.38      copyout(xch, dom, parray, 
    1.39 -            txtsz, image + sizeof ehdr + ehdr.text, ehdr.data);
    1.40 -    /* XXX zeroing of BSS needed? */
    1.41 +            start+txtsz, image + sizeof ehdr + ehdr.text, ehdr.data);
    1.42  
    1.43      /* XXX load symbols */
    1.44  
    1.45 @@ -110,13 +112,14 @@ static void
    1.46  copyout(
    1.47      int xch, u32 dom,
    1.48      unsigned long *parray,
    1.49 -    unsigned long off,
    1.50 +    unsigned long addr,
    1.51      void *buf,
    1.52      int sz)
    1.53  {
    1.54 -    unsigned long pgoff, chunksz;
    1.55 +    unsigned long pgoff, chunksz, off;
    1.56      void *pg;
    1.57  
    1.58 +    off = KOFFSET(addr);
    1.59      while (sz > 0) {
    1.60          pgoff = off & (PAGE_SIZE-1);
    1.61          chunksz = sz;