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