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