Commit 8912eacc authored by Greg Ungerer's avatar Greg Ungerer

m68k: always make available dump_fpu()

Our local m68k architecture dump_fpu() is conditionally compiled in on
CONFIG_FPU. That is OK for all existing MMU enabled CPU types, but won't
handle the case for some ColdFire SoC CPU parts that we want to support
that have no FPU hardware.

dump_fpu() is expected to be present by the ELF loader, so we must always
have it available and exported.

Remove the conditional and reorganize the dump_fpu hard FPU code path
to let the compiler remove code when not needed.

This change based on changes and discussion from Yannick Gicquel
<yannick.gicquel@open.eurogiciel.org>.
Signed-off-by: default avatarGreg Ungerer <gerg@linux-m68k.org>
parent 8cf4a973
...@@ -203,11 +203,8 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, ...@@ -203,11 +203,8 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
} }
/* Fill in the fpu structure for a core dump. */ /* Fill in the fpu structure for a core dump. */
#ifdef CONFIG_FPU
int dump_fpu (struct pt_regs *regs, struct user_m68kfp_struct *fpu) int dump_fpu (struct pt_regs *regs, struct user_m68kfp_struct *fpu)
{ {
char fpustate[216];
if (FPU_IS_EMU) { if (FPU_IS_EMU) {
int i; int i;
...@@ -222,37 +219,40 @@ int dump_fpu (struct pt_regs *regs, struct user_m68kfp_struct *fpu) ...@@ -222,37 +219,40 @@ int dump_fpu (struct pt_regs *regs, struct user_m68kfp_struct *fpu)
return 1; return 1;
} }
/* First dump the fpu context to avoid protocol violation. */ if (IS_ENABLED(CONFIG_FPU)) {
asm volatile ("fsave %0" :: "m" (fpustate[0]) : "memory"); char fpustate[216];
if (!CPU_IS_060 ? !fpustate[0] : !fpustate[2])
return 0;
if (CPU_IS_COLDFIRE) { /* First dump the fpu context to avoid protocol violation. */
asm volatile ("fmovel %/fpiar,%0\n\t" asm volatile ("fsave %0" :: "m" (fpustate[0]) : "memory");
"fmovel %/fpcr,%1\n\t" if (!CPU_IS_060 ? !fpustate[0] : !fpustate[2])
"fmovel %/fpsr,%2\n\t" return 0;
"fmovemd %/fp0-%/fp7,%3"
: if (CPU_IS_COLDFIRE) {
: "m" (fpu->fpcntl[0]), asm volatile ("fmovel %/fpiar,%0\n\t"
"m" (fpu->fpcntl[1]), "fmovel %/fpcr,%1\n\t"
"m" (fpu->fpcntl[2]), "fmovel %/fpsr,%2\n\t"
"m" (fpu->fpregs[0]) "fmovemd %/fp0-%/fp7,%3"
: "memory"); :
} else { : "m" (fpu->fpcntl[0]),
asm volatile ("fmovem %/fpiar/%/fpcr/%/fpsr,%0" "m" (fpu->fpcntl[1]),
: "m" (fpu->fpcntl[2]),
: "m" (fpu->fpcntl[0]) "m" (fpu->fpregs[0])
: "memory"); : "memory");
asm volatile ("fmovemx %/fp0-%/fp7,%0" } else {
: asm volatile ("fmovem %/fpiar/%/fpcr/%/fpsr,%0"
: "m" (fpu->fpregs[0]) :
: "memory"); : "m" (fpu->fpcntl[0])
: "memory");
asm volatile ("fmovemx %/fp0-%/fp7,%0"
:
: "m" (fpu->fpregs[0])
: "memory");
}
} }
return 1; return 1;
} }
EXPORT_SYMBOL(dump_fpu); EXPORT_SYMBOL(dump_fpu);
#endif /* CONFIG_FPU */
unsigned long get_wchan(struct task_struct *p) unsigned long get_wchan(struct task_struct *p)
{ {
......
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