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


The following set of patches is version 2 of clean ups and merges of
individual files in the arch/m68k/lib directory. It is mostly the same
as the first version, but drops the removal of string.c, and does a
simple cleanup of checksum.c.

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

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

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

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

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

* [PATCH v2 1/6] m68k: merge mmu and non-mmu versions of muldi3
  2011-04-20  5:54 ` gerg
@ 2011-04-20  5:54   ` gerg
  2011-04-20  5:54     ` [PATCH v2 2/6] m68k: merge mmu and non-mmu versions of lib/Makefile gerg
  2011-04-20  8:06     ` [PATCH v2 1/6] m68k: merge mmu and non-mmu versions of muldi3 Sam Ravnborg
  2011-04-20  6:04   ` [PATCH v2 0/6] m68knommu: merge and clean up of arch/m68k/lib files Greg Ungerer
  1 sibling, 2 replies; 21+ messages in thread
From: gerg @ 2011-04-20  5:54 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..43ac41b 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__)
+
+#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] 21+ messages in thread

* [PATCH v2 2/6] m68k: merge mmu and non-mmu versions of lib/Makefile
  2011-04-20  5:54   ` [PATCH v2 1/6] m68k: merge mmu and non-mmu versions of muldi3 gerg
@ 2011-04-20  5:54     ` gerg
  2011-04-20  5:54       ` [PATCH v2 3/6] m68k: remove duplicate memmove() implementation gerg
  2011-04-20  8:06     ` [PATCH v2 1/6] m68k: merge mmu and non-mmu versions of muldi3 Sam Ravnborg
  1 sibling, 1 reply; 21+ messages in thread
From: gerg @ 2011-04-20  5:54 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] 21+ messages in thread

* [PATCH v2 3/6] m68k: remove duplicate memmove() implementation
  2011-04-20  5:54     ` [PATCH v2 2/6] m68k: merge mmu and non-mmu versions of lib/Makefile gerg
@ 2011-04-20  5:54       ` gerg
  2011-04-20  5:54         ` [PATCH v2 4/6] m68k: remove duplicate memset() implementation gerg
  0 siblings, 1 reply; 21+ messages in thread
From: gerg @ 2011-04-20  5:54 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] 21+ messages in thread

* [PATCH v2 4/6] m68k: remove duplicate memset() implementation
  2011-04-20  5:54       ` [PATCH v2 3/6] m68k: remove duplicate memmove() implementation gerg
@ 2011-04-20  5:54         ` gerg
  2011-04-20  5:54           ` [PATCH v2 5/6] m68k: remove duplicate memcpy() implementation gerg
  0 siblings, 1 reply; 21+ messages in thread
From: gerg @ 2011-04-20  5:54 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..eea2834 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__)
+		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] 21+ messages in thread

* [PATCH v2 5/6] m68k: remove duplicate memcpy() implementation
  2011-04-20  5:54         ` [PATCH v2 4/6] m68k: remove duplicate memset() implementation gerg
@ 2011-04-20  5:54           ` gerg
  2011-04-20  5:54             ` [PATCH v2 6/6] m68k: let Makefile sort out compiling mmu and non-mmu lib/checksum.c gerg
  0 siblings, 1 reply; 21+ messages in thread
From: gerg @ 2011-04-20  5:54 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..2592171 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__)
+		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] 21+ messages in thread

* [PATCH v2 6/6] m68k: let Makefile sort out compiling mmu and non-mmu lib/checksum.c
  2011-04-20  5:54           ` [PATCH v2 5/6] m68k: remove duplicate memcpy() implementation gerg
@ 2011-04-20  5:54             ` gerg
  0 siblings, 0 replies; 21+ messages in thread
From: gerg @ 2011-04-20  5:54 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] 21+ messages in thread

* Re: [PATCH v2 0/6] m68knommu: merge and clean up of arch/m68k/lib files
  2011-04-20  5:54 ` gerg
  2011-04-20  5:54   ` [PATCH v2 1/6] m68k: merge mmu and non-mmu versions of muldi3 gerg
