1 /*- 2 * Copyright (c) 1995-1996 S�ren Schmidt 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer 10 * in this position and unchanged. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 3. The name of the author may not be used to endorse or promote products 15 * derived from this software withough specific prior written permission 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * 28 * $FreeBSD: src/sys/sys/imgact_elf.h,v 1.17.2.1 2000/07/06 22:26:40 obrien Exp $ 29 * $DragonFly: src/sys/sys/imgact_elf.h,v 1.9 2008/07/23 17:22:33 dillon Exp $ 30 */ 31 32 #ifndef _SYS_IMGACT_ELF_H_ 33 #define _SYS_IMGACT_ELF_H_ 34 35 #include <sys/elf_common.h> 36 #include <machine/elf.h> 37 38 #ifdef _KERNEL 39 40 #define AUXARGS_ENTRY(pos, id, val) {suword(pos++, id); suword(pos++, val);} 41 42 #if ELF_TARG_CLASS == ELFCLASS32 43 44 /* 45 * Structure used to pass infomation from the loader to the 46 * stack fixup routine. 47 */ 48 typedef struct { 49 Elf32_Sword execfd; 50 Elf32_Size phdr; 51 Elf32_Size phent; 52 Elf32_Size phnum; 53 Elf32_Size pagesz; 54 Elf32_Size base; 55 Elf32_Size flags; 56 Elf32_Size entry; 57 Elf32_Size trace; 58 } Elf32_Auxargs; 59 60 typedef struct { 61 int brand; 62 const char *compat_3_brand; /* pre Binutils 2.10 method (FBSD 3) */ 63 int (*match_abi_note)(const Elf_Note *); 64 const char *emul_path; 65 const char *interp_path; 66 struct sysentvec *sysvec; 67 } Elf32_Brandinfo; 68 69 #define MAX_BRANDS 8 70 71 int elf_brand_inuse (Elf32_Brandinfo *entry); 72 int elf_insert_brand_entry (Elf32_Brandinfo *entry); 73 int elf_remove_brand_entry (Elf32_Brandinfo *entry); 74 75 #else /* !(ELF_TARG_CLASS == ELFCLASS32) */ 76 77 /* 78 * Structure used to pass infomation from the loader to the 79 * stack fixup routine. 80 */ 81 typedef struct { 82 Elf64_Ssize execfd; 83 Elf64_Size phdr; 84 Elf64_Size phent; 85 Elf64_Size phnum; 86 Elf64_Size pagesz; 87 Elf64_Size base; 88 Elf64_Size flags; 89 Elf64_Size entry; 90 Elf64_Size trace; 91 } Elf64_Auxargs; 92 93 typedef struct { 94 int brand; 95 const char *compat_3_brand; /* pre Binutils 2.10 method (FBSD 3) */ 96 int (*match_abi_note)(const Elf_Note *); 97 const char *emul_path; 98 const char *interp_path; 99 struct sysentvec *sysvec; 100 } Elf64_Brandinfo; 101 102 #define MAX_BRANDS 8 103 104 int elf_brand_inuse (Elf64_Brandinfo *entry); 105 int elf_insert_brand_entry (Elf64_Brandinfo *entry); 106 int elf_remove_brand_entry (Elf64_Brandinfo *entry); 107 108 #endif /* ELF_TARG_CLASS == ELFCLASS32 */ 109 110 struct lwp; 111 struct file; 112 struct vnode; 113 114 int elf_coredump (struct lwp *, int, struct vnode *, off_t); 115 int generic_elf_coredump(struct lwp *lp, int sig, struct file *fp, off_t limit); 116 #endif /* _KERNEL */ 117 118 #endif /* !_SYS_IMGACT_ELF_H_ */ 119