All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/6] m68knommu: merge and clean up of arch/m68k/lib files
@ 2011-04-21  0:24 gerg
  2011-04-21  0:24 ` [PATCH v3 1/6] m68k: merge mmu and non-mmu versions of muldi3 gerg
  0 siblings, 1 reply; 20+ messages in thread
From: gerg @ 2011-04-21  0:24 UTC (permalink / raw)
  To: linux-m68k, uclinux-dev


The following set of patches is version 3 of clean ups and merges of
individual files in the arch/m68k/lib directory. The only change over
version 3 is that the processor list that supports the more complex
instructions includes the __mcpu32__ type.

I have build and run tested on ARAnyM/Atari and ColdFire (non-mmu)
targets.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH v3 1/6] m68k: merge mmu and non-mmu versions of muldi3
  2011-04-21  0:24 [PATCH v3 0/6] m68knommu: merge and clean up of arch/m68k/lib files gerg
@ 2011-04-21  0:24 ` gerg
  2011-04-21  0:24   ` [PATCH v3 2/6] m68k: merge mmu and non-mmu versions of lib/Makefile gerg
  0 siblings, 1 reply; 20+ messages in thread
From: gerg @ 2011-04-21  0:24 UTC (permalink / raw)
  To: linux-m68k, uclinux-dev; +Cc: Greg Ungerer

From: Greg Ungerer <gerg@uclinux.org>

The implementation of gcc's muldi3 support function differs only in
the use of the machine's 64 bit sized mul or not. (It isn't based
on using an MMU or not). Merge the current mmu and non-mmu versions
of arc/m68k/lib/muldi3 and use the appropriate pre-processor
conditionals to get the right version for all m68k processor types.

Signed-off-by: Greg Ungerer <gerg@uclinux.org>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 arch/m68k/lib/muldi3.c    |   99 +++++++++++++++++++++++++++++++++++++++++++-
 arch/m68k/lib/muldi3_mm.c |   63 ----------------------------
 arch/m68k/lib/muldi3_no.c |   86 ---------------------------------------
 3 files changed, 96 insertions(+), 152 deletions(-)
 delete mode 100644 arch/m68k/lib/muldi3_mm.c
 delete mode 100644 arch/m68k/lib/muldi3_no.c

diff --git a/arch/m68k/lib/muldi3.c b/arch/m68k/lib/muldi3.c
index 16e0eb3..079bafc 100644
--- a/arch/m68k/lib/muldi3.c
+++ b/arch/m68k/lib/muldi3.c
@@ -1,5 +1,98 @@
-#ifdef CONFIG_MMU
-#include "muldi3_mm.c"
+/* muldi3.c extracted from gcc-2.7.2.3/libgcc2.c and 
+			   gcc-2.7.2.3/longlong.h which is: */
+/* Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING.  If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+#if defined(__mc68020__) || defined(__mc68030__) || \
+    defined(__mc68040__) || defined(__mc68060__) || defined(__mcpu32__)
+
+#define umul_ppmm(w1, w0, u, v) \
+  __asm__ ("mulu%.l %3,%1:%0"						\
+           : "=d" ((USItype)(w0)),					\
+             "=d" ((USItype)(w1))					\
+           : "%0" ((USItype)(u)),					\
+             "dmi" ((USItype)(v)))
+
 #else
-#include "muldi3_no.c"
+
+#define SI_TYPE_SIZE 32
+#define __BITS4 (SI_TYPE_SIZE / 4)
+#define __ll_B (1L << (SI_TYPE_SIZE / 2))
+#define __ll_lowpart(t) ((USItype) (t) % __ll_B)
+#define __ll_highpart(t) ((USItype) (t) / __ll_B)
+
+#define umul_ppmm(w1, w0, u, v)						\
+  do {									\
+    USItype __x0, __x1, __x2, __x3;					\
+    USItype __ul, __vl, __uh, __vh;					\
+									\
+    __ul = __ll_lowpart (u);						\
+    __uh = __ll_highpart (u);						\
+    __vl = __ll_lowpart (v);						\
+    __vh = __ll_highpart (v);						\
+									\
+    __x0 = (USItype) __ul * __vl;					\
+    __x1 = (USItype) __ul * __vh;					\
+    __x2 = (USItype) __uh * __vl;					\
+    __x3 = (USItype) __uh * __vh;					\
+									\
+    __x1 += __ll_highpart (__x0);/* this can't give carry */		\
+    __x1 += __x2;		/* but this indeed can */		\
+    if (__x1 < __x2)		/* did we get it? */			\
+      __x3 += __ll_B;		/* yes, add it in the proper pos. */	\
+									\
+    (w1) = __x3 + __ll_highpart (__x1);					\
+    (w0) = __ll_lowpart (__x1) * __ll_B + __ll_lowpart (__x0);		\
+  } while (0)
+
 #endif
+
+#define __umulsidi3(u, v) \
+  ({DIunion __w;							\
+    umul_ppmm (__w.s.high, __w.s.low, u, v);				\
+    __w.ll; })
+
+typedef 	 int SItype	__attribute__ ((mode (SI)));
+typedef unsigned int USItype	__attribute__ ((mode (SI)));
+typedef		 int DItype	__attribute__ ((mode (DI)));
+typedef int word_type __attribute__ ((mode (__word__)));
+
+struct DIstruct {SItype high, low;};
+
+typedef union
+{
+  struct DIstruct s;
+  DItype ll;
+} DIunion;
+
+DItype
+__muldi3 (DItype u, DItype v)
+{
+  DIunion w;
+  DIunion uu, vv;
+
+  uu.ll = u,
+  vv.ll = v;
+
+  w.ll = __umulsidi3 (uu.s.low, vv.s.low);
+  w.s.high += ((USItype) uu.s.low * (USItype) vv.s.high
+	       + (USItype) uu.s.high * (USItype) vv.s.low);
+
+  return w.ll;
+}
diff --git a/arch/m68k/lib/muldi3_mm.c b/arch/m68k/lib/muldi3_mm.c
deleted file mode 100644
index be4f275..0000000
--- a/arch/m68k/lib/muldi3_mm.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/* muldi3.c extracted from gcc-2.7.2.3/libgcc2.c and
-			   gcc-2.7.2.3/longlong.h which is: */
-/* Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING.  If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
-
-#define BITS_PER_UNIT 8
-
-#define umul_ppmm(w1, w0, u, v) \
-  __asm__ ("mulu%.l %3,%1:%0"						\
-           : "=d" ((USItype)(w0)),					\
-             "=d" ((USItype)(w1))					\
-           : "%0" ((USItype)(u)),					\
-             "dmi" ((USItype)(v)))
-
-#define __umulsidi3(u, v) \
-  ({DIunion __w;							\
-    umul_ppmm (__w.s.high, __w.s.low, u, v);				\
-    __w.ll; })
-
-typedef		 int SItype	__attribute__ ((mode (SI)));
-typedef unsigned int USItype	__attribute__ ((mode (SI)));
-typedef		 int DItype	__attribute__ ((mode (DI)));
-typedef int word_type __attribute__ ((mode (__word__)));
-
-struct DIstruct {SItype high, low;};
-
-typedef union
-{
-  struct DIstruct s;
-  DItype ll;
-} DIunion;
-
-DItype
-__muldi3 (DItype u, DItype v)
-{
-  DIunion w;
-  DIunion uu, vv;
-
-  uu.ll = u,
-  vv.ll = v;
-
-  w.ll = __umulsidi3 (uu.s.low, vv.s.low);
-  w.s.high += ((USItype) uu.s.low * (USItype) vv.s.high
-	       + (USItype) uu.s.high * (USItype) vv.s.low);
-
-  return w.ll;
-}
diff --git a/arch/m68k/lib/muldi3_no.c b/arch/m68k/lib/muldi3_no.c
deleted file mode 100644
index 34af72c..0000000
--- a/arch/m68k/lib/muldi3_no.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/* muldi3.c extracted from gcc-2.7.2.3/libgcc2.c and 
-			   gcc-2.7.2.3/longlong.h which is: */
-/* Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING.  If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
-
-#define BITS_PER_UNIT 8
-#define SI_TYPE_SIZE 32
-
-#define __BITS4 (SI_TYPE_SIZE / 4)
-#define __ll_B (1L << (SI_TYPE_SIZE / 2))
-#define __ll_lowpart(t) ((USItype) (t) % __ll_B)
-#define __ll_highpart(t) ((USItype) (t) / __ll_B)
-
-#define umul_ppmm(w1, w0, u, v)						\
-  do {									\
-    USItype __x0, __x1, __x2, __x3;					\
-    USItype __ul, __vl, __uh, __vh;					\
-									\
-    __ul = __ll_lowpart (u);						\
-    __uh = __ll_highpart (u);						\
-    __vl = __ll_lowpart (v);						\
-    __vh = __ll_highpart (v);						\
-									\
-    __x0 = (USItype) __ul * __vl;					\
-    __x1 = (USItype) __ul * __vh;					\
-    __x2 = (USItype) __uh * __vl;					\
-    __x3 = (USItype) __uh * __vh;					\
-									\
-    __x1 += __ll_highpart (__x0);/* this can't give carry */		\
-    __x1 += __x2;		/* but this indeed can */		\
-    if (__x1 < __x2)		/* did we get it? */			\
-      __x3 += __ll_B;		/* yes, add it in the proper pos. */	\
-									\
-    (w1) = __x3 + __ll_highpart (__x1);					\
-    (w0) = __ll_lowpart (__x1) * __ll_B + __ll_lowpart (__x0);		\
-  } while (0)
-
-#define __umulsidi3(u, v) \
-  ({DIunion __w;							\
-    umul_ppmm (__w.s.high, __w.s.low, u, v);				\
-    __w.ll; })
-
-typedef 	 int SItype	__attribute__ ((mode (SI)));
-typedef unsigned int USItype	__attribute__ ((mode (SI)));
-typedef		 int DItype	__attribute__ ((mode (DI)));
-typedef int word_type __attribute__ ((mode (__word__)));
-
-struct DIstruct {SItype high, low;};
-
-typedef union
-{
-  struct DIstruct s;
-  DItype ll;
-} DIunion;
-
-DItype
-__muldi3 (DItype u, DItype v)
-{
-  DIunion w;
-  DIunion uu, vv;
-
-  uu.ll = u,
-  vv.ll = v;
-
-  w.ll = __umulsidi3 (uu.s.low, vv.s.low);
-  w.s.high += ((USItype) uu.s.low * (USItype) vv.s.high
-	       + (USItype) uu.s.high * (USItype) vv.s.low);
-
-  return w.ll;
-}
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v3 2/6] m68k: merge mmu and non-mmu versions of lib/Makefile
  2011-04-21  0:24 ` [PATCH v3 1/6] m68k: merge mmu and non-mmu versions of muldi3 gerg
