aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/include/asm
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh/include/asm')
-rw-r--r--arch/sh/include/asm/atomic-irq.h2
-rw-r--r--arch/sh/include/asm/atomic.h2
-rw-r--r--arch/sh/include/asm/auxvec.h2
-rw-r--r--arch/sh/include/asm/barrier.h54
-rw-r--r--arch/sh/include/asm/bitops.h1
-rw-r--r--arch/sh/include/asm/bl_bit.h10
-rw-r--r--arch/sh/include/asm/bl_bit_32.h33
-rw-r--r--arch/sh/include/asm/bl_bit_64.h40
-rw-r--r--arch/sh/include/asm/bug.h5
-rw-r--r--arch/sh/include/asm/cache_insns.h11
-rw-r--r--arch/sh/include/asm/cache_insns_32.h21
-rw-r--r--arch/sh/include/asm/cache_insns_64.h23
-rw-r--r--arch/sh/include/asm/clock.h2
-rw-r--r--arch/sh/include/asm/cmpxchg-irq.h2
-rw-r--r--arch/sh/include/asm/cmpxchg.h70
-rw-r--r--arch/sh/include/asm/exec.h10
-rw-r--r--arch/sh/include/asm/futex-irq.h1
-rw-r--r--arch/sh/include/asm/io.h26
-rw-r--r--arch/sh/include/asm/irq.h11
-rw-r--r--arch/sh/include/asm/pci.h6
-rw-r--r--arch/sh/include/asm/posix_types_32.h5
-rw-r--r--arch/sh/include/asm/posix_types_64.h4
-rw-r--r--arch/sh/include/asm/processor.h15
-rw-r--r--arch/sh/include/asm/ptrace.h1
-rw-r--r--arch/sh/include/asm/setup.h1
-rw-r--r--arch/sh/include/asm/switch_to.h19
-rw-r--r--arch/sh/include/asm/switch_to_32.h (renamed from arch/sh/include/asm/system_32.h)108
-rw-r--r--arch/sh/include/asm/switch_to_64.h35
-rw-r--r--arch/sh/include/asm/system.h184
-rw-r--r--arch/sh/include/asm/system_64.h79
-rw-r--r--arch/sh/include/asm/traps.h21
-rw-r--r--arch/sh/include/asm/traps_32.h68
-rw-r--r--arch/sh/include/asm/traps_64.h24
-rw-r--r--arch/sh/include/asm/uaccess.h14
-rw-r--r--arch/sh/include/asm/unistd.h37
-rw-r--r--arch/sh/include/asm/unistd_32.h102
-rw-r--r--arch/sh/include/asm/unistd_64.h106
37 files changed, 598 insertions, 557 deletions
diff --git a/arch/sh/include/asm/atomic-irq.h b/arch/sh/include/asm/atomic-irq.h
index 467d9415a32e..9f7c56609e53 100644
--- a/arch/sh/include/asm/atomic-irq.h
+++ b/arch/sh/include/asm/atomic-irq.h
@@ -1,6 +1,8 @@
1#ifndef __ASM_SH_ATOMIC_IRQ_H 1#ifndef __ASM_SH_ATOMIC_IRQ_H
2#define __ASM_SH_ATOMIC_IRQ_H 2#define __ASM_SH_ATOMIC_IRQ_H
3 3
4#include <linux/irqflags.h>
5
4/* 6/*
5 * To get proper branch prediction for the main line, we must branch 7 * To get proper branch prediction for the main line, we must branch
6 * forward to code at the end of this object's .text section, then 8 * forward to code at the end of this object's .text section, then
diff --git a/arch/sh/include/asm/atomic.h b/arch/sh/include/asm/atomic.h
index 63a27dbc952e..37f2f4a55231 100644
--- a/arch/sh/include/asm/atomic.h
+++ b/arch/sh/include/asm/atomic.h
@@ -9,7 +9,7 @@
9 9
10#include <linux/compiler.h> 10#include <linux/compiler.h>
11#include <linux/types.h> 11#include <linux/types.h>
12#include <asm/system.h> 12#include <asm/cmpxchg.h>
13 13
14#define ATOMIC_INIT(i) ( (atomic_t) { (i) } ) 14#define ATOMIC_INIT(i) ( (atomic_t) { (i) } )
15 15
diff --git a/arch/sh/include/asm/auxvec.h b/arch/sh/include/asm/auxvec.h
index 483effd65e00..8bcc51af9367 100644
--- a/arch/sh/include/asm/auxvec.h
+++ b/arch/sh/include/asm/auxvec.h
@@ -33,4 +33,6 @@
33#define AT_L1D_CACHESHAPE 35 33#define AT_L1D_CACHESHAPE 35
34#define AT_L2_CACHESHAPE 36 34#define AT_L2_CACHESHAPE 36
35 35
36#define AT_VECTOR_SIZE_ARCH 5 /* entries in ARCH_DLINFO */
37
36#endif /* __ASM_SH_AUXVEC_H */ 38#endif /* __ASM_SH_AUXVEC_H */
diff --git a/arch/sh/include/asm/barrier.h b/arch/sh/include/asm/barrier.h
new file mode 100644
index 000000000000..72c103dae300
--- /dev/null
+++ b/arch/sh/include/asm/barrier.h
@@ -0,0 +1,54 @@
1/*
2 * Copyright (C) 1999, 2000 Niibe Yutaka & Kaz Kojima
3 * Copyright (C) 2002 Paul Mundt
4 */
5#ifndef __ASM_SH_BARRIER_H
6#define __ASM_SH_BARRIER_H
7
8#if defined(CONFIG_CPU_SH4A) || defined(CONFIG_CPU_SH5)
9#include <asm/cache_insns.h>
10#endif
11
12/*
13 * A brief note on ctrl_barrier(), the control register write barrier.
14 *
15 * Legacy SH cores typically require a sequence of 8 nops after
16 * modification of a control register in order for the changes to take
17 * effect. On newer cores (like the sh4a and sh5) this is accomplished
18 * with icbi.
19 *
20 * Also note that on sh4a in the icbi case we can forego a synco for the
21 * write barrier, as it's not necessary for control registers.
22 *
23 * Historically we have only done this type of barrier for the MMUCR, but
24 * it's also necessary for the CCR, so we make it generic here instead.
25 */
26#if defined(CONFIG_CPU_SH4A) || defined(CONFIG_CPU_SH5)
27#define mb() __asm__ __volatile__ ("synco": : :"memory")
28#define rmb() mb()
29#define wmb() __asm__ __volatile__ ("synco": : :"memory")
30#define ctrl_barrier() __icbi(PAGE_OFFSET)
31#define read_barrier_depends() do { } while(0)
32#else
33#define mb() __asm__ __volatile__ ("": : :"memory")
34#define rmb() mb()
35#define wmb() __asm__ __volatile__ ("": : :"memory")
36#define ctrl_barrier() __asm__ __volatile__ ("nop;nop;nop;nop;nop;nop;nop;nop")
37#define read_barrier_depends() do { } while(0)
38#endif
39
40#ifdef CONFIG_SMP
41#define smp_mb() mb()
42#define smp_rmb() rmb()
43#define smp_wmb() wmb()
44#define smp_read_barrier_depends() read_barrier_depends()
45#else
46#define smp_mb() barrier()
47#define smp_rmb() barrier()
48#define smp_wmb() barrier()
49#define smp_read_barrier_depends() do { } while(0)
50#endif
51
52#define set_mb(var, value) do { (void)xchg(&var, value); } while (0)
53
54#endif /* __ASM_SH_BARRIER_H */
diff --git a/arch/sh/include/asm/bitops.h b/arch/sh/include/asm/bitops.h
index 90fa3e48b4d6..ea8706d94f08 100644
--- a/arch/sh/include/asm/bitops.h
+++ b/arch/sh/include/asm/bitops.h
@@ -7,7 +7,6 @@
7#error only <linux/bitops.h> can be included directly 7#error only <linux/bitops.h> can be included directly
8#endif 8#endif
9 9
10#include <asm/system.h>
11/* For __swab32 */ 10/* For __swab32 */
12#include <asm/byteorder.h> 11#include <asm/byteorder.h>
13 12
diff --git a/arch/sh/include/asm/bl_bit.h b/arch/sh/include/asm/bl_bit.h
new file mode 100644
index 000000000000..45e6b9fc37a0
--- /dev/null
+++ b/arch/sh/include/asm/bl_bit.h
@@ -0,0 +1,10 @@
1#ifndef __ASM_SH_BL_BIT_H
2#define __ASM_SH_BL_BIT_H
3
4#ifdef CONFIG_SUPERH32
5# include "bl_bit_32.h"
6#else
7# include "bl_bit_64.h"
8#endif
9
10#endif /* __ASM_SH_BL_BIT_H */
diff --git a/arch/sh/include/asm/bl_bit_32.h b/arch/sh/include/asm/bl_bit_32.h
new file mode 100644
index 000000000000..fd21eee62149
--- /dev/null
+++ b/arch/sh/include/asm/bl_bit_32.h
@@ -0,0 +1,33 @@
1#ifndef __ASM_SH_BL_BIT_32_H
2#define __ASM_SH_BL_BIT_32_H
3
4static inline void set_bl_bit(void)
5{
6 unsigned long __dummy0, __dummy1;
7
8 __asm__ __volatile__ (
9 "stc sr, %0\n\t"
10 "or %2, %0\n\t"
11 "and %3, %0\n\t"
12 "ldc %0, sr\n\t"
13 : "=&r" (__dummy0), "=r" (__dummy1)
14 : "r" (0x10000000), "r" (0xffffff0f)
15 : "memory"
16 );
17}
18
19static inline void clear_bl_bit(void)
20{
21 unsigned long __dummy0, __dummy1;
22
23 __asm__ __volatile__ (
24 "stc sr, %0\n\t"
25 "and %2, %0\n\t"
26 "ldc %0, sr\n\t"
27 : "=&r" (__dummy0), "=r" (__dummy1)
28 : "1" (~0x10000000)
29 : "memory"
30 );
31}
32
33#endif /* __ASM_SH_BL_BIT_32_H */
diff --git a/arch/sh/include/asm/bl_bit_64.h b/arch/sh/include/asm/bl_bit_64.h
new file mode 100644
index 000000000000..6cc8711af435
--- /dev/null
+++ b/arch/sh/include/asm/bl_bit_64.h
@@ -0,0 +1,40 @@
1/*
2 * Copyright (C) 2000, 2001 Paolo Alberelli
3 * Copyright (C) 2003 Paul Mundt
4 * Copyright (C) 2004 Richard Curnow
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#ifndef __ASM_SH_BL_BIT_64_H
11#define __ASM_SH_BL_BIT_64_H
12
13#include <asm/processor.h>
14
15#define SR_BL_LL 0x0000000010000000LL
16
17static inline void set_bl_bit(void)
18{
19 unsigned long long __dummy0, __dummy1 = SR_BL_LL;
20
21 __asm__ __volatile__("getcon " __SR ", %0\n\t"
22 "or %0, %1, %0\n\t"
23 "putcon %0, " __SR "\n\t"
24 : "=&r" (__dummy0)
25 : "r" (__dummy1));
26
27}
28
29static inline void clear_bl_bit(void)
30{
31 unsigned long long __dummy0, __dummy1 = ~SR_BL_LL;
32
33 __asm__ __volatile__("getcon " __SR ", %0\n\t"
34 "and %0, %1, %0\n\t"
35 "putcon %0, " __SR "\n\t"
36 : "=&r" (__dummy0)
37 : "r" (__dummy1));
38}
39
40#endif /* __ASM_SH_BL_BIT_64_H */
diff --git a/arch/sh/include/asm/bug.h b/arch/sh/include/asm/bug.h
index 6323f864d111..2b87d86bfc41 100644
--- a/arch/sh/include/asm/bug.h
+++ b/arch/sh/include/asm/bug.h
@@ -1,6 +1,8 @@
1#ifndef __ASM_SH_BUG_H 1#ifndef __ASM_SH_BUG_H
2#define __ASM_SH_BUG_H 2#define __ASM_SH_BUG_H
3 3
4#include <linux/linkage.h>
5
4#define TRAPA_BUG_OPCODE 0xc33e /* trapa #0x3e */ 6#define TRAPA_BUG_OPCODE 0xc33e /* trapa #0x3e */
5#define BUGFLAG_UNWINDER (1 << 1) 7#define BUGFLAG_UNWINDER (1 << 1)
6 8
@@ -107,4 +109,7 @@ do { \
107 109
108#include <asm-generic/bug.h> 110#include <asm-generic/bug.h>
109 111
112struct pt_regs;
113extern void die(const char *str, struct pt_regs *regs, long err) __attribute__ ((noreturn));
114
110#endif /* __ASM_SH_BUG_H */ 115#endif /* __ASM_SH_BUG_H */
diff --git a/arch/sh/include/asm/cache_insns.h b/arch/sh/include/asm/cache_insns.h
new file mode 100644
index 000000000000..d25fbe53090d
--- /dev/null
+++ b/arch/sh/include/asm/cache_insns.h
@@ -0,0 +1,11 @@
1#ifndef __ASM_SH_CACHE_INSNS_H
2#define __ASM_SH_CACHE_INSNS_H
3
4
5#ifdef CONFIG_SUPERH32
6# include "cache_insns_32.h"
7#else
8# include "cache_insns_64.h"
9#endif
10
11#endif /* __ASM_SH_CACHE_INSNS_H */
diff --git a/arch/sh/include/asm/cache_insns_32.h b/arch/sh/include/asm/cache_insns_32.h
new file mode 100644
index 000000000000..b92fe5416092
--- /dev/null
+++ b/arch/sh/include/asm/cache_insns_32.h
@@ -0,0 +1,21 @@
1#ifndef __ASM_SH_CACHE_INSNS_32_H
2#define __ASM_SH_CACHE_INSNS_32_H
3
4#include <linux/types.h>
5
6#if defined(CONFIG_CPU_SH4A)
7#define __icbi(addr) __asm__ __volatile__ ( "icbi @%0\n\t" : : "r" (addr))
8#else
9#define __icbi(addr) mb()
10#endif
11
12#define __ocbp(addr) __asm__ __volatile__ ( "ocbp @%0\n\t" : : "r" (addr))
13#define __ocbi(addr) __asm__ __volatile__ ( "ocbi @%0\n\t" : : "r" (addr))
14#define __ocbwb(addr) __asm__ __volatile__ ( "ocbwb @%0\n\t" : : "r" (addr))
15
16static inline reg_size_t register_align(void *val)
17{
18 return (unsigned long)(signed long)val;
19}
20
21#endif /* __ASM_SH_CACHE_INSNS_32_H */
diff --git a/arch/sh/include/asm/cache_insns_64.h b/arch/sh/include/asm/cache_insns_64.h
new file mode 100644
index 000000000000..70b6357eaf1a
--- /dev/null
+++ b/arch/sh/include/asm/cache_insns_64.h
@@ -0,0 +1,23 @@
1/*
2 * Copyright (C) 2000, 2001 Paolo Alberelli
3 * Copyright (C) 2003 Paul Mundt
4 * Copyright (C) 2004 Richard Curnow
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#ifndef __ASM_SH_CACHE_INSNS_64_H
11#define __ASM_SH_CACHE_INSNS_64_H
12
13#define __icbi(addr) __asm__ __volatile__ ( "icbi %0, 0\n\t" : : "r" (addr))
14#define __ocbp(addr) __asm__ __volatile__ ( "ocbp %0, 0\n\t" : : "r" (addr))
15#define __ocbi(addr) __asm__ __volatile__ ( "ocbi %0, 0\n\t" : : "r" (addr))
16#define __ocbwb(addr) __asm__ __volatile__ ( "ocbwb %0, 0\n\t" : : "r" (addr))
17
18static inline reg_size_t register_align(void *val)
19{
20 return (unsigned long long)(signed long long)(signed long)val;
21}
22
23#endif /* __ASM_SH_CACHE_INSNS_64_H */
diff --git a/arch/sh/include/asm/clock.h b/arch/sh/include/asm/clock.h
index 803d4c7f09dc..0390a07e7e3b 100644
--- a/arch/sh/include/asm/clock.h
+++ b/arch/sh/include/asm/clock.h
@@ -4,7 +4,7 @@
4#include <linux/sh_clk.h> 4#include <linux/sh_clk.h>
5 5
6/* Should be defined by processor-specific code */ 6/* Should be defined by processor-specific code */
7void __deprecated arch_init_clk_ops(struct clk_ops **, int type); 7void __deprecated arch_init_clk_ops(struct sh_clk_ops **, int type);
8int __init arch_clk_init(void); 8int __init arch_clk_init(void);
9 9
10/* arch/sh/kernel/cpu/clock-cpg.c */ 10/* arch/sh/kernel/cpu/clock-cpg.c */
diff --git a/arch/sh/include/asm/cmpxchg-irq.h b/arch/sh/include/asm/cmpxchg-irq.h
index 43049ec0554b..bd11f630414a 100644
--- a/arch/sh/include/asm/cmpxchg-irq.h
+++ b/arch/sh/include/asm/cmpxchg-irq.h
@@ -1,6 +1,8 @@
1#ifndef __ASM_SH_CMPXCHG_IRQ_H 1#ifndef __ASM_SH_CMPXCHG_IRQ_H
2#define __ASM_SH_CMPXCHG_IRQ_H 2#define __ASM_SH_CMPXCHG_IRQ_H
3 3
4#include <linux/irqflags.h>
5
4static inline unsigned long xchg_u32(volatile u32 *m, unsigned long val) 6static inline unsigned long xchg_u32(volatile u32 *m, unsigned long val)
5{ 7{
6 unsigned long flags, retval; 8 unsigned long flags, retval;
diff --git a/arch/sh/include/asm/cmpxchg.h b/arch/sh/include/asm/cmpxchg.h
new file mode 100644
index 000000000000..f6bd1406b897
--- /dev/null
+++ b/arch/sh/include/asm/cmpxchg.h
@@ -0,0 +1,70 @@
1#ifndef __ASM_SH_CMPXCHG_H
2#define __ASM_SH_CMPXCHG_H
3
4/*
5 * Atomic operations that C can't guarantee us. Useful for
6 * resource counting etc..
7 */
8
9#include <linux/compiler.h>
10#include <linux/types.h>
11
12#if defined(CONFIG_GUSA_RB)
13#include <asm/cmpxchg-grb.h>
14#elif defined(CONFIG_CPU_SH4A)
15#include <asm/cmpxchg-llsc.h>
16#else
17#include <asm/cmpxchg-irq.h>
18#endif
19
20extern void __xchg_called_with_bad_pointer(void);
21
22#define __xchg(ptr, x, size) \
23({ \
24 unsigned long __xchg__res; \
25 volatile void *__xchg_ptr = (ptr); \
26 switch (size) { \
27 case 4: \
28 __xchg__res = xchg_u32(__xchg_ptr, x); \
29 break; \
30 case 1: \
31 __xchg__res = xchg_u8(__xchg_ptr, x); \
32 break; \
33 default: \
34 __xchg_called_with_bad_pointer(); \
35 __xchg__res = x; \
36 break; \
37 } \
38 \
39 __xchg__res; \
40})
41
42#define xchg(ptr,x) \
43 ((__typeof__(*(ptr)))__xchg((ptr),(unsigned long)(x), sizeof(*(ptr))))
44
45/* This function doesn't exist, so you'll get a linker error
46 * if something tries to do an invalid cmpxchg(). */
47extern void __cmpxchg_called_with_bad_pointer(void);
48
49#define __HAVE_ARCH_CMPXCHG 1
50
51static inline unsigned long __cmpxchg(volatile void * ptr, unsigned long old,
52 unsigned long new, int size)
53{
54 switch (size) {
55 case 4:
56 return __cmpxchg_u32(ptr, old, new);
57 }
58 __cmpxchg_called_with_bad_pointer();
59 return old;
60}
61
62#define cmpxchg(ptr,o,n) \
63 ({ \
64 __typeof__(*(ptr)) _o_ = (o); \
65 __typeof__(*(ptr)) _n_ = (n); \
66 (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \
67 (unsigned long)_n_, sizeof(*(ptr))); \
68 })
69
70#endif /* __ASM_SH_CMPXCHG_H */
diff --git a/arch/sh/include/asm/exec.h b/arch/sh/include/asm/exec.h
new file mode 100644
index 000000000000..69486a9497f7
--- /dev/null
+++ b/arch/sh/include/asm/exec.h
@@ -0,0 +1,10 @@
1/*
2 * Copyright (C) 1999, 2000 Niibe Yutaka & Kaz Kojima
3 * Copyright (C) 2002 Paul Mundt
4 */
5#ifndef __ASM_SH_EXEC_H
6#define __ASM_SH_EXEC_H
7
8#define arch_align_stack(x) (x)
9
10#endif /* __ASM_SH_EXEC_H */
diff --git a/arch/sh/include/asm/futex-irq.h b/arch/sh/include/asm/futex-irq.h
index 6cb9f193a95e..63d33129ea23 100644
--- a/arch/sh/include/asm/futex-irq.h
+++ b/arch/sh/include/asm/futex-irq.h
@@ -1,7 +1,6 @@
1#ifndef __ASM_SH_FUTEX_IRQ_H 1#ifndef __ASM_SH_FUTEX_IRQ_H
2#define __ASM_SH_FUTEX_IRQ_H 2#define __ASM_SH_FUTEX_IRQ_H
3 3
4#include <asm/system.h>
5 4
6static inline int atomic_futex_op_xchg_set(int oparg, u32 __user *uaddr, 5static inline int atomic_futex_op_xchg_set(int oparg, u32 __user *uaddr,
7 int *oldval) 6 int *oldval)
diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
index 28c5aa58bb45..ec464a6b95fe 100644
--- a/arch/sh/include/asm/io.h
+++ b/arch/sh/include/asm/io.h
@@ -14,7 +14,6 @@
14 */ 14 */
15#include <linux/errno.h> 15#include <linux/errno.h>
16#include <asm/cache.h> 16#include <asm/cache.h>
17#include <asm/system.h>
18#include <asm/addrspace.h> 17#include <asm/addrspace.h>
19#include <asm/machvec.h> 18#include <asm/machvec.h>
20#include <asm/pgtable.h> 19#include <asm/pgtable.h>
@@ -24,6 +23,7 @@
24#define __IO_PREFIX generic 23#define __IO_PREFIX generic
25#include <asm/io_generic.h> 24#include <asm/io_generic.h>
26#include <asm/io_trapped.h> 25#include <asm/io_trapped.h>
26#include <mach/mangle-port.h>
27 27
28#define __raw_writeb(v,a) (__chk_io_ptr(a), *(volatile u8 __force *)(a) = (v)) 28#define __raw_writeb(v,a) (__chk_io_ptr(a), *(volatile u8 __force *)(a) = (v))
29#define __raw_writew(v,a) (__chk_io_ptr(a), *(volatile u16 __force *)(a) = (v)) 29#define __raw_writew(v,a) (__chk_io_ptr(a), *(volatile u16 __force *)(a) = (v))
@@ -35,21 +35,15 @@
35#define __raw_readl(a) (__chk_io_ptr(a), *(volatile u32 __force *)(a)) 35#define __raw_readl(a) (__chk_io_ptr(a), *(volatile u32 __force *)(a))
36#define __raw_readq(a) (__chk_io_ptr(a), *(volatile u64 __force *)(a)) 36#define __raw_readq(a) (__chk_io_ptr(a), *(volatile u64 __force *)(a))
37 37
38#define readb_relaxed(c) ({ u8 __v = __raw_readb(c); __v; }) 38#define readb_relaxed(c) ({ u8 __v = ioswabb(__raw_readb(c)); __v; })
39#define readw_relaxed(c) ({ u16 __v = le16_to_cpu((__force __le16) \ 39#define readw_relaxed(c) ({ u16 __v = ioswabw(__raw_readw(c)); __v; })
40 __raw_readw(c)); __v; }) 40#define readl_relaxed(c) ({ u32 __v = ioswabl(__raw_readl(c)); __v; })
41#define readl_relaxed(c) ({ u32 __v = le32_to_cpu((__force __le32) \ 41#define readq_relaxed(c) ({ u64 __v = ioswabq(__raw_readq(c)); __v; })
42 __raw_readl(c)); __v; }) 42
43#define readq_relaxed(c) ({ u64 __v = le64_to_cpu((__force __le64) \ 43#define writeb_relaxed(v,c) ((void)__raw_writeb((__force u8)ioswabb(v),c))
44 __raw_readq(c)); __v; }) 44#define writew_relaxed(v,c) ((void)__raw_writew((__force u16)ioswabw(v),c))
45 45#define writel_relaxed(v,c) ((void)__raw_writel((__force u32)ioswabl(v),c))
46#define writeb_relaxed(v,c) ((void)__raw_writeb(v,c)) 46#define writeq_relaxed(v,c) ((void)__raw_writeq((__force u64)ioswabq(v),c))
47#define writew_relaxed(v,c) ((void)__raw_writew((__force u16) \
48 cpu_to_le16(v),c))
49#define writel_relaxed(v,c) ((void)__raw_writel((__force u32) \
50 cpu_to_le32(v),c))
51#define writeq_relaxed(v,c) ((void)__raw_writeq((__force u64) \
52 cpu_to_le64(v),c))
53 47
54#define readb(a) ({ u8 r_ = readb_relaxed(a); rmb(); r_; }) 48#define readb(a) ({ u8 r_ = readb_relaxed(a); rmb(); r_; })
55#define readw(a) ({ u16 r_ = readw_relaxed(a); rmb(); r_; }) 49#define readw(a) ({ u16 r_ = readw_relaxed(a); rmb(); r_; })
diff --git a/arch/sh/include/asm/irq.h b/arch/sh/include/asm/irq.h
index 45d08b6a5ef7..2a62017eb275 100644
--- a/arch/sh/include/asm/irq.h
+++ b/arch/sh/include/asm/irq.h
@@ -21,17 +21,6 @@
21#define NO_IRQ_IGNORE ((unsigned int)-1) 21#define NO_IRQ_IGNORE ((unsigned int)-1)
22 22
23/* 23/*
24 * Convert back and forth between INTEVT and IRQ values.
25 */
26#ifdef CONFIG_CPU_HAS_INTEVT
27#define evt2irq(evt) (((evt) >> 5) - 16)
28#define irq2evt(irq) (((irq) + 16) << 5)
29#else
30#define evt2irq(evt) (evt)
31#define irq2evt(irq) (irq)
32#endif
33
34/*
35 * Simple Mask Register Support 24 * Simple Mask Register Support
36 */ 25 */
37extern void make_maskreg_irq(unsigned int irq); 26extern void make_maskreg_irq(unsigned int irq);
diff --git a/arch/sh/include/asm/pci.h b/arch/sh/include/asm/pci.h
index cb21e2399dc1..bff96c2e7d25 100644
--- a/arch/sh/include/asm/pci.h
+++ b/arch/sh/include/asm/pci.h
@@ -114,12 +114,6 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
114/* Board-specific fixup routines. */ 114/* Board-specific fixup routines. */
115int pcibios_map_platform_irq(const struct pci_dev *dev, u8 slot, u8 pin); 115int pcibios_map_platform_irq(const struct pci_dev *dev, u8 slot, u8 pin);
116 116
117extern void pcibios_resource_to_bus(struct pci_dev *dev,
118 struct pci_bus_region *region, struct resource *res);
119
120extern void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
121 struct pci_bus_region *region);
122
123#define pci_domain_nr(bus) ((struct pci_channel *)(bus)->sysdata)->index 117#define pci_domain_nr(bus) ((struct pci_channel *)(bus)->sysdata)->index
124 118
125static inline int pci_proc_domain(struct pci_bus *bus) 119static inline int pci_proc_domain(struct pci_bus *bus)
diff --git a/arch/sh/include/asm/posix_types_32.h b/arch/sh/include/asm/posix_types_32.h
index 6a9ceaaf1aea..abda58467ece 100644
--- a/arch/sh/include/asm/posix_types_32.h
+++ b/arch/sh/include/asm/posix_types_32.h
@@ -12,11 +12,6 @@ typedef unsigned short __kernel_uid_t;
12typedef unsigned short __kernel_gid_t; 12typedef unsigned short __kernel_gid_t;
13#define __kernel_gid_t __kernel_gid_t 13#define __kernel_gid_t __kernel_gid_t
14 14
15typedef unsigned int __kernel_uid32_t;
16#define __kernel_uid32_t __kernel_uid32_t
17typedef unsigned int __kernel_gid32_t;
18#define __kernel_gid32_t __kernel_gid32_t
19
20typedef unsigned short __kernel_old_uid_t; 15typedef unsigned short __kernel_old_uid_t;
21#define __kernel_old_uid_t __kernel_old_uid_t 16#define __kernel_old_uid_t __kernel_old_uid_t
22typedef unsigned short __kernel_old_gid_t; 17typedef unsigned short __kernel_old_gid_t;
diff --git a/arch/sh/include/asm/posix_types_64.h b/arch/sh/include/asm/posix_types_64.h
index 8cd11485c06b..fcda07b4a616 100644
--- a/arch/sh/include/asm/posix_types_64.h
+++ b/arch/sh/include/asm/posix_types_64.h
@@ -17,10 +17,6 @@ typedef int __kernel_ssize_t;
17#define __kernel_ssize_t __kernel_ssize_t 17#define __kernel_ssize_t __kernel_ssize_t
18typedef int __kernel_ptrdiff_t; 18typedef int __kernel_ptrdiff_t;
19#define __kernel_ptrdiff_t __kernel_ptrdiff_t 19#define __kernel_ptrdiff_t __kernel_ptrdiff_t
20typedef unsigned int __kernel_uid32_t;
21#define __kernel_uid32_t __kernel_uid32_t
22typedef unsigned int __kernel_gid32_t;
23#define __kernel_gid32_t __kernel_gid32_t
24 20
25typedef unsigned short __kernel_old_uid_t; 21typedef unsigned short __kernel_old_uid_t;
26#define __kernel_old_uid_t __kernel_old_uid_t 22#define __kernel_old_uid_t __kernel_old_uid_t
diff --git a/arch/sh/include/asm/processor.h b/arch/sh/include/asm/processor.h
index 9c7bdfcaebbd..a229c393826a 100644
--- a/arch/sh/include/asm/processor.h
+++ b/arch/sh/include/asm/processor.h
@@ -101,6 +101,10 @@ extern struct sh_cpuinfo cpu_data[];
101#define cpu_sleep() __asm__ __volatile__ ("sleep" : : : "memory") 101#define cpu_sleep() __asm__ __volatile__ ("sleep" : : : "memory")
102#define cpu_relax() barrier() 102#define cpu_relax() barrier()
103 103
104void default_idle(void);
105void cpu_idle_wait(void);
106void stop_this_cpu(void *);
107
104/* Forward decl */ 108/* Forward decl */
105struct seq_operations; 109struct seq_operations;
106struct task_struct; 110struct task_struct;
@@ -161,6 +165,17 @@ int vsyscall_init(void);
161#define vsyscall_init() do { } while (0) 165#define vsyscall_init() do { } while (0)
162#endif 166#endif
163 167
168/*
169 * SH-2A has both 16 and 32-bit opcodes, do lame encoding checks.
170 */
171#ifdef CONFIG_CPU_SH2A
172extern unsigned int instruction_size(unsigned int insn);
173#elif defined(CONFIG_SUPERH32)
174#define instruction_size(insn) (2)
175#else
176#define instruction_size(insn) (4)
177#endif
178
164#endif /* __ASSEMBLY__ */ 179#endif /* __ASSEMBLY__ */
165 180
166#ifdef CONFIG_SUPERH32 181#ifdef CONFIG_SUPERH32
diff --git a/arch/sh/include/asm/ptrace.h b/arch/sh/include/asm/ptrace.h
index 2d3679b2447f..c7b7e1ed194a 100644
--- a/arch/sh/include/asm/ptrace.h
+++ b/arch/sh/include/asm/ptrace.h
@@ -37,7 +37,6 @@
37#include <linux/thread_info.h> 37#include <linux/thread_info.h>
38#include <asm/addrspace.h> 38#include <asm/addrspace.h>
39#include <asm/page.h> 39#include <asm/page.h>
40#include <asm/system.h>
41 40
42#define user_mode(regs) (((regs)->sr & 0x40000000)==0) 41#define user_mode(regs) (((regs)->sr & 0x40000000)==0)
43#define kernel_stack_pointer(_regs) ((unsigned long)(_regs)->regs[15]) 42#define kernel_stack_pointer(_regs) ((unsigned long)(_regs)->regs[15])
diff --git a/arch/sh/include/asm/setup.h b/arch/sh/include/asm/setup.h
index 01fa17a3d759..465a22df8fd0 100644
--- a/arch/sh/include/asm/setup.h
+++ b/arch/sh/include/asm/setup.h
@@ -20,6 +20,7 @@
20 20
21void sh_mv_setup(void); 21void sh_mv_setup(void);
22void check_for_initrd(void); 22void check_for_initrd(void);
23void per_cpu_trap_init(void);
23 24
24#endif /* __KERNEL__ */ 25#endif /* __KERNEL__ */
25 26
diff --git a/arch/sh/include/asm/switch_to.h b/arch/sh/include/asm/switch_to.h
new file mode 100644
index 000000000000..62b1941813e3
--- /dev/null
+++ b/arch/sh/include/asm/switch_to.h
@@ -0,0 +1,19 @@
1/*
2 * Copyright (C) 2000, 2001 Paolo Alberelli
3 * Copyright (C) 2003 Paul Mundt
4 * Copyright (C) 2004 Richard Curnow
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#ifndef __ASM_SH_SWITCH_TO_H
11#define __ASM_SH_SWITCH_TO_H
12
13#ifdef CONFIG_SUPERH32
14# include "switch_to_32.h"
15#else
16# include "switch_to_64.h"
17#endif
18
19#endif /* __ASM_SH_SWITCH_TO_H */
diff --git a/arch/sh/include/asm/system_32.h b/arch/sh/include/asm/switch_to_32.h
index a4ad1cd9bc4d..0c065513e7ac 100644
--- a/arch/sh/include/asm/system_32.h
+++ b/arch/sh/include/asm/switch_to_32.h
@@ -1,8 +1,5 @@
1#ifndef __ASM_SH_SYSTEM_32_H 1#ifndef __ASM_SH_SWITCH_TO_32_H
2#define __ASM_SH_SYSTEM_32_H 2#define __ASM_SH_SWITCH_TO_32_H
3
4#include <linux/types.h>
5#include <asm/mmu.h>
6 3
7#ifdef CONFIG_SH_DSP 4#ifdef CONFIG_SH_DSP
8 5
@@ -32,7 +29,6 @@ do { \
32 : : "r" (__ts2)); \ 29 : : "r" (__ts2)); \
33} while (0) 30} while (0)
34 31
35
36#define __save_dsp(tsk) \ 32#define __save_dsp(tsk) \
37do { \ 33do { \
38 register u32 *__ts2 __asm__ ("r2") = \ 34 register u32 *__ts2 __asm__ ("r2") = \
@@ -64,16 +60,6 @@ do { \
64#define __restore_dsp(tsk) do { } while (0) 60#define __restore_dsp(tsk) do { } while (0)
65#endif 61#endif
66 62
67#if defined(CONFIG_CPU_SH4A)
68#define __icbi(addr) __asm__ __volatile__ ( "icbi @%0\n\t" : : "r" (addr))
69#else
70#define __icbi(addr) mb()
71#endif
72
73#define __ocbp(addr) __asm__ __volatile__ ( "ocbp @%0\n\t" : : "r" (addr))
74#define __ocbi(addr) __asm__ __volatile__ ( "ocbi @%0\n\t" : : "r" (addr))
75#define __ocbwb(addr) __asm__ __volatile__ ( "ocbwb @%0\n\t" : : "r" (addr))
76
77struct task_struct *__switch_to(struct task_struct *prev, 63struct task_struct *__switch_to(struct task_struct *prev,
78 struct task_struct *next); 64 struct task_struct *next);
79 65
@@ -145,92 +131,4 @@ do { \
145 __restore_dsp(prev); \ 131 __restore_dsp(prev); \
146} while (0) 132} while (0)
147 133
148#ifdef CONFIG_CPU_HAS_SR_RB 134#endif /* __ASM_SH_SWITCH_TO_32_H */
149#define lookup_exception_vector() \
150({ \
151 unsigned long _vec; \
152 \
153 __asm__ __volatile__ ( \
154 "stc r2_bank, %0\n\t" \
155 : "=r" (_vec) \
156 ); \
157 \
158 _vec; \
159})
160#else
161#define lookup_exception_vector() \
162({ \
163 unsigned long _vec; \
164 __asm__ __volatile__ ( \
165 "mov r4, %0\n\t" \
166 : "=r" (_vec) \
167 ); \
168 \
169 _vec; \
170})
171#endif
172
173static inline reg_size_t register_align(void *val)
174{
175 return (unsigned long)(signed long)val;
176}
177
178int handle_unaligned_access(insn_size_t instruction, struct pt_regs *regs,
179 struct mem_access *ma, int, unsigned long address);
180
181static inline void trigger_address_error(void)
182{
183 __asm__ __volatile__ (
184 "ldc %0, sr\n\t"
185 "mov.l @%1, %0"
186 :
187 : "r" (0x10000000), "r" (0x80000001)
188 );
189}
190
191asmlinkage void do_address_error(struct pt_regs *regs,
192 unsigned long writeaccess,
193 unsigned long address);
194asmlinkage void do_divide_error(unsigned long r4, unsigned long r5,
195 unsigned long r6, unsigned long r7,
196 struct pt_regs __regs);
197asmlinkage void do_reserved_inst(unsigned long r4, unsigned long r5,
198 unsigned long r6, unsigned long r7,
199 struct pt_regs __regs);
200asmlinkage void do_illegal_slot_inst(unsigned long r4, unsigned long r5,
201 unsigned long r6, unsigned long r7,
202 struct pt_regs __regs);
203asmlinkage void do_exception_error(unsigned long r4, unsigned long r5,
204 unsigned long r6, unsigned long r7,
205 struct pt_regs __regs);
206
207static inline void set_bl_bit(void)
208{
209 unsigned long __dummy0, __dummy1;
210
211 __asm__ __volatile__ (
212 "stc sr, %0\n\t"
213 "or %2, %0\n\t"
214 "and %3, %0\n\t"
215 "ldc %0, sr\n\t"
216 : "=&r" (__dummy0), "=r" (__dummy1)
217 : "r" (0x10000000), "r" (0xffffff0f)
218 : "memory"
219 );
220}
221
222static inline void clear_bl_bit(void)
223{
224 unsigned long __dummy0, __dummy1;
225
226 __asm__ __volatile__ (
227 "stc sr, %0\n\t"
228 "and %2, %0\n\t"
229 "ldc %0, sr\n\t"
230 : "=&r" (__dummy0), "=r" (__dummy1)
231 : "1" (~0x10000000)
232 : "memory"
233 );
234}
235
236#endif /* __ASM_SH_SYSTEM_32_H */
diff --git a/arch/sh/include/asm/switch_to_64.h b/arch/sh/include/asm/switch_to_64.h
new file mode 100644
index 000000000000..ba3129d6bc21
--- /dev/null
+++ b/arch/sh/include/asm/switch_to_64.h
@@ -0,0 +1,35 @@
1/*
2 * Copyright (C) 2000, 2001 Paolo Alberelli
3 * Copyright (C) 2003 Paul Mundt
4 * Copyright (C) 2004 Richard Curnow
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#ifndef __ASM_SH_SWITCH_TO_64_H
11#define __ASM_SH_SWITCH_TO_64_H
12
13struct thread_struct;
14struct task_struct;
15
16/*
17 * switch_to() should switch tasks to task nr n, first
18 */
19struct task_struct *sh64_switch_to(struct task_struct *prev,
20 struct thread_struct *prev_thread,
21 struct task_struct *next,
22 struct thread_struct *next_thread);
23
24#define switch_to(prev,next,last) \
25do { \
26 if (last_task_used_math != next) { \
27 struct pt_regs *regs = next->thread.uregs; \
28 if (regs) regs->sr |= SR_FD; \
29 } \
30 last = sh64_switch_to(prev, &prev->thread, next, \
31 &next->thread); \
32} while (0)
33
34
35#endif /* __ASM_SH_SWITCH_TO_64_H */
diff --git a/arch/sh/include/asm/system.h b/arch/sh/include/asm/system.h
deleted file mode 100644
index 10c8b1823a18..000000000000
--- a/arch/sh/include/asm/system.h
+++ /dev/null
@@ -1,184 +0,0 @@
1#ifndef __ASM_SH_SYSTEM_H
2#define __ASM_SH_SYSTEM_H
3
4/*
5 * Copyright (C) 1999, 2000 Niibe Yutaka & Kaz Kojima
6 * Copyright (C) 2002 Paul Mundt
7 */
8
9#include <linux/irqflags.h>
10#include <linux/compiler.h>
11#include <linux/linkage.h>
12#include <asm/types.h>
13#include <asm/uncached.h>
14
15#define AT_VECTOR_SIZE_ARCH 5 /* entries in ARCH_DLINFO */
16
17/*
18 * A brief note on ctrl_barrier(), the control register write barrier.
19 *
20 * Legacy SH cores typically require a sequence of 8 nops after
21 * modification of a control register in order for the changes to take
22 * effect. On newer cores (like the sh4a and sh5) this is accomplished
23 * with icbi.
24 *
25 * Also note that on sh4a in the icbi case we can forego a synco for the
26 * write barrier, as it's not necessary for control registers.
27 *
28 * Historically we have only done this type of barrier for the MMUCR, but
29 * it's also necessary for the CCR, so we make it generic here instead.
30 */
31#if defined(CONFIG_CPU_SH4A) || defined(CONFIG_CPU_SH5)
32#define mb() __asm__ __volatile__ ("synco": : :"memory")
33#define rmb() mb()
34#define wmb() __asm__ __volatile__ ("synco": : :"memory")
35#define ctrl_barrier() __icbi(PAGE_OFFSET)
36#define read_barrier_depends() do { } while(0)
37#else
38#define mb() __asm__ __volatile__ ("": : :"memory")
39#define rmb() mb()
40#define wmb() __asm__ __volatile__ ("": : :"memory")
41#define ctrl_barrier() __asm__ __volatile__ ("nop;nop;nop;nop;nop;nop;nop;nop")
42#define read_barrier_depends() do { } while(0)
43#endif
44
45#ifdef CONFIG_SMP
46#define smp_mb() mb()
47#define smp_rmb() rmb()
48#define smp_wmb() wmb()
49#define smp_read_barrier_depends() read_barrier_depends()
50#else
51#define smp_mb() barrier()
52#define smp_rmb() barrier()
53#define smp_wmb() barrier()
54#define smp_read_barrier_depends() do { } while(0)
55#endif
56
57#define set_mb(var, value) do { (void)xchg(&var, value); } while (0)
58
59#ifdef CONFIG_GUSA_RB
60#include <asm/cmpxchg-grb.h>
61#elif defined(CONFIG_CPU_SH4A)
62#include <asm/cmpxchg-llsc.h>
63#else
64#include <asm/cmpxchg-irq.h>
65#endif
66
67extern void __xchg_called_with_bad_pointer(void);
68
69#define __xchg(ptr, x, size) \
70({ \
71 unsigned long __xchg__res; \
72 volatile void *__xchg_ptr = (ptr); \
73 switch (size) { \
74 case 4: \
75 __xchg__res = xchg_u32(__xchg_ptr, x); \
76 break; \
77 case 1: \
78 __xchg__res = xchg_u8(__xchg_ptr, x); \
79 break; \
80 default: \
81 __xchg_called_with_bad_pointer(); \
82 __xchg__res = x; \
83 break; \
84 } \
85 \
86 __xchg__res; \
87})
88
89#define xchg(ptr,x) \
90 ((__typeof__(*(ptr)))__xchg((ptr),(unsigned long)(x), sizeof(*(ptr))))
91
92/* This function doesn't exist, so you'll get a linker error
93 * if something tries to do an invalid cmpxchg(). */
94extern void __cmpxchg_called_with_bad_pointer(void);
95
96#define __HAVE_ARCH_CMPXCHG 1
97
98static inline unsigned long __cmpxchg(volatile void * ptr, unsigned long old,
99 unsigned long new, int size)
100{
101 switch (size) {
102 case 4:
103 return __cmpxchg_u32(ptr, old, new);
104 }
105 __cmpxchg_called_with_bad_pointer();
106 return old;
107}
108
109#define cmpxchg(ptr,o,n) \
110 ({ \
111 __typeof__(*(ptr)) _o_ = (o); \
112 __typeof__(*(ptr)) _n_ = (n); \
113 (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \
114 (unsigned long)_n_, sizeof(*(ptr))); \
115 })
116
117struct pt_regs;
118
119extern void die(const char *str, struct pt_regs *regs, long err) __attribute__ ((noreturn));
120void free_initmem(void);
121void free_initrd_mem(unsigned long start, unsigned long end);
122
123extern void *set_exception_table_vec(unsigned int vec, void *handler);
124
125static inline void *set_exception_table_evt(unsigned int evt, void *handler)
126{
127 return set_exception_table_vec(evt >> 5, handler);
128}
129
130/*
131 * SH-2A has both 16 and 32-bit opcodes, do lame encoding checks.
132 */
133#ifdef CONFIG_CPU_SH2A
134extern unsigned int instruction_size(unsigned int insn);
135#elif defined(CONFIG_SUPERH32)
136#define instruction_size(insn) (2)
137#else
138#define instruction_size(insn) (4)
139#endif
140
141void per_cpu_trap_init(void);
142void default_idle(void);
143void cpu_idle_wait(void);
144void stop_this_cpu(void *);
145
146#ifdef CONFIG_SUPERH32
147#define BUILD_TRAP_HANDLER(name) \
148asmlinkage void name##_trap_handler(unsigned long r4, unsigned long r5, \
149 unsigned long r6, unsigned long r7, \
150 struct pt_regs __regs)
151
152#define TRAP_HANDLER_DECL \
153 struct pt_regs *regs = RELOC_HIDE(&__regs, 0); \
154 unsigned int vec = regs->tra; \
155 (void)vec;
156#else
157#define BUILD_TRAP_HANDLER(name) \
158asmlinkage void name##_trap_handler(unsigned int vec, struct pt_regs *regs)
159#define TRAP_HANDLER_DECL
160#endif
161
162BUILD_TRAP_HANDLER(address_error);
163BUILD_TRAP_HANDLER(debug);
164BUILD_TRAP_HANDLER(bug);
165BUILD_TRAP_HANDLER(breakpoint);
166BUILD_TRAP_HANDLER(singlestep);
167BUILD_TRAP_HANDLER(fpu_error);
168BUILD_TRAP_HANDLER(fpu_state_restore);
169BUILD_TRAP_HANDLER(nmi);
170
171#define arch_align_stack(x) (x)
172
173struct mem_access {
174 unsigned long (*from)(void *dst, const void __user *src, unsigned long cnt);
175 unsigned long (*to)(void __user *dst, const void *src, unsigned long cnt);
176};
177
178#ifdef CONFIG_SUPERH32
179# include "system_32.h"
180#else
181# include "system_64.h"
182#endif
183
184#endif
diff --git a/arch/sh/include/asm/system_64.h b/arch/sh/include/asm/system_64.h
deleted file mode 100644
index 8593bc8d1a4e..000000000000
--- a/arch/sh/include/asm/system_64.h
+++ /dev/null
@@ -1,79 +0,0 @@
1#ifndef __ASM_SH_SYSTEM_64_H
2#define __ASM_SH_SYSTEM_64_H
3
4/*
5 * include/asm-sh/system_64.h
6 *
7 * Copyright (C) 2000, 2001 Paolo Alberelli
8 * Copyright (C) 2003 Paul Mundt
9 * Copyright (C) 2004 Richard Curnow
10 *
11 * This file is subject to the terms and conditions of the GNU General Public
12 * License. See the file "COPYING" in the main directory of this archive
13 * for more details.
14 */
15#include <cpu/registers.h>
16#include <asm/processor.h>
17
18/*
19 * switch_to() should switch tasks to task nr n, first
20 */
21struct thread_struct;
22struct task_struct *sh64_switch_to(struct task_struct *prev,
23 struct thread_struct *prev_thread,
24 struct task_struct *next,
25 struct thread_struct *next_thread);
26
27#define switch_to(prev,next,last) \
28do { \
29 if (last_task_used_math != next) { \
30 struct pt_regs *regs = next->thread.uregs; \
31 if (regs) regs->sr |= SR_FD; \
32 } \
33 last = sh64_switch_to(prev, &prev->thread, next, \
34 &next->thread); \
35} while (0)
36
37#define __icbi(addr) __asm__ __volatile__ ( "icbi %0, 0\n\t" : : "r" (addr))
38#define __ocbp(addr) __asm__ __volatile__ ( "ocbp %0, 0\n\t" : : "r" (addr))
39#define __ocbi(addr) __asm__ __volatile__ ( "ocbi %0, 0\n\t" : : "r" (addr))
40#define __ocbwb(addr) __asm__ __volatile__ ( "ocbwb %0, 0\n\t" : : "r" (addr))
41
42static inline reg_size_t register_align(void *val)
43{
44 return (unsigned long long)(signed long long)(signed long)val;
45}
46
47extern void phys_stext(void);
48
49static inline void trigger_address_error(void)
50{
51 phys_stext();
52}
53
54#define SR_BL_LL 0x0000000010000000LL
55
56static inline void set_bl_bit(void)
57{
58 unsigned long long __dummy0, __dummy1 = SR_BL_LL;
59
60 __asm__ __volatile__("getcon " __SR ", %0\n\t"
61 "or %0, %1, %0\n\t"
62 "putcon %0, " __SR "\n\t"
63 : "=&r" (__dummy0)
64 : "r" (__dummy1));
65
66}
67
68static inline void clear_bl_bit(void)
69{
70 unsigned long long __dummy0, __dummy1 = ~SR_BL_LL;
71
72 __asm__ __volatile__("getcon " __SR ", %0\n\t"
73 "and %0, %1, %0\n\t"
74 "putcon %0, " __SR "\n\t"
75 : "=&r" (__dummy0)
76 : "r" (__dummy1));
77}
78
79#endif /* __ASM_SH_SYSTEM_64_H */
diff --git a/arch/sh/include/asm/traps.h b/arch/sh/include/asm/traps.h
new file mode 100644
index 000000000000..afd9df8d0641
--- /dev/null
+++ b/arch/sh/include/asm/traps.h
@@ -0,0 +1,21 @@
1#ifndef __ASM_SH_TRAPS_H
2#define __ASM_SH_TRAPS_H
3
4#include <linux/compiler.h>
5
6#ifdef CONFIG_SUPERH32
7# include "traps_32.h"
8#else
9# include "traps_64.h"
10#endif
11
12BUILD_TRAP_HANDLER(address_error);
13BUILD_TRAP_HANDLER(debug);
14BUILD_TRAP_HANDLER(bug);
15BUILD_TRAP_HANDLER(breakpoint);
16BUILD_TRAP_HANDLER(singlestep);
17BUILD_TRAP_HANDLER(fpu_error);
18BUILD_TRAP_HANDLER(fpu_state_restore);
19BUILD_TRAP_HANDLER(nmi);
20
21#endif /* __ASM_SH_TRAPS_H */
diff --git a/arch/sh/include/asm/traps_32.h b/arch/sh/include/asm/traps_32.h
new file mode 100644
index 000000000000..cfd55ff9dff2
--- /dev/null
+++ b/arch/sh/include/asm/traps_32.h
@@ -0,0 +1,68 @@
1#ifndef __ASM_SH_TRAPS_32_H
2#define __ASM_SH_TRAPS_32_H
3
4#include <linux/types.h>
5#include <asm/mmu.h>
6
7#ifdef CONFIG_CPU_HAS_SR_RB
8#define lookup_exception_vector() \
9({ \
10 unsigned long _vec; \
11 \
12 __asm__ __volatile__ ( \
13 "stc r2_bank, %0\n\t" \
14 : "=r" (_vec) \
15 ); \
16 \
17 _vec; \
18})
19#else
20#define lookup_exception_vector() \
21({ \
22 unsigned long _vec; \
23 __asm__ __volatile__ ( \
24 "mov r4, %0\n\t" \
25 : "=r" (_vec) \
26 ); \
27 \
28 _vec; \
29})
30#endif
31
32static inline void trigger_address_error(void)
33{
34 __asm__ __volatile__ (
35 "ldc %0, sr\n\t"
36 "mov.l @%1, %0"
37 :
38 : "r" (0x10000000), "r" (0x80000001)
39 );
40}
41
42asmlinkage void do_address_error(struct pt_regs *regs,
43 unsigned long writeaccess,
44 unsigned long address);
45asmlinkage void do_divide_error(unsigned long r4, unsigned long r5,
46 unsigned long r6, unsigned long r7,
47 struct pt_regs __regs);
48asmlinkage void do_reserved_inst(unsigned long r4, unsigned long r5,
49 unsigned long r6, unsigned long r7,
50 struct pt_regs __regs);
51asmlinkage void do_illegal_slot_inst(unsigned long r4, unsigned long r5,
52 unsigned long r6, unsigned long r7,
53 struct pt_regs __regs);
54asmlinkage void do_exception_error(unsigned long r4, unsigned long r5,
55 unsigned long r6, unsigned long r7,
56 struct pt_regs __regs);
57
58#define BUILD_TRAP_HANDLER(name) \
59asmlinkage void name##_trap_handler(unsigned long r4, unsigned long r5, \
60 unsigned long r6, unsigned long r7, \
61 struct pt_regs __regs)
62
63#define TRAP_HANDLER_DECL \
64 struct pt_regs *regs = RELOC_HIDE(&__regs, 0); \
65 unsigned int vec = regs->tra; \
66 (void)vec;
67
68#endif /* __ASM_SH_TRAPS_32_H */
diff --git a/arch/sh/include/asm/traps_64.h b/arch/sh/include/asm/traps_64.h
new file mode 100644
index 000000000000..c52d7f9a06c1
--- /dev/null
+++ b/arch/sh/include/asm/traps_64.h
@@ -0,0 +1,24 @@
1/*
2 * Copyright (C) 2000, 2001 Paolo Alberelli
3 * Copyright (C) 2003 Paul Mundt
4 * Copyright (C) 2004 Richard Curnow
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#ifndef __ASM_SH_TRAPS_64_H
11#define __ASM_SH_TRAPS_64_H
12
13extern void phys_stext(void);
14
15static inline void trigger_address_error(void)
16{
17 phys_stext();
18}
19
20#define BUILD_TRAP_HANDLER(name) \
21asmlinkage void name##_trap_handler(unsigned int vec, struct pt_regs *regs)
22#define TRAP_HANDLER_DECL
23
24#endif /* __ASM_SH_TRAPS_64_H */
diff --git a/arch/sh/include/asm/uaccess.h b/arch/sh/include/asm/uaccess.h
index 075848f43b6a..050f221fa898 100644
--- a/arch/sh/include/asm/uaccess.h
+++ b/arch/sh/include/asm/uaccess.h
@@ -254,5 +254,19 @@ int fixup_exception(struct pt_regs *regs);
254unsigned long search_exception_table(unsigned long addr); 254unsigned long search_exception_table(unsigned long addr);
255const struct exception_table_entry *search_exception_tables(unsigned long addr); 255const struct exception_table_entry *search_exception_tables(unsigned long addr);
256 256
257extern void *set_exception_table_vec(unsigned int vec, void *handler);
258
259static inline void *set_exception_table_evt(unsigned int evt, void *handler)
260{
261 return set_exception_table_vec(evt >> 5, handler);
262}
263
264struct mem_access {
265 unsigned long (*from)(void *dst, const void __user *src, unsigned long cnt);
266 unsigned long (*to)(void __user *dst, const void *src, unsigned long cnt);
267};
268
269int handle_unaligned_access(insn_size_t instruction, struct pt_regs *regs,
270 struct mem_access *ma, int, unsigned long address);
257 271
258#endif /* __ASM_SH_UACCESS_H */ 272#endif /* __ASM_SH_UACCESS_H */
diff --git a/arch/sh/include/asm/unistd.h b/arch/sh/include/asm/unistd.h
index 65be656ead7d..a42a5610a36a 100644
--- a/arch/sh/include/asm/unistd.h
+++ b/arch/sh/include/asm/unistd.h
@@ -1,9 +1,46 @@
1#ifdef __KERNEL__ 1#ifdef __KERNEL__
2# ifdef CONFIG_SUPERH32 2# ifdef CONFIG_SUPERH32
3
3# include "unistd_32.h" 4# include "unistd_32.h"
5# define __ARCH_WANT_SYS_RT_SIGSUSPEND
6
4# else 7# else
5# include "unistd_64.h" 8# include "unistd_64.h"
6# endif 9# endif
10
11# define __ARCH_WANT_IPC_PARSE_VERSION
12# define __ARCH_WANT_OLD_READDIR
13# define __ARCH_WANT_OLD_STAT
14# define __ARCH_WANT_STAT64
15# define __ARCH_WANT_SYS_ALARM
16# define __ARCH_WANT_SYS_GETHOSTNAME
17# define __ARCH_WANT_SYS_IPC
18# define __ARCH_WANT_SYS_PAUSE
19# define __ARCH_WANT_SYS_SGETMASK
20# define __ARCH_WANT_SYS_SIGNAL
21# define __ARCH_WANT_SYS_TIME
22# define __ARCH_WANT_SYS_UTIME
23# define __ARCH_WANT_SYS_WAITPID
24# define __ARCH_WANT_SYS_SOCKETCALL
25# define __ARCH_WANT_SYS_FADVISE64
26# define __ARCH_WANT_SYS_GETPGRP
27# define __ARCH_WANT_SYS_LLSEEK
28# define __ARCH_WANT_SYS_NICE
29# define __ARCH_WANT_SYS_OLD_GETRLIMIT
30# define __ARCH_WANT_SYS_OLD_UNAME
31# define __ARCH_WANT_SYS_OLDUMOUNT
32# define __ARCH_WANT_SYS_SIGPENDING
33# define __ARCH_WANT_SYS_SIGPROCMASK
34# define __ARCH_WANT_SYS_RT_SIGACTION
35
36/*
37 * "Conditional" syscalls
38 *
39 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
40 * but it doesn't work on all toolchains, so we just do it by hand
41 */
42# define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
43
7#else 44#else
8# ifdef __SH5__ 45# ifdef __SH5__
9# include "unistd_64.h" 46# include "unistd_64.h"
diff --git a/arch/sh/include/asm/unistd_32.h b/arch/sh/include/asm/unistd_32.h
index 152b8627a184..72fd1e061006 100644
--- a/arch/sh/include/asm/unistd_32.h
+++ b/arch/sh/include/asm/unistd_32.h
@@ -1,5 +1,5 @@
1#ifndef __ASM_SH_UNISTD_H 1#ifndef __ASM_SH_UNISTD_32_H
2#define __ASM_SH_UNISTD_H 2#define __ASM_SH_UNISTD_32_H
3 3
4/* 4/*
5 * Copyright (C) 1999 Niibe Yutaka 5 * Copyright (C) 1999 Niibe Yutaka
@@ -26,7 +26,7 @@
26#define __NR_mknod 14 26#define __NR_mknod 14
27#define __NR_chmod 15 27#define __NR_chmod 15
28#define __NR_lchown 16 28#define __NR_lchown 16
29#define __NR_break 17 29 /* 17 was sys_break */
30#define __NR_oldstat 18 30#define __NR_oldstat 18
31#define __NR_lseek 19 31#define __NR_lseek 19
32#define __NR_getpid 20 32#define __NR_getpid 20
@@ -40,11 +40,11 @@
40#define __NR_oldfstat 28 40#define __NR_oldfstat 28
41#define __NR_pause 29 41#define __NR_pause 29
42#define __NR_utime 30 42#define __NR_utime 30
43#define __NR_stty 31 43 /* 31 was sys_stty */
44#define __NR_gtty 32 44 /* 32 was sys_gtty */
45#define __NR_access 33 45#define __NR_access 33
46#define __NR_nice 34 46#define __NR_nice 34
47#define __NR_ftime 35 47 /* 35 was sys_ftime */
48#define __NR_sync 36 48#define __NR_sync 36
49#define __NR_kill 37 49#define __NR_kill 37
50#define __NR_rename 38 50#define __NR_rename 38
@@ -53,7 +53,7 @@
53#define __NR_dup 41 53#define __NR_dup 41
54#define __NR_pipe 42 54#define __NR_pipe 42
55#define __NR_times 43 55#define __NR_times 43
56#define __NR_prof 44 56 /* 44 was sys_prof */
57#define __NR_brk 45 57#define __NR_brk 45
58#define __NR_setgid 46 58#define __NR_setgid 46
59#define __NR_getgid 47 59#define __NR_getgid 47
@@ -62,13 +62,13 @@
62#define __NR_getegid 50 62#define __NR_getegid 50
63#define __NR_acct 51 63#define __NR_acct 51
64#define __NR_umount2 52 64#define __NR_umount2 52
65#define __NR_lock 53 65 /* 53 was sys_lock */
66#define __NR_ioctl 54 66#define __NR_ioctl 54
67#define __NR_fcntl 55 67#define __NR_fcntl 55
68#define __NR_mpx 56 68 /* 56 was sys_mpx */
69#define __NR_setpgid 57 69#define __NR_setpgid 57
70#define __NR_ulimit 58 70 /* 58 was sys_ulimit */
71#define __NR_oldolduname 59 71 /* 59 was sys_olduname */
72#define __NR_umask 60 72#define __NR_umask 60
73#define __NR_chroot 61 73#define __NR_chroot 61
74#define __NR_ustat 62 74#define __NR_ustat 62
@@ -91,7 +91,7 @@
91#define __NR_settimeofday 79 91#define __NR_settimeofday 79
92#define __NR_getgroups 80 92#define __NR_getgroups 80
93#define __NR_setgroups 81 93#define __NR_setgroups 81
94#define __NR_select 82 94 /* 82 was sys_oldselect */
95#define __NR_symlink 83 95#define __NR_symlink 83
96#define __NR_oldlstat 84 96#define __NR_oldlstat 84
97#define __NR_readlink 85 97#define __NR_readlink 85
@@ -107,10 +107,10 @@
107#define __NR_fchown 95 107#define __NR_fchown 95
108#define __NR_getpriority 96 108#define __NR_getpriority 96
109#define __NR_setpriority 97 109#define __NR_setpriority 97
110#define __NR_profil 98 110 /* 98 was sys_profil */
111#define __NR_statfs 99 111#define __NR_statfs 99
112#define __NR_fstatfs 100 112#define __NR_fstatfs 100
113#define __NR_ioperm 101 113 /* 101 was sys_ioperm */
114#define __NR_socketcall 102 114#define __NR_socketcall 102
115#define __NR_syslog 103 115#define __NR_syslog 103
116#define __NR_setitimer 104 116#define __NR_setitimer 104
@@ -119,10 +119,10 @@
119#define __NR_lstat 107 119#define __NR_lstat 107
120#define __NR_fstat 108 120#define __NR_fstat 108
121#define __NR_olduname 109 121#define __NR_olduname 109
122#define __NR_iopl 110 122 /* 110 was sys_iopl */
123#define __NR_vhangup 111 123#define __NR_vhangup 111
124#define __NR_idle 112 124 /* 112 was sys_idle */
125#define __NR_vm86old 113 125 /* 113 was sys_vm86old */
126#define __NR_wait4 114 126#define __NR_wait4 114
127#define __NR_swapoff 115 127#define __NR_swapoff 115
128#define __NR_sysinfo 116 128#define __NR_sysinfo 116
@@ -136,17 +136,17 @@
136#define __NR_adjtimex 124 136#define __NR_adjtimex 124
137#define __NR_mprotect 125 137#define __NR_mprotect 125
138#define __NR_sigprocmask 126 138#define __NR_sigprocmask 126
139#define __NR_create_module 127 139 /* 127 was sys_create_module */
140#define __NR_init_module 128 140#define __NR_init_module 128
141#define __NR_delete_module 129 141#define __NR_delete_module 129
142#define __NR_get_kernel_syms 130 142 /* 130 was sys_get_kernel_syms */
143#define __NR_quotactl 131 143#define __NR_quotactl 131
144#define __NR_getpgid 132 144#define __NR_getpgid 132
145#define __NR_fchdir 133 145#define __NR_fchdir 133
146#define __NR_bdflush 134 146#define __NR_bdflush 134
147#define __NR_sysfs 135 147#define __NR_sysfs 135
148#define __NR_personality 136 148#define __NR_personality 136
149#define __NR_afs_syscall 137 /* Syscall for Andrew File System */ 149 /* 137 was sys_afs_syscall */
150#define __NR_setfsuid 138 150#define __NR_setfsuid 138
151#define __NR_setfsgid 139 151#define __NR_setfsgid 139
152#define __NR__llseek 140 152#define __NR__llseek 140
@@ -175,8 +175,8 @@
175#define __NR_mremap 163 175#define __NR_mremap 163
176#define __NR_setresuid 164 176#define __NR_setresuid 164
177#define __NR_getresuid 165 177#define __NR_getresuid 165
178#define __NR_vm86 166 178 /* 166 was sys_vm86 */
179#define __NR_query_module 167 179 /* 167 was sys_query_module */
180#define __NR_poll 168 180#define __NR_poll 168
181#define __NR_nfsservctl 169 181#define __NR_nfsservctl 169
182#define __NR_setresgid 170 182#define __NR_setresgid 170
@@ -197,8 +197,8 @@
197#define __NR_capset 185 197#define __NR_capset 185
198#define __NR_sigaltstack 186 198#define __NR_sigaltstack 186
199#define __NR_sendfile 187 199#define __NR_sendfile 187
200#define __NR_streams1 188 /* some people actually want it */ 200 /* 188 reserved for sys_getpmsg */
201#define __NR_streams2 189 /* some people actually want it */ 201 /* 189 reserved for sys_putpmsg */
202#define __NR_vfork 190 202#define __NR_vfork 190
203#define __NR_ugetrlimit 191 /* SuS compliant getrlimit */ 203#define __NR_ugetrlimit 191 /* SuS compliant getrlimit */
204#define __NR_mmap2 192 204#define __NR_mmap2 192
@@ -231,7 +231,8 @@
231#define __NR_madvise 219 231#define __NR_madvise 219
232#define __NR_getdents64 220 232#define __NR_getdents64 220
233#define __NR_fcntl64 221 233#define __NR_fcntl64 221
234/* 223 is unused */ 234 /* 222 is reserved for tux */
235 /* 223 is unused */
235#define __NR_gettid 224 236#define __NR_gettid 224
236#define __NR_readahead 225 237#define __NR_readahead 225
237#define __NR_setxattr 226 238#define __NR_setxattr 226
@@ -251,15 +252,15 @@
251#define __NR_futex 240 252#define __NR_futex 240
252#define __NR_sched_setaffinity 241 253#define __NR_sched_setaffinity 241
253#define __NR_sched_getaffinity 242 254#define __NR_sched_getaffinity 242
254#define __NR_set_thread_area 243 255 /* 243 is reserved for set_thread_area */
255#define __NR_get_thread_area 244 256 /* 244 is reserved for get_thread_area */
256#define __NR_io_setup 245 257#define __NR_io_setup 245
257#define __NR_io_destroy 246 258#define __NR_io_destroy 246
258#define __NR_io_getevents 247 259#define __NR_io_getevents 247
259#define __NR_io_submit 248 260#define __NR_io_submit 248
260#define __NR_io_cancel 249 261#define __NR_io_cancel 249
261#define __NR_fadvise64 250 262#define __NR_fadvise64 250
262 263 /* 251 is unused */
263#define __NR_exit_group 252 264#define __NR_exit_group 252
264#define __NR_lookup_dcookie 253 265#define __NR_lookup_dcookie 253
265#define __NR_epoll_create 254 266#define __NR_epoll_create 254
@@ -281,7 +282,7 @@
281#define __NR_tgkill 270 282#define __NR_tgkill 270
282#define __NR_utimes 271 283#define __NR_utimes 271
283#define __NR_fadvise64_64 272 284#define __NR_fadvise64_64 272
284#define __NR_vserver 273 285 /* 273 is reserved for vserver */
285#define __NR_mbind 274 286#define __NR_mbind 274
286#define __NR_get_mempolicy 275 287#define __NR_get_mempolicy 275
287#define __NR_set_mempolicy 276 288#define __NR_set_mempolicy 276
@@ -301,7 +302,7 @@
301#define __NR_inotify_init 290 302#define __NR_inotify_init 290
302#define __NR_inotify_add_watch 291 303#define __NR_inotify_add_watch 291
303#define __NR_inotify_rm_watch 292 304#define __NR_inotify_rm_watch 292
304/* 293 is unused */ 305 /* 293 is unused */
305#define __NR_migrate_pages 294 306#define __NR_migrate_pages 294
306#define __NR_openat 295 307#define __NR_openat 295
307#define __NR_mkdirat 296 308#define __NR_mkdirat 296
@@ -380,43 +381,4 @@
380 381
381#define NR_syscalls 367 382#define NR_syscalls 367
382 383
383#ifdef __KERNEL__ 384#endif /* __ASM_SH_UNISTD_32_H */
384
385#define __ARCH_WANT_IPC_PARSE_VERSION
386#define __ARCH_WANT_OLD_READDIR
387#define __ARCH_WANT_OLD_STAT
388#define __ARCH_WANT_STAT64
389#define __ARCH_WANT_SYS_ALARM
390#define __ARCH_WANT_SYS_GETHOSTNAME
391#define __ARCH_WANT_SYS_IPC
392#define __ARCH_WANT_SYS_PAUSE
393#define __ARCH_WANT_SYS_SGETMASK
394#define __ARCH_WANT_SYS_SIGNAL
395#define __ARCH_WANT_SYS_TIME
396#define __ARCH_WANT_SYS_UTIME
397#define __ARCH_WANT_SYS_WAITPID
398#define __ARCH_WANT_SYS_SOCKETCALL
399#define __ARCH_WANT_SYS_FADVISE64
400#define __ARCH_WANT_SYS_GETPGRP
401#define __ARCH_WANT_SYS_LLSEEK
402#define __ARCH_WANT_SYS_NICE
403#define __ARCH_WANT_SYS_OLD_GETRLIMIT
404#define __ARCH_WANT_SYS_OLD_UNAME
405#define __ARCH_WANT_SYS_OLDUMOUNT
406#define __ARCH_WANT_SYS_SIGPENDING
407#define __ARCH_WANT_SYS_SIGPROCMASK
408#define __ARCH_WANT_SYS_RT_SIGACTION
409#define __ARCH_WANT_SYS_RT_SIGSUSPEND
410
411/*
412 * "Conditional" syscalls
413 *
414 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
415 * but it doesn't work on all toolchains, so we just do it by hand
416 */
417#ifndef cond_syscall
418#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
419#endif
420
421#endif /* __KERNEL__ */
422#endif /* __ASM_SH_UNISTD_H */
diff --git a/arch/sh/include/asm/unistd_64.h b/arch/sh/include/asm/unistd_64.h
index c330c23db5a0..a28edc329692 100644
--- a/arch/sh/include/asm/unistd_64.h
+++ b/arch/sh/include/asm/unistd_64.h
@@ -31,7 +31,7 @@
31#define __NR_mknod 14 31#define __NR_mknod 14
32#define __NR_chmod 15 32#define __NR_chmod 15
33#define __NR_lchown 16 33#define __NR_lchown 16
34#define __NR_break 17 34 /* 17 was sys_break */
35#define __NR_oldstat 18 35#define __NR_oldstat 18
36#define __NR_lseek 19 36#define __NR_lseek 19
37#define __NR_getpid 20 37#define __NR_getpid 20
@@ -45,11 +45,11 @@
45#define __NR_oldfstat 28 45#define __NR_oldfstat 28
46#define __NR_pause 29 46#define __NR_pause 29
47#define __NR_utime 30 47#define __NR_utime 30
48#define __NR_stty 31 48 /* 31 was sys_stty */
49#define __NR_gtty 32 49 /* 32 was sys_gtty */
50#define __NR_access 33 50#define __NR_access 33
51#define __NR_nice 34 51#define __NR_nice 34
52#define __NR_ftime 35 52 /* 35 was sys_ftime */
53#define __NR_sync 36 53#define __NR_sync 36
54#define __NR_kill 37 54#define __NR_kill 37
55#define __NR_rename 38 55#define __NR_rename 38
@@ -58,7 +58,7 @@
58#define __NR_dup 41 58#define __NR_dup 41
59#define __NR_pipe 42 59#define __NR_pipe 42
60#define __NR_times 43 60#define __NR_times 43
61#define __NR_prof 44 61 /* 44 was sys_prof */
62#define __NR_brk 45 62#define __NR_brk 45
63#define __NR_setgid 46 63#define __NR_setgid 46
64#define __NR_getgid 47 64#define __NR_getgid 47
@@ -67,13 +67,13 @@
67#define __NR_getegid 50 67#define __NR_getegid 50
68#define __NR_acct 51 68#define __NR_acct 51
69#define __NR_umount2 52 69#define __NR_umount2 52
70#define __NR_lock 53 70 /* 53 was sys_lock */
71#define __NR_ioctl 54 71#define __NR_ioctl 54
72#define __NR_fcntl 55 72#define __NR_fcntl 55
73#define __NR_mpx 56 73 /* 56 was sys_mpx */
74#define __NR_setpgid 57 74#define __NR_setpgid 57
75#define __NR_ulimit 58 75 /* 58 was sys_ulimit */
76#define __NR_oldolduname 59 76 /* 59 was sys_olduname */
77#define __NR_umask 60 77#define __NR_umask 60
78#define __NR_chroot 61 78#define __NR_chroot 61
79#define __NR_ustat 62 79#define __NR_ustat 62
@@ -96,7 +96,7 @@
96#define __NR_settimeofday 79 96#define __NR_settimeofday 79
97#define __NR_getgroups 80 97#define __NR_getgroups 80
98#define __NR_setgroups 81 98#define __NR_setgroups 81
99#define __NR_select 82 99 /* 82 was sys_select */
100#define __NR_symlink 83 100#define __NR_symlink 83
101#define __NR_oldlstat 84 101#define __NR_oldlstat 84
102#define __NR_readlink 85 102#define __NR_readlink 85
@@ -112,10 +112,10 @@
112#define __NR_fchown 95 112#define __NR_fchown 95
113#define __NR_getpriority 96 113#define __NR_getpriority 96
114#define __NR_setpriority 97 114#define __NR_setpriority 97
115#define __NR_profil 98 115 /* 98 was sys_profil */
116#define __NR_statfs 99 116#define __NR_statfs 99
117#define __NR_fstatfs 100 117#define __NR_fstatfs 100
118#define __NR_ioperm 101 118 /* 101 was sys_ioperm */
119#define __NR_socketcall 102 /* old implementation of socket systemcall */ 119#define __NR_socketcall 102 /* old implementation of socket systemcall */
120#define __NR_syslog 103 120#define __NR_syslog 103
121#define __NR_setitimer 104 121#define __NR_setitimer 104
@@ -124,10 +124,10 @@
124#define __NR_lstat 107 124#define __NR_lstat 107
125#define __NR_fstat 108 125#define __NR_fstat 108
126#define __NR_olduname 109 126#define __NR_olduname 109
127#define __NR_iopl 110 127 /* 110 was sys_iopl */
128#define __NR_vhangup 111 128#define __NR_vhangup 111
129#define __NR_idle 112 129 /* 112 was sys_idle */
130#define __NR_vm86old 113 130 /* 113 was sys_vm86old */
131#define __NR_wait4 114 131#define __NR_wait4 114
132#define __NR_swapoff 115 132#define __NR_swapoff 115
133#define __NR_sysinfo 116 133#define __NR_sysinfo 116
@@ -141,17 +141,17 @@
141#define __NR_adjtimex 124 141#define __NR_adjtimex 124
142#define __NR_mprotect 125 142#define __NR_mprotect 125
143#define __NR_sigprocmask 126 143#define __NR_sigprocmask 126
144#define __NR_create_module 127 144 /* 127 was sys_create_module */
145#define __NR_init_module 128 145#define __NR_init_module 128
146#define __NR_delete_module 129 146#define __NR_delete_module 129
147#define __NR_get_kernel_syms 130 147 /* 130 was sys_get_kernel_syms */
148#define __NR_quotactl 131 148#define __NR_quotactl 131
149#define __NR_getpgid 132 149#define __NR_getpgid 132
150#define __NR_fchdir 133 150#define __NR_fchdir 133
151#define __NR_bdflush 134 151#define __NR_bdflush 134
152#define __NR_sysfs 135 152#define __NR_sysfs 135
153#define __NR_personality 136 153#define __NR_personality 136
154#define __NR_afs_syscall 137 /* Syscall for Andrew File System */ 154 /* 137 was sys_afs_syscall */
155#define __NR_setfsuid 138 155#define __NR_setfsuid 138
156#define __NR_setfsgid 139 156#define __NR_setfsgid 139
157#define __NR__llseek 140 157#define __NR__llseek 140
@@ -180,8 +180,8 @@
180#define __NR_mremap 163 180#define __NR_mremap 163
181#define __NR_setresuid 164 181#define __NR_setresuid 164
182#define __NR_getresuid 165 182#define __NR_getresuid 165
183#define __NR_vm86 166 183 /* 166 was sys_vm86 */
184#define __NR_query_module 167 184 /* 167 was sys_query_module */
185#define __NR_poll 168 185#define __NR_poll 168
186#define __NR_nfsservctl 169 186#define __NR_nfsservctl 169
187#define __NR_setresgid 170 187#define __NR_setresgid 170
@@ -202,8 +202,8 @@
202#define __NR_capset 185 202#define __NR_capset 185
203#define __NR_sigaltstack 186 203#define __NR_sigaltstack 186
204#define __NR_sendfile 187 204#define __NR_sendfile 187
205#define __NR_streams1 188 /* some people actually want it */ 205 /* 188 reserved for getpmsg */
206#define __NR_streams2 189 /* some people actually want it */ 206 /* 189 reserved for putpmsg */
207#define __NR_vfork 190 207#define __NR_vfork 190
208#define __NR_ugetrlimit 191 /* SuS compliant getrlimit */ 208#define __NR_ugetrlimit 191 /* SuS compliant getrlimit */
209#define __NR_mmap2 192 209#define __NR_mmap2 192
@@ -262,16 +262,15 @@
262#define __NR_msgrcv 241 262#define __NR_msgrcv 241
263#define __NR_msgget 242 263#define __NR_msgget 242
264#define __NR_msgctl 243 264#define __NR_msgctl 243
265#if 0 265#define __NR_shmat 244
266#define __NR_shmatcall 244
267#endif
268#define __NR_shmdt 245 266#define __NR_shmdt 245
269#define __NR_shmget 246 267#define __NR_shmget 246
270#define __NR_shmctl 247 268#define __NR_shmctl 247
271 269
272#define __NR_getdents64 248 270#define __NR_getdents64 248
273#define __NR_fcntl64 249 271#define __NR_fcntl64 249
274/* 223 is unused */ 272 /* 250 is reserved for tux */
273 /* 251 is unused */
275#define __NR_gettid 252 274#define __NR_gettid 252
276#define __NR_readahead 253 275#define __NR_readahead 253
277#define __NR_setxattr 254 276#define __NR_setxattr 254
@@ -291,14 +290,15 @@
291#define __NR_futex 268 290#define __NR_futex 268
292#define __NR_sched_setaffinity 269 291#define __NR_sched_setaffinity 269
293#define __NR_sched_getaffinity 270 292#define __NR_sched_getaffinity 270
294#define __NR_set_thread_area 271 293 /* 271 is reserved for set_thread_area */
295#define __NR_get_thread_area 272 294 /* 272 is reserved for get_thread_area */
296#define __NR_io_setup 273 295#define __NR_io_setup 273
297#define __NR_io_destroy 274 296#define __NR_io_destroy 274
298#define __NR_io_getevents 275 297#define __NR_io_getevents 275
299#define __NR_io_submit 276 298#define __NR_io_submit 276
300#define __NR_io_cancel 277 299#define __NR_io_cancel 277
301#define __NR_fadvise64 278 300#define __NR_fadvise64 278
301 /* 279 is unused */
302#define __NR_exit_group 280 302#define __NR_exit_group 280
303 303
304#define __NR_lookup_dcookie 281 304#define __NR_lookup_dcookie 281
@@ -321,17 +321,17 @@
321#define __NR_tgkill 298 321#define __NR_tgkill 298
322#define __NR_utimes 299 322#define __NR_utimes 299
323#define __NR_fadvise64_64 300 323#define __NR_fadvise64_64 300
324#define __NR_vserver 301 324 /* 301 is reserved for vserver */
325#define __NR_mbind 302 325 /* 302 is reserved for mbind */
326#define __NR_get_mempolicy 303 326 /* 303 is reserved for get_mempolicy */
327#define __NR_set_mempolicy 304 327 /* 304 is reserved for set_mempolicy */
328#define __NR_mq_open 305 328#define __NR_mq_open 305
329#define __NR_mq_unlink (__NR_mq_open+1) 329#define __NR_mq_unlink (__NR_mq_open+1)
330#define __NR_mq_timedsend (__NR_mq_open+2) 330#define __NR_mq_timedsend (__NR_mq_open+2)
331#define __NR_mq_timedreceive (__NR_mq_open+3) 331#define __NR_mq_timedreceive (__NR_mq_open+3)
332#define __NR_mq_notify (__NR_mq_open+4) 332#define __NR_mq_notify (__NR_mq_open+4)
333#define __NR_mq_getsetattr (__NR_mq_open+5) 333#define __NR_mq_getsetattr (__NR_mq_open+5)
334#define __NR_kexec_load 311 334 /* 311 is reserved for kexec */
335#define __NR_waitid 312 335#define __NR_waitid 312
336#define __NR_add_key 313 336#define __NR_add_key 313
337#define __NR_request_key 314 337#define __NR_request_key 314
@@ -341,7 +341,7 @@
341#define __NR_inotify_init 318 341#define __NR_inotify_init 318
342#define __NR_inotify_add_watch 319 342#define __NR_inotify_add_watch 319
343#define __NR_inotify_rm_watch 320 343#define __NR_inotify_rm_watch 320
344/* 321 is unused */ 344 /* 321 is unused */
345#define __NR_migrate_pages 322 345#define __NR_migrate_pages 322
346#define __NR_openat 323 346#define __NR_openat 323
347#define __NR_mkdirat 324 347#define __NR_mkdirat 324
@@ -399,44 +399,6 @@
399#define __NR_process_vm_readv 376 399#define __NR_process_vm_readv 376
400#define __NR_process_vm_writev 377 400#define __NR_process_vm_writev 377
401 401
402#ifdef __KERNEL__
403
404#define NR_syscalls 378 402#define NR_syscalls 378
405 403
406#define __ARCH_WANT_IPC_PARSE_VERSION
407#define __ARCH_WANT_OLD_READDIR
408#define __ARCH_WANT_OLD_STAT
409#define __ARCH_WANT_STAT64
410#define __ARCH_WANT_SYS_ALARM
411#define __ARCH_WANT_SYS_GETHOSTNAME
412#define __ARCH_WANT_SYS_IPC
413#define __ARCH_WANT_SYS_PAUSE
414#define __ARCH_WANT_SYS_SGETMASK
415#define __ARCH_WANT_SYS_SIGNAL
416#define __ARCH_WANT_SYS_TIME
417#define __ARCH_WANT_SYS_UTIME
418#define __ARCH_WANT_SYS_WAITPID
419#define __ARCH_WANT_SYS_SOCKETCALL
420#define __ARCH_WANT_SYS_FADVISE64
421#define __ARCH_WANT_SYS_GETPGRP
422#define __ARCH_WANT_SYS_LLSEEK
423#define __ARCH_WANT_SYS_NICE
424#define __ARCH_WANT_SYS_OLD_GETRLIMIT
425#define __ARCH_WANT_SYS_OLD_UNAME
426#define __ARCH_WANT_SYS_OLDUMOUNT
427#define __ARCH_WANT_SYS_SIGPENDING
428#define __ARCH_WANT_SYS_SIGPROCMASK
429#define __ARCH_WANT_SYS_RT_SIGACTION
430
431/*
432 * "Conditional" syscalls
433 *
434 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
435 * but it doesn't work on all toolchains, so we just do it by hand
436 */
437#ifndef cond_syscall
438#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
439#endif
440
441#endif /* __KERNEL__ */
442#endif /* __ASM_SH_UNISTD_64_H */ 404#endif /* __ASM_SH_UNISTD_64_H */