Skip to content

Commit 46490b5

Browse files
author
Markos Chandras
committed
MIPS: kernel: elf: Improve the overall ABI and FPU mode checks
The previous implementation did not cover all possible FPU combinations and it silently allowed ABI incompatible objects to be loaded with the wrong ABI. For example, the previous logic would set the FP_64 ABI as the matching ABI for an FP_XX object combined with an FP_64A object. This was wrong, and the matching ABI should have been FP_64A. The previous logic is now replaced with a new one which determines the appropriate FPU mode to be used rather than the FP ABI. This has the advantage that the entire logic is much simpler since it is the FPU mode we are interested in rather than the FP ABI resulting to code simplifications. This also removes the now obsolete FP32XX_HYBRID_FPRS option. Cc: Matthew Fortune <[email protected]> Cc: Paul Burton <[email protected]> Signed-off-by: Markos Chandras <[email protected]>
1 parent 6134d94 commit 46490b5

File tree

3 files changed

+194
-132
lines changed

3 files changed

+194
-132
lines changed

arch/mips/Kconfig.debug

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -122,17 +122,4 @@ config SPINLOCK_TEST
122122
help
123123
Add several files to the debugfs to test spinlock speed.
124124

125-
config FP32XX_HYBRID_FPRS
126-
bool "Run FP32 & FPXX code with hybrid FPRs"
127-
depends on MIPS_O32_FP64_SUPPORT
128-
help
129-
The hybrid FPR scheme is normally used only when a program needs to
130-
execute a mix of FP32 & FP64A code, since the trapping & emulation
131-
that it entails is expensive. When enabled, this option will lead
132-
to the kernel running programs which use the FP32 & FPXX FP ABIs
133-
using the hybrid FPR scheme, which can be useful for debugging
134-
purposes.
135-
136-
If unsure, say N.
137-
138125
endmenu

arch/mips/include/asm/elf.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -417,13 +417,15 @@ extern unsigned long arch_randomize_brk(struct mm_struct *mm);
417417
struct arch_elf_state {
418418
int fp_abi;
419419
int interp_fp_abi;
420-
int overall_abi;
420+
int overall_fp_mode;
421421
};
422422

423+
#define MIPS_ABI_FP_UNKNOWN (-1) /* Unknown FP ABI (kernel internal) */
424+
423425
#define INIT_ARCH_ELF_STATE { \
424-
.fp_abi = -1, \
425-
.interp_fp_abi = -1, \
426-
.overall_abi = -1, \
426+
.fp_abi = MIPS_ABI_FP_UNKNOWN, \
427+
.interp_fp_abi = MIPS_ABI_FP_UNKNOWN, \
428+
.overall_fp_mode = -1, \
427429
}
428430

429431
extern int arch_elf_pt_proc(void *ehdr, void *phdr, struct file *elf,

0 commit comments

Comments
 (0)