mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-25 16:31:13 +00:00
7b3354bb92
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com> SVN-Revision: 44416
80 lines
2.3 KiB
Diff
80 lines
2.3 KiB
Diff
--- a/arch/mips/Kconfig
|
|
+++ b/arch/mips/Kconfig
|
|
@@ -2521,6 +2521,20 @@ config MIPS_O32_FP64_SUPPORT
|
|
|
|
If unsure, say N.
|
|
|
|
+config MIPS_FPU_EMULATOR
|
|
+ bool "MIPS FPU Emulator"
|
|
+ default y
|
|
+ help
|
|
+ This option lets you disable the built-in MIPS FPU (Coprocessor 1)
|
|
+ emulator, which handles floating-point instructions on processors
|
|
+ without a hardware FPU. It is generally a good idea to keep the
|
|
+ emulator built-in, unless you are perfectly sure you have a
|
|
+ complete soft-float environment. With the emulator disabled, all
|
|
+ users of float operations will be killed with an illegal instr-
|
|
+ uction exception.
|
|
+
|
|
+ Say Y, please.
|
|
+
|
|
config USE_OF
|
|
bool
|
|
select OF
|
|
--- a/arch/mips/Makefile
|
|
+++ b/arch/mips/Makefile
|
|
@@ -275,7 +275,7 @@ OBJCOPYFLAGS += --remove-section=.regin
|
|
head-y := arch/mips/kernel/head.o
|
|
|
|
libs-y += arch/mips/lib/
|
|
-libs-y += arch/mips/math-emu/
|
|
+libs-$(CONFIG_MIPS_FPU_EMULATOR) += arch/mips/math-emu/
|
|
|
|
# See arch/mips/Kbuild for content of core part of the kernel
|
|
core-y += arch/mips/
|
|
--- a/arch/mips/include/asm/fpu.h
|
|
+++ b/arch/mips/include/asm/fpu.h
|
|
@@ -210,8 +210,10 @@ static inline int init_fpu(void)
|
|
/* Restore FRE */
|
|
write_c0_config5(config5);
|
|
enable_fpu_hazard();
|
|
- } else
|
|
+ } else if (IS_ENABLED(CONFIG_MIPS_FPU_EMULATOR))
|
|
fpu_emulator_init_fpu();
|
|
+ else
|
|
+ ret = SIGILL;
|
|
|
|
return ret;
|
|
}
|
|
--- a/arch/mips/include/asm/fpu_emulator.h
|
|
+++ b/arch/mips/include/asm/fpu_emulator.h
|
|
@@ -30,6 +30,7 @@
|
|
#include <asm/local.h>
|
|
#include <asm/processor.h>
|
|
|
|
+#ifdef CONFIG_MIPS_FPU_EMULATOR
|
|
#ifdef CONFIG_DEBUG_FS
|
|
|
|
struct mips_fpu_emulator_stats {
|
|
@@ -65,6 +66,20 @@ extern int do_dsemulret(struct pt_regs *
|
|
extern int fpu_emulator_cop1Handler(struct pt_regs *xcp,
|
|
struct mips_fpu_struct *ctx, int has_fpu,
|
|
void *__user *fault_addr);
|
|
+#else /* no CONFIG_MIPS_FPU_EMULATOR */
|
|
+static inline int do_dsemulret(struct pt_regs *xcp)
|
|
+{
|
|
+ return 0; /* 0 means error, should never get here anyway */
|
|
+}
|
|
+
|
|
+static inline int fpu_emulator_cop1Handler(struct pt_regs *xcp,
|
|
+ struct mips_fpu_struct *ctx, int has_fpu,
|
|
+ void *__user *fault_addr)
|
|
+{
|
|
+ return SIGILL; /* we don't speak MIPS FPU */
|
|
+}
|
|
+#endif /* CONFIG_MIPS_FPU_EMULATOR */
|
|
+
|
|
int process_fpemu_return(int sig, void __user *fault_addr);
|
|
int mm_isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn,
|
|
unsigned long *contpc);
|