Rob Pike | ed5e39a | 2008-06-12 14:50:25 -0700 | [diff] [blame] | 1 | // 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 | |
| 29 | struct coffsect |
| 30 | { |
| 31 | char name[8]; |
Russ Cox | 9aad9fe | 2008-08-03 17:25:15 -0700 | [diff] [blame] | 32 | uint32 phys; |
| 33 | uint32 virt; |
| 34 | uint32 size; |
| 35 | uint32 fptr; |
| 36 | uint32 fptrreloc; |
| 37 | uint32 fptrlineno; |
| 38 | uint32 nrelocnlineno; |
| 39 | uint32 flags; |
Rob Pike | ed5e39a | 2008-06-12 14:50:25 -0700 | [diff] [blame] | 40 | }; |
| 41 | |
| 42 | /* |
| 43 | * proprietary exec headers, needed to bootstrap various machines |
| 44 | */ |
| 45 | struct mipsexec |
| 46 | { |
| 47 | short mmagic; /* (0x160) mips magic number */ |
| 48 | short nscns; /* (unused) number of sections */ |
Russ Cox | 9aad9fe | 2008-08-03 17:25:15 -0700 | [diff] [blame] | 49 | int32 timdat; /* (unused) time & date stamp */ |
| 50 | int32 symptr; /* offset to symbol table */ |
| 51 | int32 nsyms; /* size of symbol table */ |
Rob Pike | ed5e39a | 2008-06-12 14:50:25 -0700 | [diff] [blame] | 52 | short opthdr; /* (0x38) sizeof(optional hdr) */ |
| 53 | short pcszs; /* flags */ |
| 54 | short amagic; /* see above */ |
| 55 | short vstamp; /* version stamp */ |
Russ Cox | 9aad9fe | 2008-08-03 17:25:15 -0700 | [diff] [blame] | 56 | 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 Pike | ed5e39a | 2008-06-12 14:50:25 -0700 | [diff] [blame] | 64 | union{ |
Russ Cox | 9aad9fe | 2008-08-03 17:25:15 -0700 | [diff] [blame] | 65 | int32 cprmask[4]; /* co-processor register masks */ |
| 66 | int32 pcsize; |
Rob Pike | ed5e39a | 2008-06-12 14:50:25 -0700 | [diff] [blame] | 67 | }; |
Russ Cox | 9aad9fe | 2008-08-03 17:25:15 -0700 | [diff] [blame] | 68 | int32 gp_value; /* the gp value used for this object */ |
Rob Pike | ed5e39a | 2008-06-12 14:50:25 -0700 | [diff] [blame] | 69 | }; |
| 70 | |
| 71 | struct mips4kexec |
| 72 | { |
| 73 | struct mipsexec h; |
| 74 | struct coffsect itexts; |
| 75 | struct coffsect idatas; |
| 76 | struct coffsect ibsss; |
| 77 | }; |
| 78 | |
| 79 | struct sparcexec |
| 80 | { |
| 81 | short sjunk; /* dynamic bit and version number */ |
| 82 | short smagic; /* 0407 */ |
Russ Cox | 9aad9fe | 2008-08-03 17:25:15 -0700 | [diff] [blame] | 83 | uint32 stext; |
| 84 | uint32 sdata; |
| 85 | uint32 sbss; |
| 86 | uint32 ssyms; |
| 87 | uint32 sentry; |
| 88 | uint32 strsize; |
| 89 | uint32 sdrsize; |
Rob Pike | ed5e39a | 2008-06-12 14:50:25 -0700 | [diff] [blame] | 90 | }; |
| 91 | |
| 92 | struct nextexec |
| 93 | { |
| 94 | /* UNUSED |
| 95 | struct nexthdr{ |
Russ Cox | 9aad9fe | 2008-08-03 17:25:15 -0700 | [diff] [blame] | 96 | uint32 nmagic; |
| 97 | uint32 ncputype; |
| 98 | uint32 ncpusubtype; |
| 99 | uint32 nfiletype; |
| 100 | uint32 ncmds; |
| 101 | uint32 nsizeofcmds; |
| 102 | uint32 nflags; |
Rob Pike | ed5e39a | 2008-06-12 14:50:25 -0700 | [diff] [blame] | 103 | }; |
| 104 | |
| 105 | struct nextcmd{ |
Russ Cox | 9aad9fe | 2008-08-03 17:25:15 -0700 | [diff] [blame] | 106 | uint32 cmd; |
| 107 | uint32 cmdsize; |
Rob Pike | ed5e39a | 2008-06-12 14:50:25 -0700 | [diff] [blame] | 108 | uchar segname[16]; |
Russ Cox | 9aad9fe | 2008-08-03 17:25:15 -0700 | [diff] [blame] | 109 | uint32 vmaddr; |
| 110 | uint32 vmsize; |
| 111 | uint32 fileoff; |
| 112 | uint32 filesize; |
| 113 | uint32 maxprot; |
| 114 | uint32 initprot; |
| 115 | uint32 nsects; |
| 116 | uint32 flags; |
Rob Pike | ed5e39a | 2008-06-12 14:50:25 -0700 | [diff] [blame] | 117 | }textc; |
| 118 | struct nextsect{ |
| 119 | char sectname[16]; |
| 120 | char segname[16]; |
Russ Cox | 9aad9fe | 2008-08-03 17:25:15 -0700 | [diff] [blame] | 121 | 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 Pike | ed5e39a | 2008-06-12 14:50:25 -0700 | [diff] [blame] | 130 | }texts; |
| 131 | struct nextcmd datac; |
| 132 | struct nextsect datas; |
| 133 | struct nextsect bsss; |
| 134 | struct nextsym{ |
Russ Cox | 9aad9fe | 2008-08-03 17:25:15 -0700 | [diff] [blame] | 135 | uint32 cmd; |
| 136 | uint32 cmdsize; |
| 137 | uint32 symoff; |
| 138 | uint32 nsyms; |
| 139 | uint32 spoff; |
| 140 | uint32 pcoff; |
Rob Pike | ed5e39a | 2008-06-12 14:50:25 -0700 | [diff] [blame] | 141 | }symc; |
| 142 | */ |
| 143 | }; |
| 144 | |
| 145 | struct i386exec |
| 146 | { |
| 147 | /* UNUSED |
| 148 | struct i386coff{ |
Russ Cox | 9aad9fe | 2008-08-03 17:25:15 -0700 | [diff] [blame] | 149 | uint32 isectmagic; |
| 150 | uint32 itime; |
| 151 | uint32 isyms; |
| 152 | uint32 insyms; |
| 153 | uint32 iflags; |
Rob Pike | ed5e39a | 2008-06-12 14:50:25 -0700 | [diff] [blame] | 154 | }; |
| 155 | struct i386hdr{ |
Russ Cox | 9aad9fe | 2008-08-03 17:25:15 -0700 | [diff] [blame] | 156 | uint32 imagic; |
| 157 | uint32 itextsize; |
| 158 | uint32 idatasize; |
| 159 | uint32 ibsssize; |
| 160 | uint32 ientry; |
| 161 | uint32 itextstart; |
| 162 | uint32 idatastart; |
Rob Pike | ed5e39a | 2008-06-12 14:50:25 -0700 | [diff] [blame] | 163 | }; |
| 164 | struct coffsect itexts; |
| 165 | struct coffsect idatas; |
| 166 | struct coffsect ibsss; |
| 167 | struct coffsect icomments; |
| 168 | */ |
| 169 | }; |