From: kfraser@dhcp93.uk.xensource.com Date: Tue, 27 Jun 2006 13:38:58 +0000 (+0100) Subject: [TOOLS] Remove plan9 loader code. Latest plan9 port uses linux builder. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~15913^2~14 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=8c01122785fa6c207de9a2acf115f2b687e866fc;p=xen.git [TOOLS] Remove plan9 loader code. Latest plan9 port uses linux builder. Signed-off-by: Keir Fraser --- diff --git a/tools/libxc/Makefile b/tools/libxc/Makefile index 2adbf61928..0ee949a3e1 100644 --- a/tools/libxc/Makefile +++ b/tools/libxc/Makefile @@ -31,7 +31,6 @@ GUEST_SRCS-y += xc_load_bin.c GUEST_SRCS-y += xc_load_elf.c GUEST_SRCS-y += xg_private.c GUEST_SRCS-$(CONFIG_IA64) += xc_ia64_stubs.c -GUEST_SRCS-$(CONFIG_PLAN9) += xc_load_aout9.c GUEST_SRCS-$(CONFIG_MIGRATE) += xc_linux_restore.c xc_linux_save.c GUEST_SRCS-$(CONFIG_HVM) += xc_hvm_build.c diff --git a/tools/libxc/xc_aout9.h b/tools/libxc/xc_aout9.h deleted file mode 100644 index 9a5ada084a..0000000000 --- a/tools/libxc/xc_aout9.h +++ /dev/null @@ -1,30 +0,0 @@ - -typedef struct Exec -{ - long magic; /* magic number */ - long text; /* size of text segment */ - long data; /* size of initialized data */ - long bss; /* size of uninitialized data */ - long syms; /* size of symbol table */ - long entry; /* entry point */ - long spsz; /* size of pc/sp offset table */ - long pcsz; /* size of pc/line number table */ -} Exec; - -#define _MAGIC(b) ((((4*b)+0)*b)+7) -#define A_MAGIC _MAGIC(8) /* 68020 */ -#define I_MAGIC _MAGIC(11) /* intel 386 */ -#define J_MAGIC _MAGIC(12) /* intel 960 (retired) */ -#define K_MAGIC _MAGIC(13) /* sparc */ -#define V_MAGIC _MAGIC(16) /* mips 3000 BE */ -#define X_MAGIC _MAGIC(17) /* att dsp 3210 (retired) */ -#define M_MAGIC _MAGIC(18) /* mips 4000 BE */ -#define D_MAGIC _MAGIC(19) /* amd 29000 (retired) */ -#define E_MAGIC _MAGIC(20) /* arm */ -#define Q_MAGIC _MAGIC(21) /* powerpc */ -#define N_MAGIC _MAGIC(22) /* mips 4000 LE */ -#define L_MAGIC _MAGIC(23) /* dec alpha */ -#define P_MAGIC _MAGIC(24) /* mips 3000 LE */ -#define U_MAGIC _MAGIC(25) /* sparc64 */ -#define S_MAGIC _MAGIC(26) /* amd64 */ - diff --git a/tools/libxc/xc_ia64_stubs.c b/tools/libxc/xc_ia64_stubs.c index ab964ada4c..4e7ed26fee 100644 --- a/tools/libxc/xc_ia64_stubs.c +++ b/tools/libxc/xc_ia64_stubs.c @@ -38,23 +38,12 @@ int xc_linux_restore(int xc_handle, int io_fd, uint32_t dom, unsigned long nr_pf return -1; } -int -xc_plan9_build(int xc_handle, - uint32_t domid, - const char *image_name, - const char *cmdline, - unsigned int control_evtchn, unsigned long flags) -{ - PERROR("xc_plan9_build not implemented\n"); - return -1; -} /* VMM uses put_user to copy pfn_list to guest buffer, this maybe fail, VMM doesn't handle this now. This method will touch guest buffer to make sure the buffer's mapping is tracked by VMM, */ - int xc_ia64_get_pfn_list(int xc_handle, uint32_t domid, xen_pfn_t *pfn_buf, diff --git a/tools/libxc/xc_linux_build.c b/tools/libxc/xc_linux_build.c index 26d15596af..cacab9b1b7 100644 --- a/tools/libxc/xc_linux_build.c +++ b/tools/libxc/xc_linux_build.c @@ -7,7 +7,6 @@ #include #include "xc_elf.h" -#include "xc_aout9.h" #include #include #include @@ -35,10 +34,6 @@ #define round_pgup(_p) (((_p)+(PAGE_SIZE-1))&PAGE_MASK) #define round_pgdown(_p) ((_p)&PAGE_MASK) -#ifdef __ia64__ -#define probe_aout9(image,image_size,load_funcs) 1 -#endif - struct initrd_info { enum { INITRD_none, INITRD_file, INITRD_mem } type; unsigned long len; @@ -124,8 +119,7 @@ static int probeimageformat(const char *image, struct load_funcs *load_funcs) { if ( probe_elf(image, image_size, load_funcs) && - probe_bin(image, image_size, load_funcs) && - probe_aout9(image, image_size, load_funcs) ) + probe_bin(image, image_size, load_funcs) ) { ERROR( "Unrecognized image format" ); return -EINVAL; diff --git a/tools/libxc/xc_load_aout9.c b/tools/libxc/xc_load_aout9.c deleted file mode 100644 index 23168d47ba..0000000000 --- a/tools/libxc/xc_load_aout9.c +++ /dev/null @@ -1,178 +0,0 @@ - -#include "xg_private.h" -#include "xc_aout9.h" - -#if defined(__i386__) - #define A9_MAGIC I_MAGIC -#elif defined(__x86_64__) - #define A9_MAGIC S_MAGIC -#elif defined(__ia64__) - #define A9_MAGIC 0 -#else -#error "Unsupported architecture" -#endif - -#define round_pgup(_p) (((_p)+(PAGE_SIZE-1))&PAGE_MASK) -#define KZERO 0x80000000 -#define KOFFSET(_p) ((_p)&~KZERO) - -static int parseaout9image(const char *, unsigned long, struct domain_setup_info *); -static int loadaout9image(const char *, unsigned long, int, uint32_t, xen_pfn_t *, struct domain_setup_info *); -static void copyout(int, uint32_t, unsigned long *, unsigned long, const char *, int); -struct Exec *get_header(const char *, unsigned long, struct Exec *); - - -int -probe_aout9( - const char *image, - unsigned long image_size, - struct load_funcs *load_funcs) -{ - struct Exec ehdr; - - if (!get_header(image, image_size, &ehdr)) { - ERROR("Kernel image does not have a a.out9 header."); - return -EINVAL; - } - - load_funcs->parseimage = parseaout9image; - load_funcs->loadimage = loadaout9image; - return 0; -} - -static int -parseaout9image( - const char *image, - unsigned long image_size, - struct domain_setup_info *dsi) -{ - struct Exec ehdr; - unsigned long start, dstart, end; - - if (!get_header(image, image_size, &ehdr)) { - ERROR("Kernel image does not have a a.out9 header."); - return -EINVAL; - } - - if (sizeof ehdr + ehdr.text + ehdr.data > image_size) { - ERROR("a.out program extends past end of image."); - return -EINVAL; - } - - start = ehdr.entry; - dstart = round_pgup(start + ehdr.text); - end = dstart + ehdr.data + ehdr.bss; - - dsi->v_start = KZERO; - dsi->v_kernstart = start; - dsi->v_kernend = end; - dsi->v_kernentry = ehdr.entry; - dsi->v_end = end; - - /* XXX load symbols */ - - return 0; -} - -static int -loadaout9image( - const char *image, - unsigned long image_size, - int xch, uint32_t dom, - xen_pfn_t *parray, - struct domain_setup_info *dsi) -{ - struct Exec ehdr; - unsigned long start, dstart; - - if (!get_header(image, image_size, &ehdr)) { - ERROR("Kernel image does not have a a.out9 header."); - return -EINVAL; - } - - start = ehdr.entry; - dstart = round_pgup(start + ehdr.text); - copyout(xch, dom, parray, start, image + sizeof ehdr, ehdr.text); - copyout(xch, dom, parray, dstart, - image + sizeof ehdr + ehdr.text, ehdr.data); - - /* XXX load symbols */ - - return 0; -} - -/* - * copyout data to the domain given an offset to the start - * of its memory region described by parray. - */ -static void -copyout( - int xch, uint32_t dom, - unsigned long *parray, - unsigned long addr, - const char *buf, - int sz) -{ - unsigned long pgoff, chunksz, off; - void *pg; - - off = KOFFSET(addr); - while (sz > 0) { - pgoff = off & (PAGE_SIZE-1); - chunksz = sz; - if(chunksz > PAGE_SIZE - pgoff) - chunksz = PAGE_SIZE - pgoff; - - pg = xc_map_foreign_range(xch, dom, PAGE_SIZE, PROT_WRITE, - parray[off>>PAGE_SHIFT]); - memcpy(pg + pgoff, buf, chunksz); - munmap(pg, PAGE_SIZE); - - off += chunksz; - buf += chunksz; - sz -= chunksz; - } -} - -#define swap16(_v) ((((uint16_t)(_v)>>8)&0xff)|(((uint16_t)(_v)&0xff)<<8)) -#define swap32(_v) (((uint32_t)swap16((uint16_t)(_v))<<16)|(uint32_t)swap16((uint32_t)((_v)>>16))) - -/* - * Decode the header from the start of image and return it. - */ -struct Exec * -get_header( - const char *image, - unsigned long image_size, - struct Exec *ehdr) -{ - uint32_t *v, x; - int i; - - if (A9_MAGIC == 0) - return 0; - - if (image_size < sizeof ehdr) - return 0; - - /* ... all big endian words */ - v = (uint32_t *)ehdr; - for (i = 0; i < sizeof(*ehdr); i += 4) { - x = *(uint32_t *)&image[i]; - v[i/4] = swap32(x); - } - - if(ehdr->magic != A9_MAGIC) - return 0; - return ehdr; -} - -/* - * Local variables: - * mode: C - * c-set-style: "BSD" - * c-basic-offset: 4 - * tab-width: 4 - * indent-tabs-mode: nil - * End: - */ diff --git a/tools/libxc/xg_private.h b/tools/libxc/xg_private.h index 16dcc966d5..42b8cfd13f 100644 --- a/tools/libxc/xg_private.h +++ b/tools/libxc/xg_private.h @@ -196,8 +196,5 @@ int probe_elf(const char *image, unsigned long image_size, struct load_funcs *funcs); int probe_bin(const char *image, unsigned long image_size, struct load_funcs *funcs); -int probe_aout9(const char *image, unsigned long image_size, - struct load_funcs *funcs); - -#endif +#endif /* XG_PRIVATE_H */