cputimer_intr_reload() - prevent a negatively indexed or too-small a reload
[dragonfly.git] / sys / sys / imgact_elf.h
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.6 2005/05/31 17:45:19 joerg 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_Word      phdr;
51         Elf32_Word      phent;
52         Elf32_Word      phnum;
53         Elf32_Word      pagesz;
54         Elf32_Word      base;
55         Elf32_Word      flags;
56         Elf32_Word      entry;
57         Elf32_Word      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_Sword     execfd;
83         Elf64_Addr      phdr;
84         Elf64_Word      phent;
85         Elf64_Word      phnum;
86         Elf64_Word      pagesz;
87         Elf64_Addr      base;
88         Elf64_Word      flags;
89         Elf64_Addr      entry;
90         Elf64_Word      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         const char *emul_path;
97         const char *interp_path;
98         struct sysentvec *sysvec;
99 } Elf64_Brandinfo;
100
101 #define MAX_BRANDS      8
102
103 int     elf_brand_inuse        (Elf64_Brandinfo *entry);
104 int     elf_insert_brand_entry (Elf64_Brandinfo *entry);
105 int     elf_remove_brand_entry (Elf64_Brandinfo *entry);
106
107 #endif /* ELF_TARG_CLASS == ELFCLASS32 */
108
109 struct proc;
110 struct file;
111 struct vnode;
112
113 int     elf_coredump (struct proc *, struct vnode *, off_t);
114 int     generic_elf_coredump(struct proc *p, struct file *fp, off_t limit);
115 #endif /* _KERNEL */
116
117 #endif /* !_SYS_IMGACT_ELF_H_ */