@ 2011-04-21  0:24   ` gerg
  2011-04-21  0:24     ` [PATCH v3 3/6] m68k: remove duplicate memmove() implementation gerg
  0 siblings, 1 reply; 20+ messages in thread
From: gerg @ 2011-04-21  0:24 UTC (permalink / raw)
  To: linux-m68k, uclinux-dev; +Cc: Greg Ungerer

From: Greg Ungerer <gerg@uclinux.org>

We can easily support the slight differences in libs needed by the
mmu and non-mmu builds in a single Makefile, so merge them back into
a single file again.

Signed-off-by: Greg Ungerer <gerg@uclinux.org>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 arch/m68k/lib/Makefile    |   13 +++++++++++--
 arch/m68k/lib/Makefile_mm |    6 ------
 arch/m68k/lib/Makefile_no |    7 -------
 3 files changed, 11 insertions(+), 15 deletions(-)
 delete mode 100644 arch/m68k/lib/Makefile_mm
 delete mode 100644 arch/m68k/lib/Makefile_no

diff --git a/arch/m68k/lib/Makefile b/arch/m68k/lib/Makefile
index 1f95881..3d85fb6 100644
--- a/arch/m68k/lib/Makefile
+++ b/arch/m68k/lib/Makefile
@@ -1,5 +1,14 @@
+
+#
+# Makefile for m68k-specific library files..
+#
+
+lib-y	:= ashldi3.o ashrdi3.o lshrdi3.o muldi3.o checksum.o
+
 ifdef CONFIG_MMU
-include arch/m68k/lib/Makefile_mm
+lib-y	+= string.o uaccess.o
 else
-include arch/m68k/lib/Makefile_no
+lib-y	+= mulsi3.o divsi3.o udivsi3.o modsi3.o umodsi3.o \
+	   memcpy.o memmove.o memset.o delay.o
 endif
