]> git.saurik.com Git - apple/xnu.git/blob - EXTERNAL_HEADERS/mach-o/fat.h
xnu-792.6.61.tar.gz
[apple/xnu.git] / EXTERNAL_HEADERS / mach-o / fat.h
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 * This header file describes the structures of the file format for "fat"
24 * architecture specific file (wrapper design). At the begining of the file
25 * there is one fat_header structure followed by a number of fat_arch
26 * structures. For each architecture in the file, specified by a pair of
27 * cputype and cpusubtype, the fat_header describes the file offset, file
28 * size and alignment in the file of the architecture specific member.
29 * The padded bytes in the file to place each member on it's specific alignment
30 * are defined to be read as zeros and can be left as "holes" if the file system
31 * can support them as long as they read as zeros.
32 *
33 * All structures defined here are always written and read to/from disk
34 * in big-endian order.
35 */
36
37 /*
38 * <mach/machine.h> is needed here for the cpu_type_t and cpu_subtype_t types
39 * and contains the constants for the possible values of these types.
40 */
41 #include <mach/machine.h>
42 #include <architecture/byte_order.h>
43
44 #define FAT_MAGIC 0xcafebabe
45 #define FAT_CIGAM NXSwapLong(FAT_MAGIC)
46
47 struct fat_header {
48 unsigned long magic; /* FAT_MAGIC */
49 unsigned long nfat_arch; /* number of structs that follow */
50 };
51
52 struct fat_arch {
53 cpu_type_t cputype; /* cpu specifier (int) */
54 cpu_subtype_t cpusubtype; /* machine specifier (int) */
55 unsigned long offset; /* file offset to this object file */
56 unsigned long size; /* size of this object file */
57 unsigned long align; /* alignment as a power of 2 */
58 };
59
60 #ifdef KERNEL
61
62 #include <mach/mach_types.h>
63
64 struct vnode;
65
66 /* XXX return type should be load_return_t, but mach_loader.h is not in scope */
67 int fatfile_getarch_affinity(struct vnode *vp, vm_offset_t data_ptr,
68 struct fat_arch *archret, int affinity);
69 int fatfile_getarch(struct vnode *vp, vm_offset_t data_ptr,
70 struct fat_arch *archret);
71 int fatfile_getarch_with_bits(struct vnode *vp, integer_t archbits,
72 vm_offset_t data_ptr, struct fat_arch *archret);
73
74 #endif /* KERNEL */