aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/frv/kernel/Makefile1
-rw-r--r--arch/frv/kernel/module.c80
-rw-r--r--include/asm-frv/module.h16
3 files changed, 93 insertions, 4 deletions
diff --git a/arch/frv/kernel/Makefile b/arch/frv/kernel/Makefile
index 422f30ede575..5a827b349b5e 100644
--- a/arch/frv/kernel/Makefile
+++ b/arch/frv/kernel/Makefile
@@ -21,3 +21,4 @@ obj-$(CONFIG_PM) += pm.o cmode.o
21obj-$(CONFIG_MB93093_PDK) += pm-mb93093.o 21obj-$(CONFIG_MB93093_PDK) += pm-mb93093.o
22obj-$(CONFIG_SYSCTL) += sysctl.o 22obj-$(CONFIG_SYSCTL) += sysctl.o
23obj-$(CONFIG_FUTEX) += futex.o 23obj-$(CONFIG_FUTEX) += futex.o
24obj-$(CONFIG_MODULES) += module.o
diff --git a/arch/frv/kernel/module.c b/arch/frv/kernel/module.c
new file mode 100644
index 000000000000..850d168f69fc
--- /dev/null
+++ b/arch/frv/kernel/module.c
@@ -0,0 +1,80 @@
1/* module.c: FRV specific module loading bits
2 *
3 * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 * - Derived from arch/i386/kernel/module.c, Copyright (C) 2001 Rusty Russell.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12#include <linux/moduleloader.h>
13#include <linux/elf.h>
14#include <linux/vmalloc.h>
15#include <linux/fs.h>
16#include <linux/string.h>
17#include <linux/kernel.h>
18
19#if 0
20#define DEBUGP printk
21#else
22#define DEBUGP(fmt...)
23#endif
24
25void *module_alloc(unsigned long size)
26{
27 if (size == 0)
28 return NULL;
29
30 return vmalloc_exec(size);
31}
32
33
34/* Free memory returned from module_alloc */
35void module_free(struct module *mod, void *module_region)
36{
37 vfree(module_region);
38 /* FIXME: If module_region == mod->init_region, trim exception
39 table entries. */
40}
41
42/* We don't need anything special. */
43int module_frob_arch_sections(Elf_Ehdr *hdr,
44 Elf_Shdr *sechdrs,
45 char *secstrings,
46 struct module *mod)
47{
48 return 0;
49}
50
51int apply_relocate(Elf32_Shdr *sechdrs,
52 const char *strtab,
53 unsigned int symindex,
54 unsigned int relsec,
55 struct module *me)
56{
57 printk(KERN_ERR "module %s: ADD RELOCATION unsupported\n", me->name);
58 return -ENOEXEC;
59}
60
61int apply_relocate_add(Elf32_Shdr *sechdrs,
62 const char *strtab,
63 unsigned int symindex,
64 unsigned int relsec,
65 struct module *me)
66{
67 printk(KERN_ERR "module %s: ADD RELOCATION unsupported\n", me->name);
68 return -ENOEXEC;
69}
70
71int module_finalize(const Elf_Ehdr *hdr,
72 const Elf_Shdr *sechdrs,
73 struct module *me)
74{
75 return 0;
76}
77
78void module_arch_cleanup(struct module *mod)
79{
80}
diff --git a/include/asm-frv/module.h b/include/asm-frv/module.h
index 3223cfaef743..3d5c6360289a 100644
--- a/include/asm-frv/module.h
+++ b/include/asm-frv/module.h
@@ -11,10 +11,18 @@
11#ifndef _ASM_MODULE_H 11#ifndef _ASM_MODULE_H
12#define _ASM_MODULE_H 12#define _ASM_MODULE_H
13 13
14#define module_map(x) vmalloc(x) 14struct mod_arch_specific
15#define module_unmap(x) vfree(x) 15{
16#define module_arch_init(x) (0) 16};
17#define arch_init_modules(x) do { } while (0) 17
18#define Elf_Shdr Elf32_Shdr
19#define Elf_Sym Elf32_Sym
20#define Elf_Ehdr Elf32_Ehdr
21
22/*
23 * Include the architecture version.
24 */
25#define MODULE_ARCH_VERMAGIC __stringify(PROCESSOR_MODEL_NAME) " "
18 26
19#endif /* _ASM_MODULE_H */ 27#endif /* _ASM_MODULE_H */
20 28