+
diff --git a/arch/m68k/lib/Makefile_mm b/arch/m68k/lib/Makefile_mm
deleted file mode 100644
index af9abf8..0000000
--- a/arch/m68k/lib/Makefile_mm
+++ /dev/null
@@ -1,6 +0,0 @@
-#
-# Makefile for m68k-specific library files..
-#
-
-lib-y	:= ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \
-	   checksum.o string.o uaccess.o
diff --git a/arch/m68k/lib/Makefile_no b/arch/m68k/lib/Makefile_no
deleted file mode 100644
index 32d852e..0000000
--- a/arch/m68k/lib/Makefile_no
+++ /dev/null
@@ -1,7 +0,0 @@
-#
-# Makefile for m68knommu specific library files..
-#
-
-lib-y	:= ashldi3.o ashrdi3.o lshrdi3.o \
-	   muldi3.o mulsi3.o divsi3.o udivsi3.o modsi3.o umodsi3.o \
-	   checksum.o memcpy.o memmove.o memset.o delay.o
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v3 3/6] m68k: remove duplicate memmove() implementation
  2011-04-21  0:24   ` [PATCH v3 2/6] m68k: merge mmu and non-mmu versions of lib/Makefile gerg
@ 2011-04-21  0:24     ` gerg
  2011-04-21  0:24       ` [PATCH v3 4/6] m68k: remove duplicate memset() implementation gerg
  0 siblings, 1 reply; 20+ messages in thread
From: gerg @ 2011-04-21  0:24 UTC (permalink / raw)
  To: linux-m68k, uclinux-dev; +Cc: Greg Ungerer

From: Greg Ungerer <gerg@uclinux.org>

Merging the mmu and non-mmu directories we ended up with duplicate
(and identical) implementations of memmove(). Remove one of them.

Signed-off-by: Greg Ungerer <gerg@uclinux.org>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 arch/m68k/lib/Makefile  |    4 +-
 arch/m68k/lib/memmove.c |    2 -
 arch/m68k/lib/string.c  |   95 -----------------------------------------------
 3 files changed, 2 insertions(+), 99 deletions(-)

diff --git a/arch/m68k/lib/Makefile b/arch/m68k/lib/Makefile
index 3d85fb6..ec479a9 100644
--- a/arch/m68k/lib/Makefile
+++ b/arch/m68k/lib/Makefile
@@ -3,12 +3,12 @@
 # Makefile for m68k-specific library files..
 #
 
-lib-y	:= ashldi3.o ashrdi3.o lshrdi3.o muldi3.o checksum.o
+lib-y	:= ashldi3.o ashrdi3.o lshrdi3.o muldi3.o memmove.o checksum.o
 
 ifdef CONFIG_MMU
 lib-y	+= string.o uaccess.o
 else
 lib-y	+= mulsi3.o divsi3.o udivsi3.o modsi3.o umodsi3.o \
-	   memcpy.o memmove.o memset.o delay.o
+	   memcpy.o memset.o delay.o
 endif
 
diff --git a/arch/m68k/lib/memmove.c b/arch/m68k/lib/memmove.c
index b3dcfe9..6519f7f 100644
--- a/arch/m68k/lib/memmove.c
+++ b/arch/m68k/lib/memmove.c
@@ -4,8 +4,6 @@
  * for more details.
  */
 
-#define __IN_STRING_C
-
 #include <linux/module.h>
 #include <linux/string.h>
 
diff --git a/arch/m68k/lib/string.c b/arch/m68k/lib/string.c
index d399c5f..711fa74 100644
--- a/arch/m68k/lib/string.c
+++ b/arch/m68k/lib/string.c
@@ -148,98 +148,3 @@ void *memcpy(void *to, const void *from, size_t n)
 	return xto;
 }
 EXPORT_SYMBOL(memcpy);
-
-void *memmove(void *dest, const void *src, size_t n)
-{
-	void *xdest = dest;
-	size_t temp;
-
-	if (!n)
-		return xdest;
-
-	if (dest < src) {
-		if ((long)dest & 1) {
-			char *cdest = dest;
-			const char *csrc = src;
-			*cdest++ = *csrc++;
-			dest = cdest;
-			src = csrc;
-			n--;
-		}
-		if (n > 2 && (long)dest & 2) {
-			short *sdest = dest;
-			const short *ssrc = src;
-			*sdest++ = *ssrc++;
-			dest = sdest;
-			src = ssrc;
-			n -= 2;
-		}
-		temp = n >> 2;
-		if (temp) {
-			long *ldest = dest;
-			const long *lsrc = src;
-			temp--;
-			do
-				*ldest++ = *lsrc++;
-			while (temp--);
-			dest = ldest;
-			src = lsrc;
-		}
-		if (n & 2) {
-			short *sdest = dest;
-			const short *ssrc = src;
-			*sdest++ = *ssrc++;
-			dest = sdest;
-			src = ssrc;
-		}
-		if (n & 1) {
-			char *cdest = dest;
-			const char *csrc = src;
-			*cdest = *csrc;
-		}
-	} else {
-		dest = (char *)dest + n;
-		src = (const char *)src + n;
-		if ((long)dest & 1) {
-			char *cdest = dest;
-			const char *csrc = src;
-			*--cdest = *--csrc;
-			dest = cdest;
-			src = csrc;
-			n--;
-		}
-		if (n > 2 && (long)dest & 2) {
-			short *sdest = dest;
-			const short *ssrc = src;
-			*--sdest = *--ssrc;
-			dest = sdest;
-			src = ssrc;
-			n -= 2;
-		}
-		temp = n >> 2;
-		if (temp) {
-			long *ldest = dest;
-			const long *lsrc = src;
-			temp--;
-			do
-				*--ldest = *--lsrc;
-			while (temp--);
-			dest = ldest;
-			src = lsrc;
-		}
-		if (n & 2) {
-			short *sdest = dest;
-			const short *ssrc = src;
-			*--sdest = *--ssrc;
-			dest = sdest;
-			src = ssrc;
-		}
-		if (n & 1) {
-			char *cdest = dest;
-			const char *csrc = src;
-			*--cdest = *--csrc;
-		}
-	}
-	return xdest;
-}
-EXPORT_SYMBOL(memmove);
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v3 4/6] m68k: remove duplicate memset() implementation
  2011-04-21  0:24     ` [PATCH v3 3/6] m68k: remove duplicate memmove() implementation gerg
@ 2011-04-21  0:24       ` gerg
  2011-04-21  0:24         ` [PATCH v3 5/6] m68k: remove duplicate memcpy() implementation gerg
  0 siblings, 1 reply; 20+ messages in thread
From: gerg @ 2011-04-21  0:24 UTC (permalink / raw)
  To: linux-m68k, uclinux-dev; +Cc: Greg Ungerer

From: Greg Ungerer <gerg@uclinux.org>

Merging the mmu and non-mmu directories we ended up with duplicate
implementations of memset(). One is a little more optimized for the
>= 68020 case, but that can easily be inserted into a single
implementation of memset(). Clean up the exporting of this symbol
too, otherwise we end up exporting it twice on a no-mmu build.

Signed-off-by: Greg Ungerer <gerg@uclinux.org>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 arch/m68k/kernel/m68k_ksyms_no.c |    1 -
 arch/m68k/lib/Makefile           |    5 +-
 arch/m68k/lib/memset.c           |  114 +++++++++++++++++++++++--------------
 arch/m68k/lib/string.c           |   61 --------------------
 4 files changed, 74 insertions(+), 107 deletions(-)

diff --git a/arch/m68k/kernel/m68k_ksyms_no.c b/arch/m68k/kernel/m68k_ksyms_no.c
index 39fe0a7..346bce6 100644
--- a/arch/m68k/kernel/m68k_ksyms_no.c
+++ b/arch/m68k/kernel/m68k_ksyms_no.c
@@ -36,7 +36,6 @@ EXPORT_SYMBOL(csum_partial_copy_nocheck);
    their interface isn't gonna change any time soon now, so
    it's OK to leave it out of version control.  */
 EXPORT_SYMBOL(memcpy);
-EXPORT_SYMBOL(memset);
 
 /*
  * libgcc functions - functions that are used internally by the
diff --git a/arch/m68k/lib/Makefile b/arch/m68k/lib/Makefile
index ec479a9..ac275d5 100644
--- a/arch/m68k/lib/Makefile
+++ b/arch/m68k/lib/Makefile
@@ -3,12 +3,13 @@
 # Makefile for m68k-specific library files..
 #
 
-lib-y	:= ashldi3.o ashrdi3.o lshrdi3.o muldi3.o memmove.o checksum.o
+lib-y	:= ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \
+	   memset.o memmove.o checksum.o
 
 ifdef CONFIG_MMU
 lib-y	+= string.o uaccess.o
 else
 lib-y	+= mulsi3.o divsi3.o udivsi3.o modsi3.o umodsi3.o \
-	   memcpy.o memset.o delay.o
+	   memcpy.o delay.o
 endif
 
diff --git a/arch/m68k/lib/memset.c b/arch/m68k/lib/memset.c
index 1389bf4..f649e6a 100644
--- a/arch/m68k/lib/memset.c
+++ b/arch/m68k/lib/memset.c
@@ -1,47 +1,75 @@
-#include <linux/types.h>
+/*
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file COPYING in the main directory of this archive
+ * for more details.
+ */
 
