]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
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. | |
11 | * | |
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 | |
14 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
15 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
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. | |
19 | * | |
20 | * @APPLE_LICENSE_HEADER_END@ | |
21 | */ | |
22 | /* | |
23 | * File: kern/mach_header.h | |
24 | * | |
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. | |
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 | |
47 | struct mach_header **getmachheaders(void); | |
48 | vm_offset_t getlastaddr(void); | |
49 | ||
50 | struct segment_command *firstseg(void); | |
51 | struct segment_command *firstsegfromheader(struct mach_header *header); | |
52 | struct segment_command *nextseg(struct segment_command *sgp); | |
53 | struct segment_command *nextsegfromheader( | |
54 | struct mach_header *header, | |
55 | struct segment_command *seg); | |
56 | struct segment_command *getsegbyname(const char *seg_name); | |
57 | struct segment_command *getsegbynamefromheader( | |
58 | struct mach_header *header, | |
59 | const char *seg_name); | |
60 | void *getsegdatafromheader(struct mach_header *, const char *, int *); | |
61 | struct section *getsectbyname(const char *seg_name, const char *sect_name); | |
62 | struct section *getsectbynamefromheader( | |
63 | struct mach_header *header, | |
64 | const char *seg_name, | |
65 | const char *sect_name); | |
66 | void *getsectdatafromheader(struct mach_header *, const char *, const char *, int *); | |
67 | struct section *firstsect(struct segment_command *sgp); | |
68 | struct section *nextsect(struct segment_command *sgp, struct section *sp); | |
69 | struct fvmlib_command *fvmlib(void); | |
70 | struct fvmlib_command *fvmlibfromheader(struct mach_header *header); | |
71 | struct segment_command *getfakefvmseg(void); | |
72 | #ifdef MACH_KDB | |
73 | struct symtab_command *getsectcmdsymtabfromheader(struct mach_header *); | |
74 | boolean_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_ */ |