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