]> git.saurik.com Git - apple/xnu.git/blame - libsa/load.h
xnu-792.21.3.tar.gz
[apple/xnu.git] / libsa / load.h
CommitLineData
55e303ae
A
1#ifndef __LOAD_H__
2#define __LOAD_H__
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include "dgraph.h"
9
10#ifdef KERNEL
11#else
12#include "KXKext.h"
13#endif /* KERNEL */
14
15#ifndef KERNEL
16typedef KXKextManagerError kload_error;
17enum {
18 kload_error_none = kKXKextManagerErrorNone,
19 kload_error_unspecified = kKXKextManagerErrorUnspecified,
20 kload_error_invalid_argument = kKXKextManagerErrorInvalidArgument,
21 kload_error_no_memory = kKXKextManagerErrorNoMemory,
22
23 kload_error_user_abort = kKXKextManagerErrorUserAbort,
24 kload_error_kernel_error = kKXKextManagerErrorKernelError,
25 kload_error_kernel_permission = kKXKextManagerErrorKernelPermission,
26
27 kload_error_executable_bad = kKXKextManagerErrorLoadExecutableBad,
28 kload_error_already_loaded = kKXKextManagerErrorAlreadyLoaded,
29 kload_error_loaded_version_differs = kKXKextManagerErrorLoadedVersionDiffers,
30 kload_error_dependency_loaded_version_differs = kKXKextManagerErrorDependencyLoadedVersionDiffers,
31 kload_error_link_load = kKXKextManagerErrorLinkLoad
32};
33
34typedef KXKextManagerLogLevel kload_log_level;
35enum {
36 kload_log_level_silent = kKXKextManagerLogLevelSilent,
37 kload_log_level_errors_only = kKXKextManagerLogLevelErrorsOnly,
38 kload_log_level_default = kKXKextManagerLogLevelDefault,
39 kload_log_level_basic = kKXKextManagerLogLevelBasic,
40 kload_log_level_load_basic = kKXKextManagerLogLevelLoadBasic,
41 kload_log_level_details = kKXKextManagerLogLevelDetails,
42 kload_log_level_kexts = kKXKextManagerLogLevelKexts,
43 kload_log_level_kext_details = kKXKextManagerLogLevelKextDetails,
44 kload_log_level_load_details = kKXKextManagerLogLevelLoadDetails
45};
46#else
47
48typedef enum {
49 kload_error_none,
50 kload_error_unspecified,
51 kload_error_invalid_argument,
52 kload_error_no_memory,
53
54 kload_error_user_abort,
55 kload_error_kernel_error,
56 kload_error_kernel_permission,
57
58 kload_error_executable_bad,
59 kload_error_already_loaded,
60 kload_error_loaded_version_differs,
61 kload_error_dependency_loaded_version_differs,
62 kload_error_link_load
63} kload_error;
64
65typedef enum {
66 kload_log_level_silent = -2, // no notices, no errors
67 kload_log_level_errors_only = -1,
68 kload_log_level_default = 0,
69 kload_log_level_basic = 1,
70 kload_log_level_load_basic = 2,
71 kload_log_level_details = 3,
72 kload_log_level_kexts = 4,
73 kload_log_level_kext_details = 5,
74 kload_log_level_load_details = 6
75} kload_log_level;
76
77#endif /* KERNEL */
78
79
80kload_error kload_load_dgraph(dgraph_t * dgraph
81#ifndef KERNEL
82 ,
83 const char * kernel_file,
84 const char * patch_file, const char * patch_dir,
85 const char * symbol_file, const char * symbol_dir,
86 int do_load, int do_start_kmod, int do_prelink,
87 int interactive_level,
88 int ask_overwrite_symbols, int overwrite_symbols
89#endif /* not KERNEL */
90 );
91
92#ifndef KERNEL
93kload_error kload_load_with_arglist(
94 int argc, char **argv,
95 const char * kernel_file,
96 const char * patch_file, const char * patch_dir,
97 const char * symbol_file, const char * symbol_dir,
98 int do_load, int do_start_kmod,
99 int interactive_level,
100 int ask_overwrite_symbols, int overwrite_symbols);
101#endif /* not KERNEL */
102
103kload_error kload_map_dgraph(dgraph_t * dgraph
104#ifndef KERNEL
105 ,
106 const char * kernel_file
107#endif /* not KERNEL */
108 );
109kload_error kload_map_entry(dgraph_entry_t * entry);
110
111#ifndef KERNEL
112int kload_file_exists(const char * path);
113kload_error kload_request_load_addresses(
114 dgraph_t * dgraph,
115 const char * kernel_file);
116kload_error kload_set_load_addresses_from_args(
117 dgraph_t * dgraph,
118 const char * kernel_file,
119 char ** addresses);
120#endif /* not KERNEL */
121
122kload_error kload_set_load_addresses_from_kernel(
123 dgraph_t * dgraph
124#ifndef KERNEL
125 ,
126 const char * kernel_file,
127 int do_load
128#endif /* not KERNEL */
129 );
130
131void kload_set_log_level(kload_log_level level);
132#ifndef KERNEL
133void kload_set_log_function(
134 void (*)(const char * format, ...));
135void kload_set_error_log_function(
136 void (*)(const char * format, ...));
137void kload_set_user_approve_function(
138 int (*)(int default_answer, const char * format, ...));
139void kload_set_user_veto_function(
140 int (*)(int default_answer, const char * format, ...));
141void kload_set_user_input_function(
142 const char * (*)(const char * format, ...));
143
144void kload_log_message(const char * format, ...);
145void kload_log_error(const char * format, ...);
146#define KNL ""
147
148#else
149#define kload_log_message IOLog
150#define kload_log_error IOLog
151#define KNL "\n"
152
153#endif /* not KERNEL */
154
155
156
157#endif /* __LOAD_H__ */
158
159#ifdef __cplusplus
160}
161#endif
162