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