pef.h revision 1.2.22.1 1 /* $NetBSD: pef.h,v 1.2.22.1 2014/05/18 17:45:23 rmind Exp $ */
2
3 /*-
4 * Copyright (C) 1995-1997 Gary Thomas (gdt (at) linuxppc.org)
5 * All rights reserved.
6 *
7 * Structure of a PEF format file
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. All advertising materials mentioning features or use of this software
18 * must display the following acknowledgement:
19 * This product includes software developed by Gary Thomas.
20 * 4. The name of the author may not be used to endorse or promote products
21 * derived from this software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
28 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35 struct FileHeader
36 {
37 uint32_t magic;
38 uint32_t fileTypeID;
39 uint32_t archID;
40 uint32_t versionNumber;
41 uint32_t dateTimeStamp;
42 uint32_t definVersion;
43 uint32_t implVersion;
44 uint32_t currentVersion;
45 uint16_t numSections;
46 uint16_t loadableSections;
47 uint32_t memoryAddress;
48 };
49
50 #define PEF_MAGIC 0x4A6F7921 /* Joy! */
51 #define PEF_FILE 0x70656666 /* peff */
52 #define PEF_PPC 0x70777063 /* pwpc */
53
54 struct SectionHeader
55 {
56 uint32_t sectionName;
57 uint32_t sectionAddress;
58 uint32_t execSize;
59 uint32_t initSize;
60 uint32_t rawSize;
61 uint32_t fileOffset;
62 uint8_t regionKind;
63 uint8_t shareKind;
64 uint8_t alignment;
65 uint8_t _reserved;
66 };
67
68 #define CodeSection 0
69 #define DataSection 1
70 #define PIDataSection 2
71 #define ConstantSection 3
72 #define LoaderSection 4
73
74 #define NeverShare 0
75 #define ContextShare 1
76 #define TeamShare 2
77 #define TaskShare 3
78 #define GlobalShare 4
79
80 struct LoaderHeader
81 {
82 uint32_t entryPointSection;
83 uint32_t entryPointOffset;
84 uint32_t initPointSection;
85 uint32_t initPointOffset;
86 uint32_t termPointSection;
87 uint32_t termPointOffset;
88 uint32_t numImportFiles;
89 uint32_t numImportSyms;
90 uint32_t numSections;
91 uint32_t relocationsOffset;
92 uint32_t stringsOffset;
93 uint32_t hashSlotTable;
94 uint32_t hashSlotTableSize;
95 uint32_t numExportSyms;
96 };
97