m68k: handle presence of 64bit mul/div instructions cleanly

The traditional 68000 processors and the newer reduced instruction set
ColdFire processors do not support the 32*32->64 multiply or the 64/32->32
divide instructions. This is not a difference based on the presence of
a hardware MMU or not.

Create a new config symbol to mark that a CPU type doesn't support the
longer multiply/divide instructions. Use this then as a basis for using
the fast 64bit based divide (in div64.h) and for linking in the extra
libgcc functions that may be required (mulsi3, divsi3, etc).

Signed-off-by: Greg Ungerer <gerg@uclinux.org>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
This commit is contained in:
Greg Ungerer 2011-11-11 15:13:08 +10:00
parent 7f73bafc46
commit 84f3fb7a2a
5 changed files with 13 additions and 10 deletions

View File

@ -63,6 +63,9 @@ config ZONE_DMA
config CPU_HAS_NO_BITFIELDS config CPU_HAS_NO_BITFIELDS
bool bool
config CPU_HAS_NO_MULDIV64
bool
config HZ config HZ
int int
default 1000 if CLEOPATRA default 1000 if CLEOPATRA

View File

@ -3,6 +3,7 @@ comment "Processor Type"
config M68000 config M68000
bool bool
select CPU_HAS_NO_BITFIELDS select CPU_HAS_NO_BITFIELDS
select CPU_HAS_NO_MULDIV64
select GENERIC_CSUM select GENERIC_CSUM
help help
The Freescale (was Motorola) 68000 CPU is the first generation of The Freescale (was Motorola) 68000 CPU is the first generation of
@ -24,6 +25,7 @@ config COLDFIRE
select GENERIC_GPIO select GENERIC_GPIO
select ARCH_REQUIRE_GPIOLIB select ARCH_REQUIRE_GPIOLIB
select CPU_HAS_NO_BITFIELDS select CPU_HAS_NO_BITFIELDS
select CPU_HAS_NO_MULDIV64
select GENERIC_CSUM select GENERIC_CSUM
help help
The Freescale ColdFire family of processors is a modern derivitive The Freescale ColdFire family of processors is a modern derivitive

View File

@ -1,7 +1,9 @@
#ifndef _M68K_DIV64_H #ifndef _M68K_DIV64_H
#define _M68K_DIV64_H #define _M68K_DIV64_H
#ifdef CONFIG_MMU #ifdef CONFIG_CPU_HAS_NO_MULDIV64
#include <asm-generic/div64.h>
#else
#include <linux/types.h> #include <linux/types.h>
@ -27,8 +29,6 @@
__rem; \ __rem; \
}) })
#else #endif /* CONFIG_CPU_HAS_NO_MULDIV64 */
#include <asm-generic/div64.h>
#endif /* CONFIG_MMU */
#endif /* _M68K_DIV64_H */ #endif /* _M68K_DIV64_H */

View File

@ -14,7 +14,7 @@ EXPORT_SYMBOL(__ashrdi3);
EXPORT_SYMBOL(__lshrdi3); EXPORT_SYMBOL(__lshrdi3);
EXPORT_SYMBOL(__muldi3); EXPORT_SYMBOL(__muldi3);
#if defined(CONFIG_M68000) || defined(CONFIG_COLDFIRE) #if defined(CONFIG_CPU_HAS_NO_MULDIV64)
/* /*
* Simpler 68k and ColdFire parts also need a few other gcc functions. * Simpler 68k and ColdFire parts also need a few other gcc functions.
*/ */

View File

@ -6,11 +6,9 @@
lib-y := ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \ lib-y := ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \
memcpy.o memset.o memmove.o memcpy.o memset.o memmove.o
ifdef CONFIG_MMU lib-$(CONFIG_MMU) += string.o uaccess.o
lib-y += string.o uaccess.o lib-$(CONFIG_CPU_HAS_NO_MULDIV64) += mulsi3.o divsi3.o udivsi3.o
else lib-$(CONFIG_CPU_HAS_NO_MULDIV64) += modsi3.o umodsi3.o
lib-y += mulsi3.o divsi3.o udivsi3.o modsi3.o umodsi3.o
endif
ifndef CONFIG_GENERIC_CSUM ifndef CONFIG_GENERIC_CSUM
lib-y += checksum.o lib-y += checksum.o