diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2013-10-17 08:02:22 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2013-10-17 08:02:22 +0000 |
commit | 1c86921d81610e1ef2eb9efef0f9f1a890d366d1 (patch) | |
tree | a9ffc9257c80a7b70ebe3bb5f77753b490df0c8a /sys | |
parent | 35ebe67b708457ec2cf2541a8d67f5698c58bee9 (diff) |
Remove support for a.out and ecoff. We only do elf now.
ok miod
Diffstat (limited to 'sys')
32 files changed, 180 insertions, 1751 deletions
diff --git a/sys/arch/alpha/alpha/machdep.c b/sys/arch/alpha/alpha/machdep.c index 964dd1fe2c2..deffc101f69 100644 --- a/sys/arch/alpha/alpha/machdep.c +++ b/sys/arch/alpha/alpha/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.142 2013/09/28 12:40:28 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.143 2013/10/17 08:02:14 deraadt Exp $ */ /* $NetBSD: machdep.c,v 1.210 2000/06/01 17:12:38 thorpej Exp $ */ /*- @@ -78,7 +78,6 @@ #include <sys/tty.h> #include <sys/user.h> #include <sys/exec.h> -#include <sys/exec_ecoff.h> #include <sys/sysctl.h> #include <sys/core.h> #include <sys/kcore.h> diff --git a/sys/arch/alpha/include/ecoff_machdep.h b/sys/arch/alpha/include/ecoff_machdep.h deleted file mode 100644 index 7afff084e66..00000000000 --- a/sys/arch/alpha/include/ecoff_machdep.h +++ /dev/null @@ -1,104 +0,0 @@ -/* $OpenBSD: ecoff_machdep.h,v 1.4 2007/10/16 15:55:33 deraadt Exp $ */ -/* $NetBSD: ecoff_machdep.h,v 1.3 1996/05/09 23:47:25 cgd Exp $ */ - -/* - * Copyright (c) 1994 Adam Glass - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Adam Glass. - * 4. The name of the Author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY Adam Glass ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL Adam Glass BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#define ECOFF_LDPGSZ 4096 - -#define ECOFF_PAD \ - u_short bldrev; /* XXX */ - -#define ECOFF_MACHDEP \ - u_int gprmask; \ - u_int fprmask; \ - u_long gp_value - -#define ECOFF_MAGIC_ALPHA 0603 -#define ECOFF_MAGIC_NATIVE_ALPHA 0605 -#define ECOFF_BADMAG(ep) \ - ((ep)->f.f_magic != ECOFF_MAGIC_ALPHA && \ - (ep)->f.f_magic != ECOFF_MAGIC_NATIVE_ALPHA) - -#define ECOFF_FLAG_EXEC 0002 -#define ECOFF_SEGMENT_ALIGNMENT(ep) \ - (((ep)->f.f_flags & ECOFF_FLAG_EXEC) == 0 ? 8 : 16) - -#define ECOFF_FLAG_OBJECT_TYPE_MASK 0x3000 -#define ECOFF_OBJECT_TYPE_NO_SHARED 0x1000 -#define ECOFF_OBJECT_TYPE_SHARABLE 0x2000 -#define ECOFF_OBJECT_TYPE_CALL_SHARED 0x3000 - -struct ecoff_symhdr { - int16_t magic; - int16_t vstamp; - int32_t lineMax; - int32_t densenumMax; - int32_t procMax; - int32_t lsymMax; - int32_t optsymMax; - int32_t auxsymMax; - int32_t lstrMax; - int32_t estrMax; - int32_t fdMax; - int32_t rfdMax; - int32_t esymMax; - long linesize; - long cbLineOffset; - long cbDnOffset; - long cbPdOffset; - long cbSymOffset; - long cbOptOffset; - long cbAuxOffset; - long cbSsOffset; - long cbSsExtOffset; - long cbFdOffset; - long cbRfdOffset; - long cbExtOffset; -}; - -struct ecoff_extsym { - long es_value; - int es_strindex; - unsigned int es_type:6; - unsigned int es_class:5; - unsigned int :1; - unsigned int es_symauxindex:20; - unsigned int es_jmptbl:1; - unsigned int es_cmain:1; - unsigned int es_weakext:1; - unsigned int :29; - int es_indexfld; -}; - -#ifdef _KERNEL -void cpu_exec_ecoff_setregs(struct proc *, struct exec_package *, u_long, register_t *); -#endif diff --git a/sys/arch/alpha/include/exec.h b/sys/arch/alpha/include/exec.h index 76662e27069..9442516af91 100644 --- a/sys/arch/alpha/include/exec.h +++ b/sys/arch/alpha/include/exec.h @@ -1,4 +1,4 @@ -/* $OpenBSD: exec.h,v 1.13 2013/02/09 19:20:39 miod Exp $ */ +/* $OpenBSD: exec.h,v 1.14 2013/10/17 08:02:14 deraadt Exp $ */ /* $NetBSD: exec.h,v 1.1 1995/02/13 23:07:37 cgd Exp $ */ /* @@ -40,9 +40,7 @@ #define ELF_TARG_DATA ELFDATA2LSB #define ELF_TARG_MACH EM_ALPHA_EXP -#define _NLIST_DO_ECOFF #define _NLIST_DO_ELF - #define _KERN_DO_ELF64 #endif /* !_MACHINE_EXEC_H_ */ diff --git a/sys/arch/amd64/stand/installboot/nlist.c b/sys/arch/amd64/stand/installboot/nlist.c index 0b46cc676af..65f95a68a6f 100644 --- a/sys/arch/amd64/stand/installboot/nlist.c +++ b/sys/arch/amd64/stand/installboot/nlist.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nlist.c,v 1.11 2011/07/04 00:59:26 krw Exp $ */ +/* $OpenBSD: nlist.c,v 1.12 2013/10/17 08:02:15 deraadt Exp $ */ /* * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. @@ -45,13 +45,7 @@ #include <elf_abi.h> #endif -#ifdef _NLIST_DO_ECOFF -#include <sys/exec_ecoff.h> -#endif - int __fdnlist(int, struct nlist *); -int __aout_fdnlist(int, struct nlist *); -int __ecoff_fdnlist(int, struct nlist *); int __elf_fdnlist(int, struct nlist *); #ifdef _NLIST_DO_ELF int __elf_is_okay__(Elf_Ehdr *ehdr); @@ -59,210 +53,6 @@ int __elf_is_okay__(Elf_Ehdr *ehdr); #define ISLAST(p) (p->n_un.n_name == 0 || p->n_un.n_name[0] == 0) -#ifdef _NLIST_DO_AOUT -int -__aout_fdnlist(int fd, struct nlist *list) -{ - struct nlist *p, *s; - char *strtab; - off_t symoff, stroff; - u_long symsize; - int nent, cc; - int strsize, usemalloc = 0; - struct nlist nbuf[1024]; - struct exec exec; - - if (pread(fd, &exec, sizeof(exec), (off_t)0) != sizeof(exec) || - N_BADMAG(exec) || exec.a_syms == 0) - return (-1); - - stroff = N_STROFF(exec); - symoff = N_SYMOFF(exec); - symsize = exec.a_syms; - - /* Read in the size of the string table. */ - if (pread(fd, (void *)&strsize, sizeof(strsize), stroff) != - sizeof(strsize)) - return (-1); - else - stroff += sizeof(strsize); - - /* - * Read in the string table. We try mmap, but that will fail - * for /dev/ksyms so fall back on malloc. Since OpenBSD's malloc(3) - * returns memory to the system on free this does not cause bloat. - */ - strsize -= sizeof(strsize); - strtab = mmap(NULL, (size_t)strsize, PROT_READ, MAP_SHARED|MAP_FILE, - fd, stroff); - if (strtab == MAP_FAILED) { - usemalloc = 1; - if ((strtab = (char *)malloc(strsize)) == NULL) - return (-1); - errno = EIO; - if (pread(fd, strtab, strsize, stroff) != strsize) { - nent = -1; - goto aout_done; - } - } - - /* - * clean out any left-over information for all valid entries. - * Type and value defined to be 0 if not found; historical - * versions cleared other and desc as well. Also figure out - * the largest string length so don't read any more of the - * string table than we have to. - * - * XXX clearing anything other than n_type and n_value violates - * the semantics given in the man page. - */ - nent = 0; - for (p = list; !ISLAST(p); ++p) { - p->n_type = 0; - p->n_other = 0; - p->n_desc = 0; - p->n_value = 0; - ++nent; - } - - while (symsize > 0) { - cc = MIN(symsize, sizeof(nbuf)); - if (pread(fd, nbuf, cc, symoff) != cc) - break; - symsize -= cc; - symoff += cc; - for (s = nbuf; cc > 0; ++s, cc -= sizeof(*s)) { - char *sname = strtab + s->n_un.n_strx - sizeof(int); - - if (s->n_un.n_strx == 0 || (s->n_type & N_STAB) != 0) - continue; - for (p = list; !ISLAST(p); p++) { - char *pname = p->n_un.n_name; - - if (*sname != '_' && *pname == '_') - pname++; - if (!strcmp(sname, pname)) { - p->n_value = s->n_value; - p->n_type = s->n_type; - p->n_desc = s->n_desc; - p->n_other = s->n_other; - if (--nent <= 0) - break; - } - } - } - } -aout_done: - if (usemalloc) - free(strtab); - else - munmap(strtab, strsize); - return (nent); -} -#endif /* _NLIST_DO_AOUT */ - -#ifdef _NLIST_DO_ECOFF -#define check(off, size) ((off < 0) || (off + size > mappedsize)) -#define BAD do { rv = -1; goto out; } while (0) -#define BADUNMAP do { rv = -1; goto unmap; } while (0) - -int -__ecoff_fdnlist(int fd, struct nlist *list) -{ - struct nlist *p; - struct ecoff_exechdr *exechdrp; - struct ecoff_symhdr *symhdrp; - struct ecoff_extsym *esyms; - struct stat st; - char *mappedfile; - size_t mappedsize; - u_long symhdroff, extstroff; - u_int symhdrsize; - int rv, nent; - long i, nesyms; - - rv = -3; - - if (fstat(fd, &st) < 0) - BAD; - if (st.st_size > SIZE_T_MAX) { - errno = EFBIG; - BAD; - } - mappedsize = st.st_size; - mappedfile = mmap(NULL, mappedsize, PROT_READ, MAP_SHARED|MAP_FILE, - fd, 0); - if (mappedfile == MAP_FAILED) - BAD; - - if (check(0, sizeof *exechdrp)) - BADUNMAP; - exechdrp = (struct ecoff_exechdr *)&mappedfile[0]; - - if (ECOFF_BADMAG(exechdrp)) - BADUNMAP; - - symhdroff = exechdrp->f.f_symptr; - symhdrsize = exechdrp->f.f_nsyms; - - if (check(symhdroff, sizeof *symhdrp) || - sizeof *symhdrp != symhdrsize) - BADUNMAP; - symhdrp = (struct ecoff_symhdr *)&mappedfile[symhdroff]; - - nesyms = symhdrp->esymMax; - if (check(symhdrp->cbExtOffset, nesyms * sizeof *esyms)) - BADUNMAP; - esyms = (struct ecoff_extsym *)&mappedfile[symhdrp->cbExtOffset]; - extstroff = symhdrp->cbSsExtOffset; - - /* - * clean out any left-over information for all valid entries. - * Type and value defined to be 0 if not found; historical - * versions cleared other and desc as well. - * - * XXX clearing anything other than n_type and n_value violates - * the semantics given in the man page. - */ - nent = 0; - for (p = list; !ISLAST(p); ++p) { - p->n_type = 0; - p->n_other = 0; - p->n_desc = 0; - p->n_value = 0; - ++nent; - } - - for (i = 0; i < nesyms; i++) { - for (p = list; !ISLAST(p); p++) { - char *nlistname; - char *symtabname; - - nlistname = p->n_un.n_name; - if (*nlistname == '_') - nlistname++; - symtabname = - &mappedfile[extstroff + esyms[i].es_strindex]; - - if (!strcmp(symtabname, nlistname)) { - p->n_value = esyms[i].es_value; - p->n_type = N_EXT; /* XXX */ - p->n_desc = 0; /* XXX */ - p->n_other = 0; /* XXX */ - if (--nent <= 0) - break; - } - } - } - rv = nent; - -unmap: - munmap(mappedfile, mappedsize); -out: - return (rv); -} -#endif /* _NLIST_DO_ECOFF */ - #ifdef _NLIST_DO_ELF /* * __elf_is_okay__ - Determine if ehdr really @@ -489,15 +279,9 @@ elf_done: static struct nlist_handlers { int (*fn)(int fd, struct nlist *list); } nlist_fn[] = { -#ifdef _NLIST_DO_AOUT - { __aout_fdnlist }, -#endif #ifdef _NLIST_DO_ELF { __elf_fdnlist }, #endif -#ifdef _NLIST_DO_ECOFF - { __ecoff_fdnlist }, -#endif }; int diff --git a/sys/arch/aviion/aviion/machdep.c b/sys/arch/aviion/aviion/machdep.c index cef8e4944ba..76ea515af4d 100644 --- a/sys/arch/aviion/aviion/machdep.c +++ b/sys/arch/aviion/aviion/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.57 2013/10/10 21:24:59 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.58 2013/10/17 08:02:15 deraadt Exp $ */ /* * Copyright (c) 2007 Miodrag Vallat. * @@ -619,15 +619,6 @@ nmihand(void *frame) } int -cpu_exec_aout_makecmds(p, epp) - struct proc *p; - struct exec_package *epp; -{ - - return (ENOEXEC); -} - -int sys_sysarch(p, v, retval) struct proc *p; void *v; diff --git a/sys/arch/hppa/stand/mkboot/mkboot.c b/sys/arch/hppa/stand/mkboot/mkboot.c index 7c08d7889c3..6453f8eba9c 100644 --- a/sys/arch/hppa/stand/mkboot/mkboot.c +++ b/sys/arch/hppa/stand/mkboot/mkboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mkboot.c,v 1.16 2009/10/27 23:59:34 deraadt Exp $ */ +/* $OpenBSD: mkboot.c,v 1.17 2013/10/17 08:02:15 deraadt Exp $ */ /* * Copyright (c) 1990, 1993 @@ -42,7 +42,7 @@ #include <err.h> #endif -#include <sys/exec_aout.h> +#include <sys/exec.h> #include <sys/exec_elf.h> #ifndef hppa diff --git a/sys/arch/hppa64/stand/mkboot/mkboot.c b/sys/arch/hppa64/stand/mkboot/mkboot.c index 6c7d4cb5f51..0c69409b207 100644 --- a/sys/arch/hppa64/stand/mkboot/mkboot.c +++ b/sys/arch/hppa64/stand/mkboot/mkboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mkboot.c,v 1.2 2009/10/27 23:59:34 deraadt Exp $ */ +/* $OpenBSD: mkboot.c,v 1.3 2013/10/17 08:02:15 deraadt Exp $ */ /* * Copyright (c) 1990, 1993 @@ -42,7 +42,7 @@ #include <err.h> #endif -#include <sys/exec_aout.h> +#include <sys/exec.h> #include <sys/exec_elf.h> #ifndef hppa diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index 6143265a58d..eb3bab857e1 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.526 2013/10/09 01:48:40 guenther Exp $ */ +/* $OpenBSD: machdep.c,v 1.527 2013/10/17 08:02:15 deraadt Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -3374,19 +3374,6 @@ init386(paddr_t first_avail) } /* - * cpu_exec_aout_makecmds(): - * cpu-dependent a.out format hook for execve(). - * - * Determine of the given exec package refers to something which we - * understand and, if so, set up the vmcmds for it. - */ -int -cpu_exec_aout_makecmds(struct proc *p, struct exec_package *epp) -{ - return ENOEXEC; -} - -/* * consinit: * initialize the system console. */ diff --git a/sys/arch/i386/include/exec.h b/sys/arch/i386/include/exec.h index d655f867f65..07fdb961476 100644 --- a/sys/arch/i386/include/exec.h +++ b/sys/arch/i386/include/exec.h @@ -1,4 +1,4 @@ -/* $OpenBSD: exec.h,v 1.11 2012/09/11 15:44:17 deraadt Exp $ */ +/* $OpenBSD: exec.h,v 1.12 2013/10/17 08:02:16 deraadt Exp $ */ /* $NetBSD: exec.h,v 1.6 1994/10/27 04:16:05 cgd Exp $ */ /* @@ -40,10 +40,7 @@ #define ELF_TARG_MACH EM_386 /* XXX - EM_486 is currently unused by all OSs/compilers/linkers */ -#define _NLIST_DO_AOUT #define _NLIST_DO_ELF - -#define _KERN_DO_AOUT #define _KERN_DO_ELF #endif /* _MACHINE_EXEC_H_ */ diff --git a/sys/arch/luna88k/luna88k/machdep.c b/sys/arch/luna88k/luna88k/machdep.c index 973687e4cbd..6cf556b5820 100644 --- a/sys/arch/luna88k/luna88k/machdep.c +++ b/sys/arch/luna88k/luna88k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.90 2013/09/28 12:40:30 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.91 2013/10/17 08:02:16 deraadt Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -917,15 +917,6 @@ out: } int -cpu_exec_aout_makecmds(p, epp) - struct proc *p; - struct exec_package *epp; -{ - - return (ENOEXEC); -} - -int sys_sysarch(p, v, retval) struct proc *p; void *v; diff --git a/sys/arch/m68k/include/exec.h b/sys/arch/m68k/include/exec.h index 879a7cce825..46c806e70e3 100644 --- a/sys/arch/m68k/include/exec.h +++ b/sys/arch/m68k/include/exec.h @@ -1,4 +1,4 @@ -/* $OpenBSD: exec.h,v 1.6 2013/02/09 19:21:29 miod Exp $ */ +/* $OpenBSD: exec.h,v 1.7 2013/10/17 08:02:16 deraadt Exp $ */ /* $NetBSD: exec.h,v 1.8 1994/11/21 21:33:39 gwr Exp $ */ /* @@ -39,12 +39,7 @@ #define ELF_TARG_DATA ELFDATA2MSB #define ELF_TARG_MACH EM_68K -#define _NLIST_DO_AOUT #define _NLIST_DO_ELF - -#define _KERN_DO_AOUT #define _KERN_DO_ELF -#define cpu_exec_aout_makecmds(p, epp) (ENOEXEC) - #endif /* _M68K_EXEC_H_ */ diff --git a/sys/arch/m88k/include/db_machdep.h b/sys/arch/m88k/include/db_machdep.h index 2ab64f789a3..03cb5a53bf6 100644 --- a/sys/arch/m88k/include/db_machdep.h +++ b/sys/arch/m88k/include/db_machdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: db_machdep.h,v 1.16 2013/01/05 11:20:56 miod Exp $ */ +/* $OpenBSD: db_machdep.h,v 1.17 2013/10/17 08:02:16 deraadt Exp $ */ /* * Mach Operating System * Copyright (c) 1993-1991 Carnegie Mellon University @@ -92,12 +92,8 @@ void m88k_print_instruction(int, u_int, u_int32_t); /* db_disasm.c */ /* machine specific commands have been added to ddb */ #define DB_MACHINE_COMMANDS -#ifdef __ELF__ #define DB_ELF_SYMBOLS #define DB_ELFSIZE 32 -#else -#define DB_AOUT_SYMBOLS -#endif #ifdef MULTIPROCESSOR extern cpuid_t ddb_mp_nextcpu; diff --git a/sys/arch/m88k/include/exec.h b/sys/arch/m88k/include/exec.h index a7c6155d68c..ad5b58e8ec5 100644 --- a/sys/arch/m88k/include/exec.h +++ b/sys/arch/m88k/include/exec.h @@ -1,4 +1,4 @@ -/* $OpenBSD: exec.h,v 1.4 2013/04/20 18:40:42 miod Exp $ */ +/* $OpenBSD: exec.h,v 1.5 2013/10/17 08:02:16 deraadt Exp $ */ #ifndef _M88K_EXEC_H_ #define _M88K_EXEC_H_ @@ -10,10 +10,7 @@ #define ELF_TARG_DATA ELFDATA2MSB #define ELF_TARG_MACH EM_88K -#define _NLIST_DO_AOUT #define _NLIST_DO_ELF - -#define _KERN_DO_AOUT #define _KERN_DO_ELF /* Processor specific dynamic tag values. */ diff --git a/sys/arch/mvme88k/mvme88k/machdep.c b/sys/arch/mvme88k/mvme88k/machdep.c index cbe4c162bf4..1d2a0295abf 100644 --- a/sys/arch/mvme88k/mvme88k/machdep.c +++ b/sys/arch/mvme88k/mvme88k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.256 2013/09/28 12:40:31 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.257 2013/10/17 08:02:17 deraadt Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -715,15 +715,6 @@ nmihand(void *frame) } int -cpu_exec_aout_makecmds(p, epp) - struct proc *p; - struct exec_package *epp; -{ - - return (ENOEXEC); -} - -int sys_sysarch(p, v, retval) struct proc *p; void *v; diff --git a/sys/arch/sgi/include/ecoff_machdep.h b/sys/arch/sgi/include/ecoff_machdep.h deleted file mode 100644 index 23bd9003d24..00000000000 --- a/sys/arch/sgi/include/ecoff_machdep.h +++ /dev/null @@ -1,5 +0,0 @@ -/* $OpenBSD: ecoff_machdep.h,v 1.1 2004/08/06 21:12:19 pefo Exp $ */ - -/* Use Mips generic include file */ - -#include <mips64/ecoff_machdep.h> diff --git a/sys/arch/sparc/include/exec.h b/sys/arch/sparc/include/exec.h index addb144422f..6aa92960940 100644 --- a/sys/arch/sparc/include/exec.h +++ b/sys/arch/sparc/include/exec.h @@ -1,4 +1,4 @@ -/* $OpenBSD: exec.h,v 1.16 2013/02/09 19:20:39 miod Exp $ */ +/* $OpenBSD: exec.h,v 1.17 2013/10/17 08:02:17 deraadt Exp $ */ /* $NetBSD: exec.h,v 1.7 1994/11/20 20:53:02 deraadt Exp $ */ /* @@ -94,9 +94,7 @@ #define ELF_TARG_DATA ELFDATA2MSB #define ELF_TARG_MACH EM_SPARC -#define _NLIST_DO_AOUT #define _NLIST_DO_ELF - #define _KERN_DO_ELF #endif /* _MACHINE_EXEC_H_ */ diff --git a/sys/arch/vax/include/db_machdep.h b/sys/arch/vax/include/db_machdep.h index 2cd20cb7c7b..ed8ee7795c2 100644 --- a/sys/arch/vax/include/db_machdep.h +++ b/sys/arch/vax/include/db_machdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: db_machdep.h,v 1.15 2013/07/05 21:10:50 miod Exp $ */ +/* $OpenBSD: db_machdep.h,v 1.16 2013/10/17 08:02:17 deraadt Exp $ */ /* $NetBSD: db_machdep.h,v 1.6 1998/08/10 14:33:33 ragge Exp $ */ /* @@ -73,11 +73,7 @@ extern db_regs_t ddb_regs; /* register state */ /* Prototypes */ void kdb_trap(struct trapframe *); -#ifdef __ELF__ #define DB_ELF_SYMBOLS #define DB_ELFSIZE 32 -#else -#define DB_AOUT_SYMBOLS -#endif #endif /* _MACHINE_DB_MACHDEP_H_ */ diff --git a/sys/arch/vax/include/exec.h b/sys/arch/vax/include/exec.h index d073a46013b..57eed034786 100644 --- a/sys/arch/vax/include/exec.h +++ b/sys/arch/vax/include/exec.h @@ -1,4 +1,4 @@ -/* $OpenBSD: exec.h,v 1.9 2011/03/23 16:54:37 pirofti Exp $ */ +/* $OpenBSD: exec.h,v 1.10 2013/10/17 08:02:17 deraadt Exp $ */ /* $NetBSD: exec.h,v 1.4 1995/09/23 14:57:40 ragge Exp $ */ /* @@ -47,10 +47,7 @@ struct relocation_info_vax { }; #define relocation_info relocation_info_vax -#define _NLIST_DO_AOUT #define _NLIST_DO_ELF - -#define _KERN_DO_AOUT #define _KERN_DO_ELF #define ARCH_ELFSIZE 32 diff --git a/sys/arch/vax/vax/vm_machdep.c b/sys/arch/vax/vax/vm_machdep.c index f24f9d83876..a6dfdaf4340 100644 --- a/sys/arch/vax/vax/vm_machdep.c +++ b/sys/arch/vax/vax/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.39 2013/01/16 19:04:43 miod Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.40 2013/10/17 08:02:18 deraadt Exp $ */ /* $NetBSD: vm_machdep.c,v 1.67 2000/06/29 07:14:34 mrg Exp $ */ /* @@ -156,14 +156,6 @@ cpu_fork(p1, p2, stack, stacksize, func, arg) } int -cpu_exec_aout_makecmds(p, epp) - struct proc *p; - struct exec_package *epp; -{ - return ENOEXEC; -} - -int sys_sysarch(p, v, retval) struct proc *p; void *v; diff --git a/sys/arch/zaurus/stand/zboot/loadfile.c b/sys/arch/zaurus/stand/zboot/loadfile.c index fd9ff324526..d2ae4fbe155 100644 --- a/sys/arch/zaurus/stand/zboot/loadfile.c +++ b/sys/arch/zaurus/stand/zboot/loadfile.c @@ -1,5 +1,5 @@ /* $NetBSD: loadfile.c,v 1.10 2000/12/03 02:53:04 tsutsui Exp $ */ -/* $OpenBSD: loadfile.c,v 1.4 2008/06/26 05:42:14 ray Exp $ */ +/* $OpenBSD: loadfile.c,v 1.5 2013/10/17 08:02:18 deraadt Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -97,7 +97,7 @@ static int coff_exec(int, struct ecoff_exechdr *, u_long *, int); static int elf_exec(int, Elf_Ehdr *, u_long *, int); #endif #ifdef BOOT_AOUT -#include <sys/exec_aout.h> +#include <sys/exec.h> static int aout_exec(int, struct exec *, u_long *, int); #endif #ifdef BOOT_ZBOOT diff --git a/sys/conf/files b/sys/conf/files index ec4484c6dbb..f5cc08d4b3f 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1,4 +1,4 @@ -# $OpenBSD: files,v 1.557 2013/10/15 01:41:45 miod Exp $ +# $OpenBSD: files,v 1.558 2013/10/17 08:02:18 deraadt Exp $ # $NetBSD: files,v 1.87 1996/05/19 17:17:50 jonathan Exp $ # @(#)files.newconf 7.5 (Berkeley) 5/10/93 @@ -598,7 +598,6 @@ file altq/altq_rmclass.c altq file altq/altq_hfsc.c altq file altq/altq_priq.c altq file ddb/db_access.c ddb | kgdb -file ddb/db_aout.c ddb file ddb/db_break.c ddb file ddb/db_command.c ddb file ddb/db_elf.c ddb @@ -650,9 +649,7 @@ file isofs/udf/udf_subr.c udf file isofs/udf/udf_vfsops.c udf file isofs/udf/udf_vnops.c udf file kern/clock_subr.c -file kern/exec_aout.c file kern/exec_conf.c -file kern/exec_ecoff.c file kern/exec_elf32.c file kern/exec_elf64.c file kern/exec_script.c diff --git a/sys/ddb/db_aout.c b/sys/ddb/db_aout.c deleted file mode 100644 index a5fe2a6563c..00000000000 --- a/sys/ddb/db_aout.c +++ /dev/null @@ -1,391 +0,0 @@ -/* $OpenBSD: db_aout.c,v 1.30 2006/07/06 18:12:50 miod Exp $ */ -/* $NetBSD: db_aout.c,v 1.29 2000/07/07 21:55:18 jhawk Exp $ */ - -/* - * Mach Operating System - * Copyright (c) 1993,1992,1991,1990 Carnegie Mellon University - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - */ - -#include <sys/types.h> -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/proc.h> - -#include <machine/db_machdep.h> /* data types */ - -#include <ddb/db_sym.h> -#include <ddb/db_output.h> -#include <ddb/db_extern.h> - -#ifdef DB_AOUT_SYMBOLS - -#include <ddb/db_aout.h> - -boolean_t db_aout_sym_init(int, void *, void *, const char *); -db_sym_t db_aout_lookup(db_symtab_t *, char *); -db_sym_t db_aout_search_symbol(db_symtab_t *, db_addr_t, - db_strategy_t, db_expr_t *); -void db_aout_symbol_values(db_symtab_t *, db_sym_t, - char **, db_expr_t *); -boolean_t db_aout_line_at_pc(db_symtab_t *, db_sym_t, - char **, int *, db_expr_t); -boolean_t db_aout_sym_numargs(db_symtab_t *, db_sym_t, int *, - char **); -void db_aout_forall(db_symtab_t *, - db_forall_func_t db_forall_func, void *); - -db_symformat_t db_symformat_aout = { - "a.out", - db_aout_sym_init, - db_aout_lookup, - db_aout_search_symbol, - db_aout_symbol_values, - db_aout_line_at_pc, - db_aout_sym_numargs, - db_aout_forall -}; - -/* - * An a.out symbol table as loaded into the kernel debugger: - * - * symtab -> size of symbol entries, in bytes - * sp -> first symbol entry - * ... - * ep -> last symbol entry + 1 - * strtab == start of string table - * size of string table in bytes, - * including this word - * -> strings - */ -static char *strtab; -static int slen; - -#define X_db_getname(t, s) (s->n_un.n_strx ? t->end + s->n_un.n_strx : NULL) - -/* - * Find the symbol table and strings; tell ddb about them. - * - * symsize: size of symbol table - * vsymtab: pointer to end of string table - * vesymtab: pointer to end of string table, for checking - rounded up to - * integer boundry - */ -boolean_t -db_aout_sym_init(int symsize, void *vsymtab, void *vesymtab, const char *name) -{ - struct nlist *sym_start, *sym_end; - struct nlist *sp; - int bad = 0; - char *estrtab; - - /* - * XXX - ddb_init should take arguments. - * Fixup the arguments. - */ - symsize = *(long *)vsymtab; - vsymtab = (void *)((long *)vsymtab + 1); - - - if (ALIGNED_POINTER(vsymtab, long) == 0) { - printf("[ %s symbol table has bad start address %p ]\n", - name, vsymtab); - return (FALSE); - } - - /* - * Find pointers to the start and end of the symbol entries, - * given a pointer to the start of the symbol table. - */ - sym_start = (struct nlist *)vsymtab; - sym_end = (struct nlist *)((char *)sym_start + symsize); - - strtab = (char *)sym_end; - if (ALIGNED_POINTER(strtab, int) == 0) { - printf("[ %s symbol table has bad string table address %p ]\n", - name, strtab); - return (FALSE); - } - slen = *(int *)strtab; - - estrtab = strtab + slen; - -#define round_to_size(x) \ - (((vaddr_t)(x) + sizeof(vsize_t) - 1) & ~(sizeof(vsize_t) - 1)) - - if (round_to_size(estrtab) != round_to_size(vesymtab)) { - printf("[ %s a.out symbol table not valid ]\n", name); - return (FALSE); - } -#undef round_to_size - - for (sp = sym_start; sp < sym_end; sp++) { - int strx; - strx = sp->n_un.n_strx; - if (strx != 0) { - if (strx > slen) { - printf("[ %s has bad a.out string table index " - "(0x%x) ]\n", - name, strx); - bad = 1; - continue; - } - } - } - - if (bad) - return (FALSE); - - if (db_add_symbol_table((char *)sym_start, (char *)sym_end, name, - NULL) != -1) { - printf("[ using %ld bytes of %s a.out symbol table ]\n", - (long)vesymtab - (long)vsymtab, name); - return (TRUE); - } - - return (FALSE); -} - -db_sym_t -db_aout_lookup(db_symtab_t *stab, char *symstr) -{ - struct nlist *sp, *ep; - char *n_name; - - sp = (struct nlist *)stab->start; - ep = (struct nlist *)stab->end; - - for (; sp < ep; sp++) { - if ((n_name = X_db_getname(stab, sp)) == 0) - continue; - if ((sp->n_type & N_STAB) == 0 && - db_eqname(n_name, symstr, '_')) - return ((db_sym_t)sp); - } - return ((db_sym_t)0); -} - -db_sym_t -db_aout_search_symbol(db_symtab_t *symtab, db_addr_t off, - db_strategy_t strategy, db_expr_t *diffp) -{ - unsigned int diff = *diffp; - struct nlist *symp = 0; - struct nlist *sp, *ep; - - sp = (struct nlist *)symtab->start; - ep = (struct nlist *)symtab->end; - - for (; sp < ep; sp++) { - if ((sp->n_type & N_STAB) != 0 || - (sp->n_type & N_TYPE) == N_FN) - continue; - if (X_db_getname(symtab, sp) == 0) - continue; - if (off >= sp->n_value) { - if (off - sp->n_value < diff) { - diff = off - sp->n_value; - symp = sp; - if (diff == 0 && ((strategy == DB_STGY_PROC && - sp->n_type == (N_TEXT|N_EXT)) || - (strategy == DB_STGY_ANY && - (sp->n_type & N_EXT)))) - break; - } else if (off - sp->n_value == diff) { - if (symp == 0) - symp = sp; - else if ((symp->n_type & N_EXT) == 0 && - (sp->n_type & N_EXT) != 0) - symp = sp; /* pick the ext. sym */ - } - } - } - if (symp == 0) { - *diffp = off; - } else { - *diffp = diff; - } - return ((db_sym_t)symp); -} - -/* - * Return the name and value for a symbol. - */ -void -db_aout_symbol_values(db_symtab_t *symtab, db_sym_t sym, char **namep, - db_expr_t *valuep) -{ - struct nlist *sp; - - sp = (struct nlist *)sym; - if (namep) - *namep = X_db_getname(symtab, sp); - if (valuep) - *valuep = sp->n_value; -} - - -boolean_t -db_aout_line_at_pc(db_symtab_t *symtab, db_sym_t cursym, char **filename, - int *linenum, db_expr_t off) -{ - struct nlist *sp, *ep; - unsigned long sodiff = -1UL, lndiff = -1UL, ln = 0; - char *fname = NULL; - - sp = (struct nlist *)symtab->start; - ep = (struct nlist *)symtab->end; - -/* XXX - gcc specific */ -#define NEWSRC(str) ((str) != NULL && \ - (str)[0] == 'g' && strcmp((str), "gcc_compiled.") == 0) - - for (; sp < ep; sp++) { - - /* - * Prevent bogus linenumbers in case module not compiled - * with debugging options - */ -#if 0 - if (sp->n_value <= off && (off - sp->n_value) <= sodiff && - NEWSRC(X_db_getname(symtab, sp))) { -#endif - if ((sp->n_type & N_TYPE) == N_FN || - NEWSRC(X_db_getname(symtab, sp))) { - sodiff = lndiff = -1UL; - ln = 0; - fname = NULL; - } - - if (sp->n_type == N_SO) { - if (sp->n_value <= off && - (off - sp->n_value) < sodiff) { - sodiff = off - sp->n_value; - fname = X_db_getname(symtab, sp); - } - continue; - } - - if (sp->n_type != N_SLINE) - continue; - - if (sp->n_value > off) - break; - - if (off - sp->n_value < lndiff) { - lndiff = off - sp->n_value; - ln = sp->n_desc; - } - } - - if (fname != NULL && ln != 0) { - *filename = fname; - *linenum = ln; - return (TRUE); - } - - return (FALSE); -} - -boolean_t -db_aout_sym_numargs(db_symtab_t *symtab, db_sym_t cursym, int *nargp, - char **argnamep) -{ - struct nlist *sp, *ep; - u_long addr; - int maxnarg = *nargp, nargs = 0; - char *n_name; - - if (cursym == NULL) - return (FALSE); - - addr = ((struct nlist *)cursym)->n_value; - sp = (struct nlist *)symtab->start; - ep = (struct nlist *)symtab->end; - - for (; sp < ep; sp++) { - if (sp->n_type == N_FUN && sp->n_value == addr) { - while (++sp < ep && sp->n_type == N_PSYM) { - if (nargs >= maxnarg) - break; - nargs++; - n_name = X_db_getname(symtab, sp); - *argnamep++ = n_name ? n_name : "???"; - { - /* XXX - remove trailers */ - char *cp = *(argnamep - 1); - - while (*cp != '\0' && *cp != ':') - cp++; - if (*cp == ':') *cp = '\0'; - } - } - *nargp = nargs; - return (TRUE); - } - } - return (FALSE); -} - -void -db_aout_forall(db_symtab_t *stab, db_forall_func_t db_forall_func, void *arg) -{ - static char suffix[2]; - struct nlist *sp, *ep; - - sp = (struct nlist *)stab->start; - ep = (struct nlist *)stab->end; - - for (; sp < ep; sp++) { - if (X_db_getname(stab, sp) == 0) - continue; - if ((sp->n_type & N_STAB) == 0) { - suffix[1] = '\0'; - switch(sp->n_type & N_TYPE) { - case N_ABS: - suffix[0] = '@'; - break; - case N_TEXT: - suffix[0] = '*'; - break; - case N_DATA: - suffix[0] = '+'; - break; - case N_BSS: - suffix[0] = '-'; - break; - case N_FN: - suffix[0] = '/'; - break; - default: - suffix[0] = '\0'; - } - (*db_forall_func)(stab, (db_sym_t)sp, - X_db_getname(stab, sp), suffix, '_', arg); - } - } - return; -} - - -#endif /* DB_AOUT_SYMBOLS */ diff --git a/sys/ddb/db_aout.h b/sys/ddb/db_aout.h deleted file mode 100644 index bfae8d3eb88..00000000000 --- a/sys/ddb/db_aout.h +++ /dev/null @@ -1,121 +0,0 @@ -/* $OpenBSD: db_aout.h,v 1.2 2003/06/02 23:28:01 millert Exp $ */ -/* $NetBSD: db_aout.h,v 1.1 1996/02/27 20:54:44 gwr Exp $ */ - -/*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * (c) UNIX System Laboratories, Inc. - * All or some portions of this file are derived from material licensed - * to the University of California by American Telephone and Telegraph - * Co. or Unix System Laboratories, Inc. and are reproduced herein with - * the permission of UNIX System Laboratories, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * This is an in-line expansion of "a.out.h" customized for ddb. - */ - -#ifndef _DB_AOUT_H_ -#define _DB_AOUT_H_ - -/* - * @(#)nlist.h 8.2 (Berkeley) 1/21/94 - */ - -/* - * Symbol table entry format. The #ifdef's are so that programs including - * nlist.h can initialize nlist structures statically. - */ -struct nlist { - union { - char *n_name; /* symbol name (in memory) */ - long n_strx; /* file string table offset (on disk) */ - } n_un; - -#define N_UNDF 0x00 /* undefined */ -#define N_ABS 0x02 /* absolute address */ -#define N_TEXT 0x04 /* text segment */ -#define N_DATA 0x06 /* data segment */ -#define N_BSS 0x08 /* bss segment */ -#define N_INDR 0x0a /* alias definition */ -#define N_SIZE 0x0c /* pseudo type, defines a symbol's size */ -#define N_COMM 0x12 /* common reference */ -#define N_FN 0x1e /* file name (N_EXT on) */ - -#define N_EXT 0x01 /* external (global) bit, OR'ed in */ -#define N_TYPE 0x1e /* mask for all the type bits */ - unsigned char n_type; /* type defines */ - - char n_other; /* spare */ -#define n_hash n_desc /* used internally by ld(1); XXX */ - short n_desc; /* used by stab entries */ - unsigned long n_value; /* address/value of the symbol */ -}; - -#define N_FORMAT "%08x" /* namelist value format; XXX */ -#define N_STAB 0x0e0 /* mask for debugger symbols -- stab(5) */ - -/* End nlist.h */ - -/* - * @(#)stab.h 5.2 (Berkeley) 4/4/91 - */ - -/* - * The following are symbols used by various debuggers and by the Pascal - * compiler. Each of them must have one (or more) of the bits defined by - * the N_STAB mask set. - */ - -#define N_GSYM 0x20 /* global symbol */ -#define N_FNAME 0x22 /* F77 function name */ -#define N_FUN 0x24 /* procedure name */ -#define N_STSYM 0x26 /* data segment variable */ -#define N_LCSYM 0x28 /* bss segment variable */ -#define N_MAIN 0x2a /* main function name */ -#define N_PC 0x30 /* global Pascal symbol */ -#define N_RSYM 0x40 /* register variable */ -#define N_SLINE 0x44 /* text segment line number */ -#define N_DSLINE 0x46 /* data segment line number */ -#define N_BSLINE 0x48 /* bss segment line number */ -#define N_SSYM 0x60 /* structure/union element */ -#define N_SO 0x64 /* main source file name */ -#define N_LSYM 0x80 /* stack variable */ -#define N_BINCL 0x82 /* include file beginning */ -#define N_SOL 0x84 /* included source file name */ -#define N_PSYM 0xa0 /* parameter variable */ -#define N_EINCL 0xa2 /* include file end */ -#define N_ENTRY 0xa4 /* alternate entry point */ -#define N_LBRAC 0xc0 /* left bracket */ -#define N_EXCL 0xc2 /* deleted include file */ -#define N_RBRAC 0xe0 /* right bracket */ -#define N_BCOMM 0xe2 /* begin common */ -#define N_ECOMM 0xe4 /* end common */ -#define N_ECOML 0xe8 /* end common (local name) */ -#define N_LENG 0xfe /* length of preceding entry */ - -#endif /* !_DB_AOUT_H_ */ diff --git a/sys/ddb/db_sym.c b/sys/ddb/db_sym.c index a7bc8153f1f..3b335ebabd5 100644 --- a/sys/ddb/db_sym.c +++ b/sys/ddb/db_sym.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_sym.c,v 1.32 2006/03/13 06:23:20 jsg Exp $ */ +/* $OpenBSD: db_sym.c,v 1.33 2013/10/17 08:02:19 deraadt Exp $ */ /* $NetBSD: db_sym.c,v 1.24 2000/08/11 22:50:47 tv Exp $ */ /* @@ -65,9 +65,6 @@ const db_symformat_t *db_symformats[] = { #ifdef DB_ELF_SYMBOLS &db_symformat_elf, #endif -#ifdef DB_AOUT_SYMBOLS - &db_symformat_aout, -#endif NULL, }; diff --git a/sys/ddb/db_sym.h b/sys/ddb/db_sym.h index 25f9f7f3264..2e1cf1fc6dd 100644 --- a/sys/ddb/db_sym.h +++ b/sys/ddb/db_sym.h @@ -147,9 +147,6 @@ boolean_t db_line_at_pc(db_sym_t, char **, int *, db_expr_t); int db_sym_numargs(db_sym_t, int *, char **); char *db_qualify(db_sym_t, const char *); -#ifdef DB_AOUT_SYMBOLS -extern db_symformat_t db_symformat_aout; -#endif #ifdef DB_ELF_SYMBOLS extern db_symformat_t db_symformat_elf; #endif diff --git a/sys/dev/ksyms.c b/sys/dev/ksyms.c index 086fdd1d9af..a82c222ee53 100644 --- a/sys/dev/ksyms.c +++ b/sys/dev/ksyms.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ksyms.c,v 1.22 2013/03/31 17:03:25 deraadt Exp $ */ +/* $OpenBSD: ksyms.c,v 1.23 2013/10/17 08:02:19 deraadt Exp $ */ /* * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> * Copyright (c) 2001 Artur Grabowski <art@openbsd.org> @@ -115,36 +115,6 @@ ksymsattach(int num) return; } while (0); #endif - -#ifdef _NLIST_DO_AOUT - { - /* - * a.out header. - * Fake up a struct exec. - * We only fill in the following non-zero entries: - * a_text - fake text segment (struct exec only) - * a_syms - size of symbol table - */ - caddr_t symtab = (char *)(&end + 1); - struct exec *k1; - - ksym_head_size = __LDPGSZ; - ksym_head = malloc(ksym_head_size, M_DEVBUF, M_NOWAIT | M_ZERO); - if (ksym_head == NULL) { - printf("failed to allocate memory for /dev/ksyms\n"); - return; - } - - k1 = (struct exec *)ksym_head; - - N_SETMAGIC(*k1, ZMAGIC, MID_MACHINE, 0); - k1->a_text = __LDPGSZ; - k1->a_syms = end; - - ksym_syms = symtab; - ksym_syms_size = (size_t)(esym - symtab); - } -#endif } /*ARGSUSED*/ diff --git a/sys/kern/exec_aout.c b/sys/kern/exec_aout.c deleted file mode 100644 index 8cc0da6b174..00000000000 --- a/sys/kern/exec_aout.c +++ /dev/null @@ -1,232 +0,0 @@ -/* $OpenBSD: exec_aout.c,v 1.11 2012/09/29 22:23:40 miod Exp $ */ -/* $NetBSD: exec_aout.c,v 1.14 1996/02/04 02:15:01 christos Exp $ */ - -/* - * Copyright (c) 1993, 1994 Christopher G. Demetriou - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Christopher G. Demetriou. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/proc.h> -#include <sys/malloc.h> -#include <sys/vnode.h> -#include <sys/exec.h> -#include <sys/resourcevar.h> -#include <uvm/uvm_extern.h> - -#if defined(_KERN_DO_AOUT) -#if defined(COMPAT_AOUT) -void aout_compat_setup(struct exec_package *epp); -#endif - -/* - * exec_aout_makecmds(): Check if it's an a.out-format executable. - * - * Given a proc pointer and an exec package pointer, see if the referent - * of the epp is in a.out format. First check 'standard' magic numbers for - * this architecture. If that fails, try a cpu-dependent hook. - * - * This function, in the former case, or the hook, in the latter, is - * responsible for creating a set of vmcmds which can be used to build - * the process's vm space and inserting them into the exec package. - */ - -int -exec_aout_makecmds(struct proc *p, struct exec_package *epp) -{ - u_long midmag, magic; - u_short mid; - int error; - struct exec *execp = epp->ep_hdr; - - if (epp->ep_hdrvalid < sizeof(struct exec)) - return ENOEXEC; - - midmag = ntohl(execp->a_midmag); - mid = (midmag >> 16) & 0x3ff; - magic = midmag & 0xffff; - - midmag = mid << 16 | magic; - - switch (midmag) { - case (MID_MACHINE << 16) | ZMAGIC: - error = exec_aout_prep_zmagic(p, epp); - break; - case (MID_MACHINE << 16) | NMAGIC: - error = exec_aout_prep_nmagic(p, epp); - break; - case (MID_MACHINE << 16) | OMAGIC: - error = exec_aout_prep_omagic(p, epp); - break; - default: - error = cpu_exec_aout_makecmds(p, epp); - } - - if (error) - kill_vmcmds(&epp->ep_vmcmds); -#ifdef COMPAT_AOUT - aout_compat_setup(epp); -#endif - - return error; -} - -/* - * exec_aout_prep_zmagic(): Prepare a 'native' ZMAGIC binary's exec package - * - * First, set of the various offsets/lengths in the exec package. - * - * Then, mark the text image busy (so it can be demand paged) or error - * out if this is not possible. Finally, set up vmcmds for the - * text, data, bss, and stack segments. - */ - -int -exec_aout_prep_zmagic(struct proc *p, struct exec_package *epp) -{ - struct exec *execp = epp->ep_hdr; - - epp->ep_taddr = USRTEXT; - epp->ep_tsize = execp->a_text; - epp->ep_daddr = epp->ep_taddr + execp->a_text; - epp->ep_dsize = execp->a_data + execp->a_bss; - epp->ep_entry = execp->a_entry; - - /* - * check if vnode is in open for writing, because we want to - * demand-page out of it. if it is, don't do it, for various - * reasons - */ - if ((execp->a_text != 0 || execp->a_data != 0) && - epp->ep_vp->v_writecount != 0) { -#ifdef DIAGNOSTIC - if (epp->ep_vp->v_flag & VTEXT) - panic("exec: a VTEXT vnode has writecount != 0"); -#endif - return ETXTBSY; - } - vn_marktext(epp->ep_vp); - - /* set up command for text segment */ - NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_pagedvn, execp->a_text, - epp->ep_taddr, epp->ep_vp, 0, VM_PROT_READ|VM_PROT_EXECUTE); - - /* set up command for data segment */ - NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_pagedvn, execp->a_data, - epp->ep_daddr, epp->ep_vp, execp->a_text, - VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE); - - /* set up command for bss segment */ - NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, execp->a_bss, - epp->ep_daddr + execp->a_data, NULLVP, 0, - VM_PROT_READ|VM_PROT_WRITE); - - return exec_setup_stack(p, epp); -} - -/* - * exec_aout_prep_nmagic(): Prepare a 'native' NMAGIC binary's exec package - */ - -int -exec_aout_prep_nmagic(struct proc *p, struct exec_package *epp) -{ - struct exec *execp = epp->ep_hdr; - long bsize, baddr; - - epp->ep_taddr = USRTEXT; - epp->ep_tsize = execp->a_text; - epp->ep_daddr = roundup(epp->ep_taddr + execp->a_text, __LDPGSZ); - epp->ep_dsize = execp->a_data + execp->a_bss; - epp->ep_entry = execp->a_entry; - - /* set up command for text segment */ - NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_readvn, execp->a_text, - epp->ep_taddr, epp->ep_vp, sizeof(struct exec), - VM_PROT_READ|VM_PROT_EXECUTE); - - /* set up command for data segment */ - NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_readvn, execp->a_data, - epp->ep_daddr, epp->ep_vp, execp->a_text + sizeof(struct exec), - VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE); - - /* set up command for bss segment */ - baddr = round_page(epp->ep_daddr + execp->a_data); - bsize = epp->ep_daddr + epp->ep_dsize - baddr; - if (bsize > 0) - NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, bsize, baddr, - NULLVP, 0, VM_PROT_READ|VM_PROT_WRITE); - - return exec_setup_stack(p, epp); -} - -/* - * exec_aout_prep_omagic(): Prepare a 'native' OMAGIC binary's exec package - */ - -int -exec_aout_prep_omagic(struct proc *p, struct exec_package *epp) -{ - struct exec *execp = epp->ep_hdr; - long dsize, bsize, baddr; - - epp->ep_taddr = USRTEXT; - epp->ep_tsize = execp->a_text; - epp->ep_daddr = epp->ep_taddr + execp->a_text; - epp->ep_dsize = execp->a_data + execp->a_bss; - epp->ep_entry = execp->a_entry; - - /* set up command for text and data segments */ - NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_readvn, - execp->a_text + execp->a_data, epp->ep_taddr, epp->ep_vp, - sizeof(struct exec), VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE); - - /* set up command for bss segment */ - baddr = round_page(epp->ep_daddr + execp->a_data); - bsize = epp->ep_daddr + epp->ep_dsize - baddr; - if (bsize > 0) - NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, bsize, baddr, - NULLVP, 0, VM_PROT_READ|VM_PROT_WRITE); - - /* - * Make sure (# of pages) mapped above equals (vm_tsize + vm_dsize); - * obreak(2) relies on this fact. Both `vm_tsize' and `vm_dsize' are - * computed (in execve(2)) by rounding *up* `ep_tsize' and `ep_dsize' - * respectively to page boundaries. - * Compensate `ep_dsize' for the amount of data covered by the last - * text page. - */ - dsize = epp->ep_dsize + execp->a_text - round_page(execp->a_text); - epp->ep_dsize = (dsize > 0) ? dsize : 0; - /* round to a page boundary, uvm depends on this */ - epp->ep_daddr = round_page(epp->ep_daddr); - return exec_setup_stack(p, epp); -} - -#endif /* _KERN_DO_AOUT */ diff --git a/sys/kern/exec_conf.c b/sys/kern/exec_conf.c index c12e806e566..9fb907405fb 100644 --- a/sys/kern/exec_conf.c +++ b/sys/kern/exec_conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exec_conf.c,v 1.29 2013/02/09 21:03:22 miod Exp $ */ +/* $OpenBSD: exec_conf.c,v 1.30 2013/10/17 08:02:19 deraadt Exp $ */ /* $NetBSD: exec_conf.c,v 1.16 1995/12/09 05:34:47 cgd Exp $ */ /* @@ -47,21 +47,10 @@ #include <compat/linux/linux_exec.h> #endif -extern struct emul emul_native, emul_elf32, emul_elf64, emul_aout, - emul_linux_elf, emul_linux_aout; +extern struct emul emul_native, emul_elf32, emul_elf64, emul_linux_elf; struct execsw execsw[] = { { EXEC_SCRIPT_HDRSZ, exec_script_makecmds, &emul_native, }, /* shell scripts */ -#ifdef _KERN_DO_AOUT -#ifdef COMPAT_AOUT - { sizeof(struct exec), exec_aout_makecmds, &emul_aout }, -#else - { sizeof(struct exec), exec_aout_makecmds, &emul_native }, /* a.out binaries */ -#endif -#endif -#ifdef _KERN_DO_ECOFF - { ECOFF_HDR_SIZE, exec_ecoff_makecmds, &emul_native }, /* ecoff binaries */ -#endif #ifdef _KERN_DO_ELF { sizeof(Elf32_Ehdr), exec_elf32_makecmds, &emul_native }, /* elf binaries */ #endif @@ -69,7 +58,6 @@ struct execsw execsw[] = { { sizeof(Elf64_Ehdr), exec_elf64_makecmds, &emul_native }, /* elf binaries */ #endif /* ELF64 */ #ifdef COMPAT_LINUX - { LINUX_AOUT_HDR_SIZE, exec_linux_aout_makecmds, &emul_linux_aout }, /* linux a.out */ { sizeof(Elf32_Ehdr), exec_linux_elf32_makecmds, &emul_linux_elf }, #endif #ifdef LKM diff --git a/sys/kern/exec_ecoff.c b/sys/kern/exec_ecoff.c deleted file mode 100644 index 4fe1bbbb513..00000000000 --- a/sys/kern/exec_ecoff.c +++ /dev/null @@ -1,213 +0,0 @@ -/* $OpenBSD: exec_ecoff.c,v 1.10 2005/11/12 04:31:24 jsg Exp $ */ -/* $NetBSD: exec_ecoff.c,v 1.8 1996/05/19 20:36:06 jonathan Exp $ */ - -/* - * Copyright (c) 1994 Adam Glass - * Copyright (c) 1993, 1994, 1996 Christopher G. Demetriou - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Christopher G. Demetriou. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/proc.h> -#include <sys/malloc.h> -#include <sys/vnode.h> -#include <sys/exec.h> -#include <sys/resourcevar.h> -#include <uvm/uvm_extern.h> - -#if defined(_KERN_DO_ECOFF) - -#include <sys/exec_ecoff.h> - -/* - * exec_ecoff_makecmds(): Check if it's an ecoff-format executable. - * - * Given a proc pointer and an exec package pointer, see if the referent - * of the epp is in ecoff format. Check 'standard' magic numbers for - * this architecture. If that fails, return failure. - * - * This function is responsible for creating a set of vmcmds which can be - * used to build the process's vm space and inserting them into the exec - * package. - */ -int -exec_ecoff_makecmds(struct proc *p, struct exec_package *epp) -{ - int error; - struct ecoff_exechdr *execp = epp->ep_hdr; - - if (epp->ep_hdrvalid < ECOFF_HDR_SIZE) - return ENOEXEC; - - if (ECOFF_BADMAG(execp)) - return ENOEXEC; - - switch (execp->a.magic) { - case ECOFF_OMAGIC: - error = exec_ecoff_prep_omagic(p, epp); - break; - case ECOFF_NMAGIC: - error = exec_ecoff_prep_nmagic(p, epp); - break; - case ECOFF_ZMAGIC: - error = exec_ecoff_prep_zmagic(p, epp); - break; - default: - return ENOEXEC; - } - - if (error == 0) - error = cpu_exec_ecoff_hook(p, epp); - - if (error) - kill_vmcmds(&epp->ep_vmcmds); - - return error; -} - -/* - * exec_ecoff_prep_omagic(): Prepare a ECOFF OMAGIC binary's exec package - */ -int -exec_ecoff_prep_omagic(struct proc *p, struct exec_package *epp) -{ - struct ecoff_exechdr *execp = epp->ep_hdr; - struct ecoff_aouthdr *eap = &execp->a; - - epp->ep_taddr = ECOFF_SEGMENT_ALIGN(execp, eap->text_start); - epp->ep_tsize = eap->tsize; - epp->ep_daddr = ECOFF_SEGMENT_ALIGN(execp, eap->data_start); - epp->ep_dsize = eap->dsize + eap->bsize; - epp->ep_entry = eap->entry; - - /* set up command for text and data segments */ - NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_readvn, - eap->tsize + eap->dsize, epp->ep_taddr, epp->ep_vp, - ECOFF_TXTOFF(execp), - VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE); - - /* set up command for bss segment */ - if (eap->bsize > 0) - NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, eap->bsize, - ECOFF_SEGMENT_ALIGN(execp, eap->bss_start), NULLVP, 0, - VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE); - - return exec_setup_stack(p, epp); -} - -/* - * exec_ecoff_prep_nmagic(): Prepare a 'native' NMAGIC ECOFF binary's exec - * package. - */ -int -exec_ecoff_prep_nmagic(struct proc *p, struct exec_package *epp) -{ - struct ecoff_exechdr *execp = epp->ep_hdr; - struct ecoff_aouthdr *eap = &execp->a; - - epp->ep_taddr = ECOFF_SEGMENT_ALIGN(execp, eap->text_start); - epp->ep_tsize = eap->tsize; - epp->ep_daddr = ECOFF_ROUND(eap->data_start, ECOFF_LDPGSZ); - epp->ep_dsize = eap->dsize + eap->bsize; - epp->ep_entry = eap->entry; - - /* set up command for text segment */ - NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_readvn, epp->ep_tsize, - epp->ep_taddr, epp->ep_vp, ECOFF_TXTOFF(execp), - VM_PROT_READ|VM_PROT_EXECUTE); - - /* set up command for data segment */ - NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_readvn, epp->ep_dsize, - epp->ep_daddr, epp->ep_vp, ECOFF_DATOFF(execp), - VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE); - - /* set up command for bss segment */ - if (eap->bsize > 0) - NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, eap->bsize, - ECOFF_SEGMENT_ALIGN(execp, eap->bss_start), NULLVP, 0, - VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE); - - return exec_setup_stack(p, epp); -} - -/* - * exec_ecoff_prep_zmagic(): Prepare a ECOFF ZMAGIC binary's exec package - * - * First, set the various offsets/lengths in the exec package. - * - * Then, mark the text image busy (so it can be demand paged) or error - * out if this is not possible. Finally, set up vmcmds for the - * text, data, bss, and stack segments. - */ -int -exec_ecoff_prep_zmagic(struct proc *p, struct exec_package *epp) -{ - struct ecoff_exechdr *execp = epp->ep_hdr; - struct ecoff_aouthdr *eap = &execp->a; - - epp->ep_taddr = ECOFF_SEGMENT_ALIGN(execp, eap->text_start); - epp->ep_tsize = eap->tsize; - epp->ep_daddr = ECOFF_SEGMENT_ALIGN(execp, eap->data_start); - epp->ep_dsize = eap->dsize + eap->bsize; - epp->ep_entry = eap->entry; - - /* - * check if vnode is in open for writing, because we want to - * demand-page out of it. if it is, don't do it, for various - * reasons - */ - if ((eap->tsize != 0 || eap->dsize != 0) && - epp->ep_vp->v_writecount != 0) { -#ifdef DIAGNOSTIC - if (epp->ep_vp->v_flag & VTEXT) - panic("exec: a VTEXT vnode has writecount != 0"); -#endif - return ETXTBSY; - } - vn_marktext(epp->ep_vp); - - /* set up command for text segment */ - NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_pagedvn, eap->tsize, - epp->ep_taddr, epp->ep_vp, ECOFF_TXTOFF(execp), - VM_PROT_READ|VM_PROT_EXECUTE); - - /* set up command for data segment */ - NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_pagedvn, eap->dsize, - epp->ep_daddr, epp->ep_vp, ECOFF_DATOFF(execp), - VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE); - - /* set up command for bss segment */ - NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, eap->bsize, - ECOFF_SEGMENT_ALIGN(execp, eap->bss_start), NULLVP, 0, - VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE); - - return exec_setup_stack(p, epp); -} - -#endif /* _KERN_DO_ECOFF */ diff --git a/sys/sys/exec.h b/sys/sys/exec.h index ecb4239d40b..81c13a7ca1b 100644 --- a/sys/sys/exec.h +++ b/sys/sys/exec.h @@ -1,4 +1,4 @@ -/* $OpenBSD: exec.h,v 1.26 2012/08/20 23:25:07 matthew Exp $ */ +/* $OpenBSD: exec.h,v 1.27 2013/10/17 08:02:20 deraadt Exp $ */ /* $NetBSD: exec.h,v 1.59 1996/02/09 18:25:09 christos Exp $ */ /*- @@ -236,7 +236,159 @@ extern int exec_maxhdrsz; #endif /* _KERNEL */ -#include <sys/exec_aout.h> +#ifndef N_PAGSIZ +#define N_PAGSIZ(ex) (__LDPGSZ) +#endif + +/* + * Legacy a.out structures and defines; start deleting these when + * external use no longer exist. + */ + + +/* + * Header prepended to each a.out file. + * only manipulate the a_midmag field via the + * N_SETMAGIC/N_GET{MAGIC,MID,FLAG} macros below. + */ +struct exec { + u_int32_t a_midmag; /* htonl(flags<<26|mid<<16|magic) */ + u_int32_t a_text; /* text segment size */ + u_int32_t a_data; /* initialized data size */ + u_int32_t a_bss; /* uninitialized data size */ + u_int32_t a_syms; /* symbol table size */ + u_int32_t a_entry; /* entry point */ + u_int32_t a_trsize; /* text relocation size */ + u_int32_t a_drsize; /* data relocation size */ +}; + +/* a_magic */ +#define OMAGIC 0407 /* old impure format */ +#define NMAGIC 0410 /* read-only text */ +#define ZMAGIC 0413 /* demand load format */ +#define QMAGIC 0314 /* "compact" demand load format; deprecated */ + +/* + * a_mid - keep sorted in numerical order for sanity's sake + * ensure that: 0 < mid < 0x3ff + */ +#define MID_ZERO 0 /* unknown - implementation dependent */ +#define MID_SUN010 1 /* sun 68010/68020 binary */ +#define MID_SUN020 2 /* sun 68020-only binary */ +#define MID_PC386 100 /* 386 PC binary. (so quoth BFD) */ +#define MID_ROMPAOS 104 /* old IBM RT */ +#define MID_I386 134 /* i386 BSD binary */ +#define MID_M68K 135 /* m68k BSD binary with 8K page sizes */ +#define MID_M68K4K 136 /* DO NOT USE: m68k BSD binary with 4K page sizes */ +#define MID_NS32532 137 /* ns32532 */ +#define MID_SPARC 138 /* sparc */ +#define MID_PMAX 139 /* pmax */ +#define MID_VAX1K 140 /* vax 1k page size */ +#define MID_ALPHA 141 /* Alpha BSD binary */ +#define MID_MIPS 142 /* big-endian MIPS */ +#define MID_ARM6 143 /* ARM6 */ +#define MID_SH3 145 /* SH3 */ +#define MID_POWERPC 149 /* big-endian PowerPC */ +#define MID_VAX 150 /* vax */ +#define MID_SPARC64 151 /* LP64 sparc */ +#define MID_MIPS2 152 /* MIPS2 */ +#define MID_M88K 153 /* m88k BSD binary */ +#define MID_HPPA 154 /* hppa */ +#define MID_AMD64 157 /* AMD64 */ +#define MID_MIPS64 158 /* big-endian MIPS64 */ +#define MID_HP200 200 /* hp200 (68010) BSD binary */ +#define MID_HP300 300 /* hp300 (68020+68881) BSD binary */ +#define MID_HPUX 0x20C /* hp200/300 HP-UX binary */ +#define MID_HPUX800 0x20B /* hp800 HP-UX binary pa1.0 */ +#define MID_HPPA11 0x210 /* hp700 HP-UX binary pa1.1 */ +#define MID_HPPA20 0x214 /* hp700 HP-UX binary pa2.0 */ + +/* + * a_flags + */ +#define EX_DYNAMIC 0x20 +#define EX_PIC 0x10 +#define EX_DPMASK 0x30 +/* + * Interpretation of the (a_flags & EX_DPMASK) bits: + * + * 00 traditional executable or object file + * 01 object file contains PIC code (set by `as -k') + * 10 dynamic executable + * 11 position independent executable image + * (eg. a shared library) + * + */ + +/* + * The a.out structure's a_midmag field is a network-byteorder encoding + * of this int + * FFFFFFmmmmmmmmmmMMMMMMMMMMMMMMMM + * Where `F' is 6 bits of flag like EX_DYNAMIC, + * `m' is 10 bits of machine-id like MID_I386, and + * `M' is 16 bits worth of magic number, ie. ZMAGIC. + * The macros below will set/get the needed fields. + */ +#define N_GETMAGIC(ex) \ + ( (((ex).a_midmag)&0xffff0000) ? (ntohl(((ex).a_midmag))&0xffff) : ((ex).a_midmag)) +#define N_GETMAGIC2(ex) \ + ( (((ex).a_midmag)&0xffff0000) ? (ntohl(((ex).a_midmag))&0xffff) : \ + (((ex).a_midmag) | 0x10000) ) +#define N_GETMID(ex) \ + ( (((ex).a_midmag)&0xffff0000) ? ((ntohl(((ex).a_midmag))>>16)&0x03ff) : MID_ZERO ) +#define N_GETFLAG(ex) \ + ( (((ex).a_midmag)&0xffff0000) ? ((ntohl(((ex).a_midmag))>>26)&0x3f) : 0 ) +#define N_SETMAGIC(ex,mag,mid,flag) \ + ( (ex).a_midmag = htonl( (((flag)&0x3f)<<26) | (((mid)&0x03ff)<<16) | \ + (((mag)&0xffff)) ) ) + +#define N_ALIGN(ex,x) \ + (N_GETMAGIC(ex) == ZMAGIC || N_GETMAGIC(ex) == QMAGIC ? \ + ((x) + __LDPGSZ - 1) & ~(__LDPGSZ - 1) : (x)) + +/* Valid magic number check. */ +#define N_BADMAG(ex) \ + (N_GETMAGIC(ex) != NMAGIC && N_GETMAGIC(ex) != OMAGIC && \ + N_GETMAGIC(ex) != ZMAGIC && N_GETMAGIC(ex) != QMAGIC) + +/* Address of the bottom of the text segment. */ +#define N_TXTADDR(ex) (N_GETMAGIC2(ex) == (ZMAGIC|0x10000) ? 0 : __LDPGSZ) + +/* Address of the bottom of the data segment. */ +#define N_DATADDR(ex) \ + (N_GETMAGIC(ex) == OMAGIC ? N_TXTADDR(ex) + (ex).a_text : \ + (N_TXTADDR(ex) + (ex).a_text + __LDPGSZ - 1) & ~(__LDPGSZ - 1)) + +/* Address of the bottom of the bss segment. */ +#define N_BSSADDR(ex) \ + (N_DATADDR(ex) + (ex).a_data) + +/* Text segment offset. */ +#define N_TXTOFF(ex) \ + ( N_GETMAGIC2(ex)==ZMAGIC || N_GETMAGIC2(ex)==(QMAGIC|0x10000) ? \ + 0 : (N_GETMAGIC2(ex)==(ZMAGIC|0x10000) ? __LDPGSZ : \ + sizeof(struct exec)) ) + +/* Data segment offset. */ +#define N_DATOFF(ex) \ + N_ALIGN(ex, N_TXTOFF(ex) + (ex).a_text) + +/* Text relocation table offset. */ +#define N_TRELOFF(ex) \ + (N_DATOFF(ex) + (ex).a_data) + +/* Data relocation table offset. */ +#define N_DRELOFF(ex) \ + (N_TRELOFF(ex) + (ex).a_trsize) + +/* Symbol table offset. */ +#define N_SYMOFF(ex) \ + (N_DRELOFF(ex) + (ex).a_drsize) + +/* String table offset. */ +#define N_STROFF(ex) \ + (N_SYMOFF(ex) + (ex).a_syms) + #include <machine/exec.h> #endif /* !_SYS_EXEC_H_ */ diff --git a/sys/sys/exec_aout.h b/sys/sys/exec_aout.h deleted file mode 100644 index e343c185577..00000000000 --- a/sys/sys/exec_aout.h +++ /dev/null @@ -1,202 +0,0 @@ -/* $OpenBSD: exec_aout.h,v 1.23 2013/03/26 16:39:08 tedu Exp $ */ -/* $NetBSD: exec_aout.h,v 1.15 1996/05/18 17:20:54 christos Exp $ */ - -/* - * Copyright (c) 1993, 1994 Christopher G. Demetriou - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Christopher G. Demetriou. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef N_PAGSIZ -#define N_PAGSIZ(ex) (__LDPGSZ) -#endif - -/* - * Header prepended to each a.out file. - * only manipulate the a_midmag field via the - * N_SETMAGIC/N_GET{MAGIC,MID,FLAG} macros below. - */ -struct exec { - u_int32_t a_midmag; /* htonl(flags<<26|mid<<16|magic) */ - u_int32_t a_text; /* text segment size */ - u_int32_t a_data; /* initialized data size */ - u_int32_t a_bss; /* uninitialized data size */ - u_int32_t a_syms; /* symbol table size */ - u_int32_t a_entry; /* entry point */ - u_int32_t a_trsize; /* text relocation size */ - u_int32_t a_drsize; /* data relocation size */ -}; - -/* a_magic */ -#define OMAGIC 0407 /* old impure format */ -#define NMAGIC 0410 /* read-only text */ -#define ZMAGIC 0413 /* demand load format */ -#define QMAGIC 0314 /* "compact" demand load format; deprecated */ - -/* - * a_mid - keep sorted in numerical order for sanity's sake - * ensure that: 0 < mid < 0x3ff - */ -#define MID_ZERO 0 /* unknown - implementation dependent */ -#define MID_SUN010 1 /* sun 68010/68020 binary */ -#define MID_SUN020 2 /* sun 68020-only binary */ -#define MID_PC386 100 /* 386 PC binary. (so quoth BFD) */ -#define MID_ROMPAOS 104 /* old IBM RT */ -#define MID_I386 134 /* i386 BSD binary */ -#define MID_M68K 135 /* m68k BSD binary with 8K page sizes */ -#define MID_M68K4K 136 /* DO NOT USE: m68k BSD binary with 4K page sizes */ -#define MID_NS32532 137 /* ns32532 */ -#define MID_SPARC 138 /* sparc */ -#define MID_PMAX 139 /* pmax */ -#define MID_VAX1K 140 /* vax 1k page size */ -#define MID_ALPHA 141 /* Alpha BSD binary */ -#define MID_MIPS 142 /* big-endian MIPS */ -#define MID_ARM6 143 /* ARM6 */ -#define MID_SH3 145 /* SH3 */ -#define MID_POWERPC 149 /* big-endian PowerPC */ -#define MID_VAX 150 /* vax */ -#define MID_SPARC64 151 /* LP64 sparc */ -#define MID_MIPS2 152 /* MIPS2 */ -#define MID_M88K 153 /* m88k BSD binary */ -#define MID_HPPA 154 /* hppa */ -#define MID_AMD64 157 /* AMD64 */ -#define MID_MIPS64 158 /* big-endian MIPS64 */ -#define MID_HP200 200 /* hp200 (68010) BSD binary */ -#define MID_HP300 300 /* hp300 (68020+68881) BSD binary */ -#define MID_HPUX 0x20C /* hp200/300 HP-UX binary */ -#define MID_HPUX800 0x20B /* hp800 HP-UX binary pa1.0 */ -#define MID_HPPA11 0x210 /* hp700 HP-UX binary pa1.1 */ -#define MID_HPPA20 0x214 /* hp700 HP-UX binary pa2.0 */ - -/* - * a_flags - */ -#define EX_DYNAMIC 0x20 -#define EX_PIC 0x10 -#define EX_DPMASK 0x30 -/* - * Interpretation of the (a_flags & EX_DPMASK) bits: - * - * 00 traditional executable or object file - * 01 object file contains PIC code (set by `as -k') - * 10 dynamic executable - * 11 position independent executable image - * (eg. a shared library) - * - */ - -/* - * The a.out structure's a_midmag field is a network-byteorder encoding - * of this int - * FFFFFFmmmmmmmmmmMMMMMMMMMMMMMMMM - * Where `F' is 6 bits of flag like EX_DYNAMIC, - * `m' is 10 bits of machine-id like MID_I386, and - * `M' is 16 bits worth of magic number, ie. ZMAGIC. - * The macros below will set/get the needed fields. - */ -#define N_GETMAGIC(ex) \ - ( (((ex).a_midmag)&0xffff0000) ? (ntohl(((ex).a_midmag))&0xffff) : ((ex).a_midmag)) -#define N_GETMAGIC2(ex) \ - ( (((ex).a_midmag)&0xffff0000) ? (ntohl(((ex).a_midmag))&0xffff) : \ - (((ex).a_midmag) | 0x10000) ) -#define N_GETMID(ex) \ - ( (((ex).a_midmag)&0xffff0000) ? ((ntohl(((ex).a_midmag))>>16)&0x03ff) : MID_ZERO ) -#define N_GETFLAG(ex) \ - ( (((ex).a_midmag)&0xffff0000) ? ((ntohl(((ex).a_midmag))>>26)&0x3f) : 0 ) -#define N_SETMAGIC(ex,mag,mid,flag) \ - ( (ex).a_midmag = htonl( (((flag)&0x3f)<<26) | (((mid)&0x03ff)<<16) | \ - (((mag)&0xffff)) ) ) - -#define N_ALIGN(ex,x) \ - (N_GETMAGIC(ex) == ZMAGIC || N_GETMAGIC(ex) == QMAGIC ? \ - ((x) + __LDPGSZ - 1) & ~(__LDPGSZ - 1) : (x)) - -/* Valid magic number check. */ -#define N_BADMAG(ex) \ - (N_GETMAGIC(ex) != NMAGIC && N_GETMAGIC(ex) != OMAGIC && \ - N_GETMAGIC(ex) != ZMAGIC && N_GETMAGIC(ex) != QMAGIC) - -/* Address of the bottom of the text segment. */ -#define N_TXTADDR(ex) (N_GETMAGIC2(ex) == (ZMAGIC|0x10000) ? 0 : __LDPGSZ) - -/* Address of the bottom of the data segment. */ -#define N_DATADDR(ex) \ - (N_GETMAGIC(ex) == OMAGIC ? N_TXTADDR(ex) + (ex).a_text : \ - (N_TXTADDR(ex) + (ex).a_text + __LDPGSZ - 1) & ~(__LDPGSZ - 1)) - -/* Address of the bottom of the bss segment. */ -#define N_BSSADDR(ex) \ - (N_DATADDR(ex) + (ex).a_data) - -/* Text segment offset. */ -#define N_TXTOFF(ex) \ - ( N_GETMAGIC2(ex)==ZMAGIC || N_GETMAGIC2(ex)==(QMAGIC|0x10000) ? \ - 0 : (N_GETMAGIC2(ex)==(ZMAGIC|0x10000) ? __LDPGSZ : \ - sizeof(struct exec)) ) - -/* Data segment offset. */ -#define N_DATOFF(ex) \ - N_ALIGN(ex, N_TXTOFF(ex) + (ex).a_text) - -/* Text relocation table offset. */ -#define N_TRELOFF(ex) \ - (N_DATOFF(ex) + (ex).a_data) - -/* Data relocation table offset. */ -#define N_DRELOFF(ex) \ - (N_TRELOFF(ex) + (ex).a_trsize) - -/* Symbol table offset. */ -#define N_SYMOFF(ex) \ - (N_DRELOFF(ex) + (ex).a_drsize) - -/* String table offset. */ -#define N_STROFF(ex) \ - (N_SYMOFF(ex) + (ex).a_syms) - - -#ifdef _KERNEL - -/* the "a.out" format's entry in the exec switch */ -int exec_aout_makecmds(struct proc *, struct exec_package *); - -/* functions which prepare various a.out executable types */ -/* - * MI portion - */ -int exec_aout_prep_zmagic(struct proc *, struct exec_package *); -int exec_aout_prep_nmagic(struct proc *, struct exec_package *); -int exec_aout_prep_omagic(struct proc *, struct exec_package *); - -/* - * MD portion - */ -#if !defined(cpu_exec_aout_makecmds) -int cpu_exec_aout_makecmds(struct proc *, struct exec_package *); -#endif - -#endif /* _KERNEL */ diff --git a/sys/sys/exec_ecoff.h b/sys/sys/exec_ecoff.h deleted file mode 100644 index 1e9682851bb..00000000000 --- a/sys/sys/exec_ecoff.h +++ /dev/null @@ -1,113 +0,0 @@ -/* $OpenBSD: exec_ecoff.h,v 1.7 2002/03/14 01:27:14 millert Exp $ */ -/* $NetBSD: exec_ecoff.h,v 1.9 1996/05/09 23:42:08 cgd Exp $ */ - -/* - * Copyright (c) 1994 Adam Glass - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Adam Glass. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _SYS_EXEC_ECOFF_H_ -#define _SYS_EXEC_ECOFF_H_ - -#include <machine/ecoff_machdep.h> - -struct ecoff_filehdr { - u_short f_magic; /* magic number */ - u_short f_nscns; /* # of sections */ - u_int f_timdat; /* time and date stamp */ - u_long f_symptr; /* file offset of symbol table */ - u_int f_nsyms; /* # of symbol table entries */ - u_short f_opthdr; /* sizeof the optional header */ - u_short f_flags; /* flags??? */ -}; - -struct ecoff_aouthdr { - u_short magic; - u_short vstamp; - ECOFF_PAD - u_long tsize; - u_long dsize; - u_long bsize; - u_long entry; - u_long text_start; - u_long data_start; - u_long bss_start; - ECOFF_MACHDEP; -}; - -struct ecoff_scnhdr { /* needed for size info */ - char s_name[8]; /* name */ - u_long s_paddr; /* physical addr? for ROMing?*/ - u_long s_vaddr; /* virtual addr? */ - u_long s_size; /* size */ - u_long s_scnptr; /* file offset of raw data */ - u_long s_relptr; /* file offset of reloc data */ - u_long s_lnnoptr; /* file offset of line data */ - u_short s_nreloc; /* # of relocation entries */ - u_short s_nlnno; /* # of line entries */ - u_int s_flags; /* flags */ -}; - -struct ecoff_exechdr { - struct ecoff_filehdr f; - struct ecoff_aouthdr a; -}; - -#define ECOFF_HDR_SIZE (sizeof(struct ecoff_exechdr)) - -#define ECOFF_OMAGIC 0407 -#define ECOFF_NMAGIC 0410 -#define ECOFF_ZMAGIC 0413 - -#define ECOFF_ROUND(value, by) \ - (((value) + (by) - 1) & ~((by) - 1)) - -#define ECOFF_BLOCK_ALIGN(ep, value) \ - ((ep)->a.magic == ECOFF_ZMAGIC ? ECOFF_ROUND((value), ECOFF_LDPGSZ) : \ - (value)) - -#define ECOFF_TXTOFF(ep) \ - ((ep)->a.magic == ECOFF_ZMAGIC ? 0 : \ - ECOFF_ROUND(ECOFF_HDR_SIZE + (ep)->f.f_nscns * \ - sizeof(struct ecoff_scnhdr), ECOFF_SEGMENT_ALIGNMENT(ep))) - -#define ECOFF_DATOFF(ep) \ - (ECOFF_BLOCK_ALIGN((ep), ECOFF_TXTOFF(ep) + (ep)->a.tsize)) - -#define ECOFF_SEGMENT_ALIGN(ep, value) \ - (ECOFF_ROUND((value), ((ep)->a.magic == ECOFF_ZMAGIC ? ECOFF_LDPGSZ : \ - ECOFF_SEGMENT_ALIGNMENT(ep)))) - -#ifdef _KERNEL -int exec_ecoff_makecmds(struct proc *, struct exec_package *); -int cpu_exec_ecoff_hook(struct proc *, struct exec_package *); -int exec_ecoff_prep_omagic(struct proc *, struct exec_package *); -int exec_ecoff_prep_nmagic(struct proc *, struct exec_package *); -int exec_ecoff_prep_zmagic(struct proc *, struct exec_package *); -#endif /* _KERNEL */ -#endif /* !_SYS_EXEC_ECOFF_H_ */ |