37
#if !defined (GRUB_UTIL) && !defined (GRUB_MACHINE_EMU)
40
#define GRUB_MOD_INIT(name) \
41
static void grub_mod_init (grub_dl_t mod __attribute__ ((unused))) __attribute__ ((used)); \
43
grub_mod_init (grub_dl_t mod __attribute__ ((unused)))
47
#define GRUB_MOD_FINI(name) \
48
static void grub_mod_fini (void) __attribute__ ((used)); \
37
55
#ifndef GRUB_MOD_INIT
38
56
#define GRUB_MOD_INIT(name) \
39
57
static void grub_mod_init (grub_dl_t mod __attribute__ ((unused))) __attribute__ ((used)); \
54
72
grub_mod_fini (void)
58
#define GRUB_MOD_NAME(name) \
59
static char grub_modname[] __attribute__ ((section ("_modname, _modname"), used)) = #name;
61
#define GRUB_MOD_DEP(name) \
62
__asm__ (".section _moddeps, _moddeps\n.asciz \"" #name "\"\n")
64
#define GRUB_MOD_NAME(name) \
65
__asm__ (".section .modname\n.asciz \"" #name "\"\n")
67
#define GRUB_MOD_DEP(name) \
68
__asm__ (".section .moddeps\n.asciz \"" #name "\"\n")
76
81
#define GRUB_MOD_SECTION(x) "_" #x ", _" #x ""
78
83
#define GRUB_MOD_SECTION(x) "." #x
82
87
#define GRUB_MOD_SECTION(x) _ ## x , _ ##x
84
89
#define GRUB_MOD_SECTION(x) . ## x
94
#define GRUB_MOD_DEP(name) \
95
static const char grub_module_depend_##name[] \
96
__attribute__((section(GRUB_MOD_SECTION(moddeps)), __used__)) = #name
97
#define GRUB_MOD_NAME(name) \
98
static const char grub_module_name_##name[] \
99
__attribute__((section(GRUB_MOD_SECTION(modname)), __used__)) = #name
88
102
/* Me, Vladimir Serbinenko, hereby I add this module check as per new
89
103
GNU module policy. Note that this license check is informative only.
90
104
Modules have to be licensed under GPLv3 or GPLv3+ (optionally
97
111
#define GRUB_MOD_LICENSE(license) \
98
112
static char grub_module_license[] __attribute__ ((section (GRUB_MOD_SECTION (module_license)), used)) = "LICENSE=" license;
100
#define GRUB_MOD_LICENSE(license) \
101
.section GRUB_MOD_SECTION(module_license), "a"; \
113
#define GRUB_MOD_DEP(name) \
114
static const char grub_module_depend_##name[] \
115
__attribute__((section(GRUB_MOD_SECTION(moddeps)), __used__)) = #name
118
.macro GRUB_MOD_LICENSE
119
.section GRUB_MOD_SECTION(module_license)
125
.macro GRUB_MOD_LICENSE license
126
.section GRUB_MOD_SECTION(module_license), "a"
107
134
/* Under GPL license obligations you have to distribute your module
140
168
void (*init) (struct grub_dl *mod);
141
169
void (*fini) (void);
170
#if defined (__ia64__) || defined (__powerpc__)
142
176
struct grub_dl *next;
144
179
typedef struct grub_dl *grub_dl_t;
146
grub_dl_t EXPORT_FUNC(grub_dl_load_file) (const char *filename);
181
grub_dl_t grub_dl_load_file (const char *filename);
147
182
grub_dl_t EXPORT_FUNC(grub_dl_load) (const char *name);
148
183
grub_dl_t grub_dl_load_core (void *addr, grub_size_t size);
149
184
int EXPORT_FUNC(grub_dl_unload) (grub_dl_t mod);
157
192
grub_dl_t EXPORT_FUNC(grub_dl_get) (const char *name);
158
193
grub_err_t grub_dl_register_symbol (const char *name, void *addr,
194
int isfunc, grub_dl_t mod);
161
196
grub_err_t grub_arch_dl_check_header (void *ehdr);
162
197
grub_err_t grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr);
166
201
void grub_arch_dl_init_linker (void);
204
#define GRUB_IA64_DL_TRAMP_ALIGN 16
205
#define GRUB_IA64_DL_TRAMP_SIZE 48
206
#define GRUB_IA64_DL_GOT_ALIGN 16
209
grub_ia64_dl_get_tramp_got_size (const void *ehdr, grub_size_t *tramp,
212
#if defined (__ia64__)
213
#define GRUB_ARCH_DL_TRAMP_ALIGN GRUB_IA64_DL_TRAMP_ALIGN
214
#define GRUB_ARCH_DL_GOT_ALIGN GRUB_IA64_DL_GOT_ALIGN
215
#define GRUB_ARCH_DL_TRAMP_SIZE GRUB_IA64_DL_TRAMP_SIZE
216
#define grub_arch_dl_get_tramp_got_size grub_ia64_dl_get_tramp_got_size
219
grub_arch_dl_get_tramp_got_size (const void *ehdr, grub_size_t *tramp,
224
#define GRUB_ARCH_DL_TRAMP_SIZE 16
225
#define GRUB_ARCH_DL_TRAMP_ALIGN 4
226
#define GRUB_ARCH_DL_GOT_ALIGN 4
171
231
#endif /* ! GRUB_DL_H */