Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9e4930db authored by Al Viro's avatar Al Viro Committed by Geert Uytterhoeven
Browse files

m68k: Simplify the singlestepping handling in signals



Instead of checking the return value of do_signal() we can just do
the work (raise SIGTRAP and clear SR.T1) directly in handle_signal(),
when setting the sigframe up.  Simplifies the assembler glue and is
closer to the way we do it on other targets.

Note that do_delayed_trace does *not* disappear; it's still needed
to deal with single-stepping through syscall, since 68040 doesn't
raise the trace exception at all if the trap exception is pending.
We hit it after returning from sys_...() if TIF_DELAYED_TRACE is
set; all that has changed is that we don't reuse it for "single-step
into the handler" codepath.

As the result, do_signal() doesn't need to return anything anymore.

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
parent e68847fe
Loading
Loading
Loading
Loading
+1 −5
Original line number Original line Diff line number Diff line
@@ -178,11 +178,7 @@ do_signal_return:
	addql	#4,%sp
	addql	#4,%sp
	RESTORE_SWITCH_STACK
	RESTORE_SWITCH_STACK
	addql	#4,%sp
	addql	#4,%sp
	tstl	%d0
	jbra	resume_userspace
	jeq	resume_userspace
	| when single stepping into handler stop at the first insn
	btst	#6,%curptr@(TASK_INFO+TINFO_FLAGS+2)
	jeq	resume_userspace


do_delayed_trace:
do_delayed_trace:
	bclr	#7,%sp@(PT_OFF_SR)	| clear trace bit in SR
	bclr	#7,%sp@(PT_OFF_SR)	| clear trace bit in SR
+7 −4
Original line number Original line Diff line number Diff line
@@ -978,6 +978,11 @@ handle_signal(int sig, struct k_sigaction *ka, siginfo_t *info,
	if (!(ka->sa.sa_flags & SA_NODEFER))
	if (!(ka->sa.sa_flags & SA_NODEFER))
		sigaddset(&current->blocked,sig);
		sigaddset(&current->blocked,sig);
	recalc_sigpending();
	recalc_sigpending();

	if (test_thread_flag(TIF_DELAYED_TRACE)) {
		regs->sr &= ~0x8000;
		send_sig(SIGTRAP, current, 1);
	}
}
}


/*
/*
@@ -985,7 +990,7 @@ handle_signal(int sig, struct k_sigaction *ka, siginfo_t *info,
 * want to handle. Thus you cannot kill init even with a SIGKILL even by
 * want to handle. Thus you cannot kill init even with a SIGKILL even by
 * mistake.
 * mistake.
 */
 */
asmlinkage int do_signal(struct pt_regs *regs)
asmlinkage void do_signal(struct pt_regs *regs)
{
{
	siginfo_t info;
	siginfo_t info;
	struct k_sigaction ka;
	struct k_sigaction ka;
@@ -1004,7 +1009,7 @@ asmlinkage int do_signal(struct pt_regs *regs)
		/* Whee!  Actually deliver the signal.  */
		/* Whee!  Actually deliver the signal.  */
		handle_signal(signr, &ka, &info, oldset, regs);
		handle_signal(signr, &ka, &info, oldset, regs);
		clear_thread_flag(TIF_RESTORE_SIGMASK);
		clear_thread_flag(TIF_RESTORE_SIGMASK);
		return 1;
		return;
	}
	}


	/* Did we come from a system call? */
	/* Did we come from a system call? */
@@ -1017,6 +1022,4 @@ asmlinkage int do_signal(struct pt_regs *regs)
		clear_thread_flag(TIF_RESTORE_SIGMASK);
		clear_thread_flag(TIF_RESTORE_SIGMASK);
		sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
		sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
	}
	}

	return 0;
}
}