-void * memset(void * s, int c, size_t count)
+#include <linux/module.h>
+#include <linux/string.h>
+
+void *memset(void *s, int c, size_t count)
 {
-  void *xs = s;
-  size_t temp;
+	void *xs = s;
+	size_t temp;
 
-  if (!count)
-    return xs;
-  c &= 0xff;
-  c |= c << 8;
-  c |= c << 16;
-  if ((long) s & 1)
-    {
-      char *cs = s;
-      *cs++ = c;
-      s = cs;
-      count--;
-    }
-  if (count > 2 && (long) s & 2)
-    {
-      short *ss = s;
-      *ss++ = c;
-      s = ss;
-      count -= 2;
-    }
-  temp = count >> 2;
-  if (temp)
-    {
-      long *ls = s;
-      for (; temp; temp--)
-	*ls++ = c;
-      s = ls;
-    }
-  if (count & 2)
-    {
-      short *ss = s;
-      *ss++ = c;
-      s = ss;
-    }
-  if (count & 1)
-    {
-      char *cs = s;
-      *cs = c;
-    }
-  return xs;
+	if (!count)
+		return xs;
+	c &= 0xff;
+	c |= c << 8;
+	c |= c << 16;
+	if ((long)s & 1) {
+		char *cs = s;
+		*cs++ = c;
+		s = cs;
+		count--;
+	}
+	if (count > 2 && (long)s & 2) {
+		short *ss = s;
+		*ss++ = c;
+		s = ss;
+		count -= 2;
+	}
+	temp = count >> 2;
+	if (temp) {
+		long *ls = s;
+#if defined(__mc68020__) || defined(__mc68030__) || \
+    defined(__mc68040__) || defined(__mc68060__) || defined(__mcpu32__)
+		size_t temp1;
+		asm volatile (
+			"	movel %1,%2\n"
+			"	andw  #7,%2\n"
+			"	lsrl  #3,%1\n"
+			"	negw  %2\n"
+			"	jmp   %%pc@(2f,%2:w:2)\n"
+			"1:	movel %3,%0@+\n"
+			"	movel %3,%0@+\n"
+			"	movel %3,%0@+\n"
+			"	movel %3,%0@+\n"
+			"	movel %3,%0@+\n"
+			"	movel %3,%0@+\n"
+			"	movel %3,%0@+\n"
+			"	movel %3,%0@+\n"
+			"2:	dbra  %1,1b\n"
+			"	clrw  %1\n"
+			"	subql #1,%1\n"
+			"	jpl   1b"
+			: "=a" (ls), "=d" (temp), "=&d" (temp1)
+			: "d" (c), "0" (ls), "1" (temp));
+#else
+		for (; temp; temp--)
+			*ls++ = c;
+#endif
+		s = ls;
+	}
+	if (count & 2) {
+		short *ss = s;
+		*ss++ = c;
+		s = ss;
+	}
+	if (count & 1) {
+		char *cs = s;
+		*cs = c;
+	}
+	return xs;
 }
+EXPORT_SYMBOL(memset);
diff --git a/arch/m68k/lib/string.c b/arch/m68k/lib/string.c
index 711fa74..6d24612 100644
--- a/arch/m68k/lib/string.c
+++ b/arch/m68k/lib/string.c
@@ -21,67 +21,6 @@ char *strcat(char *dest, const char *src)
 }
 EXPORT_SYMBOL(strcat);
 
-void *memset(void *s, int c, size_t count)
-{
-	void *xs = s;
-	size_t temp, temp1;
-
-	if (!count)
-		return xs;
-	c &= 0xff;
-	c |= c << 8;
-	c |= c << 16;
-	if ((long)s & 1) {
-		char *cs = s;
-		*cs++ = c;
-		s = cs;
-		count--;
-	}
-	if (count > 2 && (long)s & 2) {
-		short *ss = s;
-		*ss++ = c;
-		s = ss;
-		count -= 2;
-	}
-	temp = count >> 2;
-	if (temp) {
-		long *ls = s;
-
-		asm volatile (
-			"	movel %1,%2\n"
-			"	andw  #7,%2\n"
-			"	lsrl  #3,%1\n"
-			"	negw  %2\n"
-			"	jmp   %%pc@(2f,%2:w:2)\n"
-			"1:	movel %3,%0@+\n"
-			"	movel %3,%0@+\n"
-			"	movel %3,%0@+\n"
-			"	movel %3,%0@+\n"
-			"	movel %3,%0@+\n"
-			"	movel %3,%0@+\n"
-			"	movel %3,%0@+\n"
-			"	movel %3,%0@+\n"
-			"2:	dbra  %1,1b\n"
-			"	clrw  %1\n"
-			"	subql #1,%1\n"
-			"	jpl   1b"
-			: "=a" (ls), "=d" (temp), "=&d" (temp1)
-			: "d" (c), "0" (ls), "1" (temp));
-		s = ls;
-	}
-	if (count & 2) {
-		short *ss = s;
-		*ss++ = c;
-		s = ss;
-	}
-	if (count & 1) {
-		char *cs = s;
-		*cs = c;
-	}
-	return xs;
-}
-EXPORT_SYMBOL(memset);
-
 void *memcpy(void *to, const void *from, size_t n)
 {
 	void *xto = to;
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v3 5/6] m68k: remove duplicate memcpy() implementation
  2011-04-21  0:24       ` [PATCH v3 4/6] m68k: remove duplicate memset() implementation gerg
@ 2011-04-21  0:24         ` gerg
  2011-04-21  0:24           ` [PATCH v3 6/6] m68k: let Makefile sort out compiling mmu and non-mmu lib/checksum.c gerg
  2011-05-23 19:26           ` [PATCH v3 5/6] m68k: remove duplicate memcpy() implementation Geert Uytterhoeven
  0 siblings, 2 replies; 20+ messages in thread
From: gerg @ 2011-04-21  0:24 UTC (permalink / raw)
  To: linux-m68k, uclinux-dev; +Cc: Greg Ungerer

From: Greg Ungerer <gerg@uclinux.org>

Merging the mmu and non-mmu directories we ended up with duplicate
implementations of memcpy(). One is a little more optimized for the
>= 68020 case, but that can easily be inserted into a single
implementation of memcpy(). Clean up the exporting of this symbol
too, otherwise we end up exporting it twice on a no-mmu build.

Signed-off-by: Greg Ungerer <gerg@uclinux.org>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 arch/m68k/kernel/m68k_ksyms_no.c |    6 --
 arch/m68k/lib/Makefile           |    5 +-
 arch/m68k/lib/memcpy.c           |  128 +++++++++++++++++++++----------------
 arch/m68k/lib/string.c           |   67 --------------------
 4 files changed, 75 insertions(+), 131 deletions(-)

diff --git a/arch/m68k/kernel/m68k_ksyms_no.c b/arch/m68k/kernel/m68k_ksyms_no.c
index 346bce6..10af0af 100644
--- a/arch/m68k/kernel/m68k_ksyms_no.c
+++ b/arch/m68k/kernel/m68k_ksyms_no.c
@@ -31,12 +31,6 @@ EXPORT_SYMBOL(kernel_thread);
 /* Networking helper routines. */
 EXPORT_SYMBOL(csum_partial_copy_nocheck);
 
-/* The following are special because they're not called
-   explicitly (the C compiler generates them).  Fortunately,
-   their interface isn't gonna change any time soon now, so
-   it's OK to leave it out of version control.  */
-EXPORT_SYMBOL(memcpy);
-
 /*
  * libgcc functions - functions that are used internally by the
  * compiler...  (prototypes are not correct though, but that
diff --git a/arch/m68k/lib/Makefile b/arch/m68k/lib/Makefile
index ac275d5..2438d02 100644
--- a/arch/m68k/lib/Makefile
+++ b/arch/m68k/lib/Makefile
@@ -4,12 +4,11 @@
 #
 
 lib-y	:= ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \
-	   memset.o memmove.o checksum.o
+	   memcpy.o memset.o memmove.o checksum.o
 
 ifdef CONFIG_MMU
 lib-y	+= string.o uaccess.o
 else
-lib-y	+= mulsi3.o divsi3.o udivsi3.o modsi3.o umodsi3.o \
-	   memcpy.o delay.o
+lib-y	+= mulsi3.o divsi3.o udivsi3.o modsi3.o umodsi3.o delay.o
 endif
 
diff --git a/arch/m68k/lib/memcpy.c b/arch/m68k/lib/memcpy.c
index b50dbca..62182c8 100644
--- a/arch/m68k/lib/memcpy.c
+++ b/arch/m68k/lib/memcpy.c
@@ -1,62 +1,80 @@
+/*
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file COPYING in the main directory of this archive
+ * for more details.
+ */
 
-#include <linux/types.h>
+#include <linux/module.h>
+#include <linux/string.h>
 
-void * memcpy(void * to, const void * from, size_t n)
+void *memcpy(void *to, const void *from, size_t n)
 {
-#ifdef CONFIG_COLDFIRE
-  void *xto = to;
-  size_t temp;
+	void *xto = to;
+	size_t temp, temp1;
 
-  if (!n)
-    return xto;
-  if ((long) to & 1)
-    {
-      char *cto = to;
-      const char *cfrom = from;
-      *cto++ = *cfrom++;
-      to = cto;
-      from = cfrom;
-      n--;
-    }
-  if (n > 2 && (long) to & 2)
-    {
-      short *sto = to;
-      const short *sfrom = from;
-      *sto++ = *sfrom++;
-      to = sto;
-      from = sfrom;
-      n -= 2;
-    }
-  temp = n >> 2;
-  if (temp)
-    {
-      long *lto = to;
-      const long *lfrom = from;
-      for (; temp; temp--)
-	*lto++ = *lfrom++;
-      to = lto;
-      from = lfrom;
-    }
-  if (n & 2)
-    {
-      short *sto = to;
-      const short *sfrom = from;
-      *sto++ = *sfrom++;
-      to = sto;
-      from = sfrom;
-    }
-  if (n & 1)
-    {
-      char *cto = to;
-      const char *cfrom = from;
-      *cto = *cfrom;
-    }
-  return xto;
+	if (!n)
+		return xto;
+	if ((long)to & 1) {
+		char *cto = to;
+		const char *cfrom = from;
+		*cto++ = *cfrom++;
+		to = cto;
+		from = cfrom;
+		n--;
+	}
+	if (n > 2 && (long)to & 2) {
+		short *sto = to;
+		const short *sfrom = from;
+		*sto++ = *sfrom++;
+		to = sto;
+		from = sfrom;
+		n -= 2;
+	}
+	temp = n >> 2;
+	if (temp) {
+		long *lto = to;
+		const long *lfrom = from;
+#if defined(__mc68020__) || defined(__mc68030__) || \
+    defined(__mc68040__) || defined(__mc68060__) || defined(__mcpu32__)
+		asm volatile (
+			"	movel %2,%3\n"
+			"	andw  #7,%3\n"
+			"	lsrl  #3,%2\n"
+			"	negw  %3\n"
+			"	jmp   %%pc@(1f,%3:w:2)\n"
+			"4:	movel %0@+,%1@+\n"
+			"	movel %0@+,%1@+\n"
+			"	movel %0@+,%1@+\n"
+			"	movel %0@+,%1@+\n"
+			"	movel %0@+,%1@+\n"
+			"	movel %0@+,%1@+\n"
+			"	movel %0@+,%1@+\n"
+			"	movel %0@+,%1@+\n"
+			"1:	dbra  %2,4b\n"
+			"	clrw  %2\n"
+			"	subql #1,%2\n"
+			"	jpl   4b"
+			: "=a" (lfrom), "=a" (lto), "=d" (temp), "=&d" (temp1)
+			: "0" (lfrom), "1" (lto), "2" (temp));
 #else
-  const char *c_from = from;
-  char *c_to = to;
-  while (n-- > 0)
-    *c_to++ = *c_from++;
-  return((void *) to);
+		for (; temp; temp--)
+			*lto++ = *lfrom++;
 #endif
+		to = lto;
+		from = lfrom;
+	}
+	if (n & 2) {
+		short *sto = to;
+		const short *sfrom = from;
+		*sto++ = *sfrom++;
+		to = sto;
+		from = sfrom;
+	}
+	if (n & 1) {
+		char *cto = to;
+		const char *cfrom = from;
+		*cto = *cfrom;
+	}
+	return xto;
 }
+EXPORT_SYMBOL(memcpy);
diff --git a/arch/m68k/lib/string.c b/arch/m68k/lib/string.c
index 6d24612..b9a57ab 100644
--- a/arch/m68k/lib/string.c
+++ b/arch/m68k/lib/string.c
@@ -20,70 +20,3 @@ char *strcat(char *dest, const char *src)
 	return __kernel_strcpy(dest + __kernel_strlen(dest), src);
 }
 EXPORT_SYMBOL(strcat);
-
-void *memcpy(void *to, const void *from, size_t n)
-{
-	void *xto = to;
-	size_t temp, temp1;
-
-	if (!n)
-		return xto;
-	if ((long)to & 1) {
-		char *cto = to;
-		const char *cfrom = from;
-		*cto++ = *cfrom++;
-		to = cto;
-		from = cfrom;
-		n--;
-	}
-	if (n > 2 && (long)to & 2) {
-		short *sto = to;
-		const short *sfrom = from;
-		*sto++ = *sfrom++;
-		to = sto;
-		from = sfrom;
-		n -= 2;
-	}
-	temp = n >> 2;
-	if (temp) {
-		long *lto = to;
-		const long *lfrom = from;
-
-		asm volatile (
-			"	movel %2,%3\n"
-			"	andw  #7,%3\n"
-			"	lsrl  #3,%2\n"
-			"	negw  %3\n"
-			"	jmp   %%pc@(1f,%3:w:2)\n"
-			"4:	movel %0@+,%1@+\n"
-			"	movel %0@+,%1@+\n"
-			"	movel %0@+,%1@+\n"
-			"	movel %0@+,%1@+\n"
-			"	movel %0@+,%1@+\n"
-			"	movel %0@+,%1@+\n"
-			"	movel %0@+,%1@+\n"
-			"	movel %0@+,%1@+\n"
-			"1:	dbra  %2,4b\n"
-			"	clrw  %2\n"
-			"	subql #1,%2\n"
-			"	jpl   4b"
-			: "=a" (lfrom), "=a" (lto), "=d" (temp), "=&d" (temp1)
-			: "0" (lfrom), "1" (lto), "2" (temp));
-		to = lto;
-		from = lfrom;
-	}
-	if (n & 2) {
-		short *sto = to;
-		const short *sfrom = from;
-		*sto++ = *sfrom++;
-		to = sto;
-		from = sfrom;
-	}
-	if (n & 1) {
-		char *cto = to;
-		const char *cfrom = from;
-		*cto = *cfrom;
-	}
-	return xto;
-}
-EXPORT_SYMBOL(memcpy);
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v3 6/6] m68k: let Makefile sort out compiling mmu and non-mmu lib/checksum.c
  2011-04-21  0:24         ` [PATCH v3 5/6] m68k: remove duplicate memcpy() implementation gerg
@ 2011-04-21  0:24           ` gerg
  2011-05-23 19:26           ` [PATCH v3 5/6] m68k: remove duplicate memcpy() implementation Geert Uytterhoeven
  1 sibling, 0 replies; 20+ messages in thread
From: gerg @ 2011-04-21  0:24 UTC (permalink / raw)
  To: linux-m68k, uclinux-dev; +Cc: Greg Ungerer

From: Greg Ungerer <gerg@uclinux.org>

We don't need an arch/m68k/lib/checksum.c wrapper to include the correct
mmu or non-mmu version of the checksum code. Let the Makefile just build
the appropriate one.

Signed-off-by: Greg Ungerer <gerg@uclinux.org>
---
 arch/m68k/lib/Makefile   |    6 +++---
 arch/m68k/lib/checksum.c |    5 -----
 2 files changed, 3 insertions(+), 8 deletions(-)
 delete mode 100644 arch/m68k/lib/checksum.c

diff --git a/arch/m68k/lib/Makefile b/arch/m68k/lib/Makefile
index 2438d02..df421e5 100644
--- a/arch/m68k/lib/Makefile
+++ b/arch/m68k/lib/Makefile
@@ -4,11 +4,11 @@
 #
 
 lib-y	:= ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \
-	   memcpy.o memset.o memmove.o checksum.o
+	   memcpy.o memset.o memmove.o
 
 ifdef CONFIG_MMU
-lib-y	+= string.o uaccess.o
+lib-y	+= string.o uaccess.o checksum_mm.o
 else
-lib-y	+= mulsi3.o divsi3.o udivsi3.o modsi3.o umodsi3.o delay.o
+lib-y	+= mulsi3.o divsi3.o udivsi3.o modsi3.o umodsi3.o delay.o checksum_no.o
 endif
 
diff --git a/arch/m68k/lib/checksum.c b/arch/m68k/lib/checksum.c
deleted file mode 100644
index 1297536..0000000
--- a/arch/m68k/lib/checksum.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#ifdef CONFIG_MMU
-#include "checksum_mm.c"
-#else
-#include "checksum_no.c"
-#endif
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH v3 5/6] m68k: remove duplicate memcpy() implementation
  2011-04-21  0:24         ` [PATCH v3 5/6] m68k: remove duplicate memcpy() implementation gerg
  2011-04-21  0:24           ` [PATCH v3 6/6] m68k: let Makefile sort out compiling mmu and non-mmu lib/checksum.c gerg
@ 2011-05-23 19:26           ` Geert Uytterhoeven
  2011-05-23 19:54             ` Andreas Schwab
  1 sibling, 1 reply; 20+ messages in thread
From: Geert Uytterhoeven @ 2011-05-23 19:26 UTC (permalink / raw)
  To: gerg; +Cc: linux-m68k, uclinux-dev, Greg Ungerer

On Thu, Apr 21, 2011 at 02:24,  <gerg@snapgear.com> wrote:
> +#if defined(__mc68020__) || defined(__mc68030__) || \
> +    defined(__mc68040__) || defined(__mc68060__) || defined(__mcpu32__)

FWIW, my m68k-linux-gnu-gcc (4.1.2 20061115 (prerelease)) always defines
__mc68000__ and __mc68020__, even when specifying -m68000 on the command
line.

__mc68030__, __mc68040__, __mc68060__, and __mcpu32__ are only defined
if -m68030, -m68040, -m68060, resp. -mcpu32 is specified on the command line.

So the #ifdef always evaluates to true, and it tries to use the scale
factor for 68000,
which is rejected by the assembler.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v3 5/6] m68k: remove duplicate memcpy() implementation
  2011-05-23 19:26           ` [PATCH v3 5/6] m68k: remove duplicate memcpy() implementation Geert Uytterhoeven
@ 2011-05-23 19:54             ` Andreas Schwab
  2011-05-23 23:55               ` Greg Ungerer
  2011-05-24  7:51               ` Geert Uytterhoeven
  0 siblings, 2 replies; 20+ messages in thread
From: Andreas Schwab @ 2011-05-23 19:54 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: gerg, linux-m68k, uclinux-dev, Greg Ungerer

Geert Uytterhoeven <geert@linux-m68k.org> writes:

> FWIW, my m68k-linux-gnu-gcc (4.1.2 20061115 (prerelease)) always defines
> __mc68000__ and __mc68020__, even when specifying -m68000 on the command
> line.

m68k-linux has always defined __mc68020__ unconditionally, because it
does not support anything less.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v3 5/6] m68k: remove duplicate memcpy() implementation
  2011-05-23 19:54             ` Andreas Schwab
@ 2011-05-23 23:55               ` Greg Ungerer
  2011-05-24  7:34                 ` Andreas Schwab
  2011-05-24  7:51               ` Geert Uytterhoeven
  1 sibling, 1 reply; 20+ messages in thread
From: Greg Ungerer @ 2011-05-23 23:55 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Geert Uytterhoeven, linux-m68k, uclinux-dev, Greg Ungerer

On 24/05/11 05:54, Andreas Schwab wrote:
> Geert Uytterhoeven<geert@linux-m68k.org>  writes:
>
>> FWIW, my m68k-linux-gnu-gcc (4.1.2 20061115 (prerelease)) always defines
>> __mc68000__ and __mc68020__, even when specifying -m68000 on the command
>> line.
>
> m68k-linux has always defined __mc68020__ unconditionally, because it
> does not support anything less.

I don't beleive that is always the case:


$ m68k-linux-gcc -m68000 -dM -E - < /dev/null | grep 68020

$ m68k-linux-gcc -m5200 -dM -E - < /dev/null | grep 68020

$ m68k-linux-gcc -dM -E - < /dev/null | grep 68020
#define __mc68020__ 1
#define __mc68020 1
#define mc68020 1

$ m68k-linux-gcc -mcpu32 -dM -E - < /dev/null | grep 68020
#define __mc68020__ 1
#define __mc68020 1
#define mc68020 1

$ m68k-linux-gcc --version
m68k-linux-gcc (GCC) 4.5.1
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Regards
Greg


------------------------------------------------------------------------
Greg Ungerer  --  Principal Engineer        EMAIL:     gerg@snapgear.com
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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v3 5/6] m68k: remove duplicate memcpy() implementation
  2011-05-23 23:55               ` Greg Ungerer
@ 2011-05-24  7:34                 ` Andreas Schwab
  0 siblings, 0 replies; 20+ messages in thread
From: Andreas Schwab @ 2011-05-24  7:34 UTC (permalink / raw)
  To: Greg Ungerer; +Cc: Geert Uytterhoeven, linux-m68k, uclinux-dev, Greg Ungerer

Greg Ungerer <gerg@snapgear.com> writes:

> m68k-linux-gcc (GCC) 4.5.1

Your compiler is too new :-)  (This has been reorganized completely in 4.3.)

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v3 5/6] m68k: remove duplicate memcpy() implementation
  2011-05-23 19:54             ` Andreas Schwab
  2011-05-23 23:55               ` Greg Ungerer
@ 2011-05-24  7:51               ` Geert Uytterhoeven
  2011-05-24  8:06                 ` Andreas Schwab
  1 sibling, 1 reply; 20+ messages in thread
From: Geert Uytterhoeven @ 2011-05-24  7:51 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: gerg, linux-m68k, uclinux-dev, Greg Ungerer

On Mon, May 23, 2011 at 21:54, Andreas Schwab <schwab@linux-m68k.org> wrote:
> Geert Uytterhoeven <geert@linux-m68k.org> writes:
>
>> FWIW, my m68k-linux-gnu-gcc (4.1.2 20061115 (prerelease)) always defines
>> __mc68000__ and __mc68020__, even when specifying -m68000 on the command
>> line.
>
> m68k-linux has always defined __mc68020__ unconditionally, because it
> does not support anything less.

Sorry, I'm just using my good old m68k-linux-gnu toolchain is a devil
for all ;-)

What exactly do you mean by "does not support anything less"? It seems it does
restrict instruction generation to 68000 if you ask for it.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v3 5/6] m68k: remove duplicate memcpy() implementation
  2011-05-24  7:51               ` Geert Uytterhoeven
@ 2011-05-24  8:06                 ` Andreas Schwab
  2011-05-26  6:23                   ` Greg Ungerer
  0 siblings, 1 reply; 20+ messages in thread
From: Andreas Schwab @ 2011-05-24  8:06 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: gerg, linux-m68k, uclinux-dev, Greg Ungerer

