1 /* $OpenBSD: exec_olf.h,v 1.8 2001/06/22 14:11:00 deraadt Exp $ */
2 /*
3 * Copyright (c) 1996 Erik Theisen. 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 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28 /*
29 * OLF is a modified ELF that attempts to fix two serious shortcomings in
30 * the SVR4 ABI. Namely a lack of an operating system and strip tag.
31 */
32
33 #ifndef _SYS_EXEC_OLF_H_
34 #define _SYS_EXEC_OLF_H_
35
36 #include <sys/exec_elf.h>
37
38 /* e_ident[] identification indexes */
39 #define OI_MAG0 EI_MAG0 /* file ID */
40 #define OI_MAG1 EI_MAG1 /* file ID */
41 #define OI_MAG2 EI_MAG2 /* file ID */
42 #define OI_MAG3 EI_MAG3 /* file ID */
43 #define OI_CLASS EI_CLASS /* file class */
44 #define OI_DATA EI_DATA /* data encoding */
45 #define OI_VERSION EI_VERSION /* OLF header version */
46 #define OI_OS 7 /* Operating system tag */
47 #define OI_DYNAMIC 8 /* Dynamic tag */
48 #define OI_STRIP 9 /* Strip tag */
49 #define OI_PAD 10 /* start of pad bytes */
50 #define OI_NIDENT EI_NIDENT /* Size of e_ident[] */
51
52 /* e_ident[] magic number */
53 #define OLFMAG0 ELFMAG0 /* e_ident[OI_MAG0] */
54 #define OLFMAG1 'O' /* e_ident[OI_MAG1] */
55 #define OLFMAG2 ELFMAG2 /* e_ident[OI_MAG2] */
56 #define OLFMAG3 ELFMAG3 /* e_ident[OI_MAG3] */
57 #define OLFMAG "\177OLF" /* magic */
58 #define SOLFMAG SELFMAG /* size of magic */
59
60 /* e_ident[] file class */
61 #define OLFCLASSNONE ELFCLASSNONE /* invalid */
62 #define OLFCLASS32 ELFCLASS32 /* 32-bit objs */
63 #define OLFCLASS64 ELFCLASS64 /* 64-bit objs */
64 #define OLFCLASSNUM ELFCLASSNUM /* number of classes */
65
66 /* e_ident[] data encoding */
67 #define OLFDATANONE ELFDATANONE /* invalid */
68 #define OLFDATA2LSB ELFDATA2LSB /* Little-Endian */
69 #define OLFDATA2MSB ELFDATA2MSB /* Big-Endian */
70 #define OLFDATANUM ELFDATANUM /* number of data encode defines */
71
72
73 /*
74 * Please help make this list definative.
75 */
76 /* e_ident[] system */
77 #define OOS_NULL 0 /* invalid */
78 #define OOS_OPENBSD 1 /* OpenBSD */
79 #define OOS_NETBSD 2 /* NetBSD */
80 #define OOS_FREEBSD 3 /* FreeBSD */
81 #define OOS_44BSD 4 /* 4.4BSD */
82 #define OOS_LINUX 5 /* Linux */
83 #define OOS_SVR4 6 /* AT&T System V Release 4 */
84 #define OOS_ESIX 7 /* esix UNIX */
85 #define OOS_SOLARIS 8 /* SunSoft Solaris */
86 #define OOS_IRIX 9 /* SGI IRIX */
87 #define OOS_SCO 10 /* SCO UNIX */
88 #define OOS_DELL 11 /* DELL SVR4 */
89 #define OOS_NCR 12 /* NCR SVR4 */
90 #define OOS_NUM 13 /* Number of systems */
91 /*
92 * Lowercase and numbers ONLY.
93 * No whitespace or punc.
94 */
95 #define OOSN_NULL "invalid" /* invalid */
96 #define OOSN_OPENBSD "openbsd" /* OpenBSD */
97 #define OOSN_NETBSD "netbsd" /* NetBSD */
98 #define OOSN_FREEBSD "freebsd" /* FreeBSD */
99 #define OOSN_44BSD "44bsd" /* 4.4BSD */
100 #define OOSN_LINUX "linux" /* Linux */
101 #define OOSN_SVR4 "svr4" /* AT&T System V Release 4 */
102 #define OOSN_ESIX "esix" /* esix UNIX */
103 #define OOSN_SOLARIS "solaris" /* SunSoft Solaris */
104 #define OOSN_IRIX "irix" /* SGI IRIX */
105 #define OOSN_SCO "sco" /* SCO UNIX */
106 #define OOSN_DELL "dell" /* DELL SVR4 */
107 #define OOSN_NCR "ncr" /* NCR SVR4 */
108 #define ONAMEV { OOSN_NULL, OOSN_OPENBSD, OOSN_NETBSD, \
109 OOSN_FREEBSD, OOSN_44BSD, OOSN_LINUX, \
110 OOSN_SVR4, OOSN_ESIX, OOSN_SOLARIS, \
111 OOSN_IRIX, OOSN_SCO, OOSN_DELL, \
112 OOSN_NCR, \
113 0 }
114
115 /* e_ident[] dynamic */
116 #define ODYNAMIC_N 0 /* Statically linked */
117 #define ODYNAMIC 1 /* Dynamically linked */
118
119 /* e_ident[] strip */
120 #define OSTRIP 0 /* Stripped */
121 #define OSTRIP_N 1 /* Not Stripped */
122
123 /* e_ident */
124 #define IS_OLF(ehdr) \
125 ((ehdr).e_ident[OI_MAG0] == OLFMAG0 && \
126 (ehdr).e_ident[OI_MAG1] == OLFMAG1 && \
127 (ehdr).e_ident[OI_MAG2] == OLFMAG2 && \
128 (ehdr).e_ident[OI_MAG3] == OLFMAG3)
129
130 /* The rest of the types and defines come from the ELF header file */
131 #endif /* _SYS_EXEC_OLF_H_ */