Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/arch/m68k/string Adjust for coldfire



details:   https://anonhg.NetBSD.org/src/rev/fdffc16c5c2b
branches:  trunk
changeset: 788734:fdffc16c5c2b
user:      matt <matt%NetBSD.org@localhost>
date:      Thu Jul 18 21:37:47 2013 +0000

description:
Adjust for coldfire

diffstat:

 lib/libc/arch/m68k/string/memccpy.S |  20 ++++++++++++++++++--
 lib/libc/arch/m68k/string/swab.S    |   8 +++++++-
 2 files changed, 25 insertions(+), 3 deletions(-)

diffs (91 lines):

diff -r 0fea52605dcc -r fdffc16c5c2b lib/libc/arch/m68k/string/memccpy.S
--- a/lib/libc/arch/m68k/string/memccpy.S       Thu Jul 18 21:36:37 2013 +0000
+++ b/lib/libc/arch/m68k/string/memccpy.S       Thu Jul 18 21:37:47 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: memccpy.S,v 1.3 2013/07/16 21:46:42 matt Exp $ */
+/*     $NetBSD: memccpy.S,v 1.4 2013/07/18 21:37:47 matt Exp $ */
 
 /*
  * Copyright (C) 1999 Scott Reynolds.  All rights reserved.
@@ -29,7 +29,7 @@
 #include <machine/asm.h>
 
 #if defined(LIBC_SCCS) && !defined(lint)
-       RCSID("$NetBSD: memccpy.S,v 1.3 2013/07/16 21:46:42 matt Exp $")
+       RCSID("$NetBSD: memccpy.S,v 1.4 2013/07/18 21:37:47 matt Exp $")
 #endif /* LIBC_SCCS and not lint */
 
 ENTRY(memccpy)
@@ -37,7 +37,9 @@
        jeq     Lmcbail                 | nothing to do
 
        movl    4(%sp),%a0              | a0 = toaddr
+#ifndef __mcoldfire__
        subql   #1,%d0                  |   prepare count for DBcc loop
+#endif
        movl    8(%sp),%a1              | a1 = fromaddr
        movl    12(%sp),%d1             | d1 = terminator
        jeq     Lmcloop                 |   handle ASCII NUL specially
@@ -47,11 +49,18 @@
        movb    (%a1)+,%d2              | move a byte
        movb    %d2,(%a0)+
        cmpb    %d2,%d1                 | found the terminator?
+#ifndef __mcoldfire__
        dbeq    %d0,Lmcnzloop           | if not, keep transferring,
+#endif
        jeq     Lmcnzdone               |   otherwise done
+#ifdef __mcoldfire__
+       subql   #1,%d0
+       jne     Lmcnzloop
+#else
        clrw    %d0                     | check to see if more to do
        subql   #1,%d0
        jcc     Lmcnzloop               | yes, keep going...
+#endif
 
        movl    (%sp)+,%d2              | restore scratch register
        movql   #0,%d0                  | no terminator found, return NULL
@@ -62,11 +71,18 @@
 
 Lmcloop:
        movb    (%a1)+,(%a0)+           | move a byte; was it NUL?
+#ifndef __mcoldfire__
        dbeq    %d0,Lmcloop             | if not, keep transferring,
+#endif
        jeq     Lmcdone                 |   otherwise done
+#ifdef __mcoldfire__
+       subql   #1,%d0
+       jne     Lmcloop
+#else
        clrw    %d0                     | check to see if more to do
        subql   #1,%d0
        jcc     Lmcloop                 | yes, keep going...
+#endif
                                        | Note: %d0 is now -1!
        movql   #0,%d0                  | no terminator found, return NULL
 Lmcbail:
diff -r 0fea52605dcc -r fdffc16c5c2b lib/libc/arch/m68k/string/swab.S
--- a/lib/libc/arch/m68k/string/swab.S  Thu Jul 18 21:36:37 2013 +0000
+++ b/lib/libc/arch/m68k/string/swab.S  Thu Jul 18 21:37:47 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: swab.S,v 1.9 2013/07/16 21:46:42 matt Exp $    */
+/*     $NetBSD: swab.S,v 1.10 2013/07/18 21:37:47 matt Exp $   */
 
 #include <machine/asm.h>
 
@@ -10,9 +10,15 @@
        jeq     swdone
 
 swloop:
+#ifdef __mcoldfire__
+       movb    (%a0)+,1(%a1)
+       movb    (%a0)+,(%a1)
+       addql   #2,%a1
+#else
        movw    (%a0)+,%d1
        rorw    #8,%d1
        movw    %d1,(%a1)+
+#endif
        subql   #1,%d0
        jne     swloop
 



Home | Main Index | Thread Index | Old Index