]> git.saurik.com Git - apple/xnu.git/blob - bsd/kern/mach_header.h
xnu-792.6.56.tar.gz
[apple/xnu.git] / bsd / kern / mach_header.h
1 /*
2 * Copyright (c) 2000-2004 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 * File: kern/mach_header.h
25 *
26 * Definitions for accessing mach-o headers.
27 *
28 * NOTE: The functions prototyped by this header only operate againt
29 * 32 bit mach headers. Many of these functions imply the
30 * currently running kernel, and cannot be used against mach
31 * headers other than that of the currently running kernel.
32 *
33 * HISTORY
34 * 29-Jan-92 Mike DeMoney (mike@next.com)
35 * Made into machine independent form from machdep/m68k/mach_header.h.
36 * Ifdef'ed out most of this since I couldn't find any references.
37 */
38
39 #ifndef _KERN_MACH_HEADER_
40 #define _KERN_MACH_HEADER_
41
42 #include <mach/mach_types.h>
43 #include <mach-o/loader.h>
44
45 #if KERNEL
46 struct mach_header **getmachheaders(void);
47 vm_offset_t getlastaddr(void);
48
49 struct segment_command *firstseg(void);
50 struct segment_command *firstsegfromheader(struct mach_header *header);
51 struct segment_command *nextseg(struct segment_command *sgp);
52 struct segment_command *nextsegfromheader(
53 struct mach_header *header,
54 struct segment_command *seg);
55 struct segment_command *getsegbyname(const char *seg_name);
56 struct segment_command *getsegbynamefromheader(
57 struct mach_header *header,
58 const char *seg_name);
59 void *getsegdatafromheader(struct mach_header *, const char *, int *);
60 struct section *getsectbyname(const char *seg_name, const char *sect_name);
61 struct section *getsectbynamefromheader(
62 struct mach_header *header,
63 const char *seg_name,
64 const char *sect_name);
65 void *getsectdatafromheader(struct mach_header *, const char *, const char *, int *);
66 struct section *firstsect(struct segment_command *sgp);
67 struct section *nextsect(struct segment_command *sgp, struct section *sp);
68 struct fvmlib_command *fvmlib(void);
69 struct fvmlib_command *fvmlibfromheader(struct mach_header *header);
70 struct segment_command *getfakefvmseg(void);
71
72 #endif /* KERNEL */
73
74 #endif /* _KERN_MACH_HEADER_ */