From: Ben Gras Date: Wed, 6 Jun 2012 22:35:10 +0000 (+0200) Subject: drop aout support X-Git-Tag: v3.2.1~547 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/Bv9ARM.ch09.html?a=commitdiff_plain;h=41b869d4d61342107fbd219c97dbc4da46975af8;p=minix.git drop aout support justification: soon we won't be able to execute sep I&D aouts at all (because of the vanishing segments), which was the default mode to generate them so most binaries will be sep I&D. this makes the vfs/rs exec() unification work simpler. after unification, common I&D aout could be added back quite simply. --- diff --git a/lib/libexec/libexec.h b/lib/libexec/libexec.h index 882922559..decd9447b 100644 --- a/lib/libexec/libexec.h +++ b/lib/libexec/libexec.h @@ -3,12 +3,6 @@ #include -/* a.out routines */ -int read_header_aout(const char *exec_hdr, size_t exec_len, int *sep_id, - vir_bytes *text_bytes, vir_bytes *data_bytes, - vir_bytes *bss_bytes, phys_bytes *tot_bytes, vir_bytes *pc, - int *hdrlenp); - /* ELF routines */ int read_header_elf(const char *exec_hdr, int hdr_len, vir_bytes *text_vaddr, phys_bytes *text_paddr, diff --git a/servers/rs/exec.c b/servers/rs/exec.c index 0ff1f4a84..e0faa0b3e 100644 --- a/servers/rs/exec.c +++ b/servers/rs/exec.c @@ -19,14 +19,12 @@ static void patch_ptr(char stack[ARG_MAX], vir_bytes base); static int exec_restart(int proc_e, int result, vir_bytes pc); static int read_seg(struct exec_info *execi, off_t off, int proc_e, int seg, vir_bytes seg_addr, phys_bytes seg_bytes); -static int load_aout(struct exec_info *execi); static int load_elf(struct exec_info *execi); /* Array of loaders for different object formats */ static struct exec_loaders { int (*load_object)(struct exec_info *); } const exec_loaders[] = { - { load_aout }, { load_elf }, { NULL } }; @@ -166,75 +164,6 @@ static int do_exec(int proc_e, char *exec, size_t exec_len, char *progname, return exec_restart(proc_e, OK, execi.pc); } -static int load_aout(struct exec_info *execi) -{ - int r; - int hdrlen, sep_id, load_text, allow_setuid; - vir_bytes text_bytes, data_bytes, bss_bytes; - phys_bytes tot_bytes; - off_t off; - uid_t new_uid; - gid_t new_gid; - int proc_e; - - assert(execi != NULL); - assert(execi->image != NULL); - - proc_e = execi->proc_e; - - /* Read the file header and extract the segment sizes. */ - r = read_header_aout(execi->image, execi->image_len, &sep_id, - &text_bytes, &data_bytes, &bss_bytes, - &tot_bytes, &execi->pc, &hdrlen); - if (r != OK) - { - return r; - } - - new_uid= getuid(); - new_gid= getgid(); - allow_setuid = 0; - - /* XXX what should we use to identify the executable? */ - r= exec_newmem(proc_e, 0 /*text_addr*/, text_bytes, - 0 /*data_addr*/, data_bytes + bss_bytes, tot_bytes, - execi->frame_len, sep_id, 0 /*is_elf*/, 0 /*dev*/, proc_e /*inum*/, 0 /*ctime*/, - execi->progname, new_uid, new_gid, &execi->stack_top, &load_text, - &allow_setuid); - if (r != OK) - { - printf("RS: load_aout: exec_newmem failed: %d\n", r); - exec_restart(proc_e, r, execi->pc); - return r; - } - - off = hdrlen; - - /* Read in text and data segments. */ - if (load_text) { - r= read_seg(execi, off, proc_e, T, 0, text_bytes); - if (r != OK) - { - printf("RS: load_aout: read_seg failed: %d\n", r); - exec_restart(proc_e, r, execi->pc); - return r; - } - } - else - printf("RS: load_aout: not loading text segment\n"); - - off += text_bytes; - r= read_seg(execi, off, proc_e, D, 0, data_bytes); - if (r != OK) - { - printf("RS: load_aout: read_seg failed: %d\n", r); - exec_restart(proc_e, r, execi->pc); - return r; - } - - return OK; -} - static int load_elf(struct exec_info *execi) { int r; diff --git a/servers/vfs/exec.c b/servers/vfs/exec.c index 0e55eb7df..6d2a01df6 100644 --- a/servers/vfs/exec.c +++ b/servers/vfs/exec.c @@ -55,7 +55,6 @@ static void patch_ptr(char stack[ARG_MAX], vir_bytes base); static void clo_exec(struct fproc *rfp); static int read_seg(struct vnode *vp, off_t off, int proc_e, int seg, vir_bytes seg_addr, phys_bytes seg_bytes); -static int load_aout(struct exec_info *execi); static int load_elf(struct exec_info *execi); static int stack_prepare_elf(struct exec_info *execi, char *curstack, size_t *frame_len, vir_bytes *vsp, int *extrabase); @@ -73,7 +72,6 @@ struct exec_loaders { }; static const struct exec_loaders exec_loaders[] = { - { load_aout, NULL }, { load_elf, stack_prepare_elf }, { NULL, NULL } }; @@ -341,57 +339,6 @@ pm_execfinal: return(r); } -/*===========================================================================* - * load_aout * - *===========================================================================*/ -static int load_aout(struct exec_info *execi) -{ - int r; - struct vnode *vp; - int proc_e; - off_t off; - int hdrlen; - int sep_id; - vir_bytes text_bytes, data_bytes, bss_bytes; - phys_bytes tot_bytes; /* total space for program, including gap */ - - assert(execi != NULL); - assert(execi->hdr != NULL); - assert(execi->vp != NULL); - - proc_e = execi->proc_e; - vp = execi->vp; - - /* Read the file header and extract the segment sizes. */ - r = read_header_aout(execi->hdr, execi->vp->v_size, &sep_id, - &text_bytes, &data_bytes, &bss_bytes, - &tot_bytes, &execi->pc, &hdrlen); - if (r != OK) return(r); - - r = exec_newmem(proc_e, 0 /* text_addr */, text_bytes, - 0 /* data_addr */, data_bytes + bss_bytes, tot_bytes, - execi->frame_len, sep_id, 0 /* is_elf */, vp->v_dev, - vp->v_inode_nr, execi->sb.st_ctime, execi->progname, - execi->new_uid, execi->new_gid, - &execi->stack_top, &execi->load_text, &execi->setugid); - - if (r != OK) { - printf("VFS: load_aout: exec_newmem failed: %d\n", r); - return(r); - } - - off = hdrlen; - - /* Read in text and data segments. */ - if (execi->load_text) - r = read_seg(vp, off, proc_e, T, 0, text_bytes); - off += text_bytes; - if (r == OK) - r = read_seg(vp, off, proc_e, D, 0, data_bytes); - - return(r); -} - static int stack_prepare_elf(struct exec_info *execi, char *frame, size_t *framelen, vir_bytes *newsp, int *extrabase) {