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