patch-2.3.13 linux/arch/m68k/kernel/signal.c

Next file: linux/arch/m68k/kernel/traps.c
Previous file: linux/arch/m68k/kernel/ptrace.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.12/linux/arch/m68k/kernel/signal.c linux/arch/m68k/kernel/signal.c
@@ -156,6 +156,9 @@
 
 /*
  * Do a signal return; undo the signal stack.
+ *
+ * Keep the return code on the stack quadword aligned!
+ * That makes the cache flush below easier.
  */
 
 struct sigframe
@@ -175,9 +178,9 @@
 	int sig;
 	struct siginfo *pinfo;
 	void *puc;
+	char retcode[8];
 	struct siginfo info;
 	struct ucontext uc;
-	char retcode[8];
 };
 
 
@@ -478,7 +481,7 @@
 	struct switch_stack *sw = (struct switch_stack *) &__unused;
 	struct pt_regs *regs = (struct pt_regs *) (sw + 1);
 	unsigned long usp = rdusp();
-	struct sigframe *frame = (struct sigframe *)(usp - 24);
+	struct sigframe *frame = (struct sigframe *)(usp - 4);
 	sigset_t set;
 	int d0;
 
@@ -677,25 +680,6 @@
 				      "cpushl %%bc,(%0)\n\t"
 				      ".chip 68k"
 				      : : "a" (temp));
-		if (((vaddr + 8) ^ vaddr) & ~15) {
-			if (((vaddr + 8) ^ vaddr) & PAGE_MASK)
-				__asm__ __volatile__ (".chip 68040\n\t"
-						      "nop\n\t"
-						      "ptestr (%1)\n\t"
-						      "movec %%mmusr,%0\n\t"
-						      ".chip 68k"
-						      : "=r" (temp)
-						      : "a" (vaddr + 8));
-
-			temp &= PAGE_MASK;
-			temp |= (vaddr + 8) & ~PAGE_MASK;
-
-			__asm__ __volatile__ (".chip 68040\n\t"
-					      "nop\n\t"
-					      "cpushl %%bc,(%0)\n\t"
-					      ".chip 68k"
-					      : : "a" (temp));
-		}
 	}
 	else if (CPU_IS_060) {
 		unsigned long temp;
@@ -708,18 +692,6 @@
 				      "cpushl %%bc,(%0)\n\t"
 				      ".chip 68k"
 				      : : "a" (temp));
-		if (((vaddr + 8) ^ vaddr) & ~15) {
-			if (((vaddr + 8) ^ vaddr) & PAGE_MASK)
-				__asm__ __volatile__ (".chip 68060\n\t"
-						      "plpar (%0)\n\t"
-						      ".chip 68k"
-						      : "=a" (temp)
-						      : "0" (vaddr + 8));
-			__asm__ __volatile__ (".chip 68060\n\t"
-					      "cpushl %%bc,(%0)\n\t"
-					      ".chip 68k"
-					      : : "a" (temp));
-		}
 	}
 	else {
 		/*
@@ -797,11 +769,9 @@
 
 	/* Set up to return from userspace.  */
 	err |= __put_user(frame->retcode, &frame->pretcode);
-	/* addaw #20,sp */
-	err |= __put_user(0xdefc0014, (long *)(frame->retcode + 0));
 	/* moveq #,d0; trap #0 */
 	err |= __put_user(0x70004e40 + (__NR_sigreturn << 16),
-			  (long *)(frame->retcode + 4));
+			  (long *)(frame->retcode));
 
 	if (err)
 		goto give_sigsegv;
@@ -881,10 +851,10 @@
 
 	/* Set up to return from userspace.  */
 	err |= __put_user(frame->retcode, &frame->pretcode);
-	/* movel #,d0; trap #0 */
-	err |= __put_user(0x203c, (short *)(frame->retcode + 0));
-	err |= __put_user(__NR_rt_sigreturn, (long *)(frame->retcode + 2));
-	err |= __put_user(0x4e40, (short *)(frame->retcode + 6));
+	/* moveq #,d0; notb d0; trap #0 */
+	err |= __put_user(0x70004600 + ((__NR_rt_sigreturn ^ 0xff) << 16),
+			  (long *)(frame->retcode + 0));
+	err |= __put_user(0x4e40, (short *)(frame->retcode + 4));
 
 	if (err)
 		goto give_sigsegv;
@@ -964,11 +934,10 @@
 	if (ka->sa.sa_flags & SA_ONESHOT)
 		ka->sa.sa_handler = SIG_DFL;
 
-	if (!(ka->sa.sa_flags & SA_NODEFER)) {
-		sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
+	sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
+	if (!(ka->sa.sa_flags & SA_NODEFER))
 		sigaddset(&current->blocked,sig);
-		recalc_sigpending(current);
-	}
+	recalc_sigpending(current);
 }
 
 /*
@@ -985,7 +954,7 @@
 	siginfo_t info;
 	struct k_sigaction *ka;
 
-	current->tss.esp0 = (unsigned long) regs;
+	current->thread.esp0 = (unsigned long) regs;
 
 	if (!oldset)
 		oldset = &current->blocked;
@@ -1090,6 +1059,7 @@
 
 			default:
 				sigaddset(&current->signal, signr);
+				recalc_sigpending(current);
 				current->flags |= PF_SIGNALED;
 				do_exit(exit_code);
 				/* NOTREACHED */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)