m68k: make support for FPU hardware configurable
Subsystems (2)
PATCH 1/2 m68k: make support for FPU hardware configurable
From: Greg Ungerer <[email protected]>
The classic m68k code has always supported an FPU (although it may have been a software emulated one). The non-MMU m68k code has never supported FPU hardware. To help in merging common code create a configation setting that signifies if we are builing in FPU support or not.
This switch, CONFIG_FPU, is set as per the current use cases. So it is always enabled if CONFIG_MMU is set, and disabled otherwise. With a little extra code it will be possible to disable it on the classic m68k platforms as well, and to enable it on non-MMU platforms that do have hardware FPU.
--- arch/m68k/Kconfig | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
arch/m68k/Kconfig +4 -0
@@ -7,6 +7,7 @@ config M68K select GENERIC_IRQ_SHOW select ARCH_HAVE_NMI_SAFE_CMPXCHG if RMW_INSNS select GENERIC_CPU_DEVICES + select FPU if MMU config RWSEM_GENERIC_SPINLOCK bool
@@ -67,6 +68,9 @@ config CPU_HAS_NO_MULDIV64 config CPU_HAS_ADDRESS_SPACES bool +config FPU + bool + config HZ int default 1000 if CLEOPATRA
Signature · 1 line
1.7.0.4
PATCH 2/2 m68k: merge the MMU and non-MMU versions of process.c
From: Greg Ungerer <[email protected]>
The MMU and non-MMU varients of the m68k arch process.c code are pretty much the same. Only a few minor details differ between the two. The majority of the difference is to deal with having or wanting hardware FPU support. So merge them back into a single process.c file.
---
arch/m68k/kernel/{process_mm.c => process.c} | 19 +-
arch/m68k/kernel/process_no.c | 406 --------------------------
2 files changed, 15 insertions(+), 410 deletions(-)
rename arch/m68k/kernel/{process_mm.c => process.c} (97%)
delete mode 100644 arch/m68k/kernel/process_no.carch/m68k/kernel/process.c renamed from arch/m68k/kernel/process_mm.c +15 -4
@@ -144,8 +144,10 @@ int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) "trap #0\n\t" /* Linux/m68k system call */ "tstl %0\n\t" /* child or parent */ "jne 1f\n\t" /* parent - jump */ +#ifdef CONFIG_MMU "lea %%sp@(%c7),%6\n\t" /* reload current */ "movel %6@,%6\n\t" +#endif"movel %3,%%sp@-\n\t" /* push argument */ "jsr %4@\n\t" /* call fn */ "movel %0,%%d1\n\t" /* pass exit value */
@@ -168,11 +170,13 @@ EXPORT_SYMBOL(kernel_thread);void flush_thread (void ) { -unsigned long zero =0 ; - current->thread.fs = __USER_DS; -if (!FPU_IS_EMU ) +#ifdef CONFIG_FPU +if (!FPU_IS_EMU ) { +unsigned long zero =0 ; asmvolatile ("frestore %0" : :"m" (zero)); + } +#endif }/*
@@ -184,7 +188,11 @@ void flush_thread(void) asmlinkage int m68k_fork(struct pt_regs *regs) { +#ifdef CONFIG_MMU return do_fork (SIGCHLD ,rdusp (), regs,0 ,NULL ,NULL ); +#else +return -EINVAL ; +#endif } asmlinkage int m68k_vfork(struct pt_regs *regs)
@@ -242,6 +250,7 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,*/ p->thread.fs =get_fs ().seg; +#ifdef CONFIG_FPU if (!FPU_IS_EMU ) {/* Copy the current fpu state */ asmvolatile ("fsave %0" : :"m" (p->thread.fpstate[0 ]) :"memory" );
@@ -271,12 +280,13 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,/* Restore the state in case the fpu was busy */ asmvolatile ("frestore %0" : :"m" (p->thread.fpstate[0 ])); } +#endif /* CONFIG_FPU */ return 0 ; }/* Fill in the fpu structure for a core dump. */ - +#ifdef CONFIG_FPU int dump_fpu (struct pt_regs *regs,struct user_m68kfp_struct *fpu) {char fpustate[216 ];
@@ -325,6 +335,7 @@ int dump_fpu (struct pt_regs *regs, struct user_m68kfp_struct *fpu) return 1; }EXPORT_SYMBOL (dump_fpu); +#endif /* CONFIG_FPU */ /* * sys_execve() executes a new program.
arch/m68k/kernel/process_no.c deleted +0 -406
406 lines not on this page · raw message
Signature · 1 line
1.7.0.4
Re: [PATCH 2/2] m68k: merge the MMU and non-MMU versions of process.c
Quoted 6 lines · On Fri, Feb 10, 2012 at 07:14, <[email protected]> wrote:
The MMU and non-MMU varients of the m68k arch
process.ccode are pretty much the same. Only a few minor details differ between the two. The majority of the difference is to deal with having or wanting hardware FPU support. So merge them back into a singleprocess.cfile.Signed-off-by Greg Ungerer <[email protected]>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Quoted 11 lines · On Fri, Feb 10, 2012 at 07:14, <[email protected]> wrote:
The classic m68k code has always supported an FPU (although it may have been a software emulated one). The non-MMU m68k code has never supported FPU hardware. To help in merging common code create a configation setting that signifies if we are builing in FPU support or not.
This switch,
CONFIG_FPU, is set as per the current use cases. So it is always enabled ifCONFIG_MMUis set, and disabled otherwise. With a little extra code it will be possible to disable it on the classic m68k platforms as well, and to enable it on non-MMU platforms that do have hardware FPU.Signed-off-by Greg Ungerer <[email protected]>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Hi Geert,
Quoted 6 lines · Geert Uytterhoeven
Quoted 5 lines · On Fri, Feb 10, 2012 at 07:14,<[email protected]> wrote:
The classic m68k code has always supported an FPU (although it may have been a software emulated one). The non-MMU m68k code has never supported FPU hardware. To help in merging common code create a configation setting that signifies if we are builing in FPU support or not.
Quoted 8 lines
Quoted 6 lines
This switch,
CONFIG_FPU, is set as per the current use cases. So it is always enabled ifCONFIG_MMUis set, and disabled otherwise. With a little extra code it will be possible to disable it on the classic m68k platforms as well, and to enable it on non-MMU platforms that do have hardware FPU.Signed-off-by Greg Ungerer<[email protected]>
Thanks!
Regards
Greg
------------------------------------------------------------------------
Greg Ungerer -- Principal Engineer EMAIL: [email protected] SnapGear Group, McAfee PHONE: +61 7 3435 2888 8 Gardner Close FAX: +61 7 3217 5323 Milton, QLD, 4064, Australia WEB: http://www.SnapGear.com