aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/mips/Kconfig.debug13
-rw-r--r--arch/mips/kernel/elf.c18
2 files changed, 31 insertions, 0 deletions
diff --git a/arch/mips/Kconfig.debug b/arch/mips/Kconfig.debug
index 3a2b775e8458..88a9f433f6fc 100644
--- a/arch/mips/Kconfig.debug
+++ b/arch/mips/Kconfig.debug
@@ -122,4 +122,17 @@ config SPINLOCK_TEST
help
Add several files to the debugfs to test spinlock speed.
+config FP32XX_HYBRID_FPRS
+ bool "Run FP32 & FPXX code with hybrid FPRs"
+ depends on MIPS_O32_FP64_SUPPORT
+ help
+ The hybrid FPR scheme is normally used only when a program needs to
+ execute a mix of FP32 & FP64A code, since the trapping & emulation
+ that it entails is expensive. When enabled, this option will lead
+ to the kernel running programs which use the FP32 & FPXX FP ABIs
+ using the hybrid FPR scheme, which can be useful for debugging
+ purposes.
+
+ If unsure, say N.
+
endmenu
diff --git a/arch/mips/kernel/elf.c b/arch/mips/kernel/elf.c
index 0933e0726f64..c92b15df6893 100644
--- a/arch/mips/kernel/elf.c
+++ b/arch/mips/kernel/elf.c
@@ -134,6 +134,24 @@ int arch_check_elf(void *_ehdr, bool has_interpreter,
void mips_set_personality_fp(struct arch_elf_state *state)
{
+ if (config_enabled(CONFIG_FP32XX_HYBRID_FPRS)) {
+ /*
+ * Use hybrid FPRs for all code which can correctly execute
+ * with that mode.
+ */
+ switch (state->overall_abi) {
+ case MIPS_ABI_FP_DOUBLE:
+ case MIPS_ABI_FP_SINGLE:
+ case MIPS_ABI_FP_SOFT:
+ case MIPS_ABI_FP_XX:
+ case MIPS_ABI_FP_ANY:
+ /* FR=1, FRE=1 */
+ clear_thread_flag(TIF_32BIT_FPREGS);
+ set_thread_flag(TIF_HYBRID_FPREGS);
+ return;
+ }
+ }
+
switch (state->overall_abi) {
case MIPS_ABI_FP_DOUBLE:
case MIPS_ABI_FP_SINGLE: