| 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. |
| 26 | * |
| 27 | * HISTORY |
| 28 | * 29-Jan-92 Mike DeMoney (mike@next.com) |
| 29 | * Made into machine independent form from machdep/m68k/mach_header.h. |
| 30 | * Ifdef'ed out most of this since I couldn't find any references. |
| 31 | */ |
| 32 | |
| 33 | #ifndef _KERN_MACH_HEADER_ |
| 34 | #define _KERN_MACH_HEADER_ |
| 35 | |
| 36 | #include <mach/mach_types.h> |
| 37 | #include <mach-o/loader.h> |
| 38 | |
| 39 | #if KERNEL |
| 40 | struct mach_header **getmachheaders(void); |
| 41 | vm_offset_t getlastaddr(void); |
| 42 | |
| 43 | struct segment_command *firstseg(void); |
| 44 | struct segment_command *firstsegfromheader(struct mach_header *header); |
| 45 | struct segment_command *nextseg(struct segment_command *sgp); |
| 46 | struct segment_command *nextsegfromheader( |
| 47 | struct mach_header *header, |
| 48 | struct segment_command *seg); |
| 49 | struct segment_command *getsegbyname(char *seg_name); |
| 50 | struct segment_command *getsegbynamefromheader( |
| 51 | struct mach_header *header, |
| 52 | char *seg_name); |
| 53 | void *getsegdatafromheader(struct mach_header *, char *, int *); |
| 54 | struct section *getsectbyname(char *seg_name, char *sect_name); |
| 55 | struct section *getsectbynamefromheader( |
| 56 | struct mach_header *header, |
| 57 | char *seg_name, |
| 58 | char *sect_name); |
| 59 | void *getsectdatafromheader(struct mach_header *, char *, char *, int *); |
| 60 | struct section *firstsect(struct segment_command *sgp); |
| 61 | struct section *nextsect(struct segment_command *sgp, struct section *sp); |
| 62 | struct fvmlib_command *fvmlib(void); |
| 63 | struct fvmlib_command *fvmlibfromheader(struct mach_header *header); |
| 64 | struct segment_command *getfakefvmseg(void); |
| 65 | #ifdef MACH_KDB |
| 66 | struct symtab_command *getsectcmdsymtabfromheader(struct mach_header *); |
| 67 | boolean_t getsymtab(struct mach_header *, vm_offset_t *, int *, |
| 68 | vm_offset_t *, vm_size_t *); |
| 69 | #endif |
| 70 | |
| 71 | #endif /* KERNEL */ |
| 72 | |
| 73 | #endif /* _KERN_MACH_HEADER_ */ |