xref: /netbsd/sys/arch/powerpc/stand/mkbootimage/pef.h (revision 6550d01e)
1 /*	$NetBSD: pef.h,v 1.2 2010/10/16 05:05:09 kiyohara Exp $	*/
2 
3 /*-
4  * Copyright (C) 1995-1997 Gary Thomas (gdt@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 	unsigned long magic;
38 	unsigned long fileTypeID;
39 	unsigned long archID;
40 	unsigned long versionNumber;
41 	unsigned long dateTimeStamp;
42 	unsigned long definVersion;
43 	unsigned long implVersion;
44 	unsigned long currentVersion;
45 	unsigned short numSections;
46 	unsigned short loadableSections;
47 	unsigned long 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 	unsigned long sectionName;
57 	unsigned long sectionAddress;
58 	unsigned long execSize;
59 	unsigned long initSize;
60 	unsigned long rawSize;
61 	unsigned long fileOffset;
62 	unsigned char regionKind;
63 	unsigned char shareKind;
64 	unsigned char alignment;
65 	unsigned char _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 	unsigned long entryPointSection;
83 	unsigned long entryPointOffset;
84 	unsigned long initPointSection;
85 	unsigned long initPointOffset;
86 	unsigned long termPointSection;
87 	unsigned long termPointOffset;
88 	unsigned long numImportFiles;
89 	unsigned long numImportSyms;
90 	unsigned long numSections;
91 	unsigned long relocationsOffset;
92 	unsigned long stringsOffset;
93 	unsigned long hashSlotTable;
94 	unsigned long hashSlotTableSize;
95 	unsigned long numExportSyms;
96 };
97