Commit aebdc6ff authored by Yousong Zhou's avatar Yousong Zhou Committed by Thomas Bogendoerfer

MIPS: Exclude more dsemul code when CONFIG_MIPS_FP_SUPPORT=n

This furthers what commit 42b10815 ("MIPS: Don't compile math-emu
when CONFIG_MIPS_FP_SUPPORT=n") has done
Signed-off-by: default avatarYousong Zhou <yszhou4tech@gmail.com>
Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
parent d191aaff
...@@ -253,13 +253,13 @@ struct thread_struct { ...@@ -253,13 +253,13 @@ struct thread_struct {
#ifdef CONFIG_MIPS_FP_SUPPORT #ifdef CONFIG_MIPS_FP_SUPPORT
/* Saved fpu/fpu emulator stuff. */ /* Saved fpu/fpu emulator stuff. */
struct mips_fpu_struct fpu FPU_ALIGN; struct mips_fpu_struct fpu FPU_ALIGN;
#endif
/* Assigned branch delay slot 'emulation' frame */ /* Assigned branch delay slot 'emulation' frame */
atomic_t bd_emu_frame; atomic_t bd_emu_frame;
/* PC of the branch from a branch delay slot 'emulation' */ /* PC of the branch from a branch delay slot 'emulation' */
unsigned long bd_emu_branch_pc; unsigned long bd_emu_branch_pc;
/* PC to continue from following a branch delay slot 'emulation' */ /* PC to continue from following a branch delay slot 'emulation' */
unsigned long bd_emu_cont_pc; unsigned long bd_emu_cont_pc;
#endif
#ifdef CONFIG_MIPS_MT_FPAFF #ifdef CONFIG_MIPS_MT_FPAFF
/* Emulated instruction count */ /* Emulated instruction count */
unsigned long emulated_fp; unsigned long emulated_fp;
...@@ -302,7 +302,11 @@ struct thread_struct { ...@@ -302,7 +302,11 @@ struct thread_struct {
.fpr = {{{0,},},}, \ .fpr = {{{0,},},}, \
.fcr31 = 0, \ .fcr31 = 0, \
.msacsr = 0, \ .msacsr = 0, \
}, }, \
/* Delay slot emulation */ \
.bd_emu_frame = ATOMIC_INIT(BD_EMUFRAME_NONE), \
.bd_emu_branch_pc = 0, \
.bd_emu_cont_pc = 0,
#else #else
# define FPU_INIT # define FPU_INIT
#endif #endif
...@@ -334,10 +338,6 @@ struct thread_struct { ...@@ -334,10 +338,6 @@ struct thread_struct {
* FPU affinity state (null if not FPAFF) \ * FPU affinity state (null if not FPAFF) \
*/ \ */ \
FPAFF_INIT \ FPAFF_INIT \
/* Delay slot emulation */ \
.bd_emu_frame = ATOMIC_INIT(BD_EMUFRAME_NONE), \
.bd_emu_branch_pc = 0, \
.bd_emu_cont_pc = 0, \
/* \ /* \
* Saved DSP stuff \ * Saved DSP stuff \
*/ \ */ \
......
...@@ -75,7 +75,9 @@ void start_thread(struct pt_regs * regs, unsigned long pc, unsigned long sp) ...@@ -75,7 +75,9 @@ void start_thread(struct pt_regs * regs, unsigned long pc, unsigned long sp)
lose_fpu(0); lose_fpu(0);
clear_thread_flag(TIF_MSA_CTX_LIVE); clear_thread_flag(TIF_MSA_CTX_LIVE);
clear_used_math(); clear_used_math();
#ifdef CONFIG_MIPS_FP_SUPPORT
atomic_set(&current->thread.bd_emu_frame, BD_EMUFRAME_NONE); atomic_set(&current->thread.bd_emu_frame, BD_EMUFRAME_NONE);
#endif
init_dsp(); init_dsp();
regs->cp0_epc = pc; regs->cp0_epc = pc;
regs->regs[29] = sp; regs->regs[29] = sp;
...@@ -176,7 +178,9 @@ int copy_thread_tls(unsigned long clone_flags, unsigned long usp, ...@@ -176,7 +178,9 @@ int copy_thread_tls(unsigned long clone_flags, unsigned long usp,
clear_tsk_thread_flag(p, TIF_FPUBOUND); clear_tsk_thread_flag(p, TIF_FPUBOUND);
#endif /* CONFIG_MIPS_MT_FPAFF */ #endif /* CONFIG_MIPS_MT_FPAFF */
#ifdef CONFIG_MIPS_FP_SUPPORT
atomic_set(&p->thread.bd_emu_frame, BD_EMUFRAME_NONE); atomic_set(&p->thread.bd_emu_frame, BD_EMUFRAME_NONE);
#endif
if (clone_flags & CLONE_SETTLS) if (clone_flags & CLONE_SETTLS)
ti->tp_value = tls; ti->tp_value = tls;
...@@ -650,8 +654,10 @@ unsigned long mips_stack_top(void) ...@@ -650,8 +654,10 @@ unsigned long mips_stack_top(void)
{ {
unsigned long top = TASK_SIZE & PAGE_MASK; unsigned long top = TASK_SIZE & PAGE_MASK;
/* One page for branch delay slot "emulation" */ if (IS_ENABLED(CONFIG_MIPS_FP_SUPPORT)) {
top -= PAGE_SIZE; /* One page for branch delay slot "emulation" */
top -= PAGE_SIZE;
}
/* Space for the VDSO, data page & GIC user page */ /* Space for the VDSO, data page & GIC user page */
top -= PAGE_ALIGN(current->thread.abi->vdso->size); top -= PAGE_ALIGN(current->thread.abi->vdso->size);
......
...@@ -71,10 +71,12 @@ subsys_initcall(init_vdso); ...@@ -71,10 +71,12 @@ subsys_initcall(init_vdso);
static unsigned long vdso_base(void) static unsigned long vdso_base(void)
{ {
unsigned long base; unsigned long base = STACK_TOP;
/* Skip the delay slot emulation page */ if (IS_ENABLED(CONFIG_MIPS_FP_SUPPORT)) {
base = STACK_TOP + PAGE_SIZE; /* Skip the delay slot emulation page */
base += PAGE_SIZE;
}
if (current->flags & PF_RANDOMIZE) { if (current->flags & PF_RANDOMIZE) {
base += get_random_int() & (VDSO_RANDOMIZE_SIZE - 1); base += get_random_int() & (VDSO_RANDOMIZE_SIZE - 1);
...@@ -95,14 +97,16 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) ...@@ -95,14 +97,16 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
if (down_write_killable(&mm->mmap_sem)) if (down_write_killable(&mm->mmap_sem))
return -EINTR; return -EINTR;
/* Map delay slot emulation page */ if (IS_ENABLED(CONFIG_MIPS_FP_SUPPORT)) {
base = mmap_region(NULL, STACK_TOP, PAGE_SIZE, /* Map delay slot emulation page */
VM_READ | VM_EXEC | base = mmap_region(NULL, STACK_TOP, PAGE_SIZE,
VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC, VM_READ | VM_EXEC |
0, NULL); VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC,
if (IS_ERR_VALUE(base)) { 0, NULL);
ret = base; if (IS_ERR_VALUE(base)) {
goto out; ret = base;
goto out;
}
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment