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 
module_alloc(unsigned long size)25 void *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 */
module_free(struct module * mod,void * module_region)35 void module_free(struct module *mod, void *module_region)
36 {
37 	vfree(module_region);
38 }
39 
40 /* We don't need anything special. */
module_frob_arch_sections(Elf_Ehdr * hdr,Elf_Shdr * sechdrs,char * secstrings,struct module * mod)41 int module_frob_arch_sections(Elf_Ehdr *hdr,
42 			      Elf_Shdr *sechdrs,
43 			      char *secstrings,
44 			      struct module *mod)
45 {
46 	return 0;
47 }
48 
apply_relocate(Elf32_Shdr * sechdrs,const char * strtab,unsigned int symindex,unsigned int relsec,struct module * me)49 int apply_relocate(Elf32_Shdr *sechdrs,
50 		   const char *strtab,
51 		   unsigned int symindex,
52 		   unsigned int relsec,
53 		   struct module *me)
54 {
55 	printk(KERN_ERR "module %s: ADD RELOCATION unsupported\n", me->name);
56 	return -ENOEXEC;
57 }
58 
apply_relocate_add(Elf32_Shdr * sechdrs,const char * strtab,unsigned int symindex,unsigned int relsec,struct module * me)59 int apply_relocate_add(Elf32_Shdr *sechdrs,
60 		       const char *strtab,
61 		       unsigned int symindex,
62 		       unsigned int relsec,
63 		       struct module *me)
64 {
65 	printk(KERN_ERR "module %s: ADD RELOCATION unsupported\n", me->name);
66 	return -ENOEXEC;
67 }
68 
module_finalize(const Elf_Ehdr * hdr,const Elf_Shdr * sechdrs,struct module * me)69 int module_finalize(const Elf_Ehdr *hdr,
70 		    const Elf_Shdr *sechdrs,
71 		    struct module *me)
72 {
73 	return 0;
74 }
75 
module_arch_cleanup(struct module * mod)76 void module_arch_cleanup(struct module *mod)
77 {
78 }
79