Subject: Illegal instruction - a workaround or fix ?

From: Florian Lohoff <[email-masked]>
Date: Sun, 11 Mar 2001 19:16:39 +0100

Hi,
i seem to get the illegal instruction stuff killed when
doing this.

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/03/11 16:11:30
@@ -111,13 +111,14 @@
 
 		((struct pt_regs *)&cmd)->regs[2] = tmp;
 		((struct pt_regs *)&cmd)->regs[7] = 0;
-
+#if 0
 		__asm__ __volatile__(
 			"move\t$29, %0\n\t"
 			"j\to32_ret_from_sys_call"
 			: /* No outputs */
 			: "r" (&cmd));
 		/* Unreached */
+#endif
 	}
 
 	case MIPS_FIXADE:

Could someone please explain me the difference betweeen "handle_sys"
which leads to "o32_ret_from_sys_call" and ... which leads to
"ret_from_sys_call".

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

---

From: Ralf Baechle <[email-masked]>
Date: Mon, 12 Mar 2001 12:21:34 +0100

Thanks, that was the hint I needed.  o32_ret_from_sys_call expects the
content of s-registers to be unchanged from userspace but sys_sysmips
clobbers them.

Below a patch from the famous ``Smoke This, It's Good For You (TM)''
series.  Lemme know if it helps.

  Ralf

--- arch/mips/kernel/sysmips.c	2001/02/09 21:05:46	1.17
+++ arch/mips/kernel/sysmips.c	2001/03/12 11:12:20
@@ -19,6 +19,7 @@
 
 #include <asm/cachectl.h>
 #include <asm/pgalloc.h>
+#include <asm/stackframe.h>
 #include <asm/sysmips.h>
 #include <asm/uaccess.h>
 
@@ -47,8 +48,9 @@
 	return address;
 }
 
-asmlinkage int
-sys_sysmips(int cmd, int arg1, int arg2, int arg3)
+save_static_function(sys_sysmips);
+static_unused int
+_sys_sysmips(int cmd, int arg1, int arg2, int arg3)
 {
 	int	*p;
 	char	*name;
@@ -114,7 +116,7 @@
 
 		__asm__ __volatile__(
 			"move\t$29, %0\n\t"
-			"j\to32_ret_from_sys_call"
+			"j\to32_ret_from_sys_call_restore_static"
 			: /* No outputs */
 			: "r" (&cmd));
 		/* Unreached */
--- arch/mips/kernel/scall_o32.S	2000/08/08 18:54:49	1.14
+++ arch/mips/kernel/scall_o32.S	2001/03/12 11:09:12
@@ -86,6 +86,10 @@
 	RESTORE_SOME
 	RESTORE_SP_AND_RET
 
+EXPORT(o32_ret_from_sys_call_restore_static)
+	RESTORE_STATIC
+	j	o32_ret_from_sys_call
+
 o32_handle_softirq:
 	jal	do_softirq
 	b	9b

---

From: Florian Lohoff <[email-masked]>
Date: Mon, 12 Mar 2001 14:41:31 +0100

> series.  Lemme know if it helps.

As mentioned on IRC - This "Oopses" for me ...

Flo