]> git.saurik.com Git - apple/xnu.git/blame - osfmk/mach/boot_info.h
xnu-517.3.15.tar.gz
[apple/xnu.git] / osfmk / mach / boot_info.h
CommitLineData
1c79356b
A
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
43866e37 6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
1c79356b 7 *
43866e37
A
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * file.
14 *
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1c79356b
A
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
43866e37
A
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
1c79356b
A
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25/*
26 * @OSF_COPYRIGHT@
27 */
28/*
29 * HISTORY
30 *
31 * Revision 1.1.1.1 1998/09/22 21:05:31 wsanchez
32 * Import of Mac OS X kernel (~semeria)
33 *
34 * Revision 1.1.1.1 1998/03/07 02:25:45 wsanchez
35 * Import of OSF Mach kernel (~mburg)
36 *
37 * Revision 1.2.16.4 1996/01/09 19:21:29 devrcs
38 * Added bootstrap map for alpha.
39 * This probably should be moved to some MD include file.
40 * It's not really machine dependent, just a different
41 * way of doing things.
42 * [1995/12/01 19:49:04 jfraser]
43 *
44 * Merged '64-bit safe' changes from DEC alpha port.
45 * [1995/11/21 18:08:36 jfraser]
46 *
47 * Revision 1.2.16.3 1995/01/06 19:50:04 devrcs
48 * mk6 CR668 - 1.3b26 merge
49 * Added region_desc structure;
50 * [1994/10/14 03:42:28 dwm]
51 *
52 * Revision 1.2.16.2 1994/09/23 02:34:18 ezf
53 * change marker to not FREE
54 * [1994/09/22 21:39:03 ezf]
55 *
56 * Revision 1.2.16.1 1994/06/13 20:49:19 dlb
57 * Merge MK6 and NMK17
58 * [1994/06/13 20:24:22 dlb]
59 *
60 * Revision 1.2.14.1 1994/02/08 11:01:06 bernadat
61 * Checked in NMK16_1 changes
62 * [94/02/04 bernadat]
63 *
64 * Revision 1.2.12.1 1993/12/23 08:56:06 bernadat
65 * Added COFF_F.
66 * [93/11/29 bernadat]
67 *
68 * Revision 1.2.3.2 1993/06/24 16:14:07 gm
69 * CR9371: Moved here from default_pager.
70 * [1993/06/24 16:08:52 gm]
71 *
72 * Revision 1.2.3.2 1993/06/09 02:10:53 gm
73 * Added to OSF/1 R1.3 from NMK15.0.
74 * [1993/06/02 20:41:54 gm]
75 *
76 * Revision 1.2 1993/04/19 16:31:50 devrcs
77 * Added ROSE support: we need several symbol table entries since ROSE
78 * can have up to 3 symbol section.
79 * [93/03/24 bruel]
80 *
81 * Use free copyright
82 * [1993/03/03 12:12:37 bernadat]
83 *
84 * Fixed History Revision Comments
85 * [93/02/24 bernadat]
86 *
87 * Created for external default pager.
88 * [1993/02/09 15:40:42 bruel]
89 *
90 * $EndLog$
91 */
92/* CMU_HIST */
93/*
94 * Revision 2.2 92/01/03 20:19:42 dbg
95 * Created.
96 * [91/09/06 dbg]
97 *
98 */
99/* CMU_ENDHIST */
100/*
101 */
102/*
103 * Mach Operating System
104 * Copyright (c) 1991 Carnegie Mellon University
105 * All Rights Reserved.
106 *
107 * Permission to use, copy, modify and distribute this software and its
108 * documentation is hereby granted, provided that both the copyright
109 * notice and this permission notice appear in all copies of the
110 * software, derivative works or modified versions, and any portions
111 * thereof, and that both notices appear in supporting documentation.
112 *
113 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
114 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
115 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
116 *
117 * Carnegie Mellon requests users of this software to return to
118 *
119 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
120 * School of Computer Science
121 * Carnegie Mellon University
122 * Pittsburgh PA 15213-3890
123 *
124 * any improvements or extensions that they make and grant Carnegie Mellon
125 * the rights to redistribute these changes.
126 */
127
128#ifndef _MACH_BOOT_INFO_H_
129#define _MACH_BOOT_INFO_H_
130
131#include <mach/machine/vm_types.h>
132#include <mach/vm_prot.h>
133#include <mach/boolean.h>
134
135/*
136 * The boot loader uses several instances of the following structure to
137 * provide a description of the bootstrap task virtual address space,
138 * consisting of memory regions that need to be mapped from physical pages
139 * filled by the boot loader, or regions that need to be allocated in the
140 * new address space.
141 */
142struct region_desc {
143 vm_offset_t addr; /* virtual address */
144 vm_offset_t offset; /* offset within object */
145 vm_size_t size; /* size */
146 vm_prot_t prot; /* protection */
147 boolean_t mapped; /* mapped or zero-filled */
148};
149
150#ifdef __alpha
151typedef long physaddr_t;
152#define NBOOT_REGIONS 5
153
154#define TEXT 0
155#define DATA 1
156#define BSS 2
157#define STACK 3
158#define SYMS 4
159
160struct bootstrap_map {
161 physaddr_t boot_location;
162 long boot_size;
163 long boot_entry;
164 long boot_gp_value;
165 long boot_region_count;
166 struct region_desc boot_regions[NBOOT_REGIONS];
167};
168
169#endif /* __alpha */
170
171#define BOOT_INFO_COMPAT 1
172#if BOOT_INFO_COMPAT
173/*
174 * Old compat code for makeboot produced images
175 */
176
177/*
178 * Structure of Mach kernel boot file.
179 */
180#include <mach/machine/vm_types.h>
181
182/*
183 * A Mach kernel boot file consists of the Mach
184 * kernel image and the bootstrap image, glued
185 * together.
186 *
187 * The first part of the file is a normal executable
188 * (bootable) file: a.out, coff, or whatever. The
189 * text and data sizes are set to include the entire
190 * file. (Some machines do not allow a zero-length
191 * data segment).
192 *
193 * The rest of the file sits where the kernel BSS
194 * should be. A boot_info record describes the
195 * sizes of the next 3 sections. Following this
196 * are the kernel symbol table, the bootstrap image
197 * (including its symbol table), and the loader
198 * information for the bootstrap image. Each
199 * of these sections is padded to an integer (4-byte)
200 * boundary.
201 *
202 * When the file is loaded into memory, the kernel
203 * text and data segments are at their normal locations.
204 *
205 * The boot_info structure appears at the start of
206 * the bss (at 'edata[]'):
207 */
208
209struct boot_info {
210 vm_size_t sym_size; /* size of kernel symbols */
211 vm_size_t boot_size; /* size of bootstrap image */
212 vm_size_t load_info_size; /* size of loader information
213 for bootstrap image */
214};
215
216/*
217 * The 3 sections must be moved out of BSS for the kernel to run:
218 *
219 * The kernel symbol table follows the BSS (at 'end[]').
220 *
221 * The bootstrap image is on the first page boundary (machine page
222 * size) following the kernel symbol table.
223 *
224 * The loader information immediately follows the bootstrap image.
225 */
226
227/*
228 * Loader information for bootstrap image:
229 */
230
231#define AOUT_F 1
232#define ROSE_F 2
233#define COFF_F 3
234
235struct loader_info {
236 int format; /* symbol table format (A.OUT or ROSE) */
237 vm_offset_t text_start; /* text start in memory */
238 vm_size_t text_size; /* text size */
239 vm_offset_t text_offset; /* text offset in file */
240 vm_offset_t data_start; /* data+bss start in memory */
241 vm_size_t data_size; /* data size */
242 vm_offset_t data_offset; /* data offset in file */
243 vm_size_t bss_size; /* BSS size */
244 vm_offset_t str_offset; /* strings table offset in file */
245 vm_size_t str_size; /* strings table size */
246 vm_offset_t sym_offset[4]; /* symbol table offset in file */
247 vm_size_t sym_size[4]; /* symbol table size */
248 vm_offset_t entry_1; /* 2 words for entry address */
249 vm_offset_t entry_2;
250} ;
251
252#define EX_NOT_EXECUTABLE 6000
253
254#endif /* BOOT_INFO_COMPAT */
255
256#endif /* _MACH_BOOT_INFO_H_ */