@ 2011-04-20  6:04   ` Greg Ungerer
  1 sibling, 0 replies; 21+ messages in thread
From: Greg Ungerer @ 2011-04-20  6:04 UTC (permalink / raw)
  To: linux-m68k, uclinux-dev

On 20/04/11 15:54, gerg@snapgear.com wrote:
> I have build and run tested on ARAnyM/Atari and ColdFire (non-mmu)
> targets.

Sorry, top of that message got lost somewhere, should be:


The following set of patches is version 2 of clean ups and merges of
individual files in the arch/m68k/lib directory. It is mostly the same
as the first version, but drops the removal of string.c, and does a
simple cleanup of checksum.c.

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

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] 21+ messages in thread

* Re: [PATCH v2 1/6] m68k: merge mmu and non-mmu versions of muldi3
  2011-04-20  5:54   ` [PATCH v2 1/6] m68k: merge mmu and non-mmu versions of muldi3 gerg
  2011-04-20  5:54     ` [PATCH v2 2/6] m68k: merge mmu and non-mmu versions of lib/Makefile gerg
@ 2011-04-20  8:06     ` Sam Ravnborg
  2011-04-20  8:55       ` [uClinux-dev] " Geert Uytterhoeven
                         ` (2 more replies)
  1 sibling, 3 replies; 21+ messages in thread
From: Sam Ravnborg @ 2011-04-20  8:06 UTC (permalink / raw)
  To: uClinux development list; +Cc: linux-m68k, Greg Ungerer

Hi Greg.

> +
> +#if defined(__mc68020__) || defined(__mc68030__) || \
> +    defined(__mc68040__) || defined(__mc68060__)

Why use these to decide if this is MMU or not?
This code is not exposed to user-space so we can rely on CONFIG_* symbols.
IMO the CONIFG_* symbols is easier to read/maintain.

	Sam
_______________________________________________
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] 21+ messages in thread

* Re: [uClinux-dev] [PATCH v2 1/6] m68k: merge mmu and non-mmu versions of muldi3
  2011-04-20  8:06     ` [PATCH v2 1/6] m68k: merge mmu and non-mmu versions of muldi3 Sam Ravnborg
@ 2011-04-20  8:55       ` Geert Uytterhoeven
  2011-04-20  9:12         ` Philippe De Muyter
  2011-04-20  8:57       ` Philippe De Muyter
  2011-04-20  9:08       ` Greg Ungerer
  2 siblings, 1 reply; 21+ messages in thread
From: Geert Uytterhoeven @ 2011-04-20  8:55 UTC (permalink / raw)
  To: uClinux development list; +Cc: Sam Ravnborg, linux-m68k, Greg Ungerer

On Wed, Apr 20, 2011 at 10:06, Sam Ravnborg <sam@ravnborg.org> wrote:
> Hi Greg.
>
>> +
>> +#if defined(__mc68020__) || defined(__mc68030__) || \
>> +    defined(__mc68040__) || defined(__mc68060__)
>
> Why use these to decide if this is MMU or not?
> This code is not exposed to user-space so we can rely on CONFIG_* symbols.
> IMO the CONIFG_* symbols is easier to read/maintain.

Because technically it doesn't depend on having a MMU or not, but on having
the full 32-bit multiplication instruction or not.

Does Coldfire-with-MMU (for which we haven't integrated the support
yet) have that
instruction?

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] 21+ messages in thread

* Re: [uClinux-dev] [PATCH v2 1/6] m68k: merge mmu and non-mmu versions of muldi3
  2011-04-20  8:06     ` [PATCH v2 1/6] m68k: merge mmu and non-mmu versions of muldi3 Sam Ravnborg
  2011-04-20  8:55       ` [uClinux-dev] " Geert Uytterhoeven
@ 2011-04-20  8:57       ` Philippe De Muyter
  2011-04-20  9:08       ` Greg Ungerer
  2 siblings, 0 replies; 21+ messages in thread
From: Philippe De Muyter @ 2011-04-20  8:57 UTC (permalink / raw)
  To: uClinux development list; +Cc: linux-m68k, Greg Ungerer

On Wed, Apr 20, 2011 at 10:06:09AM +0200, Sam Ravnborg wrote:
> Hi Greg.
> 
> > +
> > +#if defined(__mc68020__) || defined(__mc68030__) || \
> > +    defined(__mc68040__) || defined(__mc68060__)
> 
> Why use these to decide if this is MMU or not?
> This code is not exposed to user-space so we can rely on CONFIG_* symbols.
> IMO the CONIFG_* symbols is easier to read/maintain.

This does not decide about MMU or not MMU, but about the availability
of some assembler instructions in the processor.

Philippe

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

* Re: [uClinux-dev] [PATCH v2 1/6] m68k: merge mmu and non-mmu versions of muldi3
  2011-04-20  8:06     ` [PATCH v2 1/6] m68k: merge mmu and non-mmu versions of muldi3 Sam Ravnborg
  2011-04-20  8:55       ` [uClinux-dev] " Geert Uytterhoeven
  2011-04-20  8:57       ` Philippe De Muyter
