]> git.saurik.com Git - apple/xnu.git/blame - osfmk/mach-o/mach_header.h
xnu-792.13.8.tar.gz
[apple/xnu.git] / osfmk / mach-o / mach_header.h
CommitLineData
1c79356b
A
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
8ad349bb 4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
1c79356b 5 *
8ad349bb
A
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@
1c79356b
A
29 */
30/*
31 * File: kern/mach_header.h
32 *
91447636
A
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.
1c79356b
A
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 MACH_KERNEL
55struct mach_header **getmachheaders(void);
56vm_offset_t getlastaddr(void);
57
58struct segment_command *firstseg(void);
59struct segment_command *firstsegfromheader(struct mach_header *header);
60struct segment_command *nextseg(struct segment_command *sgp);
61struct segment_command *nextsegfromheader(
62 struct mach_header *header,
63 struct segment_command *seg);
91447636 64struct segment_command *getsegbyname(const char *seg_name);
1c79356b
A
65struct segment_command *getsegbynamefromheader(
66 struct mach_header *header,
91447636
A
67 const char *seg_name);
68void *getsegdatafromheader(struct mach_header *, const char *, int *);
69struct section *getsectbyname(const char *seg_name, const char *sect_name);
1c79356b
A
70struct section *getsectbynamefromheader(
71 struct mach_header *header,
91447636
A
72 const char *seg_name,
73 const char *sect_name);
74void *getsectdatafromheader(struct mach_header *, const char *, const char *, int *);
1c79356b
A
75struct section *firstsect(struct segment_command *sgp);
76struct section *nextsect(struct segment_command *sgp, struct section *sp);
77struct fvmlib_command *fvmlib(void);
78struct fvmlib_command *fvmlibfromheader(struct mach_header *header);
79struct segment_command *getfakefvmseg(void);
80#ifdef MACH_KDB
81struct symtab_command *getsectcmdsymtabfromheader(struct mach_header *);
82boolean_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_ */