提交 a2d1a5fa 编写于 作者: Y Yoshinori Sato 提交者: Paul Mundt

sh: __addr_ok() and other misc nommu fixups.

A few more outstanding nommu fixups..
Signed-off-by: NYoshinori Sato <ysato@users.sourceforge.jp>
Signed-off-by: NPaul Mundt <lethal@linux-sh.org>
上级 0b892935
...@@ -22,7 +22,7 @@ CONFIG_PAGE_OFFSET ?= 0x80000000 ...@@ -22,7 +22,7 @@ CONFIG_PAGE_OFFSET ?= 0x80000000
CONFIG_MEMORY_START ?= 0x0c000000 CONFIG_MEMORY_START ?= 0x0c000000
CONFIG_BOOT_LINK_OFFSET ?= 0x00800000 CONFIG_BOOT_LINK_OFFSET ?= 0x00800000
IMAGE_OFFSET := $(shell printf "0x%8x" $$[$(CONFIG_PAGE_OFFSET) + \ IMAGE_OFFSET := $(shell printf "0x%08x" $$[$(CONFIG_PAGE_OFFSET) + \
$(CONFIG_MEMORY_START) + \ $(CONFIG_MEMORY_START) + \
$(CONFIG_BOOT_LINK_OFFSET)]) $(CONFIG_BOOT_LINK_OFFSET)])
......
...@@ -302,9 +302,11 @@ ubc_set_tracing(int asid, unsigned long pc) ...@@ -302,9 +302,11 @@ ubc_set_tracing(int asid, unsigned long pc)
{ {
ctrl_outl(pc, UBC_BARA); ctrl_outl(pc, UBC_BARA);
#ifdef CONFIG_MMU
/* We don't have any ASID settings for the SH-2! */ /* We don't have any ASID settings for the SH-2! */
if (cpu_data->type != CPU_SH7604) if (cpu_data->type != CPU_SH7604)
ctrl_outb(asid, UBC_BASRA); ctrl_outb(asid, UBC_BASRA);
#endif
ctrl_outl(0, UBC_BAMRA); ctrl_outl(0, UBC_BAMRA);
...@@ -347,6 +349,7 @@ struct task_struct *__switch_to(struct task_struct *prev, struct task_struct *ne ...@@ -347,6 +349,7 @@ struct task_struct *__switch_to(struct task_struct *prev, struct task_struct *ne
} }
#endif #endif
#ifdef CONFIG_MMU
/* /*
* Restore the kernel mode register * Restore the kernel mode register
* k7 (r7_bank1) * k7 (r7_bank1)
...@@ -354,19 +357,21 @@ struct task_struct *__switch_to(struct task_struct *prev, struct task_struct *ne ...@@ -354,19 +357,21 @@ struct task_struct *__switch_to(struct task_struct *prev, struct task_struct *ne
asm volatile("ldc %0, r7_bank" asm volatile("ldc %0, r7_bank"
: /* no output */ : /* no output */
: "r" (task_thread_info(next))); : "r" (task_thread_info(next)));
#endif
#ifdef CONFIG_MMU
/* If no tasks are using the UBC, we're done */ /* If no tasks are using the UBC, we're done */
if (ubc_usercnt == 0) if (ubc_usercnt == 0)
/* If no tasks are using the UBC, we're done */; /* If no tasks are using the UBC, we're done */;
else if (next->thread.ubc_pc && next->mm) { else if (next->thread.ubc_pc && next->mm) {
ubc_set_tracing(next->mm->context & MMU_CONTEXT_ASID_MASK, int asid = 0;
next->thread.ubc_pc); #ifdef CONFIG_MMU
asid |= next->mm->context & MMU_CONTEXT_ASID_MASK;
#endif
ubc_set_tracing(asid, next->thread.ubc_pc);
} else { } else {
ctrl_outw(0, UBC_BBRA); ctrl_outw(0, UBC_BBRA);
ctrl_outw(0, UBC_BBRB); ctrl_outw(0, UBC_BBRB);
} }
#endif
return prev; return prev;
} }
......
...@@ -79,20 +79,18 @@ EXPORT_SYMBOL(strcpy); ...@@ -79,20 +79,18 @@ EXPORT_SYMBOL(strcpy);
DECLARE_EXPORT(__movstr_i4_even); DECLARE_EXPORT(__movstr_i4_even);
DECLARE_EXPORT(__movstr_i4_odd); DECLARE_EXPORT(__movstr_i4_odd);
DECLARE_EXPORT(__movstrSI12_i4); DECLARE_EXPORT(__movstrSI12_i4);
#endif
#if defined(CONFIG_CPU_SH4) || defined(CONFIG_SH7705_CACHE_32KB)
/* needed by some modules */ /* needed by some modules */
EXPORT_SYMBOL(flush_cache_all); EXPORT_SYMBOL(flush_cache_all);
EXPORT_SYMBOL(flush_cache_range); EXPORT_SYMBOL(flush_cache_range);
EXPORT_SYMBOL(flush_dcache_page); EXPORT_SYMBOL(flush_dcache_page);
EXPORT_SYMBOL(__flush_purge_region); EXPORT_SYMBOL(__flush_purge_region);
EXPORT_SYMBOL(clear_user_page);
#endif #endif
#if defined(CONFIG_SH7705_CACHE_32KB) #ifdef CONFIG_MMU
EXPORT_SYMBOL(flush_cache_all); EXPORT_SYMBOL(clear_user_page);
EXPORT_SYMBOL(flush_cache_range);
EXPORT_SYMBOL(flush_dcache_page);
EXPORT_SYMBOL(__flush_purge_region);
#endif #endif
EXPORT_SYMBOL(flush_tlb_page); EXPORT_SYMBOL(flush_tlb_page);
......
...@@ -44,7 +44,7 @@ asmlinkage int sys_pipe(unsigned long r4, unsigned long r5, ...@@ -44,7 +44,7 @@ asmlinkage int sys_pipe(unsigned long r4, unsigned long r5,
return error; return error;
} }
#if defined(HAVE_ARCH_UNMAPPED_AREA) #if defined(HAVE_ARCH_UNMAPPED_AREA) && defined(CONFIG_MMU)
/* /*
* To avoid cache alias, we map the shard page with same color. * To avoid cache alias, we map the shard page with same color.
*/ */
......
...@@ -194,7 +194,7 @@ config MEMORY_SIZE ...@@ -194,7 +194,7 @@ config MEMORY_SIZE
config 32BIT config 32BIT
bool "Support 32-bit physical addressing through PMB" bool "Support 32-bit physical addressing through PMB"
depends on CPU_SH4A depends on CPU_SH4A && MMU
default y default y
help help
If you say Y here, physical addressing will be extended to If you say Y here, physical addressing will be extended to
......
...@@ -6,7 +6,7 @@ obj-y := init.o extable.o consistent.o ...@@ -6,7 +6,7 @@ obj-y := init.o extable.o consistent.o
obj-$(CONFIG_CPU_SH2) += cache-sh2.o obj-$(CONFIG_CPU_SH2) += cache-sh2.o
obj-$(CONFIG_CPU_SH3) += cache-sh3.o obj-$(CONFIG_CPU_SH3) += cache-sh3.o
obj-$(CONFIG_CPU_SH4) += cache-sh4.o pg-sh4.o obj-$(CONFIG_CPU_SH4) += cache-sh4.o
obj-$(CONFIG_DMA_PAGE_OPS) += pg-dma.o obj-$(CONFIG_DMA_PAGE_OPS) += pg-dma.o
obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
...@@ -19,7 +19,7 @@ obj-y += $(mmu-y) ...@@ -19,7 +19,7 @@ obj-y += $(mmu-y)
ifdef CONFIG_MMU ifdef CONFIG_MMU
obj-$(CONFIG_CPU_SH3) += tlb-sh3.o obj-$(CONFIG_CPU_SH3) += tlb-sh3.o
obj-$(CONFIG_CPU_SH4) += tlb-sh4.o obj-$(CONFIG_CPU_SH4) += tlb-sh4.o pg-sh4.o
obj-$(CONFIG_SH7705_CACHE_32KB) += pg-sh7705.o obj-$(CONFIG_SH7705_CACHE_32KB) += pg-sh7705.o
endif endif
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#include <asm/cpu/addrspace.h> #include <asm/cpu/addrspace.h>
/* Memory segments (32bit Privileged mode addresses) */ /* Memory segments (32bit Privileged mode addresses) */
#ifdef CONFIG_MMU #ifndef CONFIG_CPU_SH2A
#define P0SEG 0x00000000 #define P0SEG 0x00000000
#define P1SEG 0x80000000 #define P1SEG 0x80000000
#define P2SEG 0xa0000000 #define P2SEG 0xa0000000
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#define P0SEG 0x00000000 #define P0SEG 0x00000000
#define P1SEG 0x00000000 #define P1SEG 0x00000000
#define P2SEG 0x20000000 #define P2SEG 0x20000000
#define P3SEG 0x40000000 #define P3SEG 0x00000000
#define P4SEG 0x80000000 #define P4SEG 0x80000000
#endif #endif
......
...@@ -216,6 +216,7 @@ static inline void ctrl_delay(void) ...@@ -216,6 +216,7 @@ static inline void ctrl_delay(void)
#define IO_SPACE_LIMIT 0xffffffff #define IO_SPACE_LIMIT 0xffffffff
#ifdef CONFIG_MMU
/* /*
* Change virtual addresses to physical addresses and vv. * Change virtual addresses to physical addresses and vv.
* These are trivial on the 1:1 Linux/SuperH mapping * These are trivial on the 1:1 Linux/SuperH mapping
...@@ -229,6 +230,10 @@ static inline void *phys_to_virt(unsigned long address) ...@@ -229,6 +230,10 @@ static inline void *phys_to_virt(unsigned long address)
{ {
return (void *)P1SEGADDR(address); return (void *)P1SEGADDR(address);
} }
#else
#define phys_to_virt(address) ((void *)(address))
#define virt_to_phys(address) ((unsigned long)(address))
#endif
#define virt_to_bus virt_to_phys #define virt_to_bus virt_to_phys
#define bus_to_virt phys_to_virt #define bus_to_virt phys_to_virt
......
...@@ -34,12 +34,12 @@ ...@@ -34,12 +34,12 @@
#define segment_eq(a,b) ((a).seg == (b).seg) #define segment_eq(a,b) ((a).seg == (b).seg)
#define __addr_ok(addr) \
((unsigned long)(addr) < (current_thread_info()->addr_limit.seg))
#define get_ds() (KERNEL_DS) #define get_ds() (KERNEL_DS)
#if !defined(CONFIG_MMU) #if !defined(CONFIG_MMU)
/* NOMMU is always true */
#define __addr_ok(addr) (1)
static inline mm_segment_t get_fs(void) static inline mm_segment_t get_fs(void)
{ {
return USER_DS; return USER_DS;
...@@ -66,6 +66,9 @@ static inline int __access_ok(unsigned long addr, unsigned long size) ...@@ -66,6 +66,9 @@ static inline int __access_ok(unsigned long addr, unsigned long size)
return ((addr >= memory_start) && ((addr + size) < memory_end)); return ((addr >= memory_start) && ((addr + size) < memory_end));
} }
#else /* CONFIG_MMU */ #else /* CONFIG_MMU */
#define __addr_ok(addr) \
((unsigned long)(addr) < (current_thread_info()->addr_limit.seg))
#define get_fs() (current_thread_info()->addr_limit) #define get_fs() (current_thread_info()->addr_limit)
#define set_fs(x) (current_thread_info()->addr_limit = (x)) #define set_fs(x) (current_thread_info()->addr_limit = (x))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册