]> git.saurik.com Git - apple/xnu.git/blame - osfmk/mach-o/mach_header.h
xnu-792.6.56.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 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
ff6e181a
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. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
1c79356b 12 *
ff6e181a
A
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
1c79356b
A
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
ff6e181a
A
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.
1c79356b
A
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23/*
24 * File: kern/mach_header.h
25 *
91447636
A
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.
1c79356b
A
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 MACH_KERNEL
48struct mach_header **getmachheaders(void);
49vm_offset_t getlastaddr(void);
50
51struct segment_command *firstseg(void);
52struct segment_command *firstsegfromheader(struct mach_header *header);
53struct segment_command *nextseg(struct segment_command *sgp);
54struct segment_command *nextsegfromheader(
55 struct mach_header *header,
56 struct segment_command *seg);
91447636 57struct segment_command *getsegbyname(const char *seg_name);
1c79356b
A
58struct segment_command *getsegbynamefromheader(
59 struct mach_header *header,
91447636
A
60 const char *seg_name);
61void *getsegdatafromheader(struct mach_header *, const char *, int *);
62struct section *getsectbyname(const char *seg_name, const char *sect_name);
1c79356b
A
63struct section *getsectbynamefromheader(
64 struct mach_header *header,
91447636
A
65 const char *seg_name,
66 const char *sect_name);
67void *getsectdatafromheader(struct mach_header *, const char *, const char *, int *);
1c79356b
A
68struct section *firstsect(struct segment_command *sgp);
69struct section *nextsect(struct segment_command *sgp, struct section *sp);
70struct fvmlib_command *fvmlib(void);
71struct fvmlib_command *fvmlibfromheader(struct mach_header *header);
72struct segment_command *getfakefvmseg(void);
73#ifdef MACH_KDB
74struct symtab_command *getsectcmdsymtabfromheader(struct mach_header *);
75boolean_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_ */