public inbox for linux-m68k@lists.linux-m68k.org
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@linux-m68k.org>
To: Greg Ungerer <gerg@uclinux.org>
Cc: linux-m68k@vger.kernel.org
Subject: Re: [PATCH] m68k: use conventional function parameters for do_sigreturn
Date: Tue, 09 Feb 2016 00:31:54 +0100	[thread overview]
Message-ID: <871t8mkcd1.fsf@linux-m68k.org> (raw)
In-Reply-To: <56B17EA9.8020504@uclinux.org> (Greg Ungerer's message of "Wed, 3 Feb 2016 14:14:33 +1000")

Greg Ungerer <gerg@uclinux.org> writes:

> Attached is a test case - derived from the original signal.c code.

It looks like with all those trivial functions in the non-MMU case the
compiler sees enough to consider the writes to the (pseudo) function
arguments dead.

How about this:

diff --git a/arch/m68k/kernel/signal.c b/arch/m68k/kernel/signal.c
index af1c4f3..3cc9eaa 100644
--- a/arch/m68k/kernel/signal.c
+++ b/arch/m68k/kernel/signal.c
@@ -757,6 +757,11 @@ asmlinkage int do_sigreturn(unsigned long __unused)
 
 	if (restore_sigcontext(regs, &frame->sc, frame + 1))
 		goto badframe;
+	/*
+	 * Force a barrier so that the compiler does not consider writes
+	 * to *sw and *regs as dead.
+	 */
+	barrier();
 	return regs->d0;
 
 badframe:
@@ -781,6 +786,11 @@ asmlinkage int do_rt_sigreturn(unsigned long __unused)
 
 	if (rt_restore_ucontext(regs, sw, &frame->uc))
 		goto badframe;
+	/*
+	 * Force a barrier so that the compiler does not consider writes
+	 * to *sw and *regs as dead.
+	 */
+	barrier();
 	return regs->d0;
 
 badframe:

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

  reply	other threads:[~2016-02-08 23:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-19  5:56 [PATCH] m68k: use conventional function parameters for do_sigreturn Greg Ungerer
2016-02-01  4:33 ` Greg Ungerer
2016-02-01 18:39 ` Andreas Schwab
2016-02-01 23:59   ` Greg Ungerer
2016-02-02 19:25     ` Andreas Schwab
2016-02-03  4:14       ` Greg Ungerer
2016-02-08 23:31         ` Andreas Schwab [this message]
2016-02-09  0:21           ` Greg Ungerer
2016-02-09  9:48             ` Andreas Schwab
2016-02-09 13:05               ` Greg Ungerer
2016-02-09 13:17                 ` Andreas Schwab
2016-02-09 14:01                   ` Philippe De Muyter
2016-02-09 14:36                     ` Andreas Schwab
2016-02-09 15:26                       ` Philippe De Muyter

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=871t8mkcd1.fsf@linux-m68k.org \
    --to=schwab@linux-m68k.org \
    --cc=gerg@uclinux.org \
    --cc=linux-m68k@vger.kernel.org \
    /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