Skip to contentSkip to conversation

m68knommu: merge and clean up of arch/m68k/lib files

PATCH In review [email protected] 4 participants 20 messages Apr 21, 2011 – Jun 2, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v3 cover m68knommu: merge and clean up of arch/m68k/lib files

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.

#1 lore raw

PATCH v3 1/6 m68k: merge mmu and non-mmu versions of muldi3

From: Greg Ungerer <[email protected]>

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.

---
 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
arch/m68k/lib/muldi3.c +96 -3
index 16e0eb3..079bafc 100644
@@ -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;
+}
arch/m68k/lib/muldi3_mm.c deleted +0 -63

63 lines not on this page · raw message

arch/m68k/lib/muldi3_no.c deleted +0 -86

86 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#2 lore raw

PATCH v3 2/6 m68k: merge mmu and non-mmu versions of lib/Makefile

From: Greg Ungerer <[email protected]>

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.

---
 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
arch/m68k/lib/Makefile +11 -2
index 1f95881..3d85fb6 100644
@@ -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
+
arch/m68k/lib/Makefile_mm deleted +0 -6
deleted file mode 100644
index af9abf8..0000000
@@ -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
arch/m68k/lib/Makefile_no deleted +0 -7
deleted file mode 100644
index 32d852e..0000000
@@ -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
Signature · 1 line
1.7.0.4
#3 lore raw

PATCH v3 3/6 m68k: remove duplicate memmove() implementation

From: Greg Ungerer <[email protected]>

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

---
 arch/m68k/lib/Makefile  |    4 +-
 arch/m68k/lib/memmove.c |    2 -
 arch/m68k/lib/string.c  |   95 -----------------------------------------------
 3 files changed, 2 insertions(+), 99 deletions(-)
arch/m68k/lib/Makefile +2 -2
index 3d85fb6..ec479a9 100644
@@ -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
 
arch/m68k/lib/memmove.c +0 -2
index b3dcfe9..6519f7f 100644
@@ -4,8 +4,6 @@
  * for more details.
  */
 
-#define __IN_STRING_C
-
 #include <linux/module.h>
 #include <linux/string.h>
 
arch/m68k/lib/string.c +0 -95

98 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#4 lore raw

PATCH v3 4/6 m68k: remove duplicate memset() implementation

From: Greg Ungerer <[email protected]>

Merging the mmu and non-mmu directories we ended up with duplicate implementations of memset(). One is a little more optimized for the

Quoted 1 line

= 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.

---
 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(-)
arch/m68k/kernel/m68k_ksyms_no.c +0 -1
index 39fe0a7..346bce6 100644
@@ -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
arch/m68k/lib/Makefile +3 -2
index ec479a9..ac275d5 100644
@@ -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
 
arch/m68k/lib/memset.c +71 -43

118 lines not on this page · raw message

arch/m68k/lib/string.c +0 -61

67 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#5 lore raw

PATCH v3 5/6 m68k: remove duplicate memcpy() implementation

From: Greg Ungerer <[email protected]>

Merging the mmu and non-mmu directories we ended up with duplicate implementations of memcpy(). One is a little more optimized for the

Quoted 1 line

= 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.

---
 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(-)
arch/m68k/kernel/m68k_ksyms_no.c +0 -6
index 346bce6..10af0af 100644
@@ -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
arch/m68k/lib/Makefile +2 -3
index ac275d5..2438d02 100644
@@ -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
 
arch/m68k/lib/memcpy.c +73 -55

135 lines not on this page · raw message

arch/m68k/lib/string.c +0 -67

70 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#6 lore raw

PATCH v3 6/6 m68k: let Makefile sort out compiling mmu and non-mmu lib/checksum.c

From: Greg Ungerer <[email protected]>

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.

---
 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
arch/m68k/lib/Makefile +3 -3
index 2438d02..df421e5 100644
@@ -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
 
arch/m68k/lib/checksum.c deleted +0 -5
deleted file mode 100644
index 1297536..0000000
@@ -1,5 +0,0 @@
-#ifdef CONFIG_MMU
-#include "checksum_mm.c"
-#else
-#include "checksum_no.c"
-#endif
Signature · 1 line
1.7.0.4
#7 lore raw

Re: [PATCH v3 5/6] m68k: remove duplicate memcpy() implementation

In reply to [email protected]
Quoted 2 lines · On Thu, Apr 21, 2011 at 02:24, <[email protected]> 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 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds

