sh: __addr_ok() and other misc nommu fixups.

A few more outstanding nommu fixups..

Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
This commit is contained in:
Yoshinori Sato
2006-09-27 17:25:07 +09:00
committed by Paul Mundt
parent 0b8929354c
commit a2d1a5fae6
9 changed files with 33 additions and 22 deletions

View File

@@ -14,7 +14,7 @@
#include <asm/cpu/addrspace.h>
/* Memory segments (32bit Privileged mode addresses) */
#ifdef CONFIG_MMU
#ifndef CONFIG_CPU_SH2A
#define P0SEG 0x00000000
#define P1SEG 0x80000000
#define P2SEG 0xa0000000
@@ -24,7 +24,7 @@
#define P0SEG 0x00000000
#define P1SEG 0x00000000
#define P2SEG 0x20000000
#define P3SEG 0x40000000
#define P3SEG 0x00000000
#define P4SEG 0x80000000
#endif

View File

@@ -216,6 +216,7 @@ static inline void ctrl_delay(void)
#define IO_SPACE_LIMIT 0xffffffff
#ifdef CONFIG_MMU
/*
* Change virtual addresses to physical addresses and vv.
* These are trivial on the 1:1 Linux/SuperH mapping
@@ -229,6 +230,10 @@ static inline void *phys_to_virt(unsigned long 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 bus_to_virt phys_to_virt

View File

@@ -34,12 +34,12 @@
#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)
#if !defined(CONFIG_MMU)
/* NOMMU is always true */
#define __addr_ok(addr) (1)
static inline mm_segment_t get_fs(void)
{
return USER_DS;
@@ -66,6 +66,9 @@ static inline int __access_ok(unsigned long addr, unsigned long size)
return ((addr >= memory_start) && ((addr + size) < memory_end));
}
#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 set_fs(x) (current_thread_info()->addr_limit = (x))