diff options
author | Amerigo Wang <amwang@redhat.com> | 2009-06-03 21:46:09 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2009-06-12 08:17:00 -0400 |
commit | 2d5bf28fb9e3c178db4f5536e2fe38d3a5ed7f40 (patch) | |
tree | 30997ca66fea0b95f82b546ecbcd91e249223fb3 /arch/x86/kernel/module_64.c | |
parent | 2ead9439f0c6ed03faafe27abe8bc1dd256d117b (diff) |
x86 module: merge the same functions in module_32.c and module_64.c
Merge the same functions both in module_32.c and module_64.c into
module.c.
This is the first step to merge both of them finally.
Signed-off-by: WANG Cong <amwang@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'arch/x86/kernel/module_64.c')
-rw-r--r-- | arch/x86/kernel/module_64.c | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/arch/x86/kernel/module_64.c b/arch/x86/kernel/module_64.c index c23880b90b5c..68ec7d87bb47 100644 --- a/arch/x86/kernel/module_64.c +++ b/arch/x86/kernel/module_64.c | |||
@@ -33,13 +33,6 @@ | |||
33 | #define DEBUGP(fmt...) | 33 | #define DEBUGP(fmt...) |
34 | 34 | ||
35 | #ifndef CONFIG_UML | 35 | #ifndef CONFIG_UML |
36 | void module_free(struct module *mod, void *module_region) | ||
37 | { | ||
38 | vfree(module_region); | ||
39 | /* FIXME: If module_region == mod->init_region, trim exception | ||
40 | table entries. */ | ||
41 | } | ||
42 | |||
43 | void *module_alloc(unsigned long size) | 36 | void *module_alloc(unsigned long size) |
44 | { | 37 | { |
45 | struct vm_struct *area; | 38 | struct vm_struct *area; |
@@ -58,15 +51,6 @@ void *module_alloc(unsigned long size) | |||
58 | } | 51 | } |
59 | #endif | 52 | #endif |
60 | 53 | ||
61 | /* We don't need anything special. */ | ||
62 | int module_frob_arch_sections(Elf_Ehdr *hdr, | ||
63 | Elf_Shdr *sechdrs, | ||
64 | char *secstrings, | ||
65 | struct module *mod) | ||
66 | { | ||
67 | return 0; | ||
68 | } | ||
69 | |||
70 | int apply_relocate_add(Elf64_Shdr *sechdrs, | 54 | int apply_relocate_add(Elf64_Shdr *sechdrs, |
71 | const char *strtab, | 55 | const char *strtab, |
72 | unsigned int symindex, | 56 | unsigned int symindex, |
@@ -147,48 +131,3 @@ int apply_relocate(Elf_Shdr *sechdrs, | |||
147 | return -ENOSYS; | 131 | return -ENOSYS; |
148 | } | 132 | } |
149 | 133 | ||
150 | int module_finalize(const Elf_Ehdr *hdr, | ||
151 | const Elf_Shdr *sechdrs, | ||
152 | struct module *me) | ||
153 | { | ||
154 | const Elf_Shdr *s, *text = NULL, *alt = NULL, *locks = NULL, | ||
155 | *para = NULL; | ||
156 | char *secstrings = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset; | ||
157 | |||
158 | for (s = sechdrs; s < sechdrs + hdr->e_shnum; s++) { | ||
159 | if (!strcmp(".text", secstrings + s->sh_name)) | ||
160 | text = s; | ||
161 | if (!strcmp(".altinstructions", secstrings + s->sh_name)) | ||
162 | alt = s; | ||
163 | if (!strcmp(".smp_locks", secstrings + s->sh_name)) | ||
164 | locks = s; | ||
165 | if (!strcmp(".parainstructions", secstrings + s->sh_name)) | ||
166 | para = s; | ||
167 | } | ||
168 | |||
169 | if (alt) { | ||
170 | /* patch .altinstructions */ | ||
171 | void *aseg = (void *)alt->sh_addr; | ||
172 | apply_alternatives(aseg, aseg + alt->sh_size); | ||
173 | } | ||
174 | if (locks && text) { | ||
175 | void *lseg = (void *)locks->sh_addr; | ||
176 | void *tseg = (void *)text->sh_addr; | ||
177 | alternatives_smp_module_add(me, me->name, | ||
178 | lseg, lseg + locks->sh_size, | ||
179 | tseg, tseg + text->sh_size); | ||
180 | } | ||
181 | |||
182 | if (para) { | ||
183 | void *pseg = (void *)para->sh_addr; | ||
184 | apply_paravirt(pseg, pseg + para->sh_size); | ||
185 | } | ||
186 | |||
187 | return module_bug_finalize(hdr, sechdrs, me); | ||
188 | } | ||
189 | |||
190 | void module_arch_cleanup(struct module *mod) | ||
191 | { | ||
192 | alternatives_smp_module_del(mod); | ||
193 | module_bug_cleanup(mod); | ||
194 | } | ||