Skip to content
Snippets Groups Projects
Commit 6448bf4f authored by Oskar Viljasaar's avatar Oskar Viljasaar
Browse files

Import openwrt pending patch 304-mips_disable_fpu

parent 6b23e580
Branches
No related tags found
No related merge requests found
...@@ -2893,6 +2893,20 @@ config MIPS_O32_FP64_SUPPORT ...@@ -2893,6 +2893,20 @@ config MIPS_O32_FP64_SUPPORT
If unsure, say N. 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 config USE_OF
bool bool
select OF select OF
......
...@@ -334,7 +334,7 @@ OBJCOPYFLAGS += --remove-section=.reginfo ...@@ -334,7 +334,7 @@ OBJCOPYFLAGS += --remove-section=.reginfo
head-y := arch/mips/kernel/head.o head-y := arch/mips/kernel/head.o
libs-y += arch/mips/lib/ 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 # See arch/mips/Kbuild for content of core part of the kernel
core-y += arch/mips/ core-y += arch/mips/
......
...@@ -41,6 +41,7 @@ struct task_struct; ...@@ -41,6 +41,7 @@ struct task_struct;
extern int mips_dsemul(struct pt_regs *regs, mips_instruction ir, extern int mips_dsemul(struct pt_regs *regs, mips_instruction ir,
unsigned long branch_pc, unsigned long cont_pc); unsigned long branch_pc, unsigned long cont_pc);
#ifdef CONFIG_MIPS_FPU_EMULATOR
/** /**
* do_dsemulret() - Return from a delay slot 'emulation' frame * do_dsemulret() - Return from a delay slot 'emulation' frame
* @xcp: User thread register context. * @xcp: User thread register context.
...@@ -88,5 +89,27 @@ extern bool dsemul_thread_rollback(struct pt_regs *regs); ...@@ -88,5 +89,27 @@ extern bool dsemul_thread_rollback(struct pt_regs *regs);
* before @mm is freed in order to avoid memory leaks. * before @mm is freed in order to avoid memory leaks.
*/ */
extern void dsemul_mm_cleanup(struct mm_struct *mm); extern void dsemul_mm_cleanup(struct mm_struct *mm);
#else
static inline bool do_dsemulret(struct pt_regs *xcp)
{
return false;
}
static inline bool dsemul_thread_cleanup(struct task_struct *tsk)
{
return false;
}
static inline bool dsemul_thread_rollback(struct pt_regs *regs)
{
return false;
}
static inline void dsemul_mm_cleanup(struct mm_struct *mm)
{
}
#endif
#endif /* __MIPS_ASM_DSEMUL_H__ */ #endif /* __MIPS_ASM_DSEMUL_H__ */
...@@ -230,8 +230,10 @@ static inline int init_fpu(void) ...@@ -230,8 +230,10 @@ static inline int init_fpu(void)
/* Restore FRE */ /* Restore FRE */
write_c0_config5(config5); write_c0_config5(config5);
enable_fpu_hazard(); enable_fpu_hazard();
} else } else if (IS_ENABLED(CONFIG_MIPS_FPU_EMULATOR))
fpu_emulator_init_fpu(); fpu_emulator_init_fpu();
else
ret = SIGILL;
return ret; return ret;
} }
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <asm/local.h> #include <asm/local.h>
#include <asm/processor.h> #include <asm/processor.h>
#ifdef CONFIG_MIPS_FPU_EMULATOR
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
struct mips_fpu_emulator_stats { struct mips_fpu_emulator_stats {
...@@ -179,6 +180,16 @@ do { \ ...@@ -179,6 +180,16 @@ do { \
extern int fpu_emulator_cop1Handler(struct pt_regs *xcp, extern int fpu_emulator_cop1Handler(struct pt_regs *xcp,
struct mips_fpu_struct *ctx, int has_fpu, struct mips_fpu_struct *ctx, int has_fpu,
void __user **fault_addr); void __user **fault_addr);
#else /* no CONFIG_MIPS_FPU_EMULATOR */
static inline int fpu_emulator_cop1Handler(struct pt_regs *xcp,
struct mips_fpu_struct *ctx, int has_fpu,
void __user **fault_addr)
{
*fault_addr = NULL;
return SIGILL; /* we don't speak MIPS FPU */
}
#endif /* CONFIG_MIPS_FPU_EMULATOR */
void force_fcr31_sig(unsigned long fcr31, void __user *fault_addr, void force_fcr31_sig(unsigned long fcr31, void __user *fault_addr,
struct task_struct *tsk); struct task_struct *tsk);
int process_fpemu_return(int sig, void __user *fault_addr, int process_fpemu_return(int sig, void __user *fault_addr,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment