From: Paul M. <le...@us...> - 2001-10-27 20:52:07
|
Update of /cvsroot/linux-mips/linux/arch/mips/kernel In directory usw-pr-cvs1:/tmp/cvs-serv30758/mips/kernel Modified Files: Makefile irix5sys.h scall_o32.S syscalls.h sysmips.c Log Message: sysmips syncups.. works fine on ITE board.. more testing probably needed. This brings us in sync with OSS on sysmips. Index: Makefile =================================================================== RCS file: /cvsroot/linux-mips/linux/arch/mips/kernel/Makefile,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- Makefile 2001/10/26 20:00:15 1.12 +++ Makefile 2001/10/27 20:52:05 1.13 @@ -15,10 +15,12 @@ O_TARGET := kernel.o +export-objs = pci-dma.o smp.o + obj-y += branch.o process.o signal.o entry.o \ traps.o ptrace.o vm86.o ioport.o reset.o \ semaphore.o setup.o syscall.o sysmips.o \ - ipc.o scall_o32.o unaligned.o fast-sysmips.o + ipc.o scall_o32.o unaligned.o obj-$(CONFIG_MODULES) += mips_ksyms.o obj-$(CONFIG_CPU_R3000) += r2300_fpu.o r2300_switch.o @@ -38,7 +40,6 @@ obj-$(CONFIG_CPU_MIPS64) += r4k_fpu.o r4k_switch.o obj-$(CONFIG_CPU_R6000) += r6000_fpu.o r4k_switch.o -export-objs += smp.o obj-$(CONFIG_SMP) += smp.o # Old style irq support, going to die in 2.5. @@ -57,7 +58,6 @@ obj-$(CONFIG_BINFMT_IRIX) += irixelf.o irixioctl.o irixsig.o sysirix.o \ irixinv.o obj-$(CONFIG_REMOTE_DEBUG) += gdb-low.o gdb-stub.o -export-objs += pci-dma.o obj-$(CONFIG_PCI) += pci-dma.o obj-$(CONFIG_PROC_FS) += proc.o @@ -68,6 +68,5 @@ entry.o: entry.S head.o: head.S -fast-sysmips.o: fast-sysmips.S include $(TOPDIR)/Rules.make Index: irix5sys.h =================================================================== RCS file: /cvsroot/linux-mips/linux/arch/mips/kernel/irix5sys.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- irix5sys.h 2001/09/25 03:36:35 1.3 +++ irix5sys.h 2001/10/27 20:52:05 1.4 @@ -68,7 +68,7 @@ SYS(irix_getgid, 0) /* 1047 getgid() V*/ SYS(irix_unimp, 0) /* 1048 (XXX IRIX 4 ssig) V*/ SYS(irix_msgsys, 6) /* 1049 sys_msgsys V*/ -SYS(fast_sysmips, 4) /* 1050 sysmips() HV*/ +SYS(sys_sysmips, 4) /* 1050 sysmips() HV*/ SYS(irix_unimp, 0) /* 1051 XXX sysacct() IV*/ SYS(irix_shmsys, 5) /* 1052 sys_shmsys V*/ SYS(irix_semsys, 0) /* 1053 sys_semsys V*/ Index: scall_o32.S =================================================================== RCS file: /cvsroot/linux-mips/linux/arch/mips/kernel/scall_o32.S,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- scall_o32.S 2001/09/04 16:43:46 1.5 +++ scall_o32.S 2001/10/27 20:52:05 1.6 @@ -3,7 +3,8 @@ * License. See the file "COPYING" in the main directory of this archive * for more details. * - * Copyright (C) 1997, 1998, 1999, 2000 by Ralf Baechle + * Copyright (C) 1997, 1998, 1999, 2000, 2001 by Ralf Baechle + * Copyright (C) 2001 MIPS Technologies, Inc. */ #include <asm/asm.h> #include <linux/errno.h> @@ -12,6 +13,7 @@ #include <asm/regdef.h> #include <asm/stackframe.h> #include <asm/isadep.h> +#include <asm/sysmips.h> #include <asm/unistd.h> /* This duplicates the definition from <linux/sched.h> */ @@ -192,3 +194,73 @@ sw t0, PT_R7(sp) j ret_from_sys_call END(handle_sys) + + LEAF(mips_atomic_set) + lw v1, THREAD_CURDS($28) + addiu a0, a1, 4 + or a0, a0, a1 + li v0, -EFAULT + and a0, a0, v1 + bltz a0, 8f + +#ifdef CONFIG_CPU_HAS_LLSC + /* Ok, this is the ll/sc case. World is sane :-) */ +1: ll v0, (a1) + move a0, a2 +2: sc a0, (a1) + beqz a0, 1b + + .section __ex_table,"a" + PTR 1b, bad_stack + PTR 2b, bad_stack + .previous +#else + sw a1, 16(sp) + sw a2, 20(sp) + + move a0, sp + move a2, a1 + li a1, 1 + jal do_page_fault + + lw a1, 16(sp) + lw a2, 20(sp) + + /* + * At this point the page should be readable and writable unless + * there was no more memory available. + */ +1: lw v0, (a1) +2: sw a2, (a1) + + .section __ex_table,"a" + PTR 1b, no_mem + PTR 2b, no_mem + .previous +#endif + + sw v0, PT_R2(sp) # result +1: + + /* Success, so skip usual error handling garbage. */ + lw t0, TASK_PTRACE($28) # syscall tracing enabled? + andi t0, PT_TRACESYS + bnez t0, 1f + b o32_ret_from_sys_call + +1: SAVE_STATIC + jal syscall_trace + li a3, 0 # success + j ret_from_sys_call + +no_mem: li v0, -ENOMEM + jr ra + +8: li v0, -EFAULT +9: jr ra + END(mips_atomic_set) + + LEAF(sys_sysmips) + beq a0, MIPS_ATOMIC_SET, mips_atomic_set + j _sys_sysmips + END(sys_sysmips) Index: syscalls.h =================================================================== RCS file: /cvsroot/linux-mips/linux/arch/mips/kernel/syscalls.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- syscalls.h 2001/08/13 22:08:37 1.3 +++ syscalls.h 2001/10/27 20:52:05 1.4 @@ -163,7 +163,7 @@ SYS(sys_writev, 3) SYS(sys_cacheflush, 3) SYS(sys_cachectl, 3) -SYS(fast_sysmips, 4) +SYS(sys_sysmips, 4) SYS(sys_ni_syscall, 0) /* 4150 */ SYS(sys_getsid, 1) SYS(sys_fdatasync, 0) Index: sysmips.c =================================================================== RCS file: /cvsroot/linux-mips/linux/arch/mips/kernel/sysmips.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- sysmips.c 2001/09/26 03:18:54 1.8 +++ sysmips.c 2001/10/27 20:52:05 1.9 @@ -1,11 +1,10 @@ /* - * MIPS specific syscalls - * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * - * Copyright (C) 1995, 1996, 1997, 2000 by Ralf Baechle + * Copyright (C) 1995, 1996, 1997, 2000, 2001 by Ralf Baechle + * Copyright (C) 2001 MIPS Technologies, Inc. */ #include <linux/config.h> #include <linux/errno.h> @@ -48,7 +47,7 @@ } asmlinkage int -sys_sysmips(int cmd, int arg1, int arg2, int arg3) +_sys_sysmips(int cmd, int arg1, int arg2, int arg3) { char *name; int tmp, len, retval; @@ -72,86 +71,11 @@ system_utsname.nodename[len] = '\0'; return 0; } - - 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 - if (err) { - info.si_signo = SIGSEGV; - info.si_code = SEGV_MAPERR; - goto fault; - } - - if ( (ret < 0) && (ret >= -EMAXERRNO) ) { - info.si_signo = SIGSYS; - info.si_code = 0; - goto fault; - } - - return ret; - -fault: - /* Go back to SYSCALL. */ - ((struct pt_regs *)&cmd)->cp0_epc -= 4; - - info.si_addr = (void *)((struct pt_regs *)&cmd)->cp0_epc; - force_sig_info(info.si_signo, &info, current); - - return 0; - } + case MIPS_ATOMIC_SET: + printk(KERN_CRIT "How did I get here?\n"); + retval = -EINVAL; + goto out; case MIPS_FIXADE: tmp = current->thread.mflags & ~3; |