]> git.saurik.com Git - apple/xnu.git/blob - iokit/mach-o/mach_header.h
xnu-792.13.8.tar.gz
[apple/xnu.git] / iokit / mach-o / mach_header.h
1 /*
2 * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_OSREFERENCE_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. The rights granted to you under the
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
14 * agreement.
15 *
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
18 * file.
19 *
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
27 *
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
29 */
30 /*
31 * File: kern/mach_header.h
32 *
33 * Definitions for accessing mach-o headers. This header wraps the
34 * routines defined in osfmk/mach-o/mach_header.c; this is made clear
35 * by the existance of the getsectcmdsymtabfromheader() prototype.
36 *
37 * NOTE: The functions prototyped by this header only operate againt
38 * 32 bit mach headers. Many of these functions imply the
39 * currently running kernel, and cannot be used against mach
40 * headers other than that of the currently running kernel.
41 *
42 * HISTORY
43 * 29-Jan-92 Mike DeMoney (mike@next.com)
44 * Made into machine independent form from machdep/m68k/mach_header.h.
45 * Ifdef'ed out most of this since I couldn't find any references.
46 */
47
48 #ifndef _KERN_MACH_HEADER_
49 #define _KERN_MACH_HEADER_
50
51 #include <mach/mach_types.h>
52 #include <mach-o/loader.h>
53
54 #if KERNEL
55 struct mach_header **getmachheaders(void);
56 vm_offset_t getlastaddr(void);
57
58 struct segment_command *firstseg(void);
59 struct segment_command *firstsegfromheader(struct mach_header *header);
60 struct segment_command *nextseg(struct segment_command *sgp);
61 struct segment_command *nextsegfromheader(
62 struct mach_header *header,
63 struct segment_command *seg);
64 struct segment_command *getsegbyname(const char *seg_name);
65 struct segment_command *getsegbynamefromheader(
66 struct mach_header *header,
67 const char *seg_name);
68 void *getsegdatafromheader(struct mach_header *, const char *, int *);
69 struct section *getsectbyname(const char *seg_name, const char *sect_name);
70 struct section *getsectbynamefromheader(
71 struct mach_header *header,
72 char *seg_name,
73 char *sect_name);
74 void *getsectdatafromheader(struct mach_header *, const char *, const char *, int *);
75 struct section *firstsect(struct segment_command *sgp);
76 struct section *nextsect(struct segment_command *sgp, struct section *sp);
77 struct fvmlib_command *fvmlib(void);
78 struct fvmlib_command *fvmlibfromheader(struct mach_header *header);
79 struct segment_command *getfakefvmseg(void);
80 #ifdef MACH_KDB
81 struct symtab_command *getsectcmdsymtabfromheader(struct mach_header *);
82 boolean_t getsymtab(struct mach_header *, vm_offset_t *, int *,
83 vm_offset_t *, vm_size_t *);
84 #endif
85
86 #endif /* KERNEL */
87
88 #endif /* _KERN_MACH_HEADER_ */