Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Corey Minyard <minyard@acm.org>
To: linux-mips@linux-mips.org
Subject: [PATCH] MIPS: use thread flag to choose math emulator register mode
Date: Fri, 08 Feb 2008 13:03:16 -0600	[thread overview]
Message-ID: <20080208190316.GA27730@minyard.local> (raw)

From: Corey Minyard <cminyard@mvista.com>

If a processor does not have floating point support, then the
cp0_status FR bit will always be set to 0 according to the MIPS
documents.  So using that to tell if the userland is in 32 or 64 bit
register mode on a 64-bit processor is kind of pointless.

Instead, use the thread flag that are designed for this purpose.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
---

Index: linux-2.6.24/arch/mips/math-emu/cp1emu.c
===================================================================
--- linux-2.6.24.orig/arch/mips/math-emu/cp1emu.c
+++ linux-2.6.24/arch/mips/math-emu/cp1emu.c
@@ -178,18 +178,21 @@ static int isBranchInstr(mips_instructio
 #define FR_BIT 0
 #endif
 
+#define FR_64_BIT_SUPPORT (!test_thread_flag(TIF_32BIT_REGS))
+#define FR_32_BIT_REG_MASK (~(FR_64_BIT_SUPPORT == 0))
+
 #define SIFROMREG(si, x) ((si) = \
-			(xcp->cp0_status & FR_BIT) || !(x & 1) ? \
+			(FR_64_BIT_SUPPORT) || !(x & 1) ? \
 			(int)ctx->fpr[x] : \
 			(int)(ctx->fpr[x & ~1] >> 32 ))
-#define SITOREG(si, x)	(ctx->fpr[x & ~((xcp->cp0_status & FR_BIT) == 0)] = \
-			(xcp->cp0_status & FR_BIT) || !(x & 1) ? \
+#define SITOREG(si, x)	(ctx->fpr[x & FR_32_BIT_REG_MASK] = \
+			FR_64_BIT_SUPPORT || !(x & 1) ? \
 			ctx->fpr[x & ~1] >> 32 << 32 | (u32)(si) : \
 			ctx->fpr[x & ~1] << 32 >> 32 | (u64)(si) << 32)
 
 #define DIFROMREG(di, x) ((di) = \
-			ctx->fpr[x & ~((xcp->cp0_status & FR_BIT) == 0)])
-#define DITOREG(di, x)	(ctx->fpr[x & ~((xcp->cp0_status & FR_BIT) == 0)] \
+			ctx->fpr[x & FR_32_BIT_REG_MASK])
+#define DITOREG(di, x)	(ctx->fpr[x & FR_32_BIT_REG_MASK] \
 			= (di))
 
 #define SPFROMREG(sp, x) SIFROMREG((sp).bits, x)

                 reply	other threads:[~2008-02-08 19:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20080208190316.GA27730@minyard.local \
    --to=minyard@acm.org \
    --cc=linux-mips@linux-mips.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