Geert Uytterhoeven <geert@linux-m68k.org> writes:

> What exactly do you mean by "does not support anything less"? It seems it does
> restrict instruction generation to 68000 if you ask for it.

The point is that Linux/m68k requires 68020+, so compiling for 68000
does not make sense (at least back when the gcc configuration was
created).

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v3 5/6] m68k: remove duplicate memcpy() implementation
  2011-05-24  8:06                 ` Andreas Schwab
@ 2011-05-26  6:23                   ` Greg Ungerer
  2011-05-26  6:38                     ` Geert Uytterhoeven
  2011-05-26  7:28                     ` Gavin Lambert
  0 siblings, 2 replies; 20+ messages in thread
From: Greg Ungerer @ 2011-05-26  6:23 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Geert Uytterhoeven, linux-m68k, uclinux-dev, Greg Ungerer

Hi Andreas, Geert,

On 24/05/11 18:06, Andreas Schwab wrote:
> Geert Uytterhoeven<geert@linux-m68k.org>  writes:
>
>> What exactly do you mean by "does not support anything less"? It seems it does
>> restrict instruction generation to 68000 if you ask for it.
>
> The point is that Linux/m68k requires 68020+, so compiling for 68000
> does not make sense (at least back when the gcc configuration was
> created).

Yeah, used to be true :-)
This seems very much to me to be a "broken compiler" issue.

Is it worth putting some form of compiler version limits to protect
compilation in the m68000 case?  (Probably no need to limit it for
the existing 68020+ case).

Are there any other gcc defines that we could use instead?
We need to check with your old compiler Geert :-)

I really don't want to use CONFIG_MMU here (or in bitops.h either).
When I work in the ColdFire MMU code this won't be right.

Regards
Greg


------------------------------------------------------------------------
Greg Ungerer  --  Principal Engineer        EMAIL:     gerg@snapgear.com
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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v3 5/6] m68k: remove duplicate memcpy() implementation
  2011-05-26  6:23                   ` Greg Ungerer
@ 2011-05-26  6:38                     ` Geert Uytterhoeven
  2011-06-02  5:18                       ` Greg Ungerer
  2011-05-26  7:28                     ` Gavin Lambert
  1 sibling, 1 reply; 20+ messages in thread
From: Geert Uytterhoeven @ 2011-05-26  6:38 UTC (permalink / raw)
  To: Greg Ungerer; +Cc: Andreas Schwab, linux-m68k, uclinux-dev, Greg Ungerer

On Thu, May 26, 2011 at 08:23, Greg Ungerer <gerg@snapgear.com> wrote:
> On 24/05/11 18:06, Andreas Schwab wrote:
>> Geert Uytterhoeven<geert@linux-m68k.org>  writes:
>>
>>> What exactly do you mean by "does not support anything less"? It seems it
>>> does
>>> restrict instruction generation to 68000 if you ask for it.
>>
>> The point is that Linux/m68k requires 68020+, so compiling for 68000
>> does not make sense (at least back when the gcc configuration was
>> created).
>
> Yeah, used to be true :-)
> This seems very much to me to be a "broken compiler" issue.
>
> Is it worth putting some form of compiler version limits to protect
> compilation in the m68000 case?  (Probably no need to limit it for
> the existing 68020+ case).
>
> Are there any other gcc defines that we could use instead?
> We need to check with your old compiler Geert :-)
>
> I really don't want to use CONFIG_MMU here (or in bitops.h either).
> When I work in the ColdFire MMU code this won't be right.

I was more thinking along the lines of !CONFIG_M68000 && !CONFIG_M68010
&& !CONFIG_<whatever Coldfire that doesn't support it>.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* RE: Re: [PATCH v3 5/6] m68k: remove duplicate memcpy() implementation
  2011-05-26  6:23                   ` Greg Ungerer
  2011-05-26  6:38                     ` Geert Uytterhoeven
@ 2011-05-26  7:28                     ` Gavin Lambert
  2011-05-26 11:30                       ` [uClinux-dev] " Greg Ungerer
  1 sibling, 1 reply; 20+ messages in thread
From: Gavin Lambert @ 2011-05-26  7:28 UTC (permalink / raw)
  To: 'uClinux development list', 'Andreas Schwab'
  Cc: linux-m68k, 'Greg Ungerer'

Quoth Greg Ungerer:
> On 24/05/11 18:06, Andreas Schwab wrote:
> > Geert Uytterhoeven<geert@linux-m68k.org>  writes:
> >
> >> What exactly do you mean by "does not support anything less"? It
> >> seems it does restrict instruction generation to 68000 if you 
> >> ask for it.
> >
> > The point is that Linux/m68k requires 68020+, so compiling for 68000
> > does not make sense (at least back when the gcc configuration was
> > created).
> 
> Yeah, used to be true :-)
> This seems very much to me to be a "broken compiler" issue.

Hmm, that has me worried a little.  I was thinking about trying to use gcc
for a (non-Linux) M68000 device.

Does the above mean that this would be problematic?


_______________________________________________
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [uClinux-dev] Re: [PATCH v3 5/6] m68k: remove duplicate memcpy() implementation
  2011-05-26  7:28                     ` Gavin Lambert
@ 2011-05-26 11:30                       ` Greg Ungerer
  0 siblings, 0 replies; 20+ messages in thread
From: Greg Ungerer @ 2011-05-26 11:30 UTC (permalink / raw)
  To: Gavin Lambert
  Cc: 'uClinux development list', 'Andreas Schwab',
	linux-m68k, 'Greg Ungerer'

Hi Gavin,

On 26/05/11 17:28, Gavin Lambert wrote:
> Quoth Greg Ungerer:
>> On 24/05/11 18:06, Andreas Schwab wrote:
>>> Geert Uytterhoeven<geert@linux-m68k.org>   writes:
>>>
>>>> What exactly do you mean by "does not support anything less"? It
>>>> seems it does restrict instruction generation to 68000 if you
>>>> ask for it.
>>>
>>> The point is that Linux/m68k requires 68020+, so compiling for 68000
>>> does not make sense (at least back when the gcc configuration was
>>> created).
>>
>> Yeah, used to be true :-)
>> This seems very much to me to be a "broken compiler" issue.
>
> Hmm, that has me worried a little.  I was thinking about trying to use gcc
> for a (non-Linux) M68000 device.
>
> Does the above mean that this would be problematic?

It seems to have been fixed in newer versions of gcc.
My current 4.5.1 generates only the defines I would expect
based on the supplied machine type options.

