summaryrefslogtreecommitdiffstats
path: root/include/asm-sh
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-sh')
-rw-r--r--include/asm-sh/bitops.h19
-rw-r--r--include/asm-sh/io.h36
-rw-r--r--include/asm-sh/ioctls.h12
-rw-r--r--include/asm-sh/irq.h8
-rw-r--r--include/asm-sh/mmu_context.h44
-rw-r--r--include/asm-sh/page.h11
-rw-r--r--include/asm-sh/pgtable-2level.h4
-rw-r--r--include/asm-sh/pgtable.h23
-rw-r--r--include/asm-sh/processor.h11
-rw-r--r--include/asm-sh/resource.h20
-rw-r--r--include/asm-sh/shmparam.h42
-rw-r--r--include/asm-sh/spinlock.h47
-rw-r--r--include/asm-sh/string.h20
-rw-r--r--include/asm-sh/termios.h1
-rw-r--r--include/asm-sh/uaccess.h22
15 files changed, 142 insertions, 178 deletions
diff --git a/include/asm-sh/bitops.h b/include/asm-sh/bitops.h
index de026bcd2..bf0d00c0a 100644
--- a/include/asm-sh/bitops.h
+++ b/include/asm-sh/bitops.h
@@ -96,7 +96,7 @@ extern __inline__ int test_and_change_bit(int nr, void * addr)
extern __inline__ int test_bit(int nr, const void *addr)
{
- return 1UL & (((const int *) addr)[nr >> 5] >> (nr & 31));
+ return 1UL & (((const unsigned int *) addr)[nr >> 5] >> (nr & 31));
}
extern __inline__ unsigned long ffz(unsigned long word)
@@ -107,8 +107,8 @@ extern __inline__ unsigned long ffz(unsigned long word)
"shlr %1\n\t"
"bt/s 1b\n\t"
" add #1, %0"
- : "=r" (result)
- : "r" (word), "0" (~0L));
+ : "=r" (result), "=r" (word)
+ : "0" (~0L), "1" (word));
return result;
}
@@ -151,10 +151,18 @@ found_middle:
#define find_first_zero_bit(addr, size) \
find_next_zero_bit((addr), (size), 0)
+#ifdef __LITTLE_ENDIAN__
+#define ext2_set_bit(nr, addr) test_and_set_bit((nr), (addr))
+#define ext2_clear_bit(nr, addr) test_and_clear_bit((nr), (addr))
+#define ext2_test_bit(nr, addr) test_bit((nr), (addr))
+#define ext2_find_first_zero_bit(addr, size) find_first_zero_bit((addr), (size))
+#define ext2_find_next_zero_bit(addr, size, offset) \
+ find_next_zero_bit((addr), (size), (offset))
+#else
extern __inline__ int ext2_set_bit(int nr,void * addr)
{
int mask, retval;
- unsigned long flags;
+ unsigned long flags;
unsigned char *ADDR = (unsigned char *) addr;
ADDR += nr >> 3;
@@ -169,7 +177,7 @@ extern __inline__ int ext2_set_bit(int nr,void * addr)
extern __inline__ int ext2_clear_bit(int nr, void * addr)
{
int mask, retval;
- unsigned long flags;
+ unsigned long flags;
unsigned char *ADDR = (unsigned char *) addr;
ADDR += nr >> 3;
@@ -243,6 +251,7 @@ found_first:
found_middle:
return result + ffz(__swab32(tmp));
}
+#endif
/* Bitmap functions for the minix filesystem. */
#define minix_set_bit(nr,addr) test_and_set_bit(nr,addr)
diff --git a/include/asm-sh/io.h b/include/asm-sh/io.h
index 57f0367b0..dd9205b32 100644
--- a/include/asm-sh/io.h
+++ b/include/asm-sh/io.h
@@ -72,6 +72,24 @@ extern __inline__ unsigned long inl(unsigned long addr)
return readl(addr);
}
+extern __inline__ void insb(unsigned long addr, void *buffer, int count)
+{
+ unsigned char *buf=buffer;
+ while(count--) *buf++=inb(addr);
+}
+
+extern __inline__ void insw(unsigned long addr, void *buffer, int count)
+{
+ unsigned short *buf=buffer;
+ while(count--) *buf++=inw(addr);
+}
+
+extern __inline__ void insl(unsigned long addr, void *buffer, int count)
+{
+ unsigned long *buf=buffer;
+ while(count--) *buf++=inl(addr);
+}
+
extern __inline__ void outb(unsigned char b, unsigned long addr)
{
return writeb(b,addr);
@@ -87,6 +105,24 @@ extern __inline__ void outl(unsigned int b, unsigned long addr)
return writel(b,addr);
}
+extern __inline__ void outsb(unsigned long addr, const void *buffer, int count)
+{
+ const unsigned char *buf=buffer;
+ while(count--) outb(*buf++, addr);
+}
+
+extern __inline__ void outsw(unsigned long addr, const void *buffer, int count)
+{
+ const unsigned short *buf=buffer;
+ while(count--) outw(*buf++, addr);
+}
+
+extern __inline__ void outsl(unsigned long addr, const void *buffer, int count)
+{
+ const unsigned long *buf=buffer;
+ while(count--) outl(*buf++, addr);
+}
+
extern __inline__ unsigned long ctrl_inb(unsigned long addr)
{
return *(volatile unsigned char*)addr;
diff --git a/include/asm-sh/ioctls.h b/include/asm-sh/ioctls.h
index 3905e572c..5d3e2cd24 100644
--- a/include/asm-sh/ioctls.h
+++ b/include/asm-sh/ioctls.h
@@ -10,10 +10,10 @@
#define FIONREAD _IOR('f', 127, int)
#define TIOCINQ FIONREAD
-#define TCGETS _IOR('t', 19, struct termios)
-#define TCSETS _IOW('t', 20, struct termios)
-#define TCSETSW _IOW('t', 21, struct termios)
-#define TCSETSF _IOW('t', 22, struct termios)
+#define TCGETS 0x5401
+#define TCSETS 0x5402
+#define TCSETSW 0x5403
+#define TCSETSF 0x5404
#define TCGETA _IOR('t', 23, struct termio)
#define TCSETA _IOW('t', 24, struct termio)
@@ -84,8 +84,8 @@
#define TIOCSERCONFIG _IO('T', 83) /* 0x5453 */
#define TIOCSERGWILD _IOR('T', 84, int) /* 0x5454 */
#define TIOCSERSWILD _IOW('T', 85, int) /* 0x5455 */
-#define TIOCGLCKTRMIOS _IOR('T', 86, struct termios) /* 0x5456 */
-#define TIOCSLCKTRMIOS _IOW('T', 87, struct termios) /* 0x5457 */
+#define TIOCGLCKTRMIOS 0x5456
+#define TIOCSLCKTRMIOS 0x5457
#define TIOCSERGSTRUCT _IOR('T', 88, struct async_struct) /* 0x5458 */ /* For debugging only */
#define TIOCSERGETLSR _IOR('T', 89, unsigned int) /* 0x5459 */ /* Get line status register */
/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
diff --git a/include/asm-sh/irq.h b/include/asm-sh/irq.h
index a1c06075b..f05fd7ac3 100644
--- a/include/asm-sh/irq.h
+++ b/include/asm-sh/irq.h
@@ -9,10 +9,13 @@
*
*/
+#include <linux/config.h>
+
#define TIMER_IRQ 16 /* Hard-wired */
#define TIMER_IRP_OFFSET 12
#define TIMER_PRIORITY 1
+#if defined(__SH4__)
/*
* 48 = 32+16
*
@@ -21,6 +24,11 @@
*
*/
#define NR_IRQS 48
+#elif defined(CONFIG_CPU_SUBTYPE_SH7708)
+#define NR_IRQS 32
+#elif defined(CONFIG_CPU_SUBTYPE_SH7709)
+#define NR_IRQS 61
+#endif
extern void disable_irq(unsigned int);
extern void disable_irq_nosync(unsigned int);
diff --git a/include/asm-sh/mmu_context.h b/include/asm-sh/mmu_context.h
index aca17690f..e16a7d775 100644
--- a/include/asm-sh/mmu_context.h
+++ b/include/asm-sh/mmu_context.h
@@ -16,10 +16,13 @@
*/
extern unsigned long mmu_context_cache;
-#define MMU_CONTEXT_ASID_MASK 0xff
-#define MMU_CONTEXT_VERSION_MASK 0xffffff00
-#define MMU_CONTEXT_FIRST_VERSION 0x100
-#define NO_CONTEXT 0
+#define MMU_CONTEXT_ASID_MASK 0x000000ff
+#define MMU_CONTEXT_VERSION_MASK 0xffffff00
+#define MMU_CONTEXT_FIRST_VERSION 0x00000100
+#define NO_CONTEXT 0
+
+/* ASID is 8-bit value, so it can't be 0x100 */
+#define MMU_NO_ASID 0x100
extern __inline__ void
get_new_mmu_context(struct mm_struct *mm)
@@ -34,7 +37,7 @@ get_new_mmu_context(struct mm_struct *mm)
flush_tlb_all();
/* Fix version if needed.
Note that we avoid version #0 to distingush NO_CONTEXT. */
- if (!mc)
+ if (!mc)
mmu_context_cache = mc = MMU_CONTEXT_FIRST_VERSION;
}
mm->context = mc;
@@ -71,7 +74,7 @@ extern __inline__ void init_new_context(struct task_struct *tsk,
*/
extern __inline__ void destroy_context(struct mm_struct *mm)
{
- mm->context = NO_CONTEXT;
+ /* Do nothing */
}
/* Other MMU related constants. */
@@ -84,11 +87,11 @@ extern __inline__ void destroy_context(struct mm_struct *mm)
#define MMUCR 0xFFFFFFE0 /* MMU Control Register */
-#define MMU_TLB_ADDRESS_ARRAY 0xF2000000
-#define MMU_PAGE_ASSOC_BIT 0x80
+#define MMU_TLB_ADDRESS_ARRAY 0xF2000000
+#define MMU_PAGE_ASSOC_BIT 0x80
-#define MMU_NTLB_ENTRIES 128 /* for 7708 */
-#define MMU_CONTROL_INIT 0x007 /* SV=0, TF=1, IX=1, AT=1 */
+#define MMU_NTLB_ENTRIES 128 /* for 7708 */
+#define MMU_CONTROL_INIT 0x007 /* SV=0, TF=1, IX=1, AT=1 */
#elif defined(__SH4__)
#define MMU_PTEH 0xFF000000 /* Page table entry register HIGH */
@@ -98,26 +101,26 @@ extern __inline__ void destroy_context(struct mm_struct *mm)
#define MMUCR 0xFF000010 /* MMU Control Register */
-#define MMU_ITLB_ADDRESS_ARRAY 0xF2000000
-#define MMU_UTLB_ADDRESS_ARRAY 0xF6000000
-#define MMU_PAGE_ASSOC_BIT 0x80
+#define MMU_ITLB_ADDRESS_ARRAY 0xF2000000
+#define MMU_UTLB_ADDRESS_ARRAY 0xF6000000
+#define MMU_PAGE_ASSOC_BIT 0x80
-#define MMU_NTLB_ENTRIES 64 /* for 7750 */
-#define MMU_CONTROL_INIT 0x205 /* SQMD=1, SV=0, TI=1, AT=1 */
+#define MMU_NTLB_ENTRIES 64 /* for 7750 */
+#define MMU_CONTROL_INIT 0x205 /* SQMD=1, SV=0, TI=1, AT=1 */
#endif
-extern __inline__ void set_asid (unsigned long asid)
+extern __inline__ void set_asid(unsigned long asid)
{
__asm__ __volatile__ ("mov.l %0,%1"
: /* no output */
: "r" (asid), "m" (__m(MMU_PTEH)));
}
-extern __inline__ unsigned long get_asid (void)
+extern __inline__ unsigned long get_asid(void)
{
unsigned long asid;
- __asm__ __volatile__ ("mov.l %1,%0"
+ __asm__ __volatile__ ("mov.l %1,%0"
: "=r" (asid)
: "m" (__m(MMU_PTEH)));
asid &= MMU_CONTEXT_ASID_MASK;
@@ -143,8 +146,9 @@ extern __inline__ void switch_mm(struct mm_struct *prev,
if (prev != next) {
unsigned long __pgdir = (unsigned long)next->pgd;
- __asm__ __volatile__("mov.l %0,%1": \
- :"r" (__pgdir), "m" (__m(MMU_TTB)));
+ __asm__ __volatile__("mov.l %0,%1"
+ : /* no output */
+ : "r" (__pgdir), "m" (__m(MMU_TTB)));
activate_context(next);
clear_bit(cpu, &prev->cpu_vm_mask);
}
diff --git a/include/asm-sh/page.h b/include/asm-sh/page.h
index 228c8d2d8..867c07122 100644
--- a/include/asm-sh/page.h
+++ b/include/asm-sh/page.h
@@ -39,9 +39,6 @@ typedef struct { unsigned long pgprot; } pgprot_t;
#define pgd_val(x) ((x).pgd)
#define pgprot_val(x) ((x).pgprot)
-#define __pte(x) ((pte_t) { (x) } )
-#define __pmd(x) ((pmd_t) { (x) } )
-#define __pgd(x) ((pgd_t) { (x) } )
#define __pgprot(x) ((pgprot_t) { (x) } )
#endif /* !__ASSEMBLY__ */
@@ -56,13 +53,12 @@ typedef struct { unsigned long pgprot; } pgprot_t;
*
* which has the same constant encoded..
*/
-#define __PAGE_OFFSET (0x80000000)
#define __MEMORY_START CONFIG_MEMORY_START
-#define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET+__MEMORY_START)
-#define __pa(x) ((unsigned long)(x)-__PAGE_OFFSET)
-#define __va(x) ((void *)((unsigned long)(x)+__PAGE_OFFSET))
+#define PAGE_OFFSET (0x80000000)
+#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET)
+#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET))
#define MAP_NR(addr) ((__pa(addr)-__MEMORY_START) >> PAGE_SHIFT)
#ifndef __ASSEMBLY__
@@ -74,7 +70,6 @@ extern int console_loglevel;
*/
#define BUG() do { \
printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
- console_loglevel = 0; \
asm volatile("nop"); \
} while (0)
diff --git a/include/asm-sh/pgtable-2level.h b/include/asm-sh/pgtable-2level.h
index ebfa410b3..2ec0bcbcc 100644
--- a/include/asm-sh/pgtable-2level.h
+++ b/include/asm-sh/pgtable-2level.h
@@ -32,7 +32,7 @@
extern inline int pgd_none(pgd_t pgd) { return 0; }
extern inline int pgd_bad(pgd_t pgd) { return 0; }
extern inline int pgd_present(pgd_t pgd) { return 1; }
-#define pgd_clear(xp) do { pgd_val(*(xp)) = 0; } while (0)
+#define pgd_clear(xp) do { } while (0)
#define pgd_page(pgd) \
((unsigned long) __va(pgd_val(pgd) & PAGE_MASK))
@@ -57,6 +57,4 @@ extern inline pmd_t * pmd_alloc(pgd_t *pgd, unsigned long address)
return (pmd_t *) pgd;
}
-#define SWP_ENTRY(type,offset) __pte((((type) << 1) | ((offset) << 8)))
-
#endif /* __ASM_SH_PGTABLE_2LEVEL_H */
diff --git a/include/asm-sh/pgtable.h b/include/asm-sh/pgtable.h
index 7ea944afa..97a9a3ad8 100644
--- a/include/asm-sh/pgtable.h
+++ b/include/asm-sh/pgtable.h
@@ -92,7 +92,7 @@ extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long page);
#define KERNEL_PGD_PTRS (PTRS_PER_PGD-USER_PGD_PTRS)
#define TWOLEVEL_PGDIR_SHIFT 22
-#define BOOT_USER_PGD_PTRS (__PAGE_OFFSET >> TWOLEVEL_PGDIR_SHIFT)
+#define BOOT_USER_PGD_PTRS (PAGE_OFFSET >> TWOLEVEL_PGDIR_SHIFT)
#define BOOT_KERNEL_PGD_PTRS (1024-BOOT_USER_PGD_PTRS)
#ifndef __ASSEMBLY__
@@ -183,7 +183,7 @@ extern void __handle_bad_pmd_kernel(pmd_t * pmd);
#define pte_none(x) (!pte_val(x))
#define pte_present(x) (pte_val(x) & (_PAGE_PRESENT | _PAGE_PROTNONE))
#define pte_clear(xp) do { pte_val(*(xp)) = 0; } while (0)
-#define pte_pagenr(x) ((unsigned long)((pte_val(x) >> PAGE_SHIFT)))
+#define pte_pagenr(x) ((unsigned long)(((pte_val(x) -__MEMORY_START) >> PAGE_SHIFT)))
#define pmd_none(x) (!pmd_val(x))
#define pmd_bad(x) ((pmd_val(x) & (~PAGE_MASK & ~_PAGE_USER)) != _KERNPG_TABLE)
@@ -194,7 +194,7 @@ extern void __handle_bad_pmd_kernel(pmd_t * pmd);
* Permanent address of a page. Obviously must never be
* called on a highmem page.
*/
-#define page_address(page) ({ if (PageHighMem(page)) BUG(); PAGE_OFFSET + (((page) - mem_map) << PAGE_SHIFT); })
+#define page_address(page) ({ PAGE_OFFSET + (((page) - mem_map) << PAGE_SHIFT) + __MEMORY_START; })
#define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT))
#define pte_page(x) (mem_map+pte_pagenr(x))
@@ -228,7 +228,7 @@ extern inline pte_t mk_pte(struct page *page, pgprot_t pgprot)
pte_t __pte;
pte_val(__pte) = (page-mem_map)*(unsigned long long)PAGE_SIZE +
- pgprot_val(pgprot);
+ __MEMORY_START + pgprot_val(pgprot);
return __pte;
}
@@ -274,8 +274,13 @@ extern __inline__ pgd_t *get_pgd_slow(void)
pgd_t *ret = (pgd_t *)__get_free_page(GFP_KERNEL);
if (ret) {
+ /* Clear User space */
memset(ret, 0, USER_PTRS_PER_PGD * sizeof(pgd_t));
- memcpy(ret + USER_PTRS_PER_PGD, swapper_pg_dir + USER_PTRS_PER_PGD, (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t));
+
+ /* XXX: Copy vmalloc-ed space??? */
+ memcpy(ret + USER_PTRS_PER_PGD,
+ swapper_pg_dir + USER_PTRS_PER_PGD,
+ (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t));
}
return ret;
}
@@ -412,8 +417,12 @@ extern pgd_t swapper_pg_dir[1024];
extern void update_mmu_cache(struct vm_area_struct * vma,
unsigned long address, pte_t pte);
-#define SWP_TYPE(entry) (((pte_val(entry)) >> 1) & 0x3f)
-#define SWP_OFFSET(entry) ((pte_val(entry)) >> 8)
+/* Encode and de-code a swap entry */
+#define SWP_TYPE(x) (((x).val >> 1) & 0x3f)
+#define SWP_OFFSET(x) ((x).val >> 8)
+#define SWP_ENTRY(type, offset) ((swp_entry_t) { ((type) << 1) | ((offset) << 8) })
+#define pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
+#define swp_entry_to_pte(x) ((pte_t) { (x).val })
#define module_map vmalloc
#define module_unmap vfree
diff --git a/include/asm-sh/processor.h b/include/asm-sh/processor.h
index 07175eff5..ae8b036c2 100644
--- a/include/asm-sh/processor.h
+++ b/include/asm-sh/processor.h
@@ -189,6 +189,17 @@ extern __inline__ unsigned long thread_saved_pc(struct thread_struct *t)
return t->pc;
}
+static inline unsigned long get_wchan(struct task_struct *p)
+{
+ if (!p || p == current || p->state == TASK_RUNNING)
+ return 0;
+ /* FIXME: here the actual wchan calculation should sit */
+ return 0;
+}
+
+#define KSTK_EIP(tsk) ((tsk)->thread.pc)
+#define KSTK_ESP(tsk) ((tsk)->thread.sp)
+
#define THREAD_SIZE (2*PAGE_SIZE)
extern struct task_struct * alloc_task_struct(void);
extern void free_task_struct(struct task_struct *);
diff --git a/include/asm-sh/resource.h b/include/asm-sh/resource.h
index 5f536d5f8..857c37166 100644
--- a/include/asm-sh/resource.h
+++ b/include/asm-sh/resource.h
@@ -22,16 +22,16 @@
#define INIT_RLIMITS \
{ \
- { LONG_MAX, LONG_MAX }, \
- { LONG_MAX, LONG_MAX }, \
- { LONG_MAX, LONG_MAX }, \
- { _STK_LIM, LONG_MAX }, \
- { 0, LONG_MAX }, \
- { LONG_MAX, LONG_MAX }, \
- { 0, 0 }, \
- { INR_OPEN, INR_OPEN }, \
- { LONG_MAX, LONG_MAX }, \
- { LONG_MAX, LONG_MAX }, \
+ { RLIM_INFINITY, RLIM_INFINITY }, \
+ { RLIM_INFINITY, RLIM_INFINITY }, \
+ { RLIM_INFINITY, RLIM_INFINITY }, \
+ { _STK_LIM, RLIM_INFINITY }, \
+ { 0, RLIM_INFINITY }, \
+ { RLIM_INFINITY, RLIM_INFINITY }, \
+ { 0, 0 }, \
+ { INR_OPEN, INR_OPEN }, \
+ { RLIM_INFINITY, RLIM_INFINITY }, \
+ { RLIM_INFINITY, RLIM_INFINITY }, \
}
#endif /* __KERNEL__ */
diff --git a/include/asm-sh/shmparam.h b/include/asm-sh/shmparam.h
index cf58a95e8..7d3ec7e36 100644
--- a/include/asm-sh/shmparam.h
+++ b/include/asm-sh/shmparam.h
@@ -1,46 +1,6 @@
#ifndef __ASM_SH_SHMPARAM_H
#define __ASM_SH_SHMPARAM_H
-/* address range for shared memory attaches if no address passed to shmat() */
-#define SHM_RANGE_START 0x50000000
-#define SHM_RANGE_END 0x60000000
-
-/*
- * Format of a swap-entry for shared memory pages currently out in
- * swap space (see also mm/swap.c).
- *
- * SWP_TYPE = SHM_SWP_TYPE
- * SWP_OFFSET is used as follows:
- *
- * bits 0..6 : id of shared memory segment page belongs to (SHM_ID)
- * bits 7..21: index of page within shared memory segment (SHM_IDX)
- * (actually fewer bits get used since SHMMAX is so low)
- */
-
-/*
- * Keep _SHM_ID_BITS as low as possible since SHMMNI depends on it and
- * there is a static array of size SHMMNI.
- */
-#define _SHM_ID_BITS 7
-#define SHM_ID_MASK ((1<<_SHM_ID_BITS)-1)
-
-#define SHM_IDX_SHIFT (_SHM_ID_BITS)
-#define _SHM_IDX_BITS 15
-#define SHM_IDX_MASK ((1<<_SHM_IDX_BITS)-1)
-
-/*
- * _SHM_ID_BITS + _SHM_IDX_BITS must be <= 24 on the i386 and
- * SHMMAX <= (PAGE_SIZE << _SHM_IDX_BITS).
- */
-
-#define SHMMAX 0x2000000 /* max shared seg size (bytes) */
-/* Try not to change the default shipped SHMMAX - people rely on it */
-
-#define SHMMIN 1 /* really PAGE_SIZE */ /* min shared seg size (bytes) */
-#define SHMMNI (1<<_SHM_ID_BITS) /* max num of segs system wide */
-#define SHMALL /* max shm system wide (pages) */ \
- (1<<(_SHM_IDX_BITS+_SHM_ID_BITS))
-#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */
-#define SHMSEG SHMMNI /* max shared segs per process */
+#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */
#endif /* __ASM_SH_SHMPARAM_H */
diff --git a/include/asm-sh/spinlock.h b/include/asm-sh/spinlock.h
index 8db187a29..16f70ffd7 100644
--- a/include/asm-sh/spinlock.h
+++ b/include/asm-sh/spinlock.h
@@ -1,53 +1,6 @@
#ifndef __ASM_SH_SPINLOCK_H
#define __ASM_SH_SPINLOCK_H
-#ifndef __SMP__
-
-typedef struct { } spinlock_t;
-#define SPIN_LOCK_UNLOCKED { }
-
-#define spin_lock_init(lock) do { } while(0)
-#define spin_lock(lock) do { } while(0)
-#define spin_trylock(lock) (1)
-#define spin_unlock_wait(lock) do { } while(0)
-#define spin_unlock(lock) do { } while(0)
-#define spin_lock_irq(lock) cli()
-#define spin_unlock_irq(lock) sti()
-
-#define spin_lock_irqsave(lock, flags) save_and_cli(flags)
-#define spin_unlock_irqrestore(lock, flags) restore_flags(flags)
-
-/*
- * Read-write spinlocks, allowing multiple readers
- * but only one writer.
- *
- * NOTE! it is quite common to have readers in interrupts
- * but no interrupt writers. For those circumstances we
- * can "mix" irq-safe locks - any writer needs to get a
- * irq-safe write-lock, but readers can get non-irqsafe
- * read-locks.
- */
-typedef struct { } rwlock_t;
-#define RW_LOCK_UNLOCKED (rwlock_t) { }
-
-#define read_lock(lock) do { } while(0)
-#define read_unlock(lock) do { } while(0)
-#define write_lock(lock) do { } while(0)
-#define write_unlock(lock) do { } while(0)
-#define read_lock_irq(lock) cli()
-#define read_unlock_irq(lock) sti()
-#define write_lock_irq(lock) cli()
-#define write_unlock_irq(lock) sti()
-
-#define read_lock_irqsave(lock, flags) save_and_cli(flags)
-#define read_unlock_irqrestore(lock, flags) restore_flags(flags)
-#define write_lock_irqsave(lock, flags) save_and_cli(flags)
-#define write_unlock_irqrestore(lock, flags) restore_flags(flags)
-
-#else
-
#error "No SMP on SH"
-#endif /* SMP */
-
#endif /* __ASM_SH_SPINLOCK_H */
diff --git a/include/asm-sh/string.h b/include/asm-sh/string.h
index 56ea9d8e8..bcff30489 100644
--- a/include/asm-sh/string.h
+++ b/include/asm-sh/string.h
@@ -120,24 +120,6 @@ extern void *memchr(const void *__s, int __c, size_t __n);
#define __HAVE_ARCH_BCOPY
#define __HAVE_ARCH_MEMSCAN
-extern __inline__ void *memscan(void *__addr, int __c, size_t __size)
-{
- register char *__end;
- unsigned long __dummy;
-
- __asm__("mov #0,%2\n"
- "1:\n\t"
- "cmp/eq %0,%1\n\t"
- "bt 2f\n\t"
- "cmp/eq %5,%2\n\t"
- "bf/s 1b\n\t"
- " mov.b @%0+,%2\n\t"
- "add #-1,%0\n\t"
- "2:"
- : "=r" (__addr), "=r" (__end), "=&z" (__dummy)
- : "0" (__addr), "1" ((char *)__addr + __size), "r" (__c));
-
- return __addr;
-}
+#define memscan memchr
#endif /* __ASM_SH_STRING_H */
diff --git a/include/asm-sh/termios.h b/include/asm-sh/termios.h
index f579c57a6..4e334d49a 100644
--- a/include/asm-sh/termios.h
+++ b/include/asm-sh/termios.h
@@ -53,6 +53,7 @@ struct termio {
#define N_IRDA 11 /* Linux IR - http://www.cs.uit.no/~dagb/irda/irda.html */
#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */
#define N_HDLC 13 /* synchronous HDLC */
+#define N_SYNC_PPP 14
#ifdef __KERNEL__
diff --git a/include/asm-sh/uaccess.h b/include/asm-sh/uaccess.h
index 4d888da0a..b64de2cd5 100644
--- a/include/asm-sh/uaccess.h
+++ b/include/asm-sh/uaccess.h
@@ -1,4 +1,4 @@
-/* $Id: uaccess.h,v 1.3 1999/10/12 14:46:20 gniibe Exp $
+/* $Id: uaccess.h,v 1.6 1999/10/29 13:10:44 gniibe Exp $
*
* User space memory access functions
*
@@ -392,16 +392,14 @@ extern __inline__ long __strnlen_user(const char *__s, long __n)
unsigned long __dummy;
__asm__ __volatile__(
- "mov #-1,%1\n"
- "9:\n\t"
+ "9:\n"
"cmp/eq %4,%0\n\t"
- "bt 5f\n\t"
- "cmp/eq #0,%1\n\t"
- "bf/s 9b\n\t"
+ "bt 2f\n"
"1:\t"
- " mov.b @%0+,%1\n\t"
- "5:\t"
- "sub %3,%0\n"
+ "mov.b @(%0,%3),%1\n\t"
+ "tst %1,%1\n\t"
+ "bf/s 9b\n\t"
+ " add #1,%0\n"
"2:\n"
".section .fixup,\"ax\"\n"
"3:\n\t"
@@ -415,14 +413,14 @@ extern __inline__ long __strnlen_user(const char *__s, long __n)
" .balign 4\n"
" .long 1b,3b\n"
".previous"
- : "=&r" (res), "=&z" (__dummy)
- : "0" (__s), "r" (__s), "r" (__s+__n), "i" (-EFAULT));
+ : "=z" (res), "=&r" (__dummy)
+ : "0" (0), "r" (__s), "r" (__n), "i" (-EFAULT));
return res;
}
extern __inline__ long strnlen_user(const char *s, long n)
{
- if(!access_ok(VERIFY_READ, s, n))
+ if (!__addr_ok(s))
return 0;
else
return __strnlen_user(s, n);