Subject: Re: [FIX] sysmips(MIPS_ATMIC_SET, ...) ret_from_sys_call vs. o32_ret_from_sys_call

From: Florian Lohoff <[email-masked]>
Date: Thu, 5 Apr 2001 00:13:29 +0200

On Thu, Jan 25, 2001 at 02:19:52PM -0800, Ralf Baechle wrote:
> It's more:
> 
> sysmips(MIPS_ATOMIC_SET, ptr, val)
> {
> 	result = *ptr;
> 	*ptr = val;
> 
> 	return result;
> }

If thats the case - shouldnt the attached patch fix the sysmips stuff ?
I stumbled once again over sysmips - To get a MIPS ISA I compatible
glibc 2.2.2 you need to compile it with sysmips(MIPS_ATOMIC_SET, ...)
which breaks badly with "Illegal Instruction" on current cvs kernels.

Index: arch/mips/kernel/sysmips.c
===================================================================
RCS file: /cvs/linux/arch/mips/kernel/sysmips.c,v
retrieving revision 1.17
diff -u -r1.17 sysmips.c
--- arch/mips/kernel/sysmips.c	2001/02/09 21:05:46	1.17
+++ arch/mips/kernel/sysmips.c	2001/04/04 22:09:18
@@ -75,7 +75,6 @@
 	}
 
 	case MIPS_ATOMIC_SET: {
-		unsigned int tmp;
 
 		p = (int *) arg1;
 		errno = verify_area(VERIFY_WRITE, p, sizeof(*p));
@@ -98,7 +97,7 @@
 			".word\t1b, 3b\n\t"
 			".word\t2b, 3b\n\t"
 			".previous\n\t"
-			: "=&r" (tmp), "=o" (* (u32 *) p), "=r" (errno)
+			: "=&r" (retval), "=o" (* (u32 *) p), "=r" (errno)
 			: "r" (arg2), "o" (* (u32 *) p), "2" (errno)
 			: "$1");
 
@@ -109,15 +108,7 @@
 		if (current->ptrace & PT_TRACESYS)
 			syscall_trace();
 
-		((struct pt_regs *)&cmd)->regs[2] = tmp;
-		((struct pt_regs *)&cmd)->regs[7] = 0;
-
-		__asm__ __volatile__(
-			"move\t$29, %0\n\t"
-			"j\to32_ret_from_sys_call"
-			: /* No outputs */
-			: "r" (&cmd));
-		/* Unreached */
+		goto out;
 	}
 
 	case MIPS_FIXADE:

What makes me wonder is that we try to return -EFAULT and stuff
which then limits the values for MIPS_ATOMIC_SET to positive ints. 
I dont think this is correct.

Comments ?

Flo
-- 
Florian Lohoff                  [email-masked]             +49-5201-669912
     Why is it called "common sense" when nobody seems to have any?