4 #include <linux/compiler.h>
5 #include <linux/types.h>
44 #define __init __section(.init.text) __cold notrace
45 #define __initdata __section(.init.data)
46 #define __initconst __constsection(.init.rodata)
47 #define __exitdata __section(.exit.data)
48 #define __exit_call __used __section(.exitcall.exit)
55 #ifdef CONFIG_BROKEN_RODATA
56 #define __constsection(x)
58 #define __constsection(x) __section(x)
78 #define __ref __section(.ref.text) noinline
79 #define __refdata __section(.ref.data)
80 #define __refconst __constsection(.ref.rodata)
83 #define __init_refok __ref
84 #define __initdata_refok __refdata
85 #define __exit_refok __ref
91 #define __exitused __used
94 #define __exit __section(.exit.text) __exitused __cold notrace
97 #define __devinit __section(.devinit.text) __cold notrace
98 #define __devinitdata __section(.devinit.data)
99 #define __devinitconst __constsection(.devinit.rodata)
100 #define __devexit __section(.devexit.text) __exitused __cold notrace
101 #define __devexitdata __section(.devexit.data)
102 #define __devexitconst __constsection(.devexit.rodata)
105 #define __cpuinit __section(.cpuinit.text) __cold notrace
106 #define __cpuinitdata __section(.cpuinit.data)
107 #define __cpuinitconst __constsection(.cpuinit.rodata)
108 #define __cpuexit __section(.cpuexit.text) __exitused __cold notrace
109 #define __cpuexitdata __section(.cpuexit.data)
110 #define __cpuexitconst __constsection(.cpuexit.rodata)
113 #define __meminit __section(.meminit.text) __cold notrace
114 #define __meminitdata __section(.meminit.data)
115 #define __meminitconst __constsection(.meminit.rodata)
116 #define __memexit __section(.memexit.text) __exitused __cold notrace
117 #define __memexitdata __section(.memexit.data)
118 #define __memexitconst __constsection(.memexit.rodata)
121 #define __HEAD .section ".head.text","ax"
122 #define __INIT .section ".init.text","ax"
123 #define __FINIT .previous
125 #define __INITDATA .section ".init.data","aw",%progbits
126 #define __INITRODATA .section ".init.rodata","a",%progbits
127 #define __FINITDATA .previous
129 #define __DEVINIT .section ".devinit.text", "ax"
130 #define __DEVINITDATA .section ".devinit.data", "aw"
131 #define __DEVINITRODATA .section ".devinit.rodata", "a"
133 #define __CPUINIT .section ".cpuinit.text", "ax"
134 #define __CPUINITDATA .section ".cpuinit.data", "aw"
135 #define __CPUINITRODATA .section ".cpuinit.rodata", "a"
137 #define __MEMINIT .section ".meminit.text", "ax"
138 #define __MEMINITDATA .section ".meminit.data", "aw"
139 #define __MEMINITRODATA .section ".meminit.rodata", "a"
142 #define __REF .section ".ref.text", "ax"
143 #define __REFDATA .section ".ref.data", "aw"
144 #define __REFCONST .section ".ref.rodata", "a"
150 typedef int (*initcall_t)(void);
151 typedef void (*exitcall_t)(void);
153 extern initcall_t __con_initcall_start[], __con_initcall_end[];
154 extern initcall_t __security_initcall_start[], __security_initcall_end[];
157 typedef void (*ctor_fn_t)(void);
160 extern int do_one_initcall(initcall_t fn);
161 extern char __initdata boot_command_line[];
162 extern char *saved_command_line;
163 extern unsigned int reset_devices;
166 void setup_arch(
char **);
167 void prepare_namespace(
void);
169 extern void (*late_time_init)(void);
171 extern bool initcall_debug;
189 #define __define_initcall(level,fn,id) \
190 static initcall_t __initcall_##fn##id __used \
191 __attribute__((__section__(".initcall" level ".init"))) = fn
198 #define early_initcall(fn) __define_initcall("early",fn,early)
207 #define pure_initcall(fn) __define_initcall("0",fn,0)
209 #define core_initcall(fn) __define_initcall("1",fn,1)
210 #define core_initcall_sync(fn) __define_initcall("1s",fn,1s)
211 #define postcore_initcall(fn) __define_initcall("2",fn,2)
212 #define postcore_initcall_sync(fn) __define_initcall("2s",fn,2s)
213 #define arch_initcall(fn) __define_initcall("3",fn,3)
214 #define arch_initcall_sync(fn) __define_initcall("3s",fn,3s)
215 #define subsys_initcall(fn) __define_initcall("4",fn,4)
216 #define subsys_initcall_sync(fn) __define_initcall("4s",fn,4s)
217 #define fs_initcall(fn) __define_initcall("5",fn,5)
218 #define fs_initcall_sync(fn) __define_initcall("5s",fn,5s)
219 #define rootfs_initcall(fn) __define_initcall("rootfs",fn,rootfs)
220 #define device_initcall(fn) __define_initcall("6",fn,6)
221 #define device_initcall_sync(fn) __define_initcall("6s",fn,6s)
222 #define late_initcall(fn) __define_initcall("7",fn,7)
223 #define late_initcall_sync(fn) __define_initcall("7s",fn,7s)
225 #define __initcall(fn) device_initcall(fn)
227 #define __exitcall(fn) \
228 static exitcall_t __exitcall_##fn __exit_call = fn
230 #define console_initcall(fn) \
231 static initcall_t __initcall_##fn \
232 __used __section(.con_initcall.init) = fn
234 #define security_initcall(fn) \
235 static initcall_t __initcall_##fn \
236 __used __section(.security_initcall.init) = fn
240 int (*setup_func)(
char *);
250 #define __setup_param(str, unique_id, fn, early) \
251 static const char __setup_str_##unique_id[] __initconst \
252 __aligned(1) = str; \
253 static struct obs_kernel_param __setup_##unique_id \
254 __used __section(.init.setup) \
255 __attribute__((aligned((sizeof(long))))) \
256 = { __setup_str_##unique_id, fn, early }
258 #define __setup(str, fn) \
259 __setup_param(str, fn, fn, 0)
263 #define early_param(str, fn) \
264 __setup_param(str, fn, fn, 1)
267 void __init parse_early_param(
void);
268 void __init parse_early_options(
char *cmdline);
279 #define module_init(x) __initcall(x);
291 #define module_exit(x) __exitcall(x);
296 #define early_initcall(fn) module_init(fn)
297 #define core_initcall(fn) module_init(fn)
298 #define postcore_initcall(fn) module_init(fn)
299 #define arch_initcall(fn) module_init(fn)
300 #define subsys_initcall(fn) module_init(fn)
301 #define fs_initcall(fn) module_init(fn)
302 #define device_initcall(fn) module_init(fn)
303 #define late_initcall(fn) module_init(fn)
305 #define security_initcall(fn) module_init(fn)
308 #define module_init(initfn) \
309 static inline initcall_t __inittest(void) \
311 int init_module(void) __attribute__((alias(#initfn)));
314 #define module_exit(exitfn) \
315 static inline exitcall_t __exittest(void) \
317 void cleanup_module(void) __attribute__((alias(#exitfn)));
319 #define __setup_param(str, unique_id, fn)
320 #define __setup(str, func)
324 #define __nosavedata __section(.data..nosave)
328 #ifdef CONFIG_MODULES
329 #define __init_or_module
330 #define __initdata_or_module
331 #define __initconst_or_module
332 #define __INIT_OR_MODULE .text
333 #define __INITDATA_OR_MODULE .data
334 #define __INITRODATA_OR_MODULE .section ".rodata","a",%progbits
336 #define __init_or_module __init
337 #define __initdata_or_module __initdata
338 #define __initconst_or_module __initconst
339 #define __INIT_OR_MODULE __INIT
340 #define __INITDATA_OR_MODULE __INITDATA
341 #define __INITRODATA_OR_MODULE __INITRODATA
350 #if defined(MODULE) || defined(CONFIG_HOTPLUG)
351 #define __devexit_p(x) x
353 #define __devexit_p(x) NULL
357 #define __exit_p(x) x
359 #define __exit_p(x) NULL