aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYoshinori Sato <ysato@users.sourceforge.jp>2006-09-27 04:21:02 -0400
committerPaul Mundt <lethal@linux-sh.org>2006-09-27 04:21:02 -0400
commite96636ccfa373a00a0ee0558e1971baa7856d8b5 (patch)
treec4f98b1c92f30f17c8c0d36419977789fe537aab
parente7f93a355c7e32c26eab8910cf53b7506bb046c5 (diff)
sh: Various nommu fixes.
This fixes up some of the various outstanding nommu bugs on SH. Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r--arch/sh/boot/compressed/Makefile10
-rw-r--r--arch/sh/mm/init.c5
-rw-r--r--arch/sh/mm/pg-nommu.c17
-rw-r--r--include/asm-sh/addrspace.h8
-rw-r--r--include/asm-sh/flat.h2
-rw-r--r--include/asm-sh/mmu.h13
-rw-r--r--include/asm-sh/page.h5
-rw-r--r--include/asm-sh/uaccess.h13
8 files changed, 50 insertions, 23 deletions
diff --git a/arch/sh/boot/compressed/Makefile b/arch/sh/boot/compressed/Makefile
index 7074267c01b7..903470429cb4 100644
--- a/arch/sh/boot/compressed/Makefile
+++ b/arch/sh/boot/compressed/Makefile
@@ -21,11 +21,17 @@ endif
21CONFIG_PAGE_OFFSET ?= 0x80000000 21CONFIG_PAGE_OFFSET ?= 0x80000000
22CONFIG_MEMORY_START ?= 0x0c000000 22CONFIG_MEMORY_START ?= 0x0c000000
23CONFIG_BOOT_LINK_OFFSET ?= 0x00800000 23CONFIG_BOOT_LINK_OFFSET ?= 0x00800000
24IMAGE_OFFSET := $(shell printf "0x%8x" $$[$(CONFIG_PAGE_OFFSET)+$(CONFIG_MEMORY_START)+$(CONFIG_BOOT_LINK_OFFSET)]) 24
25IMAGE_OFFSET := $(shell printf "0x%8x" $$[$(CONFIG_PAGE_OFFSET) + \
26 $(CONFIG_MEMORY_START) + \
27 $(CONFIG_BOOT_LINK_OFFSET)])
28
29LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
25 30
26LDFLAGS_vmlinux := -Ttext $(IMAGE_OFFSET) -e startup -T $(obj)/../../kernel/vmlinux.lds 31LDFLAGS_vmlinux := -Ttext $(IMAGE_OFFSET) -e startup -T $(obj)/../../kernel/vmlinux.lds
27 32
28$(obj)/vmlinux: $(OBJECTS) $(obj)/piggy.o FORCE 33
34$(obj)/vmlinux: $(OBJECTS) $(obj)/piggy.o $(LIBGCC) FORCE
29 $(call if_changed,ld) 35 $(call if_changed,ld)
30 @: 36 @:
31 37
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
index d1a979eab656..2c6dc3d8df2c 100644
--- a/arch/sh/mm/init.c
+++ b/arch/sh/mm/init.c
@@ -248,8 +248,13 @@ void __init mem_init(void)
248 * Setup wrappers for copy/clear_page(), these will get overridden 248 * Setup wrappers for copy/clear_page(), these will get overridden
249 * later in the boot process if a better method is available. 249 * later in the boot process if a better method is available.
250 */ 250 */
251#ifdef CONFIG_MMU
251 copy_page = copy_page_slow; 252 copy_page = copy_page_slow;
252 clear_page = clear_page_slow; 253 clear_page = clear_page_slow;
254#else
255 copy_page = copy_page_nommu;
256 clear_page = clear_page_nommu;
257#endif
253 258
254 /* this will put all low memory onto the freelists */ 259 /* this will put all low memory onto the freelists */
255 totalram_pages += free_all_bootmem_node(NODE_DATA(0)); 260 totalram_pages += free_all_bootmem_node(NODE_DATA(0));
diff --git a/arch/sh/mm/pg-nommu.c b/arch/sh/mm/pg-nommu.c
index 8f9165a4e333..d15221beaa16 100644
--- a/arch/sh/mm/pg-nommu.c
+++ b/arch/sh/mm/pg-nommu.c
@@ -14,23 +14,24 @@
14#include <linux/string.h> 14#include <linux/string.h>
15#include <asm/page.h> 15#include <asm/page.h>
16 16
17static void copy_page_nommu(void *to, void *from) 17void copy_page_nommu(void *to, void *from)
18{ 18{
19 memcpy(to, from, PAGE_SIZE); 19 memcpy(to, from, PAGE_SIZE);
20} 20}
21 21
22static void clear_page_nommu(void *to) 22void clear_page_nommu(void *to)
23{ 23{
24 memset(to, 0, PAGE_SIZE); 24 memset(to, 0, PAGE_SIZE);
25} 25}
26 26
27static int __init pg_nommu_init(void) 27__kernel_size_t __copy_user(void *to, const void *from, __kernel_size_t n)
28{ 28{
29 copy_page = copy_page_nommu; 29 memcpy(to, from, n);
30 clear_page = clear_page_nommu;
31
32 return 0; 30 return 0;
33} 31}
34 32
35subsys_initcall(pg_nommu_init); 33__kernel_size_t __clear_user(void *to, __kernel_size_t n)
36 34{
35 memset(to, 0, n);
36 return 0;
37}
diff --git a/include/asm-sh/addrspace.h b/include/asm-sh/addrspace.h
index 720afc11c2ca..4207368267b1 100644
--- a/include/asm-sh/addrspace.h
+++ b/include/asm-sh/addrspace.h
@@ -14,11 +14,19 @@
14#include <asm/cpu/addrspace.h> 14#include <asm/cpu/addrspace.h>
15 15
16/* Memory segments (32bit Privileged mode addresses) */ 16/* Memory segments (32bit Privileged mode addresses) */
17#ifdef CONFIG_MMU
17#define P0SEG 0x00000000 18#define P0SEG 0x00000000
18#define P1SEG 0x80000000 19#define P1SEG 0x80000000
19#define P2SEG 0xa0000000 20#define P2SEG 0xa0000000
20#define P3SEG 0xc0000000 21#define P3SEG 0xc0000000
21#define P4SEG 0xe0000000 22#define P4SEG 0xe0000000
23#else
24#define P0SEG 0x00000000
25#define P1SEG 0x00000000
26#define P2SEG 0x20000000
27#define P3SEG 0x40000000
28#define P4SEG 0x80000000
29#endif
22 30
23/* Returns the privileged segment base of a given address */ 31/* Returns the privileged segment base of a given address */
24#define PXSEG(a) (((unsigned long)(a)) & 0xe0000000) 32#define PXSEG(a) (((unsigned long)(a)) & 0xe0000000)
diff --git a/include/asm-sh/flat.h b/include/asm-sh/flat.h
index f29072e1c87e..0d5cc04ab005 100644
--- a/include/asm-sh/flat.h
+++ b/include/asm-sh/flat.h
@@ -13,7 +13,7 @@
13#define __ASM_SH_FLAT_H 13#define __ASM_SH_FLAT_H
14 14
15#define flat_stack_align(sp) /* nothing needed */ 15#define flat_stack_align(sp) /* nothing needed */
16#define flat_argvp_envp_on_stack() 1 16#define flat_argvp_envp_on_stack() 0
17#define flat_old_ram_flag(flags) (flags) 17#define flat_old_ram_flag(flags) (flags)
18#define flat_reloc_valid(reloc, size) ((reloc) <= (size)) 18#define flat_reloc_valid(reloc, size) ((reloc) <= (size))
19#define flat_get_addr_from_rp(rp, relval, flags) get_unaligned(rp) 19#define flat_get_addr_from_rp(rp, relval, flags) get_unaligned(rp)
diff --git a/include/asm-sh/mmu.h b/include/asm-sh/mmu.h
index ec09589fa6ca..6383dc84501e 100644
--- a/include/asm-sh/mmu.h
+++ b/include/asm-sh/mmu.h
@@ -3,19 +3,8 @@
3 3
4#if !defined(CONFIG_MMU) 4#if !defined(CONFIG_MMU)
5 5
6struct mm_rblock_struct {
7 int size;
8 int refcount;
9 void *kblock;
10};
11
12struct mm_tblock_struct {
13 struct mm_rblock_struct *rblock;
14 struct mm_tblock_struct *next;
15};
16
17typedef struct { 6typedef struct {
18 struct mm_tblock_struct tblock; 7 struct vm_list_struct *vmlist;
19 unsigned long end_brk; 8 unsigned long end_brk;
20} mm_context_t; 9} mm_context_t;
21 10
diff --git a/include/asm-sh/page.h b/include/asm-sh/page.h
index 1b3cfd165a66..e9135532d00c 100644
--- a/include/asm-sh/page.h
+++ b/include/asm-sh/page.h
@@ -38,8 +38,13 @@
38extern void (*clear_page)(void *to); 38extern void (*clear_page)(void *to);
39extern void (*copy_page)(void *to, void *from); 39extern void (*copy_page)(void *to, void *from);
40 40
41#ifdef CONFIG_MMU
41extern void clear_page_slow(void *to); 42extern void clear_page_slow(void *to);
42extern void copy_page_slow(void *to, void *from); 43extern void copy_page_slow(void *to, void *from);
44#else
45extern void clear_page_nommu(void *to);
46extern void copy_page_nommu(void *to, void *from);
47#endif
43 48
44#if defined(CONFIG_MMU) && (defined(CONFIG_CPU_SH4) || \ 49#if defined(CONFIG_MMU) && (defined(CONFIG_CPU_SH4) || \
45 defined(CONFIG_SH7705_CACHE_32KB)) 50 defined(CONFIG_SH7705_CACHE_32KB))
diff --git a/include/asm-sh/uaccess.h b/include/asm-sh/uaccess.h
index 6c0014dd2ef7..5c3b00c2f107 100644
--- a/include/asm-sh/uaccess.h
+++ b/include/asm-sh/uaccess.h
@@ -168,6 +168,7 @@ do { \
168 __gu_err; \ 168 __gu_err; \
169}) 169})
170 170
171#ifdef CONFIG_MMU
171#define __get_user_check(x,ptr,size) \ 172#define __get_user_check(x,ptr,size) \
172({ \ 173({ \
173 long __gu_err, __gu_val; \ 174 long __gu_err, __gu_val; \
@@ -257,6 +258,18 @@ __asm__("stc r7_bank, %1\n\t" \
257 : "r" (addr) \ 258 : "r" (addr) \
258 : "t"); \ 259 : "t"); \
259}) 260})
261#else /* CONFIG_MMU */
262#define __get_user_check(x,ptr,size) \
263({ \
264 long __gu_err, __gu_val; \
265 if (__access_ok((unsigned long)(ptr), (size))) { \
266 __get_user_size(__gu_val, (ptr), (size), __gu_err); \
267 (x) = (__typeof__(*(ptr)))__gu_val; \
268 } else \
269 __gu_err = -EFAULT; \
270 __gu_err; \
271})
272#endif
260 273
261#define __get_user_asm(x, addr, err, insn) \ 274#define __get_user_asm(x, addr, err, insn) \
262({ \ 275({ \