summaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel/elf.c
diff options
context:
space:
mode:
authorMaciej W. Rozycki2015-11-13 01:48:29 +0100
committerRalf Baechle2016-01-20 00:39:20 +0100
commit503943e0e52bd3fbf014aa1d838ced37adb43121 (patch)
treec38c3f702cc313d40c27caa9531370b24943aaeb /arch/mips/kernel/elf.c
parentMIPS: Determine the presence of IEEE Std 754-2008 features (diff)
downloadkernel-qcow2-linux-503943e0e52bd3fbf014aa1d838ced37adb43121.tar.gz
kernel-qcow2-linux-503943e0e52bd3fbf014aa1d838ced37adb43121.tar.xz
kernel-qcow2-linux-503943e0e52bd3fbf014aa1d838ced37adb43121.zip
MIPS: Add IEEE Std 754 conformance mode selection
Add an `ieee754=' kernel parameter to control IEEE Std 754 conformance mode. Use separate flags copied from the respective CPU feature flags, and adjusted according to the conformance mode selected, to make binaries requesting individual NaN encoding modes accepted or rejected as needed. Update the initial setting for FCSR and, in the full FPU emulation mode, its read-only mask accordingly. Accept the mode selection requested for legacy processors as well. As with the EF_MIPS_NAN2008 ELF file header flag adjust both ABS2008 and NAN2008 bits at the same time, to match the choice made for hardware currently implemented. Signed-off-by: Maciej W. Rozycki <macro@imgtec.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Matthew Fortune <Matthew.Fortune@imgtec.com> Cc: linux-mips@linux-mips.org Cc: linux-kernel@vger.kernel.org Patchwork: https://patchwork.linux-mips.org/patch/11481/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/kernel/elf.c')
-rw-r--r--arch/mips/kernel/elf.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/arch/mips/kernel/elf.c b/arch/mips/kernel/elf.c
index f36a261b275c..c3c234dc0c07 100644
--- a/arch/mips/kernel/elf.c
+++ b/arch/mips/kernel/elf.c
@@ -13,6 +13,10 @@
#include <asm/cpu-info.h>
+/* Whether to accept legacy-NaN and 2008-NaN user binaries. */
+bool mips_use_nan_legacy;
+bool mips_use_nan_2008;
+
/* FPU modes */
enum {
FP_FRE,
@@ -150,16 +154,16 @@ int arch_check_elf(void *_ehdr, bool has_interpreter, void *_interp_ehdr,
flags = elf32 ? ehdr->e32.e_flags : ehdr->e64.e_flags;
/*
- * Determine the NaN personality, reject the binary if no hardware
- * support. Also ensure that any interpreter matches the executable.
+ * Determine the NaN personality, reject the binary if not allowed.
+ * Also ensure that any interpreter matches the executable.
*/
if (flags & EF_MIPS_NAN2008) {
- if (cpu_has_nan_2008)
+ if (mips_use_nan_2008)
state->nan_2008 = 1;
else
return -ENOEXEC;
} else {
- if (cpu_has_nan_legacy)
+ if (mips_use_nan_legacy)
state->nan_2008 = 0;
else
return -ENOEXEC;