Skip to content

Commit aebdc6f

Browse files
yousongtsbogend
authored andcommitted
MIPS: Exclude more dsemul code when CONFIG_MIPS_FP_SUPPORT=n
This furthers what commit 42b1081 ("MIPS: Don't compile math-emu when CONFIG_MIPS_FP_SUPPORT=n") has done Signed-off-by: Yousong Zhou <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
1 parent d191aaf commit aebdc6f

File tree

3 files changed

+29
-19
lines changed

3 files changed

+29
-19
lines changed

arch/mips/include/asm/processor.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -253,13 +253,13 @@ struct thread_struct {
253253
#ifdef CONFIG_MIPS_FP_SUPPORT
254254
/* Saved fpu/fpu emulator stuff. */
255255
struct mips_fpu_struct fpu FPU_ALIGN;
256-
#endif
257256
/* Assigned branch delay slot 'emulation' frame */
258257
atomic_t bd_emu_frame;
259258
/* PC of the branch from a branch delay slot 'emulation' */
260259
unsigned long bd_emu_branch_pc;
261260
/* PC to continue from following a branch delay slot 'emulation' */
262261
unsigned long bd_emu_cont_pc;
262+
#endif
263263
#ifdef CONFIG_MIPS_MT_FPAFF
264264
/* Emulated instruction count */
265265
unsigned long emulated_fp;
@@ -302,7 +302,11 @@ struct thread_struct {
302302
.fpr = {{{0,},},}, \
303303
.fcr31 = 0, \
304304
.msacsr = 0, \
305-
},
305+
}, \
306+
/* Delay slot emulation */ \
307+
.bd_emu_frame = ATOMIC_INIT(BD_EMUFRAME_NONE), \
308+
.bd_emu_branch_pc = 0, \
309+
.bd_emu_cont_pc = 0,
306310
#else
307311
# define FPU_INIT
308312
#endif
@@ -334,10 +338,6 @@ struct thread_struct {
334338
* FPU affinity state (null if not FPAFF) \
335339
*/ \
336340
FPAFF_INIT \
337-
/* Delay slot emulation */ \
338-
.bd_emu_frame = ATOMIC_INIT(BD_EMUFRAME_NONE), \
339-
.bd_emu_branch_pc = 0, \
340-
.bd_emu_cont_pc = 0, \
341341
/* \
342342
* Saved DSP stuff \
343343
*/ \

arch/mips/kernel/process.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ void start_thread(struct pt_regs * regs, unsigned long pc, unsigned long sp)
7575
lose_fpu(0);
7676
clear_thread_flag(TIF_MSA_CTX_LIVE);
7777
clear_used_math();
78+
#ifdef CONFIG_MIPS_FP_SUPPORT
7879
atomic_set(&current->thread.bd_emu_frame, BD_EMUFRAME_NONE);
80+
#endif
7981
init_dsp();
8082
regs->cp0_epc = pc;
8183
regs->regs[29] = sp;
@@ -176,7 +178,9 @@ int copy_thread_tls(unsigned long clone_flags, unsigned long usp,
176178
clear_tsk_thread_flag(p, TIF_FPUBOUND);
177179
#endif /* CONFIG_MIPS_MT_FPAFF */
178180

181+
#ifdef CONFIG_MIPS_FP_SUPPORT
179182
atomic_set(&p->thread.bd_emu_frame, BD_EMUFRAME_NONE);
183+
#endif
180184

181185
if (clone_flags & CLONE_SETTLS)
182186
ti->tp_value = tls;
@@ -650,8 +654,10 @@ unsigned long mips_stack_top(void)
650654
{
651655
unsigned long top = TASK_SIZE & PAGE_MASK;
652656

653-
/* One page for branch delay slot "emulation" */
654-
top -= PAGE_SIZE;
657+
if (IS_ENABLED(CONFIG_MIPS_FP_SUPPORT)) {
658+
/* One page for branch delay slot "emulation" */
659+
top -= PAGE_SIZE;
660+
}
655661

656662
/* Space for the VDSO, data page & GIC user page */
657663
top -= PAGE_ALIGN(current->thread.abi->vdso->size);

arch/mips/kernel/vdso.c

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,12 @@ subsys_initcall(init_vdso);
7171

7272
static unsigned long vdso_base(void)
7373
{
74-
unsigned long base;
74+
unsigned long base = STACK_TOP;
7575

76-
/* Skip the delay slot emulation page */
77-
base = STACK_TOP + PAGE_SIZE;
76+
if (IS_ENABLED(CONFIG_MIPS_FP_SUPPORT)) {
77+
/* Skip the delay slot emulation page */
78+
base += PAGE_SIZE;
79+
}
7880

7981
if (current->flags & PF_RANDOMIZE) {
8082
base += get_random_int() & (VDSO_RANDOMIZE_SIZE - 1);
@@ -95,14 +97,16 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
9597
if (down_write_killable(&mm->mmap_sem))
9698
return -EINTR;
9799

98-
/* Map delay slot emulation page */
99-
base = mmap_region(NULL, STACK_TOP, PAGE_SIZE,
100-
VM_READ | VM_EXEC |
101-
VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC,
102-
0, NULL);
103-
if (IS_ERR_VALUE(base)) {
104-
ret = base;
105-
goto out;
100+
if (IS_ENABLED(CONFIG_MIPS_FP_SUPPORT)) {
101+
/* Map delay slot emulation page */
102+
base = mmap_region(NULL, STACK_TOP, PAGE_SIZE,
103+
VM_READ | VM_EXEC |
104+
VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC,
105+
0, NULL);
106+
if (IS_ERR_VALUE(base)) {
107+
ret = base;
108+
goto out;
109+
}
106110
}
107111

108112
/*

0 commit comments

Comments
 (0)