aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/um/sys-x86_64/Makefile7
-rw-r--r--arch/um/sys-x86_64/ksyms.c23
-rw-r--r--arch/um/sys-x86_64/um_module.c19
-rw-r--r--arch/x86_64/kernel/module.c4
-rw-r--r--include/asm-um/elf.h27
5 files changed, 79 insertions, 1 deletions
diff --git a/arch/um/sys-x86_64/Makefile b/arch/um/sys-x86_64/Makefile
index d7ed2f7908df..e60c9da8fb48 100644
--- a/arch/um/sys-x86_64/Makefile
+++ b/arch/um/sys-x86_64/Makefile
@@ -4,16 +4,20 @@
4# Licensed under the GPL 4# Licensed under the GPL
5# 5#
6 6
7#XXX: why into lib-y?
7lib-y = bitops.o bugs.o csum-partial.o delay.o fault.o mem.o memcpy.o \ 8lib-y = bitops.o bugs.o csum-partial.o delay.o fault.o mem.o memcpy.o \
8 ptrace.o ptrace_user.o semaphore.o sigcontext.o signal.o \ 9 ptrace.o ptrace_user.o semaphore.o sigcontext.o signal.o \
9 syscalls.o sysrq.o thunk.o syscall_table.o 10 syscalls.o sysrq.o thunk.o syscall_table.o
10 11
12obj-y := ksyms.o
13obj-$(CONFIG_MODULES) += module.o um_module.o
14
11USER_OBJS := ptrace_user.o sigcontext.o 15USER_OBJS := ptrace_user.o sigcontext.o
12 16
13include arch/um/scripts/Makefile.rules 17include arch/um/scripts/Makefile.rules
14 18
15SYMLINKS = bitops.c csum-copy.S csum-partial.c csum-wrappers.c memcpy.S \ 19SYMLINKS = bitops.c csum-copy.S csum-partial.c csum-wrappers.c memcpy.S \
16 semaphore.c thunk.S 20 semaphore.c thunk.S module.c
17 21
18# this needs to be before the foreach, because clean-files does not accept 22# this needs to be before the foreach, because clean-files does not accept
19# complete paths like $(src)/$f. 23# complete paths like $(src)/$f.
@@ -30,6 +34,7 @@ csum-wrappers.c-dir = lib
30memcpy.S-dir = lib 34memcpy.S-dir = lib
31semaphore.c-dir = kernel 35semaphore.c-dir = kernel
32thunk.S-dir = lib 36thunk.S-dir = lib
37module.c-dir = kernel
33 38
34$(SYMLINKS): FORCE 39$(SYMLINKS): FORCE
35 $(call if_changed,make_link) 40 $(call if_changed,make_link)
diff --git a/arch/um/sys-x86_64/ksyms.c b/arch/um/sys-x86_64/ksyms.c
new file mode 100644
index 000000000000..8d30fa8393c8
--- /dev/null
+++ b/arch/um/sys-x86_64/ksyms.c
@@ -0,0 +1,23 @@
1#include "linux/module.h"
2#include "linux/in6.h"
3#include "linux/rwsem.h"
4#include "asm/byteorder.h"
5#include "asm/semaphore.h"
6#include "asm/uaccess.h"
7#include "asm/checksum.h"
8#include "asm/errno.h"
9
10EXPORT_SYMBOL(__down_failed);
11EXPORT_SYMBOL(__down_failed_interruptible);
12EXPORT_SYMBOL(__down_failed_trylock);
13EXPORT_SYMBOL(__up_wakeup);
14
15/*XXX: we need them because they would be exported by x86_64 */
16EXPORT_SYMBOL(__memcpy);
17EXPORT_SYMBOL(strcmp);
18EXPORT_SYMBOL(strcat);
19EXPORT_SYMBOL(strcpy);
20
21/* Networking helper routines. */
22/*EXPORT_SYMBOL(csum_partial_copy_from);
23EXPORT_SYMBOL(csum_partial_copy_to);*/
diff --git a/arch/um/sys-x86_64/um_module.c b/arch/um/sys-x86_64/um_module.c
new file mode 100644
index 000000000000..8b8eff1bd977
--- /dev/null
+++ b/arch/um/sys-x86_64/um_module.c
@@ -0,0 +1,19 @@
1#include <linux/vmalloc.h>
2#include <linux/moduleloader.h>
3
4/*Copied from i386 arch/i386/kernel/module.c */
5void *module_alloc(unsigned long size)
6{
7 if (size == 0)
8 return NULL;
9 return vmalloc_exec(size);
10}
11
12/* Free memory returned from module_alloc */
13void module_free(struct module *mod, void *module_region)
14{
15 vfree(module_region);
16 /* FIXME: If module_region == mod->init_region, trim exception
17 table entries. */
18}
19
diff --git a/arch/x86_64/kernel/module.c b/arch/x86_64/kernel/module.c
index c2ffea8845ed..bac195c74bcc 100644
--- a/arch/x86_64/kernel/module.c
+++ b/arch/x86_64/kernel/module.c
@@ -30,9 +30,12 @@
30 30
31#define DEBUGP(fmt...) 31#define DEBUGP(fmt...)
32 32
33#ifndef CONFIG_UML
33void module_free(struct module *mod, void *module_region) 34void module_free(struct module *mod, void *module_region)
34{ 35{
35 vfree(module_region); 36 vfree(module_region);
37 /* FIXME: If module_region == mod->init_region, trim exception
38 table entries. */
36} 39}
37 40
38void *module_alloc(unsigned long size) 41void *module_alloc(unsigned long size)
@@ -51,6 +54,7 @@ void *module_alloc(unsigned long size)
51 54
52 return __vmalloc_area(area, GFP_KERNEL, PAGE_KERNEL_EXEC); 55 return __vmalloc_area(area, GFP_KERNEL, PAGE_KERNEL_EXEC);
53} 56}
57#endif
54 58
55/* We don't need anything special. */ 59/* We don't need anything special. */
56int module_frob_arch_sections(Elf_Ehdr *hdr, 60int module_frob_arch_sections(Elf_Ehdr *hdr,
diff --git a/include/asm-um/elf.h b/include/asm-um/elf.h
index 7908f8fe8231..d41112bfb299 100644
--- a/include/asm-um/elf.h
+++ b/include/asm-um/elf.h
@@ -21,6 +21,8 @@ extern long elf_aux_hwcap;
21 21
22#define USE_ELF_CORE_DUMP 22#define USE_ELF_CORE_DUMP
23 23
24#if defined(CONFIG_UML_X86) && !defined(CONFIG_64BIT)
25
24#define R_386_NONE 0 26#define R_386_NONE 0
25#define R_386_32 1 27#define R_386_32 1
26#define R_386_PC32 2 28#define R_386_PC32 2
@@ -34,4 +36,29 @@ extern long elf_aux_hwcap;
34#define R_386_GOTPC 10 36#define R_386_GOTPC 10
35#define R_386_NUM 11 37#define R_386_NUM 11
36 38
39#elif defined(CONFIG_UML_X86) && defined(CONFIG_64BIT)
40
41/* x86-64 relocation types */
42#define R_X86_64_NONE 0 /* No reloc */
43#define R_X86_64_64 1 /* Direct 64 bit */
44#define R_X86_64_PC32 2 /* PC relative 32 bit signed */
45#define R_X86_64_GOT32 3 /* 32 bit GOT entry */
46#define R_X86_64_PLT32 4 /* 32 bit PLT address */
47#define R_X86_64_COPY 5 /* Copy symbol at runtime */
48#define R_X86_64_GLOB_DAT 6 /* Create GOT entry */
49#define R_X86_64_JUMP_SLOT 7 /* Create PLT entry */
50#define R_X86_64_RELATIVE 8 /* Adjust by program base */
51#define R_X86_64_GOTPCREL 9 /* 32 bit signed pc relative
52 offset to GOT */
53#define R_X86_64_32 10 /* Direct 32 bit zero extended */
54#define R_X86_64_32S 11 /* Direct 32 bit sign extended */
55#define R_X86_64_16 12 /* Direct 16 bit zero extended */
56#define R_X86_64_PC16 13 /* 16 bit sign extended pc relative */
57#define R_X86_64_8 14 /* Direct 8 bit sign extended */
58#define R_X86_64_PC8 15 /* 8 bit sign extended pc relative */
59
60#define R_X86_64_NUM 16
61
62#endif
63
37#endif 64#endif