#8 lore raw

Re: [PATCH v3 5/6] m68k: remove duplicate memcpy() implementation

Quoted 3 lines · Geert Uytterhoeven

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.

Signature · 3 lines
Andreas Schwab, [email protected]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
#9 lore raw

Re: [PATCH v3 5/6] m68k: remove duplicate memcpy() implementation

Quoted 8 lines · Andreas Schwab
Quoted 3 lines · Geert Uytterhoeven

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:     [email protected]
SnapGear Group, McAfee                      PHONE:       +61 7 3435 2888
8 Gardner Close                             FAX:         +61 7 3217 5323
Milton, QLD, 4064, Australia                WEB: http://www.SnapGear.com
#10 lore raw

Re: [PATCH v3 5/6] m68k: remove duplicate memcpy() implementation

Quoted 1 line · Greg Ungerer

m68k-linux-gcc (GCC) 4.5.1

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

Andreas.

Signature · 3 lines
Andreas Schwab, [email protected]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
#11 lore raw

Re: [PATCH v3 5/6] m68k: remove duplicate memcpy() implementation

In reply to Andreas Schwab
Quoted 8 lines · Andreas Schwab
Quoted 3 lines · Geert Uytterhoeven

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 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds

#12 lore raw

Re: [PATCH v3 5/6] m68k: remove duplicate memcpy() implementation

Quoted 2 lines · Geert Uytterhoeven

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.

Signature · 3 lines
Andreas Schwab, [email protected]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
#13 lore raw

Re: [PATCH v3 5/6] m68k: remove duplicate memcpy() implementation

Hi Andreas, Geert,

Quoted 8 lines · Andreas Schwab
Quoted 2 lines · Geert Uytterhoeven

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:     [email protected]
SnapGear Group, McAfee                      PHONE:       +61 7 3435 2888
8 Gardner Close                             FAX:         +61 7 3217 5323
Milton, QLD, 4064, Australia                WEB: http://www.SnapGear.com
#14 lore raw

Re: [PATCH v3 5/6] m68k: remove duplicate memcpy() implementation

Quoted 18 lines · Greg Ungerer
Quoted 9 lines · Andreas Schwab
Quoted 3 lines · Geert Uytterhoeven

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).

Quoted 5 lines

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 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds

#15 lore raw

Re: [PATCH v3 5/6] m68k: remove duplicate memcpy() implementation

Hi Geert,

Quoted 19 lines · Geert Uytterhoeven
Quoted 18 lines · Greg Ungerer
Quoted 9 lines · Andreas Schwab
Quoted 3 lines · Geert Uytterhoeven<[email protected]> á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).

Quoted 8 lines
Quoted 5 lines

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:     [email protected]
SnapGear Group, McAfee                      PHONE:       +61 7 3435 2888
8 Gardner Close                             FAX:         +61 7 3217 5323
Milton, QLD, 4064, Australia                WEB: http://www.SnapGear.com
#16 lore raw

Re: [PATCH v3 5/6] m68k: remove duplicate memcpy() implementation

Quoted 16 lines · Greg Ungerer
Quoted 2 lines · Geert Uytterhoeven

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)

Quoted 8 lines

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 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds

#17 lore raw

Re: [PATCH v3 5/6] m68k: remove duplicate memcpy() implementation

Hi Geert,

Quoted 21 lines · Geert Uytterhoeven
Quoted 20 lines · Greg Ungerer
Quoted 2 lines · Geert Uytterhoeven

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).

Quoted 8 lines
Quoted 4 lines

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

#18 lore raw

RE: Re: [PATCH v3 5/6] m68k: remove duplicate memcpy() implementation

In reply to Greg Ungerer

Quoth Greg Ungerer:

Quoted 7 lines · Andreas Schwab
Quoted 6 lines
Quoted 3 lines · Geert Uytterhoeven

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.

Quoted 6 lines
Quoted 3 lines

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 [email protected]
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by [email protected] To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

#19 lore raw

Re: [uClinux-dev] Re: [PATCH v3 5/6] m68k: remove duplicate memcpy() implementation

Hi Gavin,

Quoted 12 lines · Gavin Lambert

Quoth Greg Ungerer:

Quoted 11 lines · Andreas Schwab
Quoted 9 lines
Quoted 3 lines · Geert Uytterhoeven

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).

Quoted 7 lines
Quoted 2 lines

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