]> git.saurik.com Git - apple/xnu.git/blame - osfmk/mach-o/mach_header.h
xnu-792.25.20.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 *
6601e61a 4 * @APPLE_LICENSE_HEADER_START@
1c79356b 5 *
6601e61a
A
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.
8f6c56a5 11 *
6601e61a
A
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
8f6c56a5
A
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
6601e61a
A
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.
8f6c56a5 19 *
6601e61a 20 * @APPLE_LICENSE_HEADER_END@
1c79356b
A
21 */
22/*
23 * File: kern/mach_header.h
24 *
91447636
A
25 * Definitions for accessing mach-o headers. This header wraps the
26 * routines defined in osfmk/mach-o/mach_header.c; this is made clear
27 * by the existance of the getsectcmdsymtabfromheader() prototype.
28 *
29 * NOTE: The functions prototyped by this header only operate againt
30 * 32 bit mach headers. Many of these functions imply the
31 * currently running kernel, and cannot be used against mach
32 * headers other than that of the currently running kernel.
1c79356b
A
33 *
34 * HISTORY
35 * 29-Jan-92 Mike DeMoney (mike@next.com)
36 * Made into machine independent form from machdep/m68k/mach_header.h.
37 * Ifdef'ed out most of this since I couldn't find any references.
38 */
39
40#ifndef _KERN_MACH_HEADER_
41#define _KERN_MACH_HEADER_
42
43#include <mach/mach_types.h>
44#include <mach-o/loader.h>
45
46#if MACH_KERNEL
47struct mach_header **getmachheaders(void);
48vm_offset_t getlastaddr(void);
49
50struct segment_command *firstseg(void);
51struct segment_command *firstsegfromheader(struct mach_header *header);
52struct segment_command *nextseg(struct segment_command *sgp);
53struct segment_command *nextsegfromheader(
54 struct mach_header *header,
55 struct segment_command *seg);
91447636 56struct segment_command *getsegbyname(const char *seg_name);
1c79356b
A
57struct segment_command *getsegbynamefromheader(
58 struct mach_header *header,
91447636
A
59 const char *seg_name);
60void *getsegdatafromheader(struct mach_header *, const char *, int *);
61struct section *getsectbyname(const char *seg_name, const char *sect_name);
1c79356b
A
62struct section *getsectbynamefromheader(
63 struct mach_header *header,
91447636
A
64 const char *seg_name,
65 const char *sect_name);
66void *getsectdatafromheader(struct mach_header *, const char *, const char *, int *);
1c79356b
A
67struct section *firstsect(struct segment_command *sgp);
68struct section *nextsect(struct segment_command *sgp, struct section *sp);
69struct fvmlib_command *fvmlib(void);
70struct fvmlib_command *fvmlibfromheader(struct mach_header *header);
71struct segment_command *getfakefvmseg(void);
72#ifdef MACH_KDB
73struct symtab_command *getsectcmdsymtabfromheader(struct mach_header *);
74boolean_t getsymtab(struct mach_header *, vm_offset_t *, int *,
75 vm_offset_t *, vm_size_t *);
76#endif
77
78#endif /* KERNEL */
79
80#endif /* _KERN_MACH_HEADER_ */