Update of /cvsroot/linux-mips/linux/arch/mips/kernel
In directory usw-pr-cvs1:/tmp/cvs-serv5739/arch/mips/kernel
Modified Files:
irix5sys.h sysmips.c
Log Message:
Sync with OSS 2.4.9.
Index: irix5sys.h
===================================================================
RCS file: /cvsroot/linux-mips/linux/arch/mips/kernel/irix5sys.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- irix5sys.h 2001/08/13 22:06:18 1.2
+++ irix5sys.h 2001/09/25 03:36:35 1.3
@@ -1,5 +1,4 @@
-/* $Id$
- *
+/*
* irix5sys.h: 32-bit IRIX5 ABI system call table.
*
* Copyright (C) 1996 David S. Miller (dm...@en...)
Index: sysmips.c
===================================================================
RCS file: /cvsroot/linux-mips/linux/arch/mips/kernel/sysmips.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- sysmips.c 2001/08/23 23:27:14 1.6
+++ sysmips.c 2001/09/25 03:36:35 1.7
@@ -50,8 +50,9 @@
asmlinkage int
sys_sysmips(int cmd, int arg1, int arg2, int arg3)
{
+ int *p;
char *name;
- int tmp, len, retval;
+ int tmp, len, retval, errno;
switch(cmd) {
case SETNAME: {
@@ -74,83 +75,53 @@
}
case MIPS_ATOMIC_SET: {
- int *ptr, val, ret, err, tmp;
- struct siginfo info;
-
- ptr = (int *)arg1;
- val = (int)arg2;
-
- /* Don't emulate unaligned accesses. */
- if ((int)ptr & 3) {
- info.si_signo = SIGBUS;
- info.si_code = BUS_ADRALN;
- goto fault;
- }
-
- /* A zero here saves us three instructions. */
- err = verify_area(VERIFY_WRITE, ptr, 0);
- if (err) {
- info.si_signo = SIGSEGV;
- info.si_code = SEGV_ACCERR;
- goto fault;
- }
-
#ifdef CONFIG_CPU_HAS_LLSC
- __asm__(".set mips2\n\t"
- "1:\n\t"
- "ll %0,%5\n\t"
- ".set push\n\t"
- ".set noreorder\n\t"
- "beq %0,%4,3f\n\t"
- " move %3,%4\n"
- ".set pop\n\t"
- "2:\n\t"
- "sc %3,%1\n\t"
- "beqz %3,1b\n\t"
- "3:\n\t"
- ".set mips0\n\t"
- ".section .fixup,\"ax\"\n"
- "4:\n\t"
- "li %2,%7\n\t"
- "j 3b\n\t"
- ".previous\n\t"
- ".section __ex_table,\"a\"\n\t"
- ".word 1b,4b\n\t"
- ".word 2b,4b\n\t"
- ".previous"
- : "=&r" (ret), "=m" (*ptr), "=r" (err), "=&r" (tmp)
- : "r" (val), "1" (*ptr), "2" (0), "i" (-EFAULT));
-#else
- save_and_cli(tmp);
- err = __get_user(ret, ptr);
- if (ret != val)
- err |= __put_user(val, ptr); /* No fault
- unless unwriteable. */
- restore_flags(tmp);
-#endif
+ unsigned int tmp;
- if (err) {
- info.si_signo = SIGSEGV;
- info.si_code = SEGV_MAPERR;
- goto fault;
- }
+ p = (int *) arg1;
+ errno = verify_area(VERIFY_WRITE, p, sizeof(*p));
+ if (errno)
+ return errno;
+ errno = 0;
- if ( (ret < 0) && (ret >= -EMAXERRNO) ) {
- info.si_signo = SIGSYS;
- info.si_code = 0;
- goto fault;
- }
+ __asm__(".set\tpush\t\t\t# sysmips(MIPS_ATOMIC, ...)\n\t"
+ ".set\tmips2\n\t"
+ ".set\tnoat\n\t"
+ "1:\tll\t%0, %4\n\t"
+ "move\t$1, %3\n\t"
+ "2:\tsc\t$1, %1\n\t"
+ "beqz\t$1, 1b\n\t"
+ ".set\tpop\n\t"
+ ".section\t.fixup,\"ax\"\n"
+ "3:\tli\t%2, 1\t\t\t# error\n\t"
+ ".previous\n\t"
+ ".section\t__ex_table,\"a\"\n\t"
+ ".word\t1b, 3b\n\t"
+ ".word\t2b, 3b\n\t"
+ ".previous\n\t"
+ : "=&r" (tmp), "=o" (* (u32 *) p), "=r" (errno)
+ : "r" (arg2), "o" (* (u32 *) p), "2" (errno)
+ : "$1");
- return ret;
+ if (errno)
+ return -EFAULT;
-fault:
- /* Go back to SYSCALL. */
- ((struct pt_regs *)&cmd)->cp0_epc -= 4;
+ /* We're skipping error handling etc. */
+ if (current->ptrace & PT_TRACESYS)
+ syscall_trace();
- info.si_addr = (void *)((struct pt_regs *)&cmd)->cp0_epc;
- force_sig_info(info.si_signo, &info, current);
+ ((struct pt_regs *)&cmd)->regs[2] = tmp;
+ ((struct pt_regs *)&cmd)->regs[7] = 0;
- return 0;
+ __asm__ __volatile__(
+ "move\t$29, %0\n\t"
+ "j\to32_ret_from_sys_call"
+ : /* No outputs */
+ : "r" (&cmd));
+ /* Unreached */
+#else
+ printk("sys_sysmips(MIPS_ATOMIC_SET, ...) not ready for !CONFIG_CPU_HAS_LLSC\n");
+#endif
}
case MIPS_FIXADE:
|