summaryrefslogtreecommitdiffstats
path: root/include/asm-sh
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-04-19 04:00:00 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-04-19 04:00:00 +0000
commit46e045034336a2cc90c1798cd7cc07af744ddfd6 (patch)
tree3b9b51fc482e729f663d25333e77fbed9aaa939a /include/asm-sh
parent31dc59d503a02e84c4de98826452acaeb56dc15a (diff)
Merge with Linux 2.3.99-pre4.
Diffstat (limited to 'include/asm-sh')
-rw-r--r--include/asm-sh/bitops.h2
-rw-r--r--include/asm-sh/byteorder.h2
-rw-r--r--include/asm-sh/checksum.h96
-rw-r--r--include/asm-sh/current.h4
-rw-r--r--include/asm-sh/delay.h6
-rw-r--r--include/asm-sh/mman.h6
-rw-r--r--include/asm-sh/namei.h3
-rw-r--r--include/asm-sh/processor.h41
-rw-r--r--include/asm-sh/ptrace.h90
-rw-r--r--include/asm-sh/sigcontext.h12
-rw-r--r--include/asm-sh/string.h50
-rw-r--r--include/asm-sh/system.h81
-rw-r--r--include/asm-sh/uaccess.h108
-rw-r--r--include/asm-sh/unistd.h2
-rw-r--r--include/asm-sh/user.h10
15 files changed, 321 insertions, 192 deletions
diff --git a/include/asm-sh/bitops.h b/include/asm-sh/bitops.h
index bf0d00c0a..85462da1e 100644
--- a/include/asm-sh/bitops.h
+++ b/include/asm-sh/bitops.h
@@ -103,7 +103,7 @@ extern __inline__ unsigned long ffz(unsigned long word)
{
unsigned long result;
- __asm__("1:\n"
+ __asm__("1:\n\t"
"shlr %1\n\t"
"bt/s 1b\n\t"
" add #1, %0"
diff --git a/include/asm-sh/byteorder.h b/include/asm-sh/byteorder.h
index dcc9f8241..cddaeb58e 100644
--- a/include/asm-sh/byteorder.h
+++ b/include/asm-sh/byteorder.h
@@ -19,7 +19,7 @@ static __inline__ __const__ __u32 ___arch__swab32(__u32 x)
static __inline__ __const__ __u16 ___arch__swab16(__u16 x)
{
- __asm__("swap.b %0,%0"
+ __asm__("swap.b %0, %0"
: "=r" (x)
: "0" (x));
return x;
diff --git a/include/asm-sh/checksum.h b/include/asm-sh/checksum.h
index ae0272e9b..846e64509 100644
--- a/include/asm-sh/checksum.h
+++ b/include/asm-sh/checksum.h
@@ -55,24 +55,6 @@ unsigned int csum_partial_copy_from_user ( const char *src, char *dst,
return csum_partial_copy_generic ( src, dst, len, sum, err_ptr, NULL);
}
-#if 0
-
-/* Not used at the moment. It is difficult to imagine for what purpose
- it can be used :-) Please, do not forget to verify_area before it --ANK
- */
-
-/*
- * This combination is currently not used, but possible:
- */
-
-extern __inline__
-unsigned int csum_partial_copy_to_user ( const char *src, char *dst,
- int len, int sum, int *err_ptr)
-{
- return csum_partial_copy_generic ( src, dst, len, sum, NULL, err_ptr);
-}
-#endif
-
/*
* These are the old (and unsafe) way of doing checksums, a warning message will be
* printed if they are used and an exeption occurs.
@@ -91,12 +73,12 @@ static __inline__ unsigned int csum_fold(unsigned int sum)
{
unsigned int __dummy;
__asm__("clrt\n\t"
- "mov %0,%1\n\t"
+ "mov %0, %1\n\t"
"shll16 %0\n\t"
- "addc %0,%1\n\t"
+ "addc %0, %1\n\t"
"movt %0\n\t"
"shlr16 %1\n\t"
- "add %1,%0"
+ "add %1, %0"
: "=r" (sum), "=&r" (__dummy)
: "0" (sum));
return ~sum;
@@ -114,24 +96,24 @@ static __inline__ unsigned short ip_fast_csum(unsigned char * iph, unsigned int
unsigned int sum, __dummy;
__asm__ __volatile__(
- "mov.l @%1+,%0\n\t"
- "add #-4,%2\n\t"
+ "mov.l @%1+, %0\n\t"
+ "add #-4, %2\n\t"
"clrt\n\t"
- "mov.l @%1+,%3\n\t"
- "addc %3,%0\n\t"
- "mov.l @%1+,%3\n\t"
- "addc %3,%0\n\t"
- "mov.l @%1+,%3\n\t"
- "addc %3,%0\n"
+ "mov.l @%1+, %3\n\t"
+ "addc %3, %0\n\t"
+ "mov.l @%1+, %3\n\t"
+ "addc %3, %0\n\t"
+ "mov.l @%1+, %3\n\t"
+ "addc %3, %0\n"
"1:\t"
- "mov.l @%1+,%3\n\t"
- "addc %3,%0\n\t"
+ "mov.l @%1+, %3\n\t"
+ "addc %3, %0\n\t"
"movt %3\n\t"
"dt %2\n\t"
"bf/s 1b\n\t"
- " cmp/eq #1,%3\n\t"
- "mov #0,%3\n\t"
- "addc %3,%0\n\t"
+ " cmp/eq #1, %3\n\t"
+ "mov #0, %3\n\t"
+ "addc %3, %0\n\t"
/* Since the input registers which are loaded with iph and ihl
are modified, we must also specify them as outputs, or gcc
will assume they contain their original values. */
@@ -153,11 +135,11 @@ static __inline__ unsigned long csum_tcpudp_nofold(unsigned long saddr,
unsigned long len_proto = (proto<<16)+len;
#endif
__asm__("clrt\n\t"
- "addc %0,%1\n\t"
- "addc %2,%1\n\t"
- "addc %3,%1\n\t"
+ "addc %0, %1\n\t"
+ "addc %2, %1\n\t"
+ "addc %3, %1\n\t"
"movt %0\n\t"
- "add %1,%0"
+ "add %1, %0"
: "=r" (sum), "=r" (len_proto)
: "r" (daddr), "r" (saddr), "1" (len_proto), "0" (sum));
return sum;
@@ -195,26 +177,26 @@ static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr,
{
unsigned int __dummy;
__asm__("clrt\n\t"
- "mov.l @(0,%2),%1\n\t"
- "addc %1,%0\n\t"
- "mov.l @(4,%2),%1\n\t"
- "addc %1,%0\n\t"
- "mov.l @(8,%2),%1\n\t"
- "addc %1,%0\n\t"
- "mov.l @(12,%2),%1\n\t"
- "addc %1,%0\n\t"
- "mov.l @(0,%3),%1\n\t"
- "addc %1,%0\n\t"
- "mov.l @(4,%3),%1\n\t"
- "addc %1,%0\n\t"
- "mov.l @(8,%3),%1\n\t"
- "addc %1,%0\n\t"
- "mov.l @(12,%3),%1\n\t"
- "addc %1,%0\n\t"
- "addc %4,%0\n\t"
- "addc %5,%0\n\t"
+ "mov.l @(0,%2), %1\n\t"
+ "addc %1, %0\n\t"
+ "mov.l @(4,%2), %1\n\t"
+ "addc %1, %0\n\t"
+ "mov.l @(8,%2), %1\n\t"
+ "addc %1, %0\n\t"
+ "mov.l @(12,%2), %1\n\t"
+ "addc %1, %0\n\t"
+ "mov.l @(0,%3), %1\n\t"
+ "addc %1, %0\n\t"
+ "mov.l @(4,%3), %1\n\t"
+ "addc %1, %0\n\t"
+ "mov.l @(8,%3), %1\n\t"
+ "addc %1, %0\n\t"
+ "mov.l @(12,%3), %1\n\t"
+ "addc %1, %0\n\t"
+ "addc %4, %0\n\t"
+ "addc %5, %0\n\t"
"movt %1\n\t"
- "add %1,%0\n"
+ "add %1, %0\n"
: "=r" (sum), "=&r" (__dummy)
: "r" (saddr), "r" (daddr),
"r" (htonl(len)), "r" (htonl(proto)), "0" (sum));
diff --git a/include/asm-sh/current.h b/include/asm-sh/current.h
index fe65bfcc9..3bd231173 100644
--- a/include/asm-sh/current.h
+++ b/include/asm-sh/current.h
@@ -12,8 +12,8 @@ static __inline__ struct task_struct * get_current(void)
{
struct task_struct *current;
- __asm__("stc r4_bank,%0\n\t"
- "add %1,%0"
+ __asm__("stc $r4_bank, %0\n\t"
+ "add %1, %0"
:"=&r" (current)
:"r" (-8192));
return current;
diff --git a/include/asm-sh/delay.h b/include/asm-sh/delay.h
index 222561a3e..3e25684fe 100644
--- a/include/asm-sh/delay.h
+++ b/include/asm-sh/delay.h
@@ -8,7 +8,7 @@
extern __inline__ void __delay(unsigned long loops)
{
__asm__ __volatile__(
- "tst %0,%0\n\t"
+ "tst %0, %0\n\t"
"1:\t"
"bf/s 1b\n\t"
" dt %0"
@@ -19,8 +19,8 @@ extern __inline__ void __delay(unsigned long loops)
extern __inline__ void __udelay(unsigned long usecs, unsigned long lps)
{
usecs *= 0x000010c6; /* 2**32 / 1000000 */
- __asm__("dmulu.l %0,%2\n\t"
- "sts mach,%0"
+ __asm__("dmulu.l %0, %2\n\t"
+ "sts $mach, %0"
: "=r" (usecs)
: "0" (usecs), "r" (lps)
: "macl", "mach");
diff --git a/include/asm-sh/mman.h b/include/asm-sh/mman.h
index 19b02f6da..49fecaed5 100644
--- a/include/asm-sh/mman.h
+++ b/include/asm-sh/mman.h
@@ -25,6 +25,12 @@
#define MCL_CURRENT 1 /* lock all current mappings */
#define MCL_FUTURE 2 /* lock all future mappings */
+#define MADV_NORMAL 0x0 /* default page-in behavior */
+#define MADV_RANDOM 0x1 /* page-in minimum required */
+#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
+#define MADV_WILLNEED 0x3 /* pre-fault pages */
+#define MADV_DONTNEED 0x4 /* discard these pages */
+
/* compatibility flags */
#define MAP_ANON MAP_ANONYMOUS
#define MAP_FILE 0
diff --git a/include/asm-sh/namei.h b/include/asm-sh/namei.h
index 582fc77e3..a51522ac1 100644
--- a/include/asm-sh/namei.h
+++ b/include/asm-sh/namei.h
@@ -12,7 +12,6 @@
* Look at asm-sparc/namei.h for details.
*/
-#define __prefix_lookup_dentry(name, lookup_flags) \
- do {} while (0)
+#define __emul_prefix() NULL
#endif /* __ASM_SH_NAMEI_H */
diff --git a/include/asm-sh/processor.h b/include/asm-sh/processor.h
index 962461a33..1fcfb1300 100644
--- a/include/asm-sh/processor.h
+++ b/include/asm-sh/processor.h
@@ -45,8 +45,10 @@ extern struct sh_cpuinfo boot_cpu_data;
/*
* User space process size: 2GB.
+ *
+ * Since SH7709 and SH7750 have "area 7", we can't use 0x7c000000--0x7fffffff
*/
-#define TASK_SIZE 0x80000000
+#define TASK_SIZE 0x7c000000UL
/* This decides where the kernel will search for a free chunk of vm
* space during mmap's.
@@ -54,19 +56,25 @@ extern struct sh_cpuinfo boot_cpu_data;
#define TASK_UNMAPPED_BASE (TASK_SIZE / 3)
/*
- * FPU structure and data
- */
-/* FD-bit of SR register.
- * When it's set, it means the processor doesn't have right to use FPU,
- * and it results exception when the floating operation is executed.
+ * Bit of SR register
+ *
+ * FD-bit:
+ * When it's set, it means the processor doesn't have right to use FPU,
+ * and it results exception when the floating operation is executed.
+ *
+ * IMASK-bit:
+ * Interrupt level mask
*/
-#define SR_FD 0x00008000
+#define SR_FD 0x00008000
+#define SR_IMASK 0x000000f0
-#define NUM_FPU_REGS 16
+/*
+ * FPU structure and data
+ */
struct sh_fpu_hard_struct {
- unsigned long fp_regs[NUM_FPU_REGS];
- unsigned long xf_regs[NUM_FPU_REGS];
+ unsigned long fp_regs[16];
+ unsigned long long xd_regs[8];
unsigned long fpscr;
unsigned long fpul;
@@ -75,13 +83,13 @@ struct sh_fpu_hard_struct {
/* Dummy fpu emulator */
struct sh_fpu_soft_struct {
- unsigned long fp_regs[NUM_FPU_REGS];
+ unsigned long fp_regs[16];
+ unsigned long long xd_regs[8];
unsigned long fpscr;
unsigned long fpul;
- unsigned long xf_regs[NUM_FPU_REGS];
- unsigned char lookahead;
- unsigned long entry_pc;
+ unsigned char lookahead;
+ unsigned long entry_pc;
};
union sh_fpu_union {
@@ -120,7 +128,7 @@ struct thread_struct {
regs->pr = 0; \
regs->sr = 0; /* User mode. */ \
regs->pc = new_pc; \
- regs->sp = new_sp
+ regs->regs[15] = new_sp
/* Forward declaration, a strange C thing */
struct task_struct;
@@ -189,6 +197,9 @@ extern void save_fpu(struct task_struct *__tsk);
(tsk)->flags &= ~PF_USEDFPU; \
} while (0)
+/* Double presision, NANS as NANS, rounding to nearest, no exceptions */
+#define FPSCR_INIT 0x00080000
+
/*
* Return saved PC of a blocked thread.
*/
diff --git a/include/asm-sh/ptrace.h b/include/asm-sh/ptrace.h
index ad3ab8905..369fc23bb 100644
--- a/include/asm-sh/ptrace.h
+++ b/include/asm-sh/ptrace.h
@@ -2,19 +2,49 @@
#define __ASM_SH_PTRACE_H
/*
- * Copyright (C) 1999 Niibe Yutaka
+ * Copyright (C) 1999, 2000 Niibe Yutaka
*
*/
/*
+ * As GCC does:
+ * 0 - 15 are integer registers
+ * 17 - 22 are control/special registers
+ * 24 - 39 fp registers
+ * 40 - 47 xd registers
+ * 48 - fpscr register
+ * -----------------------------
+ * Not as GCC:
+ * 16 --- program counter PC
+ * 23 --- syscall #
+ */
+#define REG_REG0 0
+#define REG_REG15 15
+#define REG_PC 16
+
+#define REG_PR 17
+#define REG_SR 18
+#define REG_GBR 19
+#define REG_MACH 20
+#define REG_MACL 21
+#define REG_FPUL 22
+
+#define REG_SYSCALL 23
+
+#define REG_FPREG0 24
+#define REG_FPREG15 39
+#define REG_XDREG0 40
+#define REG_XDREG14 47
+#define REG_FPSCR 48
+
+/*
* This struct defines the way the registers are stored on the
* kernel stack during a system call or other kernel entry.
*/
struct pt_regs {
long syscall_nr;
unsigned long sr;
- unsigned long sp;
- unsigned long regs[15];
+ unsigned long regs[16];
unsigned long gbr;
unsigned long mach;
unsigned long macl;
@@ -26,6 +56,60 @@ struct pt_regs {
#define user_mode(regs) (((regs)->sr & 0x40000000)==0)
#define instruction_pointer(regs) ((regs)->pc)
extern void show_regs(struct pt_regs *);
+
+/* User Break Controller */
+
+#if defined(__sh3__)
+/* The value is for sh4, please fix... */
+#define UBC_BARA 0xff200000
+#define UBC_BAMRA 0xff200004
+#define UBC_BBRA 0xff200008
+#define UBC_BASRA 0xff000014
+#define UBC_BARB 0xff20000c
+#define UBC_BAMRB 0xff200010
+#define UBC_BBRB 0xff200014
+#define UBC_BASRB 0xff000018
+#define UBC_BDRB 0xff200018
+#define UBC_BDMRB 0xff20001c
+#define UBC_BRCR 0xff200020
+#elif defined(__SH4__)
+#define UBC_BARA 0xff200000
+#define UBC_BAMRA 0xff200004
+#define UBC_BBRA 0xff200008
+#define UBC_BASRA 0xff000014
+#define UBC_BARB 0xff20000c
+#define UBC_BAMRB 0xff200010
+#define UBC_BBRB 0xff200014
+#define UBC_BASRB 0xff000018
+#define UBC_BDRB 0xff200018
+#define UBC_BDMRB 0xff20001c
+#define UBC_BRCR 0xff200020
+#endif
+
+#define BAMR_ASID (1 << 2)
+#define BAMR_NONE 0
+#define BAMR_10 0x1
+#define BAMR_12 0x2
+#define BAMR_ALL 0x3
+#define BAMR_16 0x8
+#define BAMR_20 0x9
+
+#define BBR_INST (1 << 4)
+#define BBR_DATA (2 << 4)
+#define BBR_READ (1 << 2)
+#define BBR_WRITE (2 << 4)
+#define BBR_BYTE 0x1
+#define BBR_HALF 0x2
+#define BBR_LONG 0x3
+#define BBR_QUAD (1 << 6)
+
+#define BRCR_CMFA (1 << 15)
+#define BRCR_CMFB (1 << 14)
+#define BRCR_PCBA (1 << 10) /* 1: after execution */
+#define BRCR_DBEB (1 << 7)
+#define BRCR_PCBB (1 << 6)
+#define BRCR_SEQ (1 << 3)
+#define BRCR_UBDE (1 << 0)
#endif
#endif /* __ASM_SH_PTRACE_H */
diff --git a/include/asm-sh/sigcontext.h b/include/asm-sh/sigcontext.h
index c1a77873b..6f61ed38c 100644
--- a/include/asm-sh/sigcontext.h
+++ b/include/asm-sh/sigcontext.h
@@ -5,14 +5,22 @@ struct sigcontext {
unsigned long oldmask;
/* CPU registers */
- unsigned long sc_regs[15];
+ unsigned long sc_regs[16];
unsigned long sc_gbr;
unsigned long sc_mach;
unsigned long sc_macl;
unsigned long sc_pr;
- unsigned long sc_sp;
unsigned long sc_sr;
unsigned long sc_pc;
+
+#if defined(__SH4__)
+ /* FPU registers */
+ unsigned long sc_fpregs[16];
+ unsigned long long sc_xdregs[8];
+ unsigned int sc_fpscr;
+ unsigned int sc_fpul;
+ unsigned int sc_ownedfp;
+#endif
};
#endif /* __ASM_SH_SIGCONTEXT_H */
diff --git a/include/asm-sh/string.h b/include/asm-sh/string.h
index bcff30489..3eab1c123 100644
--- a/include/asm-sh/string.h
+++ b/include/asm-sh/string.h
@@ -13,11 +13,11 @@ extern __inline__ char *strcpy(char *__dest, const char *__src)
unsigned long __dummy;
__asm__ __volatile__("1:\n\t"
- "mov.b @%1+,%2\n\t"
- "mov.b %2,@%0\n\t"
- "cmp/eq #0,%2\n\t"
+ "mov.b @%1+, %2\n\t"
+ "mov.b %2, @%0\n\t"
+ "cmp/eq #0, %2\n\t"
"bf/s 1b\n\t"
- " add #1,%0\n\t"
+ " add #1, %0\n\t"
: "=r" (__dest), "=r" (__src), "=&z" (__dummy)
: "0" (__dest), "1" (__src)
: "memory");
@@ -36,13 +36,13 @@ extern __inline__ char *strncpy(char *__dest, const char *__src, size_t __n)
__asm__ __volatile__(
"1:\n"
- "mov.b @%1+,%2\n\t"
- "mov.b %2,@%0\n\t"
- "cmp/eq #0,%2\n\t"
+ "mov.b @%1+, %2\n\t"
+ "mov.b %2, @%0\n\t"
+ "cmp/eq #0, %2\n\t"
"bt/s 2f\n\t"
" cmp/eq %5,%1\n\t"
"bf/s 1b\n\t"
- " add #1,%0\n"
+ " add #1, %0\n"
"2:"
: "=r" (__dest), "=r" (__src), "=&z" (__dummy)
: "0" (__dest), "1" (__src), "r" (__src+__n)
@@ -58,17 +58,17 @@ extern __inline__ int strcmp(const char *__cs, const char *__ct)
unsigned long __dummy;
__asm__ __volatile__(
- "mov.b @%1+,%3\n"
+ "mov.b @%1+, %3\n"
"1:\n\t"
- "mov.b @%0+,%2\n\t"
- "cmp/eq #0,%3\n\t"
+ "mov.b @%0+, %2\n\t"
+ "cmp/eq #0, %3\n\t"
"bt 2f\n\t"
- "cmp/eq %2,%3\n\t"
+ "cmp/eq %2, %3\n\t"
"bt/s 1b\n\t"
- " mov.b @%1+,%3\n\t"
- "add #-2,%1\n\t"
- "mov.b @%1,%3\n\t"
- "sub %3,%2\n"
+ " mov.b @%1+, %3\n\t"
+ "add #-2, %1\n\t"
+ "mov.b @%1, %3\n\t"
+ "sub %3, %2\n"
"2:"
: "=r" (__cs), "=r" (__ct), "=&r" (__res), "=&z" (__dummy)
: "0" (__cs), "1" (__ct));
@@ -83,20 +83,20 @@ extern __inline__ int strncmp(const char *__cs, const char *__ct, size_t __n)
unsigned long __dummy;
__asm__ __volatile__(
- "mov.b @%1+,%3\n"
+ "mov.b @%1+, %3\n"
"1:\n\t"
- "mov.b @%0+,%2\n\t"
- "cmp/eq %6,%0\n\t"
+ "mov.b @%0+, %2\n\t"
+ "cmp/eq %6, %0\n\t"
"bt/s 2f\n\t"
- " cmp/eq #0,%3\n\t"
+ " cmp/eq #0, %3\n\t"
"bt/s 3f\n\t"
- " cmp/eq %3,%2\n\t"
+ " cmp/eq %3, %2\n\t"
"bt/s 1b\n\t"
- " mov.b @%1+,%3\n\t"
- "add #-2,%1\n\t"
- "mov.b @%1,%3\n"
+ " mov.b @%1+, %3\n\t"
+ "add #-2, %1\n\t"
+ "mov.b @%1, %3\n"
"2:\n\t"
- "sub %3,%2\n"
+ "sub %3, %2\n"
"3:"
:"=r" (__cs), "=r" (__ct), "=&r" (__res), "=&z" (__dummy)
: "0" (__cs), "1" (__ct), "r" (__cs+__n));
diff --git a/include/asm-sh/system.h b/include/asm-sh/system.h
index e76071bf2..130800b47 100644
--- a/include/asm-sh/system.h
+++ b/include/asm-sh/system.h
@@ -2,7 +2,7 @@
#define __ASM_SH_SYSTEM_H
/*
- * Copyright (C) 1999, 2000 Niibe Yutaka
+ * Copyright (C) 1999, 2000 Niibe Yutaka & Kaz Kojima
*/
/*
@@ -93,13 +93,15 @@ extern void __xchg_called_with_bad_pointer(void);
/* Interrupt Control */
extern __inline__ void __sti(void)
{
- unsigned long __dummy;
+ unsigned long __dummy0, __dummy1;
__asm__ __volatile__("stc $sr, %0\n\t"
"and %1, %0\n\t"
+ "stc $r5_bank, %1\n\t"
+ "or %1, %0\n\t"
"ldc %0, $sr"
- : "=&r" (__dummy)
- : "r" (0xefffffff)
+ : "=&r" (__dummy0), "=r" (__dummy1)
+ : "1" (~0xf0)
: "memory");
}
@@ -107,10 +109,10 @@ extern __inline__ void __cli(void)
{
unsigned long __dummy;
__asm__ __volatile__("stc $sr, %0\n\t"
- "or %1, %0\n\t"
+ "or #0xf0, %0\n\t"
"ldc %0, $sr"
- : "=&r" (__dummy)
- : "r" (0x10000000)
+ : "=&z" (__dummy)
+ : /* no inputs */
: "memory");
}
@@ -118,35 +120,72 @@ extern __inline__ void __cli(void)
x = (__extension__ ({ unsigned long __sr; \
__asm__ __volatile__( \
"stc $sr, %0" \
- : "=r" (__sr) \
+ : "=&r" (__sr) \
: /* no inputs */ \
: "memory"); \
- (__sr & 0xffff7f0f);}))
+ (__sr & 0x000000f0);}))
#define __save_and_cli(x) \
x = (__extension__ ({ unsigned long __dummy,__sr; \
__asm__ __volatile__( \
"stc $sr, %1\n\t" \
- "or %0, %1\n\t" \
- "stc $sr, %0\n\t" \
- "ldc %1, $sr" \
- : "=r" (__sr), "=&r" (__dummy) \
- : "0" (0x10000000) \
- : "memory"); (__sr & 0xffff7f0f); }))
+ "mov %1, %0\n\t" \
+ "or #0xf0, %0\n\t" \
+ "ldc %0, $sr" \
+ : "=&z" (__dummy), "=&r" (__sr) \
+ : /* no inputs */ \
+ : "memory"); (__sr & 0x000000f0); }))
#define __restore_flags(x) do { \
- unsigned long __dummy; \
- __asm__ __volatile__( \
+ unsigned long __dummy0, __dummy1; \
+ if (x != 0xf0) /* not CLI-ed? */ \
+ __asm__ __volatile__( \
"stc $sr, %0\n\t" \
"and %1, %0\n\t" \
- "or %2, %0\n\t" \
+ "stc $r5_bank, %1\n\t" \
+ "or %1, %0\n\t" \
"ldc %0, $sr" \
- : "=&r" (__dummy) \
- : "r" (0x000080f0), /* IMASK+FD */ \
- "r" (x) \
+ : "=&r" (__dummy0), "=r" (__dummy1) \
+ : "1" (0xffffff0f) \
: "memory"); \
} while (0)
+/*
+ * Jump to P2 area.
+ * When handling TLB or caches, we need to do it from P2 area.
+ */
+#define jump_to_P2() \
+do { \
+ unsigned long __dummy; \
+ __asm__ __volatile__( \
+ "mov.l 1f, %0\n\t" \
+ "or %1, %0\n\t" \
+ "jmp @%0\n\t" \
+ " nop\n\t" \
+ ".balign 4\n" \
+ "1: .long 2f\n" \
+ "2:" \
+ : "=&r" (__dummy) \
+ : "r" (0x20000000)); \
+} while (0)
+
+/*
+ * Back to P1 area.
+ */
+#define back_to_P1() \
+do { \
+ unsigned long __dummy; \
+ __asm__ __volatile__( \
+ "nop;nop;nop;nop;nop;nop\n\t" \
+ "mov.l 1f, %0\n\t" \
+ "jmp @%0\n\t" \
+ " nop\n\t" \
+ ".balign 4\n" \
+ "1: .long 2f\n" \
+ "2:" \
+ : "=&r" (__dummy)); \
+} while (0)
+
/* For spinlocks etc */
#define local_irq_save(x) __save_and_cli(x)
#define local_irq_restore(x) __restore_flags(x)
diff --git a/include/asm-sh/uaccess.h b/include/asm-sh/uaccess.h
index b64de2cd5..65ed58fd8 100644
--- a/include/asm-sh/uaccess.h
+++ b/include/asm-sh/uaccess.h
@@ -1,4 +1,4 @@
-/* $Id: uaccess.h,v 1.6 1999/10/29 13:10:44 gniibe Exp $
+/* $Id: uaccess.h,v 1.10 2000/03/24 13:53:45 gniibe Exp $
*
* User space memory access functions
*
@@ -47,7 +47,7 @@
*/
#define __range_ok(addr,size) ({ \
unsigned long flag,sum; \
- __asm__("clrt; addc %3,%1; movt %0; cmp/hi %4,%1; rotcl %0" \
+ __asm__("clrt; addc %3, %1; movt %0; cmp/hi %4, %1; rotcl %0" \
:"=&r" (flag), "=r" (sum) \
:"1" (addr), "r" ((int)(size)), "r" (current->addr_limit.seg)); \
flag; })
@@ -137,17 +137,17 @@ default: __get_user_unknown(); break; \
({ \
__asm__ __volatile__( \
"1:\n\t" \
- "mov." insn " %2,%1\n\t" \
- "mov #0,%0\n" \
- "2:\n\t" \
+ "mov." insn " %2, %1\n\t" \
+ "mov #0, %0\n" \
+ "2:\n" \
".section .fixup,\"ax\"\n" \
"3:\n\t" \
- "mov #0,%1\n\t" \
- "mov.l 4f,%0\n\t" \
+ "mov #0, %1\n\t" \
+ "mov.l 4f, %0\n\t" \
"jmp @%0\n\t" \
- " mov %3,%0\n" \
+ " mov %3, %0\n" \
"4: .long 2b\n\t" \
- ".previous\n\t" \
+ ".previous\n" \
".section __ex_table,\"a\"\n\t" \
".long 1b, 3b\n\t" \
".previous" \
@@ -189,17 +189,17 @@ default: __put_user_unknown(); break; \
({ \
__asm__ __volatile__( \
"1:\n\t" \
- "mov." insn " %1,%2\n\t" \
- "mov #0,%0\n" \
- "2:\n\t" \
+ "mov." insn " %1, %2\n\t" \
+ "mov #0, %0\n" \
+ "2:\n" \
".section .fixup,\"ax\"\n" \
"3:\n\t" \
"nop\n\t" \
- "mov.l 4f,%0\n\t" \
+ "mov.l 4f, %0\n\t" \
"jmp @%0\n\t" \
- "mov %3,%0\n" \
+ "mov %3, %0\n" \
"4: .long 2b\n\t" \
- ".previous\n\t" \
+ ".previous\n" \
".section __ex_table,\"a\"\n\t" \
".long 1b, 3b\n\t" \
".previous" \
@@ -218,18 +218,18 @@ __copy_user(void *__to, const void *__from, __kernel_size_t __n)
__asm__ __volatile__(
"9:\n\t"
- "mov.b @%2+,%1\n\t"
+ "mov.b @%2+, %1\n\t"
"dt %0\n"
"1:\n\t"
- "mov.b %1,@%3\n\t"
+ "mov.b %1, @%3\n\t"
"bf/s 9b\n\t"
- " add #1,%3\n"
- "2:"
+ " add #1, %3\n"
+ "2:\n"
".section .fixup,\"ax\"\n"
"3:\n\t"
- "mov.l 5f,%1\n\t"
+ "mov.l 5f, %1\n\t"
"jmp @%1\n\t"
- " mov %7,%0\n\t"
+ " mov %7, %0\n\t"
".balign 4\n"
"5: .long 2b\n"
".previous\n"
@@ -238,7 +238,7 @@ __copy_user(void *__to, const void *__from, __kernel_size_t __n)
" .long 9b,3b\n"
" .long 1b,2b\n"
".previous"
- : "=&r" (res), "=&z" (__dummy), "=&r" (_f), "=&r" (_t)
+ : "=r" (res), "=&z" (__dummy), "=r" (_f), "=r" (_t)
: "2" (__from), "3" (__to), "0" (__n), "i" (-EFAULT)
: "memory");
@@ -297,23 +297,21 @@ if (__copy_from_user(to,from,n)) \
extern __inline__ __kernel_size_t
__clear_user(void *addr, __kernel_size_t size)
{
- __kernel_size_t res;
- unsigned long __a, __s;
+ unsigned long __a;
__asm__ __volatile__(
"9:\n\t"
- "dt %2\n"
+ "dt %0\n"
"1:\n\t"
- "mov.b %5,@%1\n\t"
+ "mov.b %4, @%1\n\t"
"bf/s 9b\n\t"
- " add #1,%1\n\t"
- "sub %2,%0\n"
+ " add #1, %1\n"
"2:\n"
".section .fixup,\"ax\"\n"
"3:\n\t"
- "mov.l 4f,%0\n\t"
- "jmp @%0\n\t"
- " mov %7,%0\n"
+ "mov.l 4f, %1\n\t"
+ "jmp @%1\n\t"
+ " nop\n"
".balign 4\n"
"4: .long 2b\n"
".previous\n"
@@ -321,10 +319,10 @@ __clear_user(void *addr, __kernel_size_t size)
" .balign 4\n"
" .long 1b,3b\n"
".previous"
- : "=&r" (res), "=&r" (__a), "=&r" (__s)
- : "1" (addr), "2" (size), "r" (0), "0" (size), "i" (-EFAULT));
+ : "=r" (size), "=r" (__a)
+ : "0" (size), "1" (addr), "r" (0));
- return res;
+ return size;
}
#define clear_user(addr,n) ({ \
@@ -342,31 +340,31 @@ __strncpy_from_user(unsigned long __dest, unsigned long __src, int __count)
__asm__ __volatile__(
"9:\n"
- "mov.b @%2+,%1\n\t"
- "cmp/eq #0,%1\n\t"
+ "mov.b @%2+, %1\n\t"
+ "cmp/eq #0, %1\n\t"
"bt/s 2f\n"
"1:\n"
- "mov.b %1,@%3\n\t"
- "dt %0\n\t"
+ "mov.b %1, @%3\n\t"
+ "dt %7\n\t"
"bf/s 9b\n\t"
- " add #1,%3\n\t"
- "sub %6,%0\n"
- "2:\n"
+ " add #1, %3\n\t"
+ "2:\n\t"
+ "sub %7, %0\n"
+ "3:\n"
".section .fixup,\"ax\"\n"
- "3:\n\t"
- "mov.l 4f,%1\n\t"
+ "4:\n\t"
+ "mov.l 5f, %1\n\t"
"jmp @%1\n\t"
- " mov %8,%0\n\t"
+ " mov %8, %0\n\t"
".balign 4\n"
- "4: .long 2b\n"
+ "5: .long 3b\n"
".previous\n"
".section __ex_table,\"a\"\n"
" .balign 4\n"
- " .long 9b,3b\n"
- " .long 1b,2b\n"
+ " .long 9b,4b\n"
".previous"
- : "=&r" (res), "=&z" (__dummy), "=&r" (_s), "=&r" (_d)
- : "2" (__src), "3" (__dest), "r" (__count), "0" (__count),
+ : "=r" (res), "=&z" (__dummy), "=r" (_s), "=r" (_d)
+ : "0" (__count), "2" (__src), "3" (__dest), "r" (__count),
"i" (-EFAULT)
: "memory");
@@ -393,19 +391,19 @@ extern __inline__ long __strnlen_user(const char *__s, long __n)
__asm__ __volatile__(
"9:\n"
- "cmp/eq %4,%0\n\t"
+ "cmp/eq %4, %0\n\t"
"bt 2f\n"
"1:\t"
- "mov.b @(%0,%3),%1\n\t"
- "tst %1,%1\n\t"
+ "mov.b @(%0,%3), %1\n\t"
+ "tst %1, %1\n\t"
"bf/s 9b\n\t"
- " add #1,%0\n"
+ " add #1, %0\n"
"2:\n"
".section .fixup,\"ax\"\n"
"3:\n\t"
- "mov.l 4f,%1\n\t"
+ "mov.l 4f, %1\n\t"
"jmp @%1\n\t"
- " mov %5,%0\n"
+ " mov %5, %0\n"
".balign 4\n"
"4: .long 2b\n"
".previous\n"
diff --git a/include/asm-sh/unistd.h b/include/asm-sh/unistd.h
index 20f5f659b..baaff1798 100644
--- a/include/asm-sh/unistd.h
+++ b/include/asm-sh/unistd.h
@@ -227,6 +227,8 @@
#define __NR_setfsuid32 215
#define __NR_setfsgid32 216
#define __NR_pivot_root 217
+#define __NR_mincore 218
+#define __NR_madvise 219
/* user-visible error numbers are in the range -1 - -125: see <asm-sh/errno.h> */
diff --git a/include/asm-sh/user.h b/include/asm-sh/user.h
index 243cc04fd..6888368aa 100644
--- a/include/asm-sh/user.h
+++ b/include/asm-sh/user.h
@@ -30,16 +30,16 @@
*/
struct user_fpu_struct {
- unsigned long fp_regs[NUM_FPU_REGS];
- unsigned long xf_regs[NUM_FPU_REGS];
+ unsigned long fp_regs[16];
+ unsigned long long xd_regs[8];
unsigned long fpscr;
unsigned long fpul;
};
struct user {
struct pt_regs regs; /* entire machine state */
- struct user_fpu_struct fpu; /* Math Co-processor registers. */
- int u_fpvalid; /* True if math co-processor being used. */
+ struct user_fpu_struct fpu; /* Math Co-processor registers */
+ int u_fpvalid; /* True if math co-processor being used */
size_t u_tsize; /* text size (pages) */
size_t u_dsize; /* data size (pages) */
size_t u_ssize; /* stack size (pages) */
@@ -48,7 +48,7 @@ struct user {
unsigned long start_stack; /* stack starting address */
long int signal; /* signal causing core dump */
struct regs * u_ar0; /* help gdb find registers */
- struct user_fpu_struct* u_fpstate; /* Math Co-processor pointer. */
+ struct user_fpu_struct* u_fpstate; /* Math Co-processor pointer */
unsigned long magic; /* identifies a core file */
char u_comm[32]; /* user command name */
};