]> git.saurik.com Git - apple/xnu.git/blob - bsd/kern/mach_loader.h
89ef0e4da9701dee0a61decbd656e121d15a06d4
[apple/xnu.git] / bsd / kern / mach_loader.h
1 /*
2 * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23 /*
24 * Copyright (C) 1992, NeXT, Inc.
25 *
26 * File: kern/mach_loader.h
27 *
28 * Mach object file loader API.
29 *
30 * HISTORY
31 * 24-Aug-92 Doug Mitchell at NeXT
32 * Created.
33 */
34
35 #ifndef _BSD_KERN_MACH_LOADER_H_
36 #define _BSD_KERN_MACH_LOADER_H_
37
38 #include <mach/mach_types.h>
39 #include <mach-o/loader.h>
40
41 typedef int load_return_t;
42
43 /*
44 * Structure describing the result from calling load_machfile(), if that
45 * function returns LOAD_SUCCESS.
46 */
47 typedef struct _load_result {
48 user_addr_t mach_header;
49 user_addr_t entry_point;
50 user_addr_t user_stack;
51 int thread_count;
52 unsigned int
53 /* boolean_t */ unixproc :1,
54 dynlinker :1,
55 customstack :1,
56 :0;
57 } load_result_t;
58
59 struct image_params;
60 load_return_t load_machfile(
61 struct image_params *imgp,
62 struct mach_header *header,
63 thread_t thr_act,
64 vm_map_t map,
65 boolean_t clean_regions,
66 load_result_t *result);
67
68 #define LOAD_SUCCESS 0
69 #define LOAD_BADARCH 1 /* CPU type/subtype not found */
70 #define LOAD_BADMACHO 2 /* malformed mach-o file */
71 #define LOAD_SHLIB 3 /* shlib version mismatch */
72 #define LOAD_FAILURE 4 /* Miscellaneous error */
73 #define LOAD_NOSPACE 5 /* No VM available */
74 #define LOAD_PROTECT 6 /* protection violation */
75 #define LOAD_RESOURCE 7 /* resource allocation failure */
76 #define LOAD_ENOENT 8 /* resource not found */
77 #define LOAD_IOERROR 9 /* IO error */
78
79 #endif /* _BSD_KERN_MACH_LOADER_H_ */