From f4af6fb2fc942e84612e8c1a80f0727a797a750a Mon Sep 17 00:00:00 2001 From: Paul Burton Date: Thu, 11 Sep 2014 08:30:23 +0100 Subject: MIPS: Kconfig option to better exercise/debug hybrid FPRs The hybrid FPR scheme exists to allow for compatibility between existing FP32 code and newly compiled FP64A code. Such code should hopefully be rare in the real world, and for the moment is difficult to come across. All code except that built for the FP64 ABI can correctly execute using the hybrid FPR scheme, so debugging the hybrid FPR implementation can be eased by forcing all such code to use it. This is undesirable in general due to the trap & emulate overhead of the hybrid FPR implementation, but is a very useful option to have for debugging. Signed-off-by: Paul Burton Cc: linux-mips@linux-mips.org Cc: Alexander Viro Cc: linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org Patchwork: https://patchwork.linux-mips.org/patch/7680/ Signed-off-by: Ralf Baechle --- arch/mips/kernel/elf.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'arch/mips/kernel') 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: -- cgit v1.2.3