linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lennox Wu <lennox.wu@gmail.com>
To: Richard Weinberger <richard@nod.at>,
	linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org
Subject: Re: [PATCH 21/29] score: Use get_signal() signal_setup_done()
Date: Sat, 19 Oct 2013 02:26:04 +0800	[thread overview]
Message-ID: <52617D3C.1060702@gmail.com> (raw)
In-Reply-To: <1381232085-4288-2-git-send-email-richard@nod.at>

[-- Attachment #1: Type: text/plain, Size: 4215 bytes --]

It's fine for Score. Pass the compiling and other tests.
Thank you.
Acked-by: Lennox Wu <lennox.wu@gmail.com>

於 2013/10/8 下午 07:34, Richard Weinberger 提到:
> Use the more generic functions get_signal() signal_setup_done()
> for signal delivery.
>
> Signed-off-by: Richard Weinberger <richard@nod.at>
> ---
>  arch/score/kernel/signal.c | 43 ++++++++++++++++++-------------------------
>  1 file changed, 18 insertions(+), 25 deletions(-)
>
> diff --git a/arch/score/kernel/signal.c b/arch/score/kernel/signal.c
> index a00fba3..1651807 100644
> --- a/arch/score/kernel/signal.c
> +++ b/arch/score/kernel/signal.c
> @@ -173,15 +173,15 @@ badframe:
>  	return 0;
>  }
>  
> -static int setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs,
> -		int signr, sigset_t *set, siginfo_t *info)
> +static int setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs,
> +			  sigset_t *set)
>  {
>  	struct rt_sigframe __user *frame;
>  	int err = 0;
>  
> -	frame = get_sigframe(ka, regs, sizeof(*frame));
> +	frame = get_sigframe(&ksig->ka, regs, sizeof(*frame));
>  	if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
> -		goto give_sigsegv;
> +		return -EFAULT;
>  
>  	/*
>  	 * Set up the return code ...
> @@ -194,7 +194,7 @@ static int setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs,
>  	err |= __put_user(0x80008002, frame->rs_code + 1);
>  	flush_cache_sigtramp((unsigned long) frame->rs_code);
>  
> -	err |= copy_siginfo_to_user(&frame->rs_info, info);
> +	err |= copy_siginfo_to_user(&frame->rs_info, &ksig->info);
>  	err |= __put_user(0, &frame->rs_uc.uc_flags);
>  	err |= __put_user(NULL, &frame->rs_uc.uc_link);
>  	err |= __save_altstack(&frame->rs_uc.uc_stack, regs->regs[0]);
> @@ -202,26 +202,23 @@ static int setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs,
>  	err |= __copy_to_user(&frame->rs_uc.uc_sigmask, set, sizeof(*set));
>  
>  	if (err)
> -		goto give_sigsegv;
> +		return -EFAULT;
>  
>  	regs->regs[0] = (unsigned long) frame;
>  	regs->regs[3] = (unsigned long) frame->rs_code;
> -	regs->regs[4] = signr;
> +	regs->regs[4] = ksig->sig;
>  	regs->regs[5] = (unsigned long) &frame->rs_info;
>  	regs->regs[6] = (unsigned long) &frame->rs_uc;
> -	regs->regs[29] = (unsigned long) ka->sa.sa_handler;
> -	regs->cp0_epc = (unsigned long) ka->sa.sa_handler;
> +	regs->regs[29] = (unsigned long) ksig->ka.sa.sa_handler;
> +	regs->cp0_epc = (unsigned long) ksig->ka.sa.sa_handler;
>  
>  	return 0;
> -
> -give_sigsegv:
> -	force_sigsegv(signr, current);
> -	return -EFAULT;
>  }
>  
> -static void handle_signal(unsigned long sig, siginfo_t *info,
> -	struct k_sigaction *ka, struct pt_regs *regs)
> +static void handle_signal(struct ksignal *ksig, struct pt_regs *regs)
>  {
> +	int ret;
> +
>  	if (regs->is_syscall) {
>  		switch (regs->regs[4]) {
>  		case ERESTART_RESTARTBLOCK:
> @@ -229,7 +226,7 @@ static void handle_signal(unsigned long sig, siginfo_t *info,
>  			regs->regs[4] = EINTR;
>  			break;
>  		case ERESTARTSYS:
> -			if (!(ka->sa.sa_flags & SA_RESTART)) {
> +			if (!(ksig->ka.sa.sa_flags & SA_RESTART)) {
>  				regs->regs[4] = EINTR;
>  				break;
>  			}
> @@ -245,17 +242,14 @@ static void handle_signal(unsigned long sig, siginfo_t *info,
>  	/*
>  	 * Set up the stack frame
>  	 */
> -	if (setup_rt_frame(ka, regs, sig, sigmask_to_save(), info) < 0)
> -		return;
> +	ret = setup_rt_frame(ksig, regs, sigmask_to_save());
>  
> -	signal_delivered(sig, info, ka, regs, 0);
> +	signal_setup_done(ret, ksig, 0);
>  }
>  
>  static void do_signal(struct pt_regs *regs)
>  {
> -	struct k_sigaction ka;
> -	siginfo_t info;
> -	int signr;
> +	struct ksignal ksig;
>  
>  	/*
>  	 * We want the common case to go fast, which is why we may in certain
> @@ -265,10 +259,9 @@ static void do_signal(struct pt_regs *regs)
>  	if (!user_mode(regs))
>  		return;
>  
> -	signr = get_signal_to_deliver(&info, &ka, regs, NULL);
> -	if (signr > 0) {
> +	if (get_signal(&ksig)) {
>  		/* Actually deliver the signal.  */
> -		handle_signal(signr, &info, &ka, regs);
> +		handle_signal(&ksig, regs);
>  		return;
>  	}
>  



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 544 bytes --]

  parent reply	other threads:[~2013-10-18 18:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-08 11:34 [PATCH 20/29] s390: Use get_signal() signal_setup_done() Richard Weinberger
2013-10-08 11:34 ` Richard Weinberger
2013-10-08 11:34 ` [PATCH 21/29] score: " Richard Weinberger
2013-10-08 11:34   ` Richard Weinberger
2013-10-18 18:26   ` Lennox Wu [this message]
2013-10-08 11:34 ` [PATCH 22/29] sh: " Richard Weinberger
2013-10-08 11:34   ` Richard Weinberger
2013-10-08 11:34 ` [PATCH 23/29] tile: " Richard Weinberger
2013-10-08 11:34   ` Richard Weinberger
2013-10-08 11:34 ` [PATCH 24/29] um: " Richard Weinberger
2013-10-08 11:34 ` [PATCH 25/29] unicore32: " Richard Weinberger
2013-10-08 11:34   ` Richard Weinberger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52617D3C.1060702@gmail.com \
    --to=lennox.wu@gmail.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=richard@nod.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).