summaryrefslogtreecommitdiff
path: root/arch/arm/kernel/module.c
diff options
context:
space:
mode:
authorNicolas Pitre <nico@org.rmk.(none)>2004-11-10 14:52:03 +0000
committerRussell King <rmk@flint.arm.linux.org.uk>2004-11-10 14:52:03 +0000
commitf05ee51620a2a45f41ade10a1ce6bc378f8870a8 (patch)
tree9bda241d30d8a3626e085df8dc8ea4ca7300eed4 /arch/arm/kernel/module.c
parent457450ab3b946006299131970d8e1296db494a1e (diff)
[ARM PATCH] 2160/1: allow modules to work with XIP kernel
Patch from Nicolas Pitre This should be applied on top of patch #2154/1. This maps the XIP kernel in the same virtual area as used for kernel modules instead of the previous arbitrary location. Doing so has the advantage of having a well defined kernel address not conflicting with the different definitions for VMALLOC_END, as well as making modules loadable without any indirect long branch calls. The work on XIPable MTD also requires this with code marked __xipram for the same reason. This of course reduces the space available for kernel modules from 16MB to either 14MB or 12MB depending on the size of the resulting kernel but that shouldn't be a real issue at all, given that the whole purpose behind XIP is to execute as much stuff from flash, which is better achieved by compiling drivers in the kernel directly. Signed-off-by: Nicolas Pitre Signed-off-by: Russell King
Diffstat (limited to 'arch/arm/kernel/module.c')
-rw-r--r--arch/arm/kernel/module.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c
index a16951f49457..eb9240e9a7d5 100644
--- a/arch/arm/kernel/module.c
+++ b/arch/arm/kernel/module.c
@@ -9,6 +9,7 @@
*
* Module allocation method suggested by Andi Kleen.
*/
+#include <linux/config.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/elf.h>
@@ -19,6 +20,18 @@
#include <asm/pgtable.h>
+#ifdef CONFIG_XIP_KERNEL
+/*
+ * The XIP kernel text is mapped in the module area for modules and
+ * some other stuff to work without any indirect relocations.
+ * MODULE_START is redefined here and not in asm/memory.h to avoid
+ * recompiling the whole kernel when CONFIG_XIP_KERNEL is turned on/off.
+ */
+extern void _etext;
+#undef MODULE_START
+#define MODULE_START (((unsigned long)&_etext + ~PGDIR_MASK) & PGDIR_MASK)
+#endif
+
void *module_alloc(unsigned long size)
{
struct vm_struct *area;