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