aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68k/kernel/module.c
diff options
context:
space:
mode:
authorRoman Zippel <zippel@linux-m68k.org>2007-05-31 03:40:50 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-31 10:58:13 -0400
commitfbe9c9612930e0604dc99ef2da7e063fa3278817 (patch)
treeb11a5a03edd4a61fc5c71b2b38402cdfe914de22 /arch/m68k/kernel/module.c
parent1fc799e1b4efdbc405d87d9f154d64d9bc299e5c (diff)
m68k: runtime patching infrastructure
Add the basic infrastructure to allow runtime patching of kernel and modules to optimize a few functions with parameters, which are only calculated once during bootup and are otherwise constant. Use this for the conversion between virtual and physical addresses. Signed-off-by: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/m68k/kernel/module.c')
-rw-r--r--arch/m68k/kernel/module.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/arch/m68k/kernel/module.c b/arch/m68k/kernel/module.c
index 3b1a2ff61ddc..32969d0cecc4 100644
--- a/arch/m68k/kernel/module.c
+++ b/arch/m68k/kernel/module.c
@@ -1,3 +1,9 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file COPYING in the main directory of this archive
4 * for more details.
5 */
6
1#include <linux/moduleloader.h> 7#include <linux/moduleloader.h>
2#include <linux/elf.h> 8#include <linux/elf.h>
3#include <linux/vmalloc.h> 9#include <linux/vmalloc.h>
@@ -11,6 +17,8 @@
11#define DEBUGP(fmt...) 17#define DEBUGP(fmt...)
12#endif 18#endif
13 19
20#ifdef CONFIG_MODULES
21
14void *module_alloc(unsigned long size) 22void *module_alloc(unsigned long size)
15{ 23{
16 if (size == 0) 24 if (size == 0)
@@ -118,11 +126,29 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
118 126
119int module_finalize(const Elf_Ehdr *hdr, 127int module_finalize(const Elf_Ehdr *hdr,
120 const Elf_Shdr *sechdrs, 128 const Elf_Shdr *sechdrs,
121 struct module *me) 129 struct module *mod)
122{ 130{
131 module_fixup(mod, mod->arch.fixup_start, mod->arch.fixup_end);
132
123 return 0; 133 return 0;
124} 134}
125 135
126void module_arch_cleanup(struct module *mod) 136void module_arch_cleanup(struct module *mod)
127{ 137{
128} 138}
139
140#endif /* CONFIG_MODULES */
141
142void module_fixup(struct module *mod, struct m68k_fixup_info *start,
143 struct m68k_fixup_info *end)
144{
145 struct m68k_fixup_info *fixup;
146
147 for (fixup = start; fixup < end; fixup++) {
148 switch (fixup->type) {
149 case m68k_fixup_memoffset:
150 *(u32 *)fixup->addr = m68k_memoffset;
151 break;
152 }
153 }
154}