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