mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul Burton <paul.burton@imgtec.com>
To: <linux-mips@linux-mips.org>
Cc: Guenter Roeck <linux@roeck-us.net>,
	Matthew Fortune <matthew.fortune@imgtec.com>,
	Paul Burton <paul.burton@imgtec.com>,
	"Michael Ellerman" <mpe@ellerman.id.au>,
	<linux-kernel@vger.kernel.org>,
	"Richard Weinberger" <richard@nod.at>,
	Andy Lutomirski <luto@amacapital.net>,
	"Ralf Baechle" <ralf@linux-mips.org>,
	"Maciej W. Rozycki" <macro@codesourcery.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH v2 06/16] MIPS: skip odd double FP registers when copying FP32 sigcontext
Date: Mon, 27 Jul 2015 12:58:17 -0700	[thread overview]
Message-ID: <1438027107-24420-7-git-send-email-paul.burton@imgtec.com> (raw)
In-Reply-To: <1438027107-24420-1-git-send-email-paul.burton@imgtec.com>

When a task uses 32 bit floating point, the odd indexed 32b register
values are stored in bits 63:32 of the preceding even indexed 64b
FP register field in saved context. Thus there is no point in
preserving the odd indexed 64b register fields since they hold no
valid context. This patch will cause them to be skipped, as is
already done in arch/mips/kernel/signal32.c.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---

Changes in v2: None

 arch/mips/kernel/signal.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c
index 9c42c50..cc3a01f 100644
--- a/arch/mips/kernel/signal.c
+++ b/arch/mips/kernel/signal.c
@@ -69,8 +69,9 @@ static int copy_fp_to_sigcontext(void __user *sc)
 	uint32_t __user *csr = sc + abi->off_sc_fpc_csr;
 	int i;
 	int err = 0;
+	int inc = test_thread_flag(TIF_32BIT_FPREGS) ? 2 : 1;
 
-	for (i = 0; i < NUM_FPU_REGS; i++) {
+	for (i = 0; i < NUM_FPU_REGS; i += inc) {
 		err |=
 		    __put_user(get_fpr64(&current->thread.fpu.fpr[i], 0),
 			       &fpregs[i]);
@@ -87,9 +88,10 @@ static int copy_fp_from_sigcontext(void __user *sc)
 	uint32_t __user *csr = sc + abi->off_sc_fpc_csr;
 	int i;
 	int err = 0;
+	int inc = test_thread_flag(TIF_32BIT_FPREGS) ? 2 : 1;
 	u64 fpr_val;
 
-	for (i = 0; i < NUM_FPU_REGS; i++) {
+	for (i = 0; i < NUM_FPU_REGS; i += inc) {
 		err |= __get_user(fpr_val, &fpregs[i]);
 		set_fpr64(&current->thread.fpu.fpr[i], 0, fpr_val);
 	}
-- 
2.4.6


  parent reply	other threads:[~2015-07-27 20:00 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-27 19:58 [PATCH v2 00/16] MSA vector context signal handling & HWCAPs Paul Burton
2015-07-27 19:58 ` [PATCH v2 01/16] MIPS: remove outdated comments in sigcontext.h Paul Burton
2015-07-28  8:39   ` Ralf Baechle
2015-07-27 19:58 ` [PATCH v2 02/16] MIPS: simplify EVA FP context handling code Paul Burton
2015-07-27 19:58 ` [PATCH v2 03/16] MIPS: add offsets to sigcontext FP fields to struct mips_abi Paul Burton
2015-07-27 19:58 ` [PATCH v2 04/16] MIPS: use struct mips_abi offsets to save FP context Paul Burton
2015-07-27 19:58 ` [PATCH v2 05/16] MIPS: move FP usage checks into protected_{save,restore}_fp_context Paul Burton
2015-07-27 19:58 ` Paul Burton [this message]
2015-07-27 19:58 ` [PATCH v2 07/16] MIPS: use common FP sigcontext code for O32 compat Paul Burton
2015-07-27 19:58 ` [PATCH v2 08/16] MIPS: remove unused {get,put}_sigset functions Paul Burton
2015-07-27 19:58 ` [PATCH v2 09/16] MIPS: indicate FP mode in sigcontext sc_used_math Paul Burton
2015-07-27 19:58 ` [PATCH v2 10/16] MIPS: add definitions for extended context Paul Burton
2015-07-27 19:58 ` [PATCH v2 11/16] MIPS: save MSA extended context around signals Paul Burton
2015-07-27 19:58 ` [PATCH v2 12/16] MIPS: AT_HWCAP aux vector infrastructure Paul Burton
2015-07-27 19:58 ` [PATCH v2 13/16] MIPS: advertise MIPSr6 via HWCAP when appropriate Paul Burton
2015-07-27 19:58 ` [PATCH v2 14/16] MIPS: advertise MSA support via HWCAP when present Paul Burton
2015-07-27 19:58 ` [PATCH v2 15/16] MIPS: require O32 FP64 support for MIPS64 with O32 compat Paul Burton
2015-07-27 19:58 ` [PATCH v2 16/16] MIPS: drop EXPERIMENTAL tag from O32+FP64 & MSA Paul Burton

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=1438027107-24420-7-git-send-email-paul.burton@imgtec.com \
    --to=paul.burton@imgtec.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=linux@roeck-us.net \
    --cc=luto@amacapital.net \
    --cc=macro@codesourcery.com \
    --cc=matthew.fortune@imgtec.com \
    --cc=mpe@ellerman.id.au \
    --cc=ralf@linux-mips.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

all inboxes | Powered by JetHome®