Module Name:src
Committed By: matt
Date: Thu Jul 18 21:37:47 UTC 2013
Modified Files:
src/lib/libc/arch/m68k/string: memccpy.S swab.S
Log Message:
Adjust for coldfire
To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/arch/m68k/string/memccpy.S
cvs rdiff -u -r1.9 -r1.10 src/lib/libc/arch/m68k/string/swab.S
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libc/arch/m68k/string/memccpy.S
diff -u src/lib/libc/arch/m68k/string/memccpy.S:1.3 src/lib/libc/arch/m68k/string/memccpy.S:1.4
--- src/lib/libc/arch/m68k/string/memccpy.S:1.3 Tue Jul 16 21:46:42 2013
+++ src/lib/libc/arch/m68k/string/memccpy.S Thu Jul 18 21:37:47 2013
@@ -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
#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 @@ ENTRY(memccpy)
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 @@ Lmcnzloop:
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 @@ Lmcnzloop:
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:
Index: src/lib/libc/arch/m68k/string/swab.S
diff -u src/lib/libc/arch/m68k/string/swab.S:1.9 src/lib/libc/arch/m68k/string/swab.S:1.10
--- src/lib/libc/arch/m68k/string/swab.S:1.9 Tue Jul 16 21:46:42 2013
+++ src/lib/libc/arch/m68k/string/swab.S Thu Jul 18 21:37:47 2013
@@ -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
@@ -10,9 +10,15 @@ ENTRY(swab)
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