Skip to content

Commit

Permalink
MIPS: kernel: elf: Improve the overall ABI and FPU mode checks
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Markos Chandras committed Feb 17, 2015
1 parent 6134d94 commit 46490b5
Show file tree
Hide file tree
Showing 3 changed files with 194 additions and 132 deletions.
13 changes: 0 additions & 13 deletions arch/mips/Kconfig.debug
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,4 @@ 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
10 changes: 6 additions & 4 deletions arch/mips/include/asm/elf.h
Original file line number Diff line number Diff line change
Expand Up @@ -417,13 +417,15 @@ extern unsigned long arch_randomize_brk(struct mm_struct *mm);
struct arch_elf_state {
int fp_abi;
int interp_fp_abi;
int overall_abi;
int overall_fp_mode;
};

#define MIPS_ABI_FP_UNKNOWN (-1) /* Unknown FP ABI (kernel internal) */

#define INIT_ARCH_ELF_STATE { \
.fp_abi = -1, \
.interp_fp_abi = -1, \
.overall_abi = -1, \
.fp_abi = MIPS_ABI_FP_UNKNOWN, \
.interp_fp_abi = MIPS_ABI_FP_UNKNOWN, \
.overall_fp_mode = -1, \
}

extern int arch_elf_pt_proc(void *ehdr, void *phdr, struct file *elf,
Expand Down
Loading

0 comments on commit 46490b5

Please sign in to comment.