]>
git.saurik.com Git - apple/xnu.git/blob - EXTERNAL_HEADERS/mach-o/kld.h
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
27 #include <mach-o/loader.h>
31 * These API's are in libkld. Both kextload(8) and /mach_kernel should
32 * link with -lkld and then ld(1) will expand -lkld to libkld.dylib or
33 * libkld.a depending on if -dynamic or -static is in effect.
35 * Note: we are using the __DYNAMIC__ flag to indicate user space kernel
36 * linking and __STATIC__ as a synonym of KERNEL.
40 * Note that you must supply the following function for error reporting when
41 * using any of the functions listed here.
43 extern void kld_error_vprintf(const char *format
, va_list ap
);
46 * These two are only in libkld.dylib for use by kextload(8) (user code compiled
47 * with the default -dynamic).
50 extern long kld_load_basefile(
51 const char *base_filename
);
53 /* Note: this takes only one object file name */
55 struct mach_header
**header_addr
,
56 const char *object_filename
,
57 const char *output_filename
);
59 extern long kld_load_from_memory(
60 struct mach_header
**header_addr
,
61 const char *object_name
,
64 const char *output_filename
);
65 #endif /* __DYNAMIC__ */
68 * This one is only in libkld.a use by /mach_kernel (kernel code compiled with
72 /* Note: this api does not write an output file */
73 extern long kld_load_from_memory(
74 struct mach_header
**header_addr
,
75 const char *object_name
,
78 #endif /* __STATIC__ */
80 extern long kld_load_basefile_from_memory(
81 const char *base_filename
,
85 extern long kld_unload_all(
86 long deallocate_sets
);
88 extern long kld_lookup(
89 const char *symbol_name
,
90 unsigned long *value
);
92 extern long kld_forget_symbol(
93 const char *symbol_name
);
95 extern void kld_address_func(
96 unsigned long (*func
)(unsigned long size
, unsigned long headers_size
));
98 #define KLD_STRIP_ALL 0x00000000
99 #define KLD_STRIP_NONE 0x00000001
101 extern void kld_set_link_options(
102 unsigned long link_options
);
104 #endif /* _MACHO_KLD_H_ */