diff options
author | Atsushi Nemoto <anemo@mba.ocn.ne.jp> | 2006-10-25 11:08:31 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2006-11-29 20:14:44 -0500 |
commit | 656be92f9ae194ed62bc81310a4589a7cd765f13 (patch) | |
tree | 5fb14d0d7d9cd2cab2cd83a1eea38c3c964f3054 /arch/mips/kernel/module.c | |
parent | 56ae58333031bb0564c141f955d1e42276cade55 (diff) |
[MIPS] Load modules to CKSEG0 if CONFIG_BUILD_ELF64=n
This is a patch to load 64-bit modules to CKSEG0 so that can be
compiled with -msym32 option. This makes each module ~10% smaller.
* introduce MODULE_START and MODULE_END
* custom module_alloc()
* PGD for modules
* change XTLB refill handler synthesizer
* enable -msym32 for modules again
(revert ca78b1a5c6a6e70e052d3ea253828e49b5d07c8a)
New XTLB refill handler looks like this:
80000080 dmfc0 k0,C0_BADVADDR
80000084 bltz k0,800000e4 # goto l_module_alloc
80000088 lui k1,0x8046 # %high(pgd_current)
8000008c ld k1,24600(k1) # %low(pgd_current)
80000090 dsrl k0,k0,0x1b # l_vmalloc_done:
80000094 andi k0,k0,0x1ff8
80000098 daddu k1,k1,k0
8000009c dmfc0 k0,C0_BADVADDR
800000a0 ld k1,0(k1)
800000a4 dsrl k0,k0,0x12
800000a8 andi k0,k0,0xff8
800000ac daddu k1,k1,k0
800000b0 dmfc0 k0,C0_XCONTEXT
800000b4 ld k1,0(k1)
800000b8 andi k0,k0,0xff0
800000bc daddu k1,k1,k0
800000c0 ld k0,0(k1)
800000c4 ld k1,8(k1)
800000c8 dsrl k0,k0,0x6
800000cc mtc0 k0,C0_ENTRYLO0
800000d0 dsrl k1,k1,0x6
800000d4 mtc0 k1,C0_ENTRYL01
800000d8 nop
800000dc tlbwr
800000e0 eret
800000e4 dsll k1,k0,0x2 # l_module_alloc:
800000e8 bgez k1,80000008 # goto l_vmalloc
800000ec lui k1,0xc000
800000f0 dsubu k0,k0,k1
800000f4 lui k1,0x8046 # %high(module_pg_dir)
800000f8 beq zero,zero,80000000
800000fc nop
80000000 beq zero,zero,80000090 # goto l_vmalloc_done
80000004 daddiu k1,k1,0x4000
80000008 dsll32 k1,k1,0x0 # l_vmalloc:
8000000c dsubu k0,k0,k1
80000010 beq zero,zero,80000090 # goto l_vmalloc_done
80000014 lui k1,0x8046 # %high(swapper_pg_dir)
Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/kernel/module.c')
-rw-r--r-- | arch/mips/kernel/module.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/arch/mips/kernel/module.c b/arch/mips/kernel/module.c index d7bf0215bc1d..cb0801437b66 100644 --- a/arch/mips/kernel/module.c +++ b/arch/mips/kernel/module.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/kernel.h> | 29 | #include <linux/kernel.h> |
30 | #include <linux/module.h> | 30 | #include <linux/module.h> |
31 | #include <linux/spinlock.h> | 31 | #include <linux/spinlock.h> |
32 | #include <asm/pgtable.h> /* MODULE_START */ | ||
32 | 33 | ||
33 | struct mips_hi16 { | 34 | struct mips_hi16 { |
34 | struct mips_hi16 *next; | 35 | struct mips_hi16 *next; |
@@ -43,9 +44,23 @@ static DEFINE_SPINLOCK(dbe_lock); | |||
43 | 44 | ||
44 | void *module_alloc(unsigned long size) | 45 | void *module_alloc(unsigned long size) |
45 | { | 46 | { |
47 | #ifdef MODULE_START | ||
48 | struct vm_struct *area; | ||
49 | |||
50 | size = PAGE_ALIGN(size); | ||
51 | if (!size) | ||
52 | return NULL; | ||
53 | |||
54 | area = __get_vm_area(size, VM_ALLOC, MODULE_START, MODULE_END); | ||
55 | if (!area) | ||
56 | return NULL; | ||
57 | |||
58 | return __vmalloc_area(area, GFP_KERNEL, PAGE_KERNEL); | ||
59 | #else | ||
46 | if (size == 0) | 60 | if (size == 0) |
47 | return NULL; | 61 | return NULL; |
48 | return vmalloc(size); | 62 | return vmalloc(size); |
63 | #endif | ||
49 | } | 64 | } |
50 | 65 | ||
51 | /* Free memory returned from module_alloc */ | 66 | /* Free memory returned from module_alloc */ |