From e96636ccfa373a00a0ee0558e1971baa7856d8b5 Mon Sep 17 00:00:00 2001 From: Yoshinori Sato <ysato@users.sourceforge.jp> Date: Wed, 27 Sep 2006 17:21:02 +0900 Subject: 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> --- include/asm-sh/addrspace.h | 8 ++++++++ include/asm-sh/flat.h | 2 +- include/asm-sh/mmu.h | 13 +------------ include/asm-sh/page.h | 5 +++++ include/asm-sh/uaccess.h | 13 +++++++++++++ 5 files changed, 28 insertions(+), 13 deletions(-) (limited to 'include') 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 @@ #include <asm/cpu/addrspace.h> /* Memory segments (32bit Privileged mode addresses) */ +#ifdef CONFIG_MMU #define P0SEG 0x00000000 #define P1SEG 0x80000000 #define P2SEG 0xa0000000 #define P3SEG 0xc0000000 #define P4SEG 0xe0000000 +#else +#define P0SEG 0x00000000 +#define P1SEG 0x00000000 +#define P2SEG 0x20000000 +#define P3SEG 0x40000000 +#define P4SEG 0x80000000 +#endif /* Returns the privileged segment base of a given address */ #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 @@ #define __ASM_SH_FLAT_H #define flat_stack_align(sp) /* nothing needed */ -#define flat_argvp_envp_on_stack() 1 +#define flat_argvp_envp_on_stack() 0 #define flat_old_ram_flag(flags) (flags) #define flat_reloc_valid(reloc, size) ((reloc) <= (size)) #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 @@ #if !defined(CONFIG_MMU) -struct mm_rblock_struct { - int size; - int refcount; - void *kblock; -}; - -struct mm_tblock_struct { - struct mm_rblock_struct *rblock; - struct mm_tblock_struct *next; -}; - typedef struct { - struct mm_tblock_struct tblock; + struct vm_list_struct *vmlist; unsigned long end_brk; } mm_context_t; 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 @@ extern void (*clear_page)(void *to); extern void (*copy_page)(void *to, void *from); +#ifdef CONFIG_MMU extern void clear_page_slow(void *to); extern void copy_page_slow(void *to, void *from); +#else +extern void clear_page_nommu(void *to); +extern void copy_page_nommu(void *to, void *from); +#endif #if defined(CONFIG_MMU) && (defined(CONFIG_CPU_SH4) || \ 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 { \ __gu_err; \ }) +#ifdef CONFIG_MMU #define __get_user_check(x,ptr,size) \ ({ \ long __gu_err, __gu_val; \ @@ -257,6 +258,18 @@ __asm__("stc r7_bank, %1\n\t" \ : "r" (addr) \ : "t"); \ }) +#else /* CONFIG_MMU */ +#define __get_user_check(x,ptr,size) \ +({ \ + long __gu_err, __gu_val; \ + if (__access_ok((unsigned long)(ptr), (size))) { \ + __get_user_size(__gu_val, (ptr), (size), __gu_err); \ + (x) = (__typeof__(*(ptr)))__gu_val; \ + } else \ + __gu_err = -EFAULT; \ + __gu_err; \ +}) +#endif #define __get_user_asm(x, addr, err, insn) \ ({ \ -- cgit v1.2.2