summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/mips/include/uapi/asm/sigcontext.h9
-rw-r--r--arch/mips/kernel/signal.c15
2 files changed, 20 insertions, 4 deletions
diff --git a/arch/mips/include/uapi/asm/sigcontext.h b/arch/mips/include/uapi/asm/sigcontext.h
index 9081d88..28f51bb 100644
--- a/arch/mips/include/uapi/asm/sigcontext.h
+++ b/arch/mips/include/uapi/asm/sigcontext.h
@@ -12,6 +12,15 @@
#include <linux/types.h>
#include <asm/sgidefs.h>
+/* scalar FP context was used */
+#define USED_FP (1 << 0)
+
+/* the value of Status.FR when context was saved */
+#define USED_FR1 (1 << 1)
+
+/* FR=1, but with odd singles in bits 63:32 of preceding even double */
+#define USED_HYBRID_FPRS (1 << 2)
+
#if _MIPS_SIM == _MIPS_SIM_ABI32
/*
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c
index 08f5215..9cb75e9 100644
--- a/arch/mips/kernel/signal.c
+++ b/arch/mips/kernel/signal.c
@@ -133,9 +133,16 @@ int protected_save_fp_context(void __user *sc)
unsigned int used;
int err;
- used = !!used_math();
+ used = used_math() ? USED_FP : 0;
+ if (used) {
+ if (!test_thread_flag(TIF_32BIT_FPREGS))
+ used |= USED_FR1;
+ if (test_thread_flag(TIF_HYBRID_FPREGS))
+ used |= USED_HYBRID_FPRS;
+ }
+
err = __put_user(used, used_math);
- if (err || !used)
+ if (err || !(used & USED_FP))
return err;
/*
@@ -177,13 +184,13 @@ int protected_restore_fp_context(void __user *sc)
int err, sig, tmp __maybe_unused;
err = __get_user(used, used_math);
- conditional_used_math(used);
+ conditional_used_math(used & USED_FP);
/*
* The signal handler may have used FPU; give it up if the program
* doesn't want it following sigreturn.
*/
- if (err || !used) {
+ if (err || !(used & USED_FP)) {
lose_fpu(0);
return err;
}
OpenPOWER on IntegriCloud