@ 2011-04-20  9:08       ` Greg Ungerer
  2 siblings, 0 replies; 21+ messages in thread
From: Greg Ungerer @ 2011-04-20  9:08 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: uClinux development list, linux-m68k, Greg Ungerer


Hi Sam,

On 20/04/11 18:06, Sam Ravnborg wrote:
> Hi Greg.
>
>> +
>> +#if defined(__mc68020__) || defined(__mc68030__) || \
>> +    defined(__mc68040__) || defined(__mc68060__)
>
> Why use these to decide if this is MMU or not?

The asm code that is enclosed by this is not about having an MMU
or not. It is about the processor supporting the 64bit mul
instruction.


> This code is not exposed to user-space so we can rely on CONFIG_* symbols.
> IMO the CONIFG_* symbols is easier to read/maintain.

In general yes I agree. But in this specific case it really
is about a code generation option (what type of processor
instructions we can emit).

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] 21+ messages in thread

* Re: [PATCH v2 1/6] m68k: merge mmu and non-mmu versions of muldi3
  2011-04-20  8:55       ` [uClinux-dev] " Geert Uytterhoeven
@ 2011-04-20  9:12         ` Philippe De Muyter
  2011-04-20  9:31           ` [uClinux-dev] " Greg Ungerer
  0 siblings, 1 reply; 21+ messages in thread
From: Philippe De Muyter @ 2011-04-20  9:12 UTC (permalink / raw)
  To: uClinux development list; +Cc: linux-m68k, Greg Ungerer

On Wed, Apr 20, 2011 at 10:55:15AM +0200, Geert Uytterhoeven wrote:
> On Wed, Apr 20, 2011 at 10:06, Sam Ravnborg <sam@ravnborg.org> wrote:
> > Hi Greg.
> >
> >> +
> >> +#if defined(__mc68020__) || defined(__mc68030__) || \
> >> +    defined(__mc68040__) || defined(__mc68060__)
> >
> > Why use these to decide if this is MMU or not?
> > This code is not exposed to user-space so we can rely on CONFIG_* symbols.
> > IMO the CONIFG_* symbols is easier to read/maintain.
> 
> Because technically it doesn't depend on having a MMU or not, but on having
> the full 32-bit multiplication instruction or not.
> 
> Does Coldfire-with-MMU (for which we haven't integrated the support
> yet) have that
> instruction?

Actually, MCF547x & MCF548x (CFv4e family) are integrated but without their
limited MMU functionality.

freescale had even written an mmu port for 2.6.25 but has not pushed it
upstream.  This port can be found on their site or in the openwrt repository.

MCF547x & MCF548x do not have that instruction.

Philippe
_______________________________________________
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] 21+ messages in thread

