p_module.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef MODUTILS_MODULE_H
00023 #define MODUTILS_MODULE_H 1
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 struct old_kernel_sym
00035 {
00036 unsigned long value;
00037 char name[60];
00038 };
00039
00040 struct old_module_ref
00041 {
00042 unsigned long module;
00043 unsigned long next;
00044 };
00045
00046 struct old_module_symbol
00047 {
00048 unsigned long addr;
00049 unsigned long name;
00050 };
00051
00052 struct old_symbol_table
00053 {
00054 int size;
00055 int n_symbols;
00056 int n_refs;
00057 struct old_module_symbol symbol[0];
00058 struct old_module_ref ref[0];
00059 };
00060
00061 struct old_mod_routines
00062 {
00063 unsigned long init;
00064 unsigned long cleanup;
00065 };
00066
00067 struct old_module
00068 {
00069 unsigned long next;
00070 unsigned long ref;
00071 unsigned long symtab;
00072 unsigned long name;
00073 int size;
00074 unsigned long addr;
00075 int state;
00076 unsigned long cleanup;
00077 };
00078
00079
00080 #define OLD_MOD_AUTOCLEAN 0x40000000
00081
00082 int get_kernel_syms(struct old_kernel_sym *);
00083 int old_sys_init_module(char const * name, char *code, unsigned codesize,
00084 struct old_mod_routines *, struct old_symbol_table *);
00085
00086
00087
00088
00089
00090 #define tgt_sizeof_char sizeof(char)
00091 #define tgt_sizeof_short sizeof(short)
00092 #define tgt_sizeof_int sizeof(int)
00093 #define tgt_sizeof_long sizeof(long)
00094 #define tgt_sizeof_char_p sizeof(char *)
00095 #define tgt_sizeof_void_p sizeof(void *)
00096 #define tgt_long long
00097 #define tgt_long_fmt "l"
00098
00099
00100
00101
00102
00103 #if defined(COMMON_3264) && defined(ONLY_64)
00104 #undef tgt_long
00105 #undef tgt_long_fmt
00106 #undef tgt_sizeof_long
00107 #undef tgt_sizeof_char_p
00108 #undef tgt_sizeof_void_p
00109 #define tgt_long long long
00110 #define tgt_long_fmt "ll"
00111 #define tgt_sizeof_long 8
00112 #define tgt_sizeof_char_p 8
00113 #define tgt_sizeof_void_p 8
00114 #endif
00115
00116
00117
00118
00119
00120 struct module_symbol
00121 {
00122 unsigned long value;
00123 unsigned long name;
00124 };
00125
00126 struct module_ref
00127 {
00128 unsigned tgt_long dep;
00129 unsigned tgt_long ref;
00130 unsigned tgt_long next_ref;
00131 };
00132
00133 struct module
00134 {
00135 unsigned tgt_long size_of_struct;
00136 unsigned tgt_long next;
00137 unsigned tgt_long name;
00138 unsigned tgt_long size;
00139
00140 tgt_long usecount;
00141 unsigned tgt_long flags;
00142
00143 unsigned nsyms;
00144 unsigned ndeps;
00145
00146 unsigned tgt_long syms;
00147 unsigned tgt_long deps;
00148 unsigned tgt_long refs;
00149 unsigned tgt_long init;
00150 unsigned tgt_long cleanup;
00151 unsigned tgt_long ex_table_start;
00152 unsigned tgt_long ex_table_end;
00153 #ifdef __alpha__
00154 unsigned tgt_long gp;
00155 #endif
00156
00157 unsigned tgt_long read_start;
00158 unsigned tgt_long read_end;
00159 unsigned tgt_long can_unload;
00160 unsigned tgt_long runsize;
00161 unsigned tgt_long kallsyms_start;
00162 unsigned tgt_long kallsyms_end;
00163 unsigned tgt_long archdata_start;
00164 unsigned tgt_long archdata_end;
00165 unsigned tgt_long kernel_data;
00166 };
00167
00168 struct module_info
00169 {
00170 unsigned long addr;
00171 unsigned long size;
00172 unsigned long flags;
00173 long usecount;
00174 };
00175
00176
00177 #define NEW_MOD_RUNNING 1
00178 #define NEW_MOD_DELETED 2
00179 #define NEW_MOD_AUTOCLEAN 4
00180 #define NEW_MOD_VISITED 8
00181 #define NEW_MOD_USED_ONCE 16
00182 #define NEW_MOD_INITIALIZING 64
00183
00184 int sys_init_module(char const * name, const struct module *);
00185 int query_module(char const * name, int which, void *buf, size_t bufsize,
00186 size_t *ret);
00187
00188
00189
00190 #define QM_MODULES 1
00191 #define QM_DEPS 2
00192 #define QM_REFS 3
00193 #define QM_SYMBOLS 4
00194 #define QM_INFO 5
00195
00196
00197
00198
00199 unsigned long create_module(const char *, size_t);
00200 int delete_module(const char *);
00201
00202
00203
00204
00205 extern unsigned int safemode;
00206
00207 #endif