Regards
Greg

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v3 5/6] m68k: remove duplicate memcpy() implementation
  2011-05-26  6:38                     ` Geert Uytterhoeven
@ 2011-06-02  5:18                       ` Greg Ungerer
  2011-06-02  7:43                         ` Geert Uytterhoeven
  0 siblings, 1 reply; 20+ messages in thread
From: Greg Ungerer @ 2011-06-02  5:18 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Andreas Schwab, linux-m68k, uclinux-dev, Greg Ungerer


Hi Geert,

On 26/05/11 16:38, Geert Uytterhoeven wrote:
> On Thu, May 26, 2011 at 08:23, Greg Ungerer<gerg@snapgear.com>  wrote:
>> On 24/05/11 18:06, Andreas Schwab wrote:
>>> Geert Uytterhoeven<geert@linux-m68k.org>  áwrites:
>>>
>>>> What exactly do you mean by "does not support anything less"? It seems it
>>>> does
>>>> restrict instruction generation to 68000 if you ask for it.
>>>
>>> The point is that Linux/m68k requires 68020+, so compiling for 68000
>>> does not make sense (at least back when the gcc configuration was
>>> created).
>>
>> Yeah, used to be true :-)
>> This seems very much to me to be a "broken compiler" issue.
>>
>> Is it worth putting some form of compiler version limits to protect
>> compilation in the m68000 case? á(Probably no need to limit it for
>> the existing 68020+ case).
>>
>> Are there any other gcc defines that we could use instead?
>> We need to check with your old compiler Geert :-)
>>
>> I really don't want to use CONFIG_MMU here (or in bitops.h either).
>> When I work in the ColdFire MMU code this won't be right.
>
> I was more thinking along the lines of !CONFIG_M68000&&  !CONFIG_M68010
> &&  !CONFIG_<whatever Coldfire that doesn't support it>.

Or in this case (and probably most cases) we could just switch
to using the same positive logic. So what I had as:

#if defined(__mc68020__) || defined(__mc68030__) || \
     defined(__mc68040__) || defined(__mc68060__) || defined(__mcpu32__)

becomes

#if defined(CONFIG_M68020) || defined(CONFIG_M68030) || \
     defined(CONFIG_M68040) || defined(CONFIG_M68060) || \
     defined(CONFIG_MCPU32)

There currently isn't a CONFIG_MCPU32, but I could easily add
that (we only have one CPU in that class currently supported,
the 68360).

The compiler setting won't matter, only what we configured.
Sam will probably like this better, he suggested using the
kernel configs initially, in
http://www.spinics.net/lists/linux-m68k/msg03609.html

I will prepare some patches that do this and see how they look.

Regards
Greg


------------------------------------------------------------------------
Greg Ungerer  --  Principal Engineer        EMAIL:     gerg@snapgear.com
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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v3 5/6] m68k: remove duplicate memcpy() implementation
  2011-06-02  5:18                       ` Greg Ungerer
@ 2011-06-02  7:43                         ` Geert Uytterhoeven
  2011-06-02 12:34                           ` Greg Ungerer
  0 siblings, 1 reply; 20+ messages in thread
From: Geert Uytterhoeven @ 2011-06-02  7:43 UTC (permalink / raw)
  To: Greg Ungerer; +Cc: Andreas Schwab, linux-m68k, uclinux-dev, Greg Ungerer

On Thu, Jun 2, 2011 at 07:18, Greg Ungerer <gerg@snapgear.com> wrote:
> On 26/05/11 16:38, Geert Uytterhoeven wrote:
>> I was more thinking along the lines of !CONFIG_M68000&&  !CONFIG_M68010
>> &&  !CONFIG_<whatever Coldfire that doesn't support it>.
>
> Or in this case (and probably most cases) we could just switch
> to using the same positive logic. So what I had as:
>
> #if defined(__mc68020__) || defined(__mc68030__) || \
>    defined(__mc68040__) || defined(__mc68060__) || defined(__mcpu32__)
>
> becomes
>
> #if defined(CONFIG_M68020) || defined(CONFIG_M68030) || \
>    defined(CONFIG_M68040) || defined(CONFIG_M68060) || \
>    defined(CONFIG_MCPU32)
>
> There currently isn't a CONFIG_MCPU32, but I could easily add
> that (we only have one CPU in that class currently supported,
> the 68360).
>
> The compiler setting won't matter, only what we configured.
> Sam will probably like this better, he suggested using the
> kernel configs initially, in
> http://www.spinics.net/lists/linux-m68k/msg03609.html

Pure positive logic won't work in the (currently stil pathological) case you're
building a multi-platform kernel, and have both CONFIG_M68020 and a lesser
one that doesn't support cpu32 instructions selected.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v3 5/6] m68k: remove duplicate memcpy() implementation
  2011-06-02  7:43                         ` Geert Uytterhoeven
@ 2011-06-02 12:34                           ` Greg Ungerer
  0 siblings, 0 replies; 20+ messages in thread
From: Greg Ungerer @ 2011-06-02 12:34 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Andreas Schwab, linux-m68k, uclinux-dev, Greg Ungerer


Hi Geert,

On 02/06/11 17:43, Geert Uytterhoeven wrote:
> On Thu, Jun 2, 2011 at 07:18, Greg Ungerer<gerg@snapgear.com>  wrote:
>> On 26/05/11 16:38, Geert Uytterhoeven wrote:
>>> I was more thinking along the lines of !CONFIG_M68000&&  á!CONFIG_M68010
>>> &&  á!CONFIG_<whatever Coldfire that doesn't support it>.
>>
>> Or in this case (and probably most cases) we could just switch
>> to using the same positive logic. So what I had as:
>>
>> #if defined(__mc68020__) || defined(__mc68030__) || \
>> á ádefined(__mc68040__) || defined(__mc68060__) || defined(__mcpu32__)
>>
>> becomes
>>
>> #if defined(CONFIG_M68020) || defined(CONFIG_M68030) || \
>> á ádefined(CONFIG_M68040) || defined(CONFIG_M68060) || \
>> á ádefined(CONFIG_MCPU32)
>>
>> There currently isn't a CONFIG_MCPU32, but I could easily add
>> that (we only have one CPU in that class currently supported,
>> the 68360).
>>
>> The compiler setting won't matter, only what we configured.
>> Sam will probably like this better, he suggested using the
>> kernel configs initially, in
>> http://www.spinics.net/lists/linux-m68k/msg03609.html
>
> Pure positive logic won't work in the (currently stil pathological) case you're
> building a multi-platform kernel, and have both CONFIG_M68020 and a lesser
> one that doesn't support cpu32 instructions selected.

True. Though we could re-arrange the code blocks to keep the
logic positive. So for the memcpy.c case something like:

#if defined(CONFIG_COLDFIRE) || defined(CONFIG_M68000) || \
     defined(CONFIG_MCPU32)
	/* the simple code */
#else
	/* the real 68020+ code */
#endif

Now the code doesn't yet have the defines CONFIG_M68000 and
CONFIG_MCPU32. But I have a patch ready to send that introduces
them :-)

Regards
Greg

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2011-06-02 12:36 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-21  0:24 [PATCH v3 0/6] m68knommu: merge and clean up of arch/m68k/lib files gerg
2011-04-21  0:24 ` [PATCH v3 1/6] m68k: merge mmu and non-mmu versions of muldi3 gerg
2011-04-21  0:24   ` [PATCH v3 2/6] m68k: merge mmu and non-mmu versions of lib/Makefile gerg
2011-04-21  0:24     ` [PATCH v3 3/6] m68k: remove duplicate memmove() implementation gerg
2011-04-21  0:24       ` [PATCH v3 4/6] m68k: remove duplicate memset() implementation gerg
2011-04-21  0:24         ` [PATCH v3 5/6] m68k: remove duplicate memcpy() implementation gerg
2011-04-21  0:24           ` [PATCH v3 6/6] m68k: let Makefile sort out compiling mmu and non-mmu lib/checksum.c gerg
2011-05-23 19:26           ` [PATCH v3 5/6] m68k: remove duplicate memcpy() implementation Geert Uytterhoeven
2011-05-23 19:54             ` Andreas Schwab
2011-05-23 23:55               ` Greg Ungerer
2011-05-24  7:34                 ` Andreas Schwab
2011-05-24  7:51               ` Geert Uytterhoeven
2011-05-24  8:06                 ` Andreas Schwab
2011-05-26  6:23                   ` Greg Ungerer
2011-05-26  6:38                     ` Geert Uytterhoeven
2011-06-02  5:18                       ` Greg Ungerer
2011-06-02  7:43                         ` Geert Uytterhoeven
2011-06-02 12:34                           ` Greg Ungerer
2011-05-26  7:28                     ` Gavin Lambert
2011-05-26 11:30                       ` [uClinux-dev] " Greg Ungerer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.