* Re: [uClinux-dev] [PATCH v2 1/6] m68k: merge mmu and non-mmu versions of muldi3
  2011-04-20  9:12         ` Philippe De Muyter
@ 2011-04-20  9:31           ` Greg Ungerer
  2011-04-20  9:55             ` Philippe De Muyter
  0 siblings, 1 reply; 21+ messages in thread
From: Greg Ungerer @ 2011-04-20  9:31 UTC (permalink / raw)
  To: Philippe De Muyter; +Cc: uClinux development list, linux-m68k, Greg Ungerer

On 20/04/11 19:12, Philippe De Muyter wrote:
> On Wed, Apr 20, 2011 at 10:55:15AM +0200, Geert Uytterhoeven wrote:
>> On Wed, Apr 20, 2011 at 10:06, Sam Ravnborg<sam@ravnborg.org>  wrote:
>>> Hi Greg.
>>>
>>>> +
>>>> +#if defined(__mc68020__) || defined(__mc68030__) || \
>>>> + á ádefined(__mc68040__) || defined(__mc68060__)
>>>
>>> Why use these to decide if this is MMU or not?
>>> This code is not exposed to user-space so we can rely on CONFIG_* symbols.
>>> IMO the CONIFG_* symbols is easier to read/maintain.
>>
>> Because technically it doesn't depend on having a MMU or not, but on having
>> the full 32-bit multiplication instruction or not.
>>
>> Does Coldfire-with-MMU (for which we haven't integrated the support
>> yet) have that
>> instruction?
>
> Actually, MCF547x&  MCF548x (CFv4e family) are integrated but without their
> limited MMU functionality.
>
> freescale had even written an mmu port for 2.6.25 but has not pushed it
> upstream.  This port can be found on their site or in the openwrt repository.

Part of my plan with the merge of m68k and m68knommu is to make
it easy to support the v4e parts with MMU enabled. And certainly as
I work through cleaning the individual files up I am doing it
with this in mind. Of course most of the code to support the v4e
is the same no matter if you have the MMU enabled or not.

I have Freescales 2.6.25 kernel, but it is really only a reference
point for this work.

> MCF547x&  MCF548x do not have that instruction.

Thats right. I believe the processors listed in the patch are
the only ones that currently support the 64bit mul.

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] 21+ messages in thread

* Re: [uClinux-dev] [PATCH v2 1/6] m68k: merge mmu and non-mmu versions of muldi3
  2011-04-20  9:31           ` [uClinux-dev] " Greg Ungerer
@ 2011-04-20  9:55             ` Philippe De Muyter
  2011-04-20 10:18               ` Greg Ungerer
  0 siblings, 1 reply; 21+ messages in thread
From: Philippe De Muyter @ 2011-04-20  9:55 UTC (permalink / raw)
  To: Greg Ungerer; +Cc: uClinux development list, linux-m68k, Greg Ungerer

On Wed, Apr 20, 2011 at 07:31:33PM +1000, Greg Ungerer wrote:
> On 20/04/11 19:12, Philippe De Muyter wrote:
>> On Wed, Apr 20, 2011 at 10:55:15AM +0200, Geert Uytterhoeven wrote:
>>> On Wed, Apr 20, 2011 at 10:06, Sam Ravnborg<sam@ravnborg.org>  wrote:
>>>> Hi Greg.
>>>>
>>>>> +
>>>>> +#if defined(__mc68020__) || defined(__mc68030__) || \
>>>>> + á ádefined(__mc68040__) || defined(__mc68060__)
(*)
>>>>
>>>> Why use these to decide if this is MMU or not?
>>>> This code is not exposed to user-space so we can rely on CONFIG_* 
>>>> symbols.
>>>> IMO the CONIFG_* symbols is easier to read/maintain.
>>>
>>> Because technically it doesn't depend on having a MMU or not, but on 
>>> having
>>> the full 32-bit multiplication instruction or not.
>>>
>>> Does Coldfire-with-MMU (for which we haven't integrated the support
>>> yet) have that
>>> instruction?
>>
>> Actually, MCF547x&  MCF548x (CFv4e family) are integrated but without 
(*)
>> their
>> limited MMU functionality.
>>
>> freescale had even written an mmu port for 2.6.25 but has not pushed it
>> upstream.  This port can be found on their site or in the openwrt 
>> repository.
>
> Part of my plan with the merge of m68k and m68knommu is to make
> it easy to support the v4e parts with MMU enabled. And certainly as
> I work through cleaning the individual files up I am doing it
> with this in mind. Of course most of the code to support the v4e
> is the same no matter if you have the MMU enabled or not.
>
> I have Freescales 2.6.25 kernel, but it is really only a reference
> point for this work.
>
>> MCF547x&  MCF548x do not have that instruction.
(*)
>
> Thats right. I believe the processors listed in the patch are
> the only ones that currently support the 64bit mul.

