]>
Commit | Line | Data |
---|---|---|
b0d623f7 A |
1 | /* |
2 | * Copyright (c) 2008 Apple Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ | |
0a7de745 | 5 | * |
b0d623f7 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. The rights granted to you under the License | |
10 | * may not be used to create, or enable the creation or redistribution of, | |
11 | * unlawful or unlicensed copies of an Apple operating system, or to | |
12 | * circumvent, violate, or enable the circumvention or violation of, any | |
13 | * terms of an Apple operating system software license agreement. | |
0a7de745 | 14 | * |
b0d623f7 A |
15 | * Please obtain a copy of the License at |
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. | |
0a7de745 | 17 | * |
b0d623f7 A |
18 | * The Original Code and all software distributed under the License are |
19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
23 | * Please see the License for the specific language governing rights and | |
24 | * limitations under the License. | |
0a7de745 | 25 | * |
b0d623f7 A |
26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ |
27 | */ | |
28 | #ifndef _KXLD_KEXT_H_ | |
29 | #define _KXLD_KEXT_H_ | |
30 | ||
b0d623f7 A |
31 | #include <sys/types.h> |
32 | #if KERNEL | |
33 | #include <libkern/kxld_types.h> | |
0a7de745 | 34 | #else |
b0d623f7 A |
35 | #include "kxld_types.h" |
36 | #endif | |
37 | ||
38 | struct kxld_array; | |
39 | struct kxld_kext; | |
40 | struct kxld_dict; | |
6d2010ae | 41 | struct kxld_object; |
b0d623f7 A |
42 | struct kxld_sect; |
43 | struct kxld_seg; | |
44 | struct kxld_symtab; | |
45 | struct kxld_vtable; | |
46 | typedef struct kxld_kext KXLDKext; | |
47 | ||
48 | /******************************************************************************* | |
49 | * Constructors and Destructors | |
50 | *******************************************************************************/ | |
51 | ||
52 | size_t kxld_kext_sizeof(void) | |
0a7de745 | 53 | __attribute__((const, visibility("hidden"))); |
b0d623f7 | 54 | |
6d2010ae A |
55 | kern_return_t kxld_kext_init(KXLDKext *kext, struct kxld_object *kext_object, |
56 | struct kxld_object *interface_object) | |
0a7de745 | 57 | __attribute__((nonnull(1, 2), visibility("hidden"))); |
b0d623f7 A |
58 | |
59 | void kxld_kext_clear(KXLDKext *kext) | |
0a7de745 | 60 | __attribute__((nonnull, visibility("hidden"))); |
b0d623f7 A |
61 | |
62 | void kxld_kext_deinit(KXLDKext *kext) | |
0a7de745 | 63 | __attribute__((nonnull, visibility("hidden"))); |
b0d623f7 A |
64 | |
65 | /******************************************************************************* | |
66 | * Accessors | |
67 | *******************************************************************************/ | |
68 | ||
0a7de745 | 69 | kern_return_t kxld_kext_export_symbols(const KXLDKext *kext, |
6d2010ae A |
70 | struct kxld_dict *defined_symbols_by_name, |
71 | struct kxld_dict *obsolete_symbols_by_name, | |
72 | struct kxld_dict *defined_cxx_symbols_by_value) | |
0a7de745 | 73 | __attribute__((nonnull(1), visibility("hidden"))); |
b0d623f7 | 74 | |
39037602 | 75 | void kxld_kext_get_vmsize_for_seg_by_name(const KXLDKext *kext, |
0a7de745 A |
76 | const char *segname, |
77 | u_long *vmsize) | |
39037602 A |
78 | __attribute__((nonnull, visibility("hidden"))); |
79 | ||
0a7de745 | 80 | void kxld_kext_get_vmsize(const KXLDKext *kext, |
6d2010ae | 81 | u_long *header_size, u_long *vmsize) |
0a7de745 | 82 | __attribute__((nonnull, visibility("hidden"))); |
316670eb A |
83 | |
84 | void kxld_kext_set_linked_object_size(KXLDKext *kext, u_long vmsize) | |
85 | __attribute__((nonnull, visibility("hidden"))); | |
86 | ||
b0d623f7 | 87 | kern_return_t kxld_kext_export_linked_object(const KXLDKext *kext, |
0a7de745 A |
88 | void *linked_object, |
89 | kxld_addr_t *kmod_info) | |
90 | __attribute__((nonnull, visibility("hidden"))); | |
b0d623f7 | 91 | |
b0d623f7 A |
92 | /******************************************************************************* |
93 | * Modifiers | |
94 | *******************************************************************************/ | |
0a7de745 A |
95 | kern_return_t kxld_kext_export_vtables(KXLDKext *kext, |
96 | const struct kxld_dict *defined_cxx_symbols, | |
6d2010ae A |
97 | const struct kxld_dict *defined_symbols, |
98 | struct kxld_dict *vtables) | |
0a7de745 | 99 | __attribute__((nonnull, visibility("hidden"))); |
b0d623f7 | 100 | |
39037602 | 101 | kern_return_t kxld_kext_relocate(KXLDKext *kext, |
0a7de745 A |
102 | kxld_addr_t link_address, |
103 | struct kxld_dict *patched_vtables, | |
104 | const struct kxld_dict *defined_symbols, | |
105 | const struct kxld_dict *obsolete_symbols, | |
106 | const struct kxld_dict *defined_cxx_symbols) | |
107 | __attribute__((nonnull(1, 3, 4), visibility("hidden"))); | |
39037602 | 108 | |
b0d623f7 A |
109 | |
110 | #endif /* _KXLD_KEXT_H_ */ |