]>
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 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
29 #include <mach-o/loader.h>
33 * These API's are in libkld. Both kmodload(8) and /mach_kernel should
34 * link with -lkld and then ld(1) will expand -lkld to libkld.dylib or
35 * libkld.a depending on if -dynamic or -static is in effect.
37 * Note: we are using the __DYNAMIC__ flag to indicate user space kernel
38 * linking and __STATIC__ as a synonym of KERNEL.
42 * Note that you must supply the following function for error reporting when
43 * using any of the functions listed here.
45 extern void kld_error_vprintf(const char *format
, va_list ap
);
48 * These two are only in libkld.dylib for use by kmodload(8) (user code compiled
49 * with the default -dynamic).
52 __private_extern__
long kld_load_basefile(
53 const char *base_filename
);
55 /* Note: this takes only one object file name */
56 __private_extern__
long kld_load(
57 struct mach_header
**header_addr
,
58 const char *object_filename
,
59 const char *output_filename
);
61 __private_extern__
long kld_load_from_memory(
62 struct mach_header
**header_addr
,
63 const char *object_name
,
66 const char *output_filename
);
67 #endif /* __DYNAMIC__ */
70 * This two are only in libkld.a use by /mach_kernel (kernel code compiled with
74 /* Note: this api does not write an output file */
75 __private_extern__
long kld_load_from_memory(
76 struct mach_header
**header_addr
,
77 const char *object_name
,
80 #endif /* __STATIC__ */
82 __private_extern__
long kld_load_basefile_from_memory(
83 const char *base_filename
,
87 __private_extern__
long kld_unload_all(
88 long deallocate_sets
);
90 __private_extern__
long kld_lookup(
91 const char *symbol_name
,
92 unsigned long *value
);
94 __private_extern__
long kld_forget_symbol(
95 const char *symbol_name
);
97 __private_extern__
void kld_address_func(
98 unsigned long (*func
)(unsigned long size
, unsigned long headers_size
));
100 #define KLD_STRIP_ALL 0x00000000
101 #define KLD_STRIP_NONE 0x00000001
103 __private_extern__
void kld_set_link_options(
104 unsigned long link_options
);
106 #endif /* _MACHO_KLD_H_ */