The 68340 has it also. (And I have an old linux port for this processor)

I surmise the 68360 has it also.

Philippe

(*) Greg, there must be something with your mail installation : it garbles
the messages. (or is it mine, but I noticed that only with replies from you ?)

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

* Re: [uClinux-dev] [PATCH v2 1/6] m68k: merge mmu and non-mmu versions of muldi3
  2011-04-20  9:55             ` Philippe De Muyter
@ 2011-04-20 10:18               ` Greg Ungerer
  2011-04-20 10:38                 ` Andreas Schwab
  2011-04-20 10:38                 ` Philippe De Muyter
  0 siblings, 2 replies; 21+ messages in thread
From: Greg Ungerer @ 2011-04-20 10:18 UTC (permalink / raw)
  To: Philippe De Muyter; +Cc: uClinux development list, linux-m68k, Greg Ungerer

Hi Philippe,

On 20/04/11 19:55, Philippe De Muyter wrote:
> On Wed, Apr 20, 2011 at 07:31:33PM +1000, Greg Ungerer wrote:
>> On 20/04/11 19:12, Philippe De Muyter wrote:
>>> On Wed, Apr 20, 2011 at 10:55:15AM +0200, Geert Uytterhoeven wrote:
>>>> On Wed, Apr 20, 2011 at 10:06, Sam Ravnborg<sam@ravnborg.org>   wrote:
>>>>> Hi Greg.
>>>>>
>>>>>> +
>>>>>> +#if defined(__mc68020__) || defined(__mc68030__) || \
>>>>>> + á ádefined(__mc68040__) || defined(__mc68060__)
> (*)
>>>>>
>>>>> Why use these to decide if this is MMU or not?
>>>>> This code is not exposed to user-space so we can rely on CONFIG_*
>>>>> symbols.
>>>>> IMO the CONIFG_* symbols is easier to read/maintain.
>>>>
>>>> Because technically it doesn't depend on having a MMU or not, but on
>>>> having
>>>> the full 32-bit multiplication instruction or not.
>>>>
>>>> Does Coldfire-with-MMU (for which we haven't integrated the support
>>>> yet) have that
>>>> instruction?
>>>
>>> Actually, MCF547x&   MCF548x (CFv4e family) are integrated but without
> (*)
>>> their
>>> limited MMU functionality.
>>>
>>> freescale had even written an mmu port for 2.6.25 but has not pushed it
>>> upstream.  This port can be found on their site or in the openwrt
>>> repository.
>>
>> Part of my plan with the merge of m68k and m68knommu is to make
>> it easy to support the v4e parts with MMU enabled. And certainly as
>> I work through cleaning the individual files up I am doing it
>> with this in mind. Of course most of the code to support the v4e
>> is the same no matter if you have the MMU enabled or not.
>>
>> I have Freescales 2.6.25 kernel, but it is really only a reference
>> point for this work.
>>
>>> MCF547x&   MCF548x do not have that instruction.
> (*)
>>
>> Thats right. I believe the processors listed in the patch are
>> the only ones that currently support the 64bit mul.
>
> The 68340 has it also. (And I have an old linux port for this processor)

That is just a SoC that contains a 68020 though, so __mc68020__ would
be defined for that.


> I surmise the 68360 has it also.

I believe that is a SoC with a 68040 cpu core, so I would expect that
__mc68040__ would be correct for that.


> Philippe
>
> (*) Greg, there must be something with your mail installation : it garbles
> the messages. (or is it mine, but I noticed that only with replies from you ?)

