aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc64/kernel/signal32.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sparc64/kernel/signal32.c')
-rw-r--r--arch/sparc64/kernel/signal32.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/arch/sparc64/kernel/signal32.c b/arch/sparc64/kernel/signal32.c
index 0f6b7b156efd..3f19e9af3d1b 100644
--- a/arch/sparc64/kernel/signal32.c
+++ b/arch/sparc64/kernel/signal32.c
@@ -269,7 +269,7 @@ void do_sigreturn32(struct pt_regs *regs)
269 regs->tstate |= psr_to_tstate_icc(psr); 269 regs->tstate |= psr_to_tstate_icc(psr);
270 270
271 /* Prevent syscall restart. */ 271 /* Prevent syscall restart. */
272 pt_regs_clear_trap_type(regs); 272 pt_regs_clear_syscall(regs);
273 273
274 err |= __get_user(fpu_save, &sf->fpu_save); 274 err |= __get_user(fpu_save, &sf->fpu_save);
275 if (fpu_save) 275 if (fpu_save)
@@ -355,7 +355,7 @@ asmlinkage void do_rt_sigreturn32(struct pt_regs *regs)
355 regs->tstate |= psr_to_tstate_icc(psr); 355 regs->tstate |= psr_to_tstate_icc(psr);
356 356
357 /* Prevent syscall restart. */ 357 /* Prevent syscall restart. */
358 pt_regs_clear_trap_type(regs); 358 pt_regs_clear_syscall(regs);
359 359
360 err |= __get_user(fpu_save, &sf->fpu_save); 360 err |= __get_user(fpu_save, &sf->fpu_save);
361 if (fpu_save) 361 if (fpu_save)
@@ -768,16 +768,24 @@ static inline void syscall_restart32(unsigned long orig_i0, struct pt_regs *regs
768 * mistake. 768 * mistake.
769 */ 769 */
770void do_signal32(sigset_t *oldset, struct pt_regs * regs, 770void do_signal32(sigset_t *oldset, struct pt_regs * regs,
771 struct signal_deliver_cookie *cookie) 771 int restart_syscall, unsigned long orig_i0)
772{ 772{
773 struct k_sigaction ka; 773 struct k_sigaction ka;
774 siginfo_t info; 774 siginfo_t info;
775 int signr; 775 int signr;
776 776
777 signr = get_signal_to_deliver(&info, &ka, regs, cookie); 777 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
778
779 /* If the debugger messes with the program counter, it clears
780 * the "in syscall" bit, directing us to not perform a syscall
781 * restart.
782 */
783 if (restart_syscall && !pt_regs_is_syscall(regs))
784 restart_syscall = 0;
785
778 if (signr > 0) { 786 if (signr > 0) {
779 if (cookie->restart_syscall) 787 if (restart_syscall)
780 syscall_restart32(cookie->orig_i0, regs, &ka.sa); 788 syscall_restart32(orig_i0, regs, &ka.sa);
781 handle_signal32(signr, &ka, &info, oldset, regs); 789 handle_signal32(signr, &ka, &info, oldset, regs);
782 790
783 /* a signal was successfully delivered; the saved 791 /* a signal was successfully delivered; the saved
@@ -789,16 +797,16 @@ void do_signal32(sigset_t *oldset, struct pt_regs * regs,
789 clear_thread_flag(TIF_RESTORE_SIGMASK); 797 clear_thread_flag(TIF_RESTORE_SIGMASK);
790 return; 798 return;
791 } 799 }
792 if (cookie->restart_syscall && 800 if (restart_syscall &&
793 (regs->u_regs[UREG_I0] == ERESTARTNOHAND || 801 (regs->u_regs[UREG_I0] == ERESTARTNOHAND ||
794 regs->u_regs[UREG_I0] == ERESTARTSYS || 802 regs->u_regs[UREG_I0] == ERESTARTSYS ||
795 regs->u_regs[UREG_I0] == ERESTARTNOINTR)) { 803 regs->u_regs[UREG_I0] == ERESTARTNOINTR)) {
796 /* replay the system call when we are done */ 804 /* replay the system call when we are done */
797 regs->u_regs[UREG_I0] = cookie->orig_i0; 805 regs->u_regs[UREG_I0] = orig_i0;
798 regs->tpc -= 4; 806 regs->tpc -= 4;
799 regs->tnpc -= 4; 807 regs->tnpc -= 4;
800 } 808 }
801 if (cookie->restart_syscall && 809 if (restart_syscall &&
802 regs->u_regs[UREG_I0] == ERESTART_RESTARTBLOCK) { 810 regs->u_regs[UREG_I0] == ERESTART_RESTARTBLOCK) {
803 regs->u_regs[UREG_G1] = __NR_restart_syscall; 811 regs->u_regs[UREG_G1] = __NR_restart_syscall;
804 regs->tpc -= 4; 812 regs->tpc -= 4;