aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Ungerer <gerg@linux-m68k.org>2016-08-29 02:43:51 -0400
committerGreg Ungerer <gerg@linux-m68k.org>2016-09-25 22:02:59 -0400
commit8912eaccb981fd7c2624cbfd56c47c1f6f051420 (patch)
tree7994153bf5051b0a1aff58c1662025cf64741f42
parent8cf4a973b47d69227b8ad31d41e4054c59de4dcc (diff)
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: Greg Ungerer <gerg@linux-m68k.org>
-rw-r--r--arch/m68k/kernel/process.c56
1 files changed, 28 insertions, 28 deletions
diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c
index c55ff719fa72..4ba1ae7345c3 100644
--- a/arch/m68k/kernel/process.c
+++ b/arch/m68k/kernel/process.c
@@ -203,11 +203,8 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
203} 203}
204 204
205/* Fill in the fpu structure for a core dump. */ 205/* Fill in the fpu structure for a core dump. */
206#ifdef CONFIG_FPU
207int dump_fpu (struct pt_regs *regs, struct user_m68kfp_struct *fpu) 206int dump_fpu (struct pt_regs *regs, struct user_m68kfp_struct *fpu)
208{ 207{
209 char fpustate[216];
210
211 if (FPU_IS_EMU) { 208 if (FPU_IS_EMU) {
212 int i; 209 int i;
213 210
@@ -222,37 +219,40 @@ int dump_fpu (struct pt_regs *regs, struct user_m68kfp_struct *fpu)
222 return 1; 219 return 1;
223 } 220 }
224 221
225 /* First dump the fpu context to avoid protocol violation. */ 222 if (IS_ENABLED(CONFIG_FPU)) {
226 asm volatile ("fsave %0" :: "m" (fpustate[0]) : "memory"); 223 char fpustate[216];
227 if (!CPU_IS_060 ? !fpustate[0] : !fpustate[2])
228 return 0;
229 224
230 if (CPU_IS_COLDFIRE) { 225 /* First dump the fpu context to avoid protocol violation. */
231 asm volatile ("fmovel %/fpiar,%0\n\t" 226 asm volatile ("fsave %0" :: "m" (fpustate[0]) : "memory");
232 "fmovel %/fpcr,%1\n\t" 227 if (!CPU_IS_060 ? !fpustate[0] : !fpustate[2])
233 "fmovel %/fpsr,%2\n\t" 228 return 0;
234 "fmovemd %/fp0-%/fp7,%3" 229
235 : 230 if (CPU_IS_COLDFIRE) {
236 : "m" (fpu->fpcntl[0]), 231 asm volatile ("fmovel %/fpiar,%0\n\t"
237 "m" (fpu->fpcntl[1]), 232 "fmovel %/fpcr,%1\n\t"
238 "m" (fpu->fpcntl[2]), 233 "fmovel %/fpsr,%2\n\t"
239 "m" (fpu->fpregs[0]) 234 "fmovemd %/fp0-%/fp7,%3"
240 : "memory"); 235 :
241 } else { 236 : "m" (fpu->fpcntl[0]),
242 asm volatile ("fmovem %/fpiar/%/fpcr/%/fpsr,%0" 237 "m" (fpu->fpcntl[1]),
243 : 238 "m" (fpu->fpcntl[2]),
244 : "m" (fpu->fpcntl[0]) 239 "m" (fpu->fpregs[0])
245 : "memory"); 240 : "memory");
246 asm volatile ("fmovemx %/fp0-%/fp7,%0" 241 } else {
247 : 242 asm volatile ("fmovem %/fpiar/%/fpcr/%/fpsr,%0"
248 : "m" (fpu->fpregs[0]) 243 :
249 : "memory"); 244 : "m" (fpu->fpcntl[0])
245 : "memory");
246 asm volatile ("fmovemx %/fp0-%/fp7,%0"
247 :
248 : "m" (fpu->fpregs[0])
249 : "memory");
250 }
250 } 251 }
251 252
252 return 1; 253 return 1;
253} 254}
254EXPORT_SYMBOL(dump_fpu); 255EXPORT_SYMBOL(dump_fpu);
255#endif /* CONFIG_FPU */
256 256
257unsigned long get_wchan(struct task_struct *p) 257unsigned long get_wchan(struct task_struct *p)
258{ 258{