]> git.saurik.com Git - apple/xnu.git/blob - EXTERNAL_HEADERS/mach-o/kld.h
xnu-123.5.tar.gz
[apple/xnu.git] / EXTERNAL_HEADERS / mach-o / kld.h
1 /*
2 * Copyright (c) 1999 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 #ifndef _MACHO_KLD_H_
24 #define _MACHO_KLD_H_
25
26 #include <mach-o/loader.h>
27 #include <stdarg.h>
28
29 /*
30 * These API's are in libkld. Both kmodload(8) and /mach_kernel should
31 * link with -lkld and then ld(1) will expand -lkld to libkld.dylib or
32 * libkld.a depending on if -dynamic or -static is in effect.
33 */
34
35 /*
36 * Note that you must supply the following function for error reporting when
37 * using any of the functions listed here.
38 */
39 extern void kld_error_vprintf(const char *format, va_list ap);
40
41 /*
42 * This two are only in libkld.dylib for use by kmodload(8) (user code compiled
43 * with the default -dynamic).
44 */
45 #ifdef __DYNAMIC__
46 __private_extern__ long kld_load_basefile(
47 const char *base_filename);
48
49 /* Note: this takes only one object file name */
50 __private_extern__ long kld_load(
51 struct mach_header **header_addr,
52 const char *object_filename,
53 const char *output_filename);
54 #endif /* __DYNAMIC__ */
55
56 /*
57 * This two are only in libkld.a use by /mach_kernel (kernel code compiled with
58 * -static).
59 */
60 #ifdef __STATIC__
61 /* Note: this api does not write an output file */
62 __private_extern__ long kld_load_from_memory(
63 struct mach_header **header_addr,
64 const char *object_name,
65 char *object_addr,
66 long object_size);
67 #endif /* __STATIC__ */
68
69 __private_extern__ long kld_unload_all(
70 long deallocate_sets);
71
72 __private_extern__ long kld_lookup(
73 const char *symbol_name,
74 unsigned long *value);
75
76 __private_extern__ long kld_forget_symbol(
77 const char *symbol_name);
78
79 __private_extern__ void kld_address_func(
80 unsigned long (*func)(unsigned long size, unsigned long headers_size));
81
82 #endif /* _MACHO_KLD_H_ */