imgact_elf.h revision 43596
1191783Srmacklem/*-
2191783Srmacklem * Copyright (c) 1995-1996 S�ren Schmidt
3191783Srmacklem * All rights reserved.
4191783Srmacklem *
5191783Srmacklem * Redistribution and use in source and binary forms, with or without
6191783Srmacklem * modification, are permitted provided that the following conditions
7191783Srmacklem * are met:
8191783Srmacklem * 1. Redistributions of source code must retain the above copyright
9191783Srmacklem *    notice, this list of conditions and the following disclaimer
10191783Srmacklem *    in this position and unchanged.
11191783Srmacklem * 2. Redistributions in binary form must reproduce the above copyright
12191783Srmacklem *    notice, this list of conditions and the following disclaimer in the
13191783Srmacklem *    documentation and/or other materials provided with the distribution.
14191783Srmacklem * 3. The name of the author may not be used to endorse or promote products
15191783Srmacklem *    derived from this software withough specific prior written permission
16191783Srmacklem *
17191783Srmacklem * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18191783Srmacklem * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19191783Srmacklem * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20191783Srmacklem * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21191783Srmacklem * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22191783Srmacklem * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23191783Srmacklem * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24191783Srmacklem * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25191783Srmacklem * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26191783Srmacklem * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27191783Srmacklem *
28191783Srmacklem *	$Id: imgact_elf.h,v 1.10 1999/01/01 14:30:11 bde Exp $
29191783Srmacklem */
30191783Srmacklem
31191783Srmacklem#ifndef _SYS_IMGACT_ELF_H_
32191783Srmacklem#define _SYS_IMGACT_ELF_H_
33191783Srmacklem
34191783Srmacklem#include <machine/elf.h>
35191783Srmacklem
36191783Srmacklem#ifdef KERNEL
37224778Srwatson
38224778Srwatson#define AUXARGS_ENTRY(pos, id, val) {suword(pos++, id); suword(pos++, val);}
39191783Srmacklem
40191783Srmacklem#if ELF_TARG_CLASS == ELFCLASS32
41191783Srmacklem
42191783Srmacklem/*
43191783Srmacklem * Structure used to pass infomation from the loader to the
44191783Srmacklem * stack fixup routine.
45191783Srmacklem */
46214255Srmacklemtypedef struct {
47191783Srmacklem	Elf32_Sword	execfd;
48192503Srmacklem	Elf32_Word	phdr;
49192503Srmacklem	Elf32_Word	phent;
50191783Srmacklem	Elf32_Word	phnum;
51219028Snetchild	Elf32_Word	pagesz;
52219028Snetchild	Elf32_Word	base;
53191783Srmacklem	Elf32_Word	flags;
54191783Srmacklem	Elf32_Word	entry;
55191783Srmacklem	Elf32_Word	trace;
56191783Srmacklem} Elf32_Auxargs;
57191783Srmacklem
58191783Srmacklemtypedef struct {
59220530Srmacklem	char *brand;
60243738Srmacklem	char *emul_path;
61191783Srmacklem	char *interp_path;
62191783Srmacklem        struct sysentvec *sysvec;
63255532Srmacklem} Elf32_Brandinfo;
64261067Smav
65255532Srmacklem#define MAX_BRANDS      8
66191783Srmacklem
67191783Srmacklemint	elf_insert_brand_entry __P((Elf32_Brandinfo *entry));
68191783Srmacklemint	elf_remove_brand_entry __P((Elf32_Brandinfo *entry));
69217432Srmacklemint	elf_brand_inuse        __P((Elf32_Brandinfo *entry));
70217432Srmacklem
71217432Srmacklem#else /* !(ELF_TARG_CLASS == ELFCLASS32) */
72217432Srmacklem
73192503Srmacklem/*
74191783Srmacklem * Structure used to pass infomation from the loader to the
75192255Srmacklem * stack fixup routine.
76192255Srmacklem */
77191783Srmacklemtypedef struct {
78220645Srmacklem	Elf64_Sword	execfd;
79191783Srmacklem	Elf64_Addr	phdr;
80191783Srmacklem	Elf64_Word	phent;
81191783Srmacklem	Elf64_Word	phnum;
82192255Srmacklem	Elf64_Word	pagesz;
83265724Srmacklem	Elf64_Addr	base;
84192255Srmacklem	Elf64_Word	flags;
85221615Srmacklem	Elf64_Addr	entry;
86221615Srmacklem	Elf64_Word	trace;
87220645Srmacklem} Elf64_Auxargs;
88221615Srmacklem
89192255Srmacklemtypedef struct {
90221615Srmacklem	char *brand;
91192255Srmacklem	char *emul_path;
92221615Srmacklem	char *interp_path;
93192255Srmacklem        struct sysentvec *sysvec;
94221615Srmacklem} Elf64_Brandinfo;
95192255Srmacklem
96265724Srmacklem#define MAX_BRANDS      8
97265724Srmacklem
98191783Srmacklemint	elf_insert_brand_entry __P((Elf64_Brandinfo *entry));
99229617Sjhbint	elf_remove_brand_entry __P((Elf64_Brandinfo *entry));
100229617Sjhb
101191783Srmacklem#endif /* ELF_TARG_CLASS == ELFCLASS32 */
102191783Srmacklem
103191783Srmacklemstruct proc;
104191783Srmacklem
105191783Srmacklemint	elf_coredump __P((struct proc *));
106191783Srmacklem
107229617Sjhb#endif /* KERNEL */
108191783Srmacklem
109191783Srmacklem#endif /* !_SYS_IMGACT_ELF_H_ */
110191783Srmacklem