1#ifndef _LINUX_UML_INIT_H
2#define _LINUX_UML_INIT_H
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39#ifndef _LINUX_INIT_H
40typedef int (*initcall_t)(void);
41typedef void (*exitcall_t)(void);
42
43
44
45#define __init __attribute__ ((__section__ (".init.text")))
46#define __initdata __attribute__ ((__section__ (".init.data")))
47#define __exitdata __attribute__ ((__section__(".exit.data")))
48#define __exit_call __attribute_used__ __attribute__ ((__section__ (".exitcall.exit")))
49
50#ifdef MODULE
51#define __exit __attribute__ ((__section__(".exit.text")))
52#else
53#define __exit __attribute_used__ __attribute__ ((__section__(".exit.text")))
54#endif
55
56#endif
57
58#ifndef MODULE
59struct uml_param {
60 const char *str;
61 int (*setup_func)(char *, int *);
62};
63
64extern initcall_t __uml_initcall_start, __uml_initcall_end;
65extern initcall_t __uml_postsetup_start, __uml_postsetup_end;
66extern const char *__uml_help_start, *__uml_help_end;
67#endif
68
69#define __uml_initcall(fn) \
70 static initcall_t __uml_initcall_##fn __uml_init_call = fn
71
72#define __uml_exitcall(fn) \
73 static exitcall_t __uml_exitcall_##fn __uml_exit_call = fn
74
75extern struct uml_param __uml_setup_start, __uml_setup_end;
76
77#define __uml_postsetup(fn) \
78 static initcall_t __uml_postsetup_##fn __uml_postsetup_call = fn
79
80#define __non_empty_string(dummyname,string) \
81 struct __uml_non_empty_string_struct_##dummyname \
82 { \
83 char _string[sizeof(string)-2]; \
84 }
85
86#ifndef MODULE
87#define __uml_setup(str, fn, help...) \
88 __non_empty_string(fn ##_setup, str); \
89 __uml_help(fn, help); \
90 static char __uml_setup_str_##fn[] __initdata = str; \
91 static struct uml_param __uml_setup_##fn __uml_init_setup = { __uml_setup_str_##fn, fn }
92#else
93#define __uml_setup(str, fn, help...) \
94
95#endif
96
97#define __uml_help(fn, help...) \
98 __non_empty_string(fn ##__help, help); \
99 static char __uml_help_str_##fn[] __initdata = help; \
100 static const char *__uml_help_##fn __uml_setup_help = __uml_help_str_##fn
101
102
103
104
105
106#define __uml_init_setup __attribute_used__ __attribute__ ((__section__ (".uml.setup.init")))
107#define __uml_setup_help __attribute_used__ __attribute__ ((__section__ (".uml.help.init")))
108#define __uml_init_call __attribute_used__ __attribute__ ((__section__ (".uml.initcall.init")))
109#define __uml_postsetup_call __attribute_used__ __attribute__ ((__section__ (".uml.postsetup.init")))
110#define __uml_exit_call __attribute_used__ __attribute__ ((__section__ (".uml.exitcall.exit")))
111
112#ifndef __KERNEL__
113
114#define __define_initcall(level,fn) \
115 static initcall_t __initcall_##fn __attribute_used__ \
116 __attribute__((__section__(".initcall" level ".init"))) = fn
117
118
119
120
121#define __initcall(fn) __define_initcall("1", fn)
122
123#define __exitcall(fn) static exitcall_t __exitcall_##fn __exit_call = fn
124
125#define __init_call __attribute_used__ __attribute__ ((__section__ (".initcall.init")))
126
127#endif
128
129#endif
130
131
132
133
134
135
136
137
138
139
140
141