Skip to content

Commit

Permalink
[PATCH] frv: add module support stubs
Browse files Browse the repository at this point in the history
Add stubs for FRV module support.

Signed-off-by: David Howells <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
dhowells authored and Linus Torvalds committed Jan 9, 2006
1 parent a90a72c commit 00d7671
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 4 deletions.
1 change: 1 addition & 0 deletions arch/frv/kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ obj-$(CONFIG_PM) += pm.o cmode.o
obj-$(CONFIG_MB93093_PDK) += pm-mb93093.o
obj-$(CONFIG_SYSCTL) += sysctl.o
obj-$(CONFIG_FUTEX) += futex.o
obj-$(CONFIG_MODULES) += module.o
80 changes: 80 additions & 0 deletions arch/frv/kernel/module.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/* module.c: FRV specific module loading bits
*
* Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
* Written by David Howells ([email protected])
* - Derived from arch/i386/kernel/module.c, Copyright (C) 2001 Rusty Russell.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
#include <linux/moduleloader.h>
#include <linux/elf.h>
#include <linux/vmalloc.h>
#include <linux/fs.h>
#include <linux/string.h>
#include <linux/kernel.h>

#if 0
#define DEBUGP printk
#else
#define DEBUGP(fmt...)
#endif

void *module_alloc(unsigned long size)
{
if (size == 0)
return NULL;

return vmalloc_exec(size);
}


/* Free memory returned from module_alloc */
void module_free(struct module *mod, void *module_region)
{
vfree(module_region);
/* FIXME: If module_region == mod->init_region, trim exception
table entries. */
}

/* We don't need anything special. */
int module_frob_arch_sections(Elf_Ehdr *hdr,
Elf_Shdr *sechdrs,
char *secstrings,
struct module *mod)
{
return 0;
}

int apply_relocate(Elf32_Shdr *sechdrs,
const char *strtab,
unsigned int symindex,
unsigned int relsec,
struct module *me)
{
printk(KERN_ERR "module %s: ADD RELOCATION unsupported\n", me->name);
return -ENOEXEC;
}

int apply_relocate_add(Elf32_Shdr *sechdrs,
const char *strtab,
unsigned int symindex,
unsigned int relsec,
struct module *me)
{
printk(KERN_ERR "module %s: ADD RELOCATION unsupported\n", me->name);
return -ENOEXEC;
}

int module_finalize(const Elf_Ehdr *hdr,
const Elf_Shdr *sechdrs,
struct module *me)
{
return 0;
}

void module_arch_cleanup(struct module *mod)
{
}
16 changes: 12 additions & 4 deletions include/asm-frv/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,18 @@
#ifndef _ASM_MODULE_H
#define _ASM_MODULE_H

#define module_map(x) vmalloc(x)
#define module_unmap(x) vfree(x)
#define module_arch_init(x) (0)
#define arch_init_modules(x) do { } while (0)
struct mod_arch_specific
{
};

#define Elf_Shdr Elf32_Shdr
#define Elf_Sym Elf32_Sym
#define Elf_Ehdr Elf32_Ehdr

/*
* Include the architecture version.
*/
#define MODULE_ARCH_VERMAGIC __stringify(PROCESSOR_MODEL_NAME) " "

#endif /* _ASM_MODULE_H */

0 comments on commit 00d7671

Please sign in to comment.