Unfortunately mail getting to me goes through an MS exchange server
that tends to garble some parts of emails. Not too much I can do
about that (at least using the existing gerg@snapgear.com email
address).

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] 21+ messages in thread

* Re: [uClinux-dev] [PATCH v2 1/6] m68k: merge mmu and non-mmu versions of muldi3
  2011-04-20 10:18               ` Greg Ungerer
@ 2011-04-20 10:38                 ` Andreas Schwab
  2011-04-20 10:38                 ` Philippe De Muyter
  1 sibling, 0 replies; 21+ messages in thread
From: Andreas Schwab @ 2011-04-20 10:38 UTC (permalink / raw)
  To: Greg Ungerer
  Cc: Philippe De Muyter, uClinux development list, linux-m68k, Greg Ungerer

Greg Ungerer <gerg@snapgear.com> writes:

> Hi Philippe,
>
> On 20/04/11 19:55, Philippe De Muyter wrote:
>> The 68340 has it also. (And I have an old linux port for this processor)
>
> That is just a SoC that contains a 68020 though, so __mc68020__ would
> be defined for that.

Actually it has a cpu32 core, but it is close enough to be covered by
__mc68020__.

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] 21+ messages in thread

* Re: [uClinux-dev] [PATCH v2 1/6] m68k: merge mmu and non-mmu versions of muldi3
  2011-04-20 10:18               ` Greg Ungerer
  2011-04-20 10:38                 ` Andreas Schwab
@ 2011-04-20 10:38                 ` Philippe De Muyter
  2011-04-20 11:01                   ` Greg Ungerer
  1 sibling, 1 reply; 21+ messages in thread
From: Philippe De Muyter @ 2011-04-20 10:38 UTC (permalink / raw)
  To: Greg Ungerer; +Cc: uClinux development list, linux-m68k, Greg Ungerer

Hi Greg,

On Wed, Apr 20, 2011 at 08:18:09PM +1000, Greg Ungerer wrote:
>>
>> The 68340 has it also. (And I have an old linux port for this processor)
>
> That is just a SoC that contains a 68020 though, so __mc68020__ would
> be defined for that.

No, this is a cpu32 core, which is a subset of a 68020, so gcc does not
define __mc68020__, or at least should not (there are old bug reports
about that).

>
>
>> I surmise the 68360 has it also.
>
> I believe that is a SoC with a 68040 cpu core, so I would expect that
> __mc68040__ would be correct for that.

This is a cpu32+ core.

Same here.

Not that it is that important now :)

Philippe

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

* Re: [uClinux-dev] [PATCH v2 1/6] m68k: merge mmu and non-mmu versions of muldi3
  2011-04-20 10:38                 ` Philippe De Muyter
@ 2011-04-20 11:01                   ` Greg Ungerer
  2011-04-20 11:23                     ` Philippe De Muyter
  0 siblings, 1 reply; 21+ messages in thread
From: Greg Ungerer @ 2011-04-20 11:01 UTC (permalink / raw)
  To: Philippe De Muyter; +Cc: uClinux development list, linux-m68k, Greg Ungerer

Hi Philippe,

On 20/04/11 20:38, Philippe De Muyter wrote:
> Hi Greg,
>
> On Wed, Apr 20, 2011 at 08:18:09PM +1000, Greg Ungerer wrote:
>>>
>>> The 68340 has it also. (And I have an old linux port for this processor)
>>
>> That is just a SoC that contains a 68020 though, so __mc68020__ would
>> be defined for that.
>
> No, this is a cpu32 core, which is a subset of a 68020, so gcc does not
> define __mc68020__, or at least should not (there are old bug reports
> about that).

Modern gcc still does, from a gcc-4.5.1:

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


>>> I surmise the 68360 has it also.
>>
>> I believe that is a SoC with a 68040 cpu core, so I would expect that
>> __mc68040__ would be correct for that.
>
> This is a cpu32+ core.
>
> Same here.
>
> Not that it is that important now :)

Does cpu32 always support the 64bit mul?
If so we can just add __mcpu32__ to the conditional check list.

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] 21+ messages in thread

* Re: [uClinux-dev] [PATCH v2 1/6] m68k: merge mmu and non-mmu versions of muldi3
  2011-04-20 11:01                   ` Greg Ungerer
@ 2011-04-20 11:23                     ` Philippe De Muyter
  0 siblings, 0 replies; 21+ messages in thread
From: Philippe De Muyter @ 2011-04-20 11:23 UTC (permalink / raw)
  To: Greg Ungerer; +Cc: uClinux development list, linux-m68k, Greg Ungerer

Hi Greg,

On Wed, Apr 20, 2011 at 09:01:39PM +1000, Greg Ungerer wrote:
> Hi Philippe,
>
> On 20/04/11 20:38, Philippe De Muyter wrote:
>> Hi Greg,
>>
>> On Wed, Apr 20, 2011 at 08:18:09PM +1000, Greg Ungerer wrote:
>>>>
>>>> The 68340 has it also. (And I have an old linux port for this processor)
>>>
>>> That is just a SoC that contains a 68020 though, so __mc68020__ would
>>> be defined for that.
>>
>> No, this is a cpu32 core, which is a subset of a 68020, so gcc does not
>> define __mc68020__, or at least should not (there are old bug reports
>> about that).
>
> Modern gcc still does, from a gcc-4.5.1:
>
> # m68k-linux-gcc -mcpu32 -dM -E - < /dev/null | grep mc68020
> #define __mc68020__ 1
> #define __mc68020 1
> #define mc68020 1
>
>
>>>> I surmise the 68360 has it also.
>>>
>>> I believe that is a SoC with a 68040 cpu core, so I would expect that
>>> __mc68040__ would be correct for that.
>>
>> This is a cpu32+ core.
>>
>> Same here.
>>
>> Not that it is that important now :)
>
> Does cpu32 always support the 64bit mul?

Yes AFAIK.

> If so we can just add __mcpu32__ to the conditional check list.

That would be safer.

Thanks

Philippe

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

end of thread, other threads:[~2011-04-20 11:23 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-20  5:54 [PATCH v2 0/6] m68knommu: merge and clean up of arch/m68k/lib files gerg
2011-04-20  5:54 ` gerg
2011-04-20  5:54   ` [PATCH v2 1/6] m68k: merge mmu and non-mmu versions of muldi3 gerg
2011-04-20  5:54     ` [PATCH v2 2/6] m68k: merge mmu and non-mmu versions of lib/Makefile gerg
2011-04-20  5:54       ` [PATCH v2 3/6] m68k: remove duplicate memmove() implementation gerg
2011-04-20  5:54         ` [PATCH v2 4/6] m68k: remove duplicate memset() implementation gerg
2011-04-20  5:54           ` [PATCH v2 5/6] m68k: remove duplicate memcpy() implementation gerg
2011-04-20  5:54             ` [PATCH v2 6/6] m68k: let Makefile sort out compiling mmu and non-mmu lib/checksum.c gerg
2011-04-20  8:06     ` [PATCH v2 1/6] m68k: merge mmu and non-mmu versions of muldi3 Sam Ravnborg
2011-04-20  8:55       ` [uClinux-dev] " Geert Uytterhoeven
2011-04-20  9:12         ` Philippe De Muyter
2011-04-20  9:31           ` [uClinux-dev] " Greg Ungerer
2011-04-20  9:55             ` Philippe De Muyter
2011-04-20 10:18               ` Greg Ungerer
2011-04-20 10:38                 ` Andreas Schwab
2011-04-20 10:38                 ` Philippe De Muyter
2011-04-20 11:01                   ` Greg Ungerer
2011-04-20 11:23                     ` Philippe De Muyter
2011-04-20  8:57       ` Philippe De Muyter
2011-04-20  9:08       ` Greg Ungerer
2011-04-20  6:04   ` [PATCH v2 0/6] m68knommu: merge and clean up of arch/m68k/lib files 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.