ia64/xen-unstable

changeset 10544:1a52829fd60e

[TOOLS] Remove plan9 loader code. Latest plan9 port uses linux builder.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@dhcp93.uk.xensource.com
date Tue Jun 27 14:38:58 2006 +0100 (2006-06-27)
parents 30a5eb240a20
children bad506bc0c85
files tools/libxc/Makefile tools/libxc/xc_aout9.h tools/libxc/xc_ia64_stubs.c tools/libxc/xc_linux_build.c tools/libxc/xc_load_aout9.c tools/libxc/xg_private.h
line diff
     1.1 --- a/tools/libxc/Makefile	Tue Jun 27 14:34:52 2006 +0100
     1.2 +++ b/tools/libxc/Makefile	Tue Jun 27 14:38:58 2006 +0100
     1.3 @@ -31,7 +31,6 @@ GUEST_SRCS-y += xc_load_bin.c
     1.4  GUEST_SRCS-y += xc_load_elf.c
     1.5  GUEST_SRCS-y += xg_private.c
     1.6  GUEST_SRCS-$(CONFIG_IA64) += xc_ia64_stubs.c
     1.7 -GUEST_SRCS-$(CONFIG_PLAN9) += xc_load_aout9.c
     1.8  GUEST_SRCS-$(CONFIG_MIGRATE) += xc_linux_restore.c xc_linux_save.c
     1.9  GUEST_SRCS-$(CONFIG_HVM) += xc_hvm_build.c
    1.10  
     2.1 --- a/tools/libxc/xc_aout9.h	Tue Jun 27 14:34:52 2006 +0100
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,30 +0,0 @@
     2.4 -
     2.5 -typedef struct	Exec
     2.6 -{
     2.7 -	long	magic;		/* magic number */
     2.8 -	long	text;	 	/* size of text segment */
     2.9 -	long	data;	 	/* size of initialized data */
    2.10 -	long	bss;	  	/* size of uninitialized data */
    2.11 -	long	syms;	 	/* size of symbol table */
    2.12 -	long	entry;	 	/* entry point */
    2.13 -	long	spsz;		/* size of pc/sp offset table */
    2.14 -	long	pcsz;		/* size of pc/line number table */
    2.15 -} Exec;
    2.16 -
    2.17 -#define	_MAGIC(b)	((((4*b)+0)*b)+7)
    2.18 -#define	A_MAGIC		_MAGIC(8)	/* 68020 */
    2.19 -#define	I_MAGIC		_MAGIC(11)	/* intel 386 */
    2.20 -#define	J_MAGIC		_MAGIC(12)	/* intel 960 (retired) */
    2.21 -#define	K_MAGIC		_MAGIC(13)	/* sparc */
    2.22 -#define	V_MAGIC		_MAGIC(16)	/* mips 3000 BE */
    2.23 -#define	X_MAGIC		_MAGIC(17)	/* att dsp 3210 (retired) */
    2.24 -#define	M_MAGIC		_MAGIC(18)	/* mips 4000 BE */
    2.25 -#define	D_MAGIC		_MAGIC(19)	/* amd 29000 (retired) */
    2.26 -#define	E_MAGIC		_MAGIC(20)	/* arm */
    2.27 -#define	Q_MAGIC		_MAGIC(21)	/* powerpc */
    2.28 -#define	N_MAGIC		_MAGIC(22)	/* mips 4000 LE */
    2.29 -#define	L_MAGIC		_MAGIC(23)	/* dec alpha */
    2.30 -#define	P_MAGIC		_MAGIC(24)	/* mips 3000 LE */
    2.31 -#define	U_MAGIC		_MAGIC(25)	/* sparc64 */
    2.32 -#define	S_MAGIC		_MAGIC(26)	/* amd64 */
    2.33 -
     3.1 --- a/tools/libxc/xc_ia64_stubs.c	Tue Jun 27 14:34:52 2006 +0100
     3.2 +++ b/tools/libxc/xc_ia64_stubs.c	Tue Jun 27 14:38:58 2006 +0100
     3.3 @@ -38,23 +38,12 @@ int xc_linux_restore(int xc_handle, int 
     3.4      return -1;
     3.5  }
     3.6  
     3.7 -int
     3.8 -xc_plan9_build(int xc_handle,
     3.9 -               uint32_t domid,
    3.10 -               const char *image_name,
    3.11 -               const char *cmdline,
    3.12 -               unsigned int control_evtchn, unsigned long flags)
    3.13 -{
    3.14 -    PERROR("xc_plan9_build not implemented\n");
    3.15 -    return -1;
    3.16 -}
    3.17  /*  
    3.18      VMM uses put_user to copy pfn_list to guest buffer, this maybe fail,
    3.19      VMM doesn't handle this now.
    3.20      This method will touch guest buffer to make sure the buffer's mapping
    3.21      is tracked by VMM,
    3.22   */
    3.23 -
    3.24  int xc_ia64_get_pfn_list(int xc_handle,
    3.25                           uint32_t domid,
    3.26                           xen_pfn_t *pfn_buf,
     4.1 --- a/tools/libxc/xc_linux_build.c	Tue Jun 27 14:34:52 2006 +0100
     4.2 +++ b/tools/libxc/xc_linux_build.c	Tue Jun 27 14:38:58 2006 +0100
     4.3 @@ -7,7 +7,6 @@
     4.4  #include <xenctrl.h>
     4.5  
     4.6  #include "xc_elf.h"
     4.7 -#include "xc_aout9.h"
     4.8  #include <stdlib.h>
     4.9  #include <unistd.h>
    4.10  #include <inttypes.h>
    4.11 @@ -35,10 +34,6 @@
    4.12  #define round_pgup(_p)    (((_p)+(PAGE_SIZE-1))&PAGE_MASK)
    4.13  #define round_pgdown(_p)  ((_p)&PAGE_MASK)
    4.14  
    4.15 -#ifdef __ia64__
    4.16 -#define probe_aout9(image,image_size,load_funcs) 1
    4.17 -#endif
    4.18 -
    4.19  struct initrd_info {
    4.20      enum { INITRD_none, INITRD_file, INITRD_mem } type;
    4.21      unsigned long len;
    4.22 @@ -124,8 +119,7 @@ static int probeimageformat(const char *
    4.23                              struct load_funcs *load_funcs)
    4.24  {
    4.25      if ( probe_elf(image, image_size, load_funcs) &&
    4.26 -         probe_bin(image, image_size, load_funcs) &&
    4.27 -         probe_aout9(image, image_size, load_funcs) )
    4.28 +         probe_bin(image, image_size, load_funcs) )
    4.29      {
    4.30          ERROR( "Unrecognized image format" );
    4.31          return -EINVAL;
     5.1 --- a/tools/libxc/xc_load_aout9.c	Tue Jun 27 14:34:52 2006 +0100
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,178 +0,0 @@
     5.4 -
     5.5 -#include "xg_private.h"
     5.6 -#include "xc_aout9.h"
     5.7 -
     5.8 -#if defined(__i386__)
     5.9 -  #define A9_MAGIC I_MAGIC
    5.10 -#elif defined(__x86_64__)
    5.11 -  #define A9_MAGIC S_MAGIC
    5.12 -#elif defined(__ia64__)
    5.13 -  #define A9_MAGIC 0
    5.14 -#else
    5.15 -#error "Unsupported architecture"
    5.16 -#endif
    5.17 -
    5.18 -#define round_pgup(_p)    (((_p)+(PAGE_SIZE-1))&PAGE_MASK)
    5.19 -#define KZERO             0x80000000
    5.20 -#define KOFFSET(_p)       ((_p)&~KZERO)
    5.21 -
    5.22 -static int parseaout9image(const char *, unsigned long, struct domain_setup_info *);
    5.23 -static int loadaout9image(const char *, unsigned long, int, uint32_t, xen_pfn_t *, struct domain_setup_info *);
    5.24 -static void copyout(int, uint32_t, unsigned long *, unsigned long, const char *, int);
    5.25 -struct Exec *get_header(const char *, unsigned long, struct Exec *);
    5.26 -
    5.27 -
    5.28 -int
    5.29 -probe_aout9(
    5.30 -    const char *image,
    5.31 -    unsigned long image_size,
    5.32 -    struct load_funcs *load_funcs)
    5.33 -{
    5.34 -    struct Exec ehdr;
    5.35 -
    5.36 -    if (!get_header(image, image_size, &ehdr)) {
    5.37 -        ERROR("Kernel image does not have a a.out9 header.");
    5.38 -        return -EINVAL;
    5.39 -    }
    5.40 -
    5.41 -    load_funcs->parseimage = parseaout9image;
    5.42 -    load_funcs->loadimage = loadaout9image;
    5.43 -    return 0;
    5.44 -}
    5.45 -
    5.46 -static int
    5.47 -parseaout9image(
    5.48 -    const char *image,
    5.49 -    unsigned long image_size,
    5.50 -    struct domain_setup_info *dsi)
    5.51 -{
    5.52 -    struct Exec ehdr;
    5.53 -    unsigned long start, dstart, end;
    5.54 -
    5.55 -    if (!get_header(image, image_size, &ehdr)) {
    5.56 -        ERROR("Kernel image does not have a a.out9 header.");
    5.57 -        return -EINVAL;
    5.58 -    }
    5.59 -
    5.60 -    if (sizeof ehdr + ehdr.text + ehdr.data > image_size) {
    5.61 -        ERROR("a.out program extends past end of image.");
    5.62 -        return -EINVAL;
    5.63 -    }
    5.64 -
    5.65 -    start = ehdr.entry;
    5.66 -    dstart = round_pgup(start + ehdr.text);
    5.67 -    end = dstart + ehdr.data + ehdr.bss;
    5.68 -
    5.69 -    dsi->v_start     = KZERO;
    5.70 -    dsi->v_kernstart = start;
    5.71 -    dsi->v_kernend   = end;
    5.72 -    dsi->v_kernentry = ehdr.entry;
    5.73 -    dsi->v_end       = end;
    5.74 -
    5.75 -    /* XXX load symbols */
    5.76 -
    5.77 -    return 0;
    5.78 -}
    5.79 -
    5.80 -static int
    5.81 -loadaout9image(
    5.82 -    const char *image,
    5.83 -    unsigned long image_size,
    5.84 -    int xch, uint32_t dom,
    5.85 -    xen_pfn_t *parray,
    5.86 -    struct domain_setup_info *dsi)
    5.87 -{
    5.88 -    struct Exec ehdr;
    5.89 -    unsigned long start, dstart;
    5.90 -
    5.91 -    if (!get_header(image, image_size, &ehdr)) {
    5.92 -        ERROR("Kernel image does not have a a.out9 header.");
    5.93 -        return -EINVAL;
    5.94 -    }
    5.95 -
    5.96 -    start = ehdr.entry;
    5.97 -    dstart = round_pgup(start + ehdr.text);
    5.98 -    copyout(xch, dom, parray, start, image + sizeof ehdr, ehdr.text);
    5.99 -    copyout(xch, dom, parray, dstart,
   5.100 -            image + sizeof ehdr + ehdr.text, ehdr.data);
   5.101 -
   5.102 -    /* XXX load symbols */
   5.103 -
   5.104 -    return 0;
   5.105 -}
   5.106 -
   5.107 -/*
   5.108 - * copyout data to the domain given an offset to the start
   5.109 - * of its memory region described by parray.
   5.110 - */
   5.111 -static void
   5.112 -copyout(
   5.113 -    int xch, uint32_t dom,
   5.114 -    unsigned long *parray,
   5.115 -    unsigned long addr,
   5.116 -    const char *buf,
   5.117 -    int sz)
   5.118 -{
   5.119 -    unsigned long pgoff, chunksz, off;
   5.120 -    void *pg;
   5.121 -
   5.122 -    off = KOFFSET(addr);
   5.123 -    while (sz > 0) {
   5.124 -        pgoff = off & (PAGE_SIZE-1);
   5.125 -        chunksz = sz;
   5.126 -        if(chunksz > PAGE_SIZE - pgoff)
   5.127 -            chunksz = PAGE_SIZE - pgoff;
   5.128 -
   5.129 -        pg = xc_map_foreign_range(xch, dom, PAGE_SIZE, PROT_WRITE,
   5.130 -                                  parray[off>>PAGE_SHIFT]);
   5.131 -        memcpy(pg + pgoff, buf, chunksz);
   5.132 -        munmap(pg, PAGE_SIZE);
   5.133 -
   5.134 -        off += chunksz;
   5.135 -        buf += chunksz;
   5.136 -        sz -= chunksz;
   5.137 -    }
   5.138 -}
   5.139 -
   5.140 -#define swap16(_v) ((((uint16_t)(_v)>>8)&0xff)|(((uint16_t)(_v)&0xff)<<8))
   5.141 -#define swap32(_v) (((uint32_t)swap16((uint16_t)(_v))<<16)|(uint32_t)swap16((uint32_t)((_v)>>16)))
   5.142 -
   5.143 -/*
   5.144 - * Decode the header from the start of image and return it.
   5.145 - */
   5.146 -struct Exec *
   5.147 -get_header(
   5.148 -    const char *image,
   5.149 -    unsigned long image_size,
   5.150 -    struct Exec *ehdr)
   5.151 -{
   5.152 -    uint32_t *v, x;
   5.153 -    int i;
   5.154 -
   5.155 -    if (A9_MAGIC == 0)
   5.156 -        return 0;
   5.157 -
   5.158 -    if (image_size < sizeof ehdr)
   5.159 -        return 0;
   5.160 -
   5.161 -    /* ... all big endian words */
   5.162 -    v = (uint32_t *)ehdr;
   5.163 -    for (i = 0; i < sizeof(*ehdr); i += 4) {
   5.164 -        x = *(uint32_t *)&image[i];
   5.165 -        v[i/4] = swap32(x);
   5.166 -    }
   5.167 -
   5.168 -    if(ehdr->magic != A9_MAGIC)
   5.169 -        return 0;
   5.170 -    return ehdr;
   5.171 -}
   5.172 -
   5.173 -/*
   5.174 - * Local variables:
   5.175 - * mode: C
   5.176 - * c-set-style: "BSD"
   5.177 - * c-basic-offset: 4
   5.178 - * tab-width: 4
   5.179 - * indent-tabs-mode: nil
   5.180 - * End:
   5.181 - */
     6.1 --- a/tools/libxc/xg_private.h	Tue Jun 27 14:34:52 2006 +0100
     6.2 +++ b/tools/libxc/xg_private.h	Tue Jun 27 14:38:58 2006 +0100
     6.3 @@ -196,8 +196,5 @@ int probe_elf(const char *image, unsigne
     6.4                struct load_funcs *funcs);
     6.5  int probe_bin(const char *image, unsigned long image_size,
     6.6                struct load_funcs *funcs);
     6.7 -int probe_aout9(const char *image, unsigned long image_size,
     6.8 -                struct load_funcs *funcs);
     6.9  
    6.10 -#endif
    6.11 -
    6.12 +#endif /* XG_PRIVATE_H */