blob: 49721ea33b818d9b25c5f98c2936dbc9d4e376b5 [file] [log] [blame]
Rob Pikeed5e39a2008-06-12 14:50:25 -07001// Inferno libmach/bootexec.h
2// http://code.google.com/p/inferno-os/source/browse/utils/libmach/bootexec.h
3//
4// Copyright © 1994-1999 Lucent Technologies Inc.
5// Power PC support Copyright © 1995-2004 C H Forsyth (forsyth@terzarima.net).
6// Portions Copyright © 1997-1999 Vita Nuova Limited.
7// Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuova.com).
8// Revisions Copyright © 2000-2004 Lucent Technologies Inc. and others.
9// Portions Copyright © 2009 The Go Authors. All rights reserved.
10//
11// Permission is hereby granted, free of charge, to any person obtaining a copy
12// of this software and associated documentation files (the "Software"), to deal
13// in the Software without restriction, including without limitation the rights
14// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15// copies of the Software, and to permit persons to whom the Software is
16// furnished to do so, subject to the following conditions:
17//
18// The above copyright notice and this permission notice shall be included in
19// all copies or substantial portions of the Software.
20//
21// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
27// THE SOFTWARE.
28
29struct coffsect
30{
31 char name[8];
Russ Cox9aad9fe2008-08-03 17:25:15 -070032 uint32 phys;
33 uint32 virt;
34 uint32 size;
35 uint32 fptr;
36 uint32 fptrreloc;
37 uint32 fptrlineno;
38 uint32 nrelocnlineno;
39 uint32 flags;
Rob Pikeed5e39a2008-06-12 14:50:25 -070040};
41
42/*
43 * proprietary exec headers, needed to bootstrap various machines
44 */
45struct mipsexec
46{
47 short mmagic; /* (0x160) mips magic number */
48 short nscns; /* (unused) number of sections */
Russ Cox9aad9fe2008-08-03 17:25:15 -070049 int32 timdat; /* (unused) time & date stamp */
50 int32 symptr; /* offset to symbol table */
51 int32 nsyms; /* size of symbol table */
Rob Pikeed5e39a2008-06-12 14:50:25 -070052 short opthdr; /* (0x38) sizeof(optional hdr) */
53 short pcszs; /* flags */
54 short amagic; /* see above */
55 short vstamp; /* version stamp */
Russ Cox9aad9fe2008-08-03 17:25:15 -070056 int32 tsize; /* text size in bytes */
57 int32 dsize; /* initialized data */
58 int32 bsize; /* uninitialized data */
59 int32 mentry; /* entry pt. */
60 int32 text_start; /* base of text used for this file */
61 int32 data_start; /* base of data used for this file */
62 int32 bss_start; /* base of bss used for this file */
63 int32 gprmask; /* general purpose register mask */
Rob Pikeed5e39a2008-06-12 14:50:25 -070064union{
Russ Cox9aad9fe2008-08-03 17:25:15 -070065 int32 cprmask[4]; /* co-processor register masks */
66 int32 pcsize;
Rob Pikeed5e39a2008-06-12 14:50:25 -070067};
Russ Cox9aad9fe2008-08-03 17:25:15 -070068 int32 gp_value; /* the gp value used for this object */
Rob Pikeed5e39a2008-06-12 14:50:25 -070069};
70
71struct mips4kexec
72{
73 struct mipsexec h;
74 struct coffsect itexts;
75 struct coffsect idatas;
76 struct coffsect ibsss;
77};
78
79struct sparcexec
80{
81 short sjunk; /* dynamic bit and version number */
82 short smagic; /* 0407 */
Russ Cox9aad9fe2008-08-03 17:25:15 -070083 uint32 stext;
84 uint32 sdata;
85 uint32 sbss;
86 uint32 ssyms;
87 uint32 sentry;
88 uint32 strsize;
89 uint32 sdrsize;
Rob Pikeed5e39a2008-06-12 14:50:25 -070090};
91
92struct nextexec
93{
94/* UNUSED
95 struct nexthdr{
Russ Cox9aad9fe2008-08-03 17:25:15 -070096 uint32 nmagic;
97 uint32 ncputype;
98 uint32 ncpusubtype;
99 uint32 nfiletype;
100 uint32 ncmds;
101 uint32 nsizeofcmds;
102 uint32 nflags;
Rob Pikeed5e39a2008-06-12 14:50:25 -0700103 };
104
105 struct nextcmd{
Russ Cox9aad9fe2008-08-03 17:25:15 -0700106 uint32 cmd;
107 uint32 cmdsize;
Rob Pikeed5e39a2008-06-12 14:50:25 -0700108 uchar segname[16];
Russ Cox9aad9fe2008-08-03 17:25:15 -0700109 uint32 vmaddr;
110 uint32 vmsize;
111 uint32 fileoff;
112 uint32 filesize;
113 uint32 maxprot;
114 uint32 initprot;
115 uint32 nsects;
116 uint32 flags;
Rob Pikeed5e39a2008-06-12 14:50:25 -0700117 }textc;
118 struct nextsect{
119 char sectname[16];
120 char segname[16];
Russ Cox9aad9fe2008-08-03 17:25:15 -0700121 uint32 addr;
122 uint32 size;
123 uint32 offset;
124 uint32 align;
125 uint32 reloff;
126 uint32 nreloc;
127 uint32 flags;
128 uint32 reserved1;
129 uint32 reserved2;
Rob Pikeed5e39a2008-06-12 14:50:25 -0700130 }texts;
131 struct nextcmd datac;
132 struct nextsect datas;
133 struct nextsect bsss;
134 struct nextsym{
Russ Cox9aad9fe2008-08-03 17:25:15 -0700135 uint32 cmd;
136 uint32 cmdsize;
137 uint32 symoff;
138 uint32 nsyms;
139 uint32 spoff;
140 uint32 pcoff;
Rob Pikeed5e39a2008-06-12 14:50:25 -0700141 }symc;
142*/
143};
144
145struct i386exec
146{
147/* UNUSED
148 struct i386coff{
Russ Cox9aad9fe2008-08-03 17:25:15 -0700149 uint32 isectmagic;
150 uint32 itime;
151 uint32 isyms;
152 uint32 insyms;
153 uint32 iflags;
Rob Pikeed5e39a2008-06-12 14:50:25 -0700154 };
155 struct i386hdr{
Russ Cox9aad9fe2008-08-03 17:25:15 -0700156 uint32 imagic;
157 uint32 itextsize;
158 uint32 idatasize;
159 uint32 ibsssize;
160 uint32 ientry;
161 uint32 itextstart;
162 uint32 idatastart;
Rob Pikeed5e39a2008-06-12 14:50:25 -0700163 };
164 struct coffsect itexts;
165 struct coffsect idatas;
166 struct coffsect ibsss;
167 struct coffsect icomments;
168*/
169};