patch-2.4.9 linux/arch/arm/kernel/signal.c

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

diff -u --recursive --new-file v2.4.8/linux/arch/arm/kernel/signal.c linux/arch/arm/kernel/signal.c
@@ -327,16 +327,15 @@
 	/*
 	 * This is the X/Open sanctioned signal stack switching.
 	 */
-	if ((ka->sa.sa_flags & SA_ONSTACK) && ! on_sig_stack(sp))
+	if ((ka->sa.sa_flags & SA_ONSTACK) && sas_ss_flags(sp))
 		sp = current->sas_ss_sp + current->sas_ss_size;
 
 	/*
 	 * No matter what happens, 'sp' must be word
 	 * aligned otherwise nasty things could happen
 	 */
-	sp &= ~3;
-
-	return (void *)(sp - framesize);
+	/* ATPCS B01 mandates 8-byte alignment */
+	return (void *)((sp - framesize) & ~7);
 }
 
 static void setup_frame(int sig, struct k_sigaction *ka,
@@ -364,7 +363,7 @@
 		retcode = (unsigned long)ka->sa.sa_restorer;
 	} else {
 		retcode = (unsigned long)&frame->retcode;
-		err |= __put_user(SWI_SYS_SIGRETURN, &frame->retcode);
+		__put_user_error(SWI_SYS_SIGRETURN, &frame->retcode, err);
 		flush_icache_range(retcode, retcode + 4);
 	}
 
@@ -404,8 +403,8 @@
 	if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame)))
 		goto segv_and_exit;
 
-	err |= __put_user(&frame->info, &frame->pinfo);
-	err |= __put_user(&frame->uc, &frame->puc);
+	__put_user_error(&frame->info, &frame->pinfo, err);
+	__put_user_error(&frame->uc, &frame->puc, err);
 	err |= copy_siginfo_to_user(&frame->info, info);
 
 	/* Clear all the bits of the ucontext we don't use.  */
@@ -421,7 +420,7 @@
 		retcode = (unsigned long)ka->sa.sa_restorer;
 	} else {
 		retcode = (unsigned long)&frame->retcode;
-		err |= __put_user(SWI_SYS_RT_SIGRETURN, &frame->retcode);
+		__put_user_error(SWI_SYS_RT_SIGRETURN, &frame->retcode, err);
 		flush_icache_range(retcode, retcode + 4);
 	}
 
@@ -432,6 +431,15 @@
 		regs->ARM_r0 = current->exec_domain->signal_invmap[sig];
 	else
 		regs->ARM_r0 = sig;
+
+	/*
+	 * For realtime signals we must also set the second and third
+	 * arguments for the signal handler.
+	 *   -- Peter Maydell <pmaydell@chiark.greenend.org.uk> 2000-12-06
+	 */
+	regs->ARM_r1 = (unsigned long)frame->pinfo;
+	regs->ARM_r2 = (unsigned long)frame->puc;
+
 	regs->ARM_sp = (unsigned long)frame;
 	regs->ARM_lr = retcode;
 	regs->ARM_pc = (unsigned long)ka->sa.sa_handler;

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