Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/common/lib/libc/arch/m68k Adjust for Coldfire
details: https://anonhg.NetBSD.org/src/rev/d23c8f1a736c
branches: trunk
changeset: 788756:d23c8f1a736c
user: matt <matt%NetBSD.org@localhost>
date: Thu Jul 18 22:42:50 2013 +0000
description:
Adjust for Coldfire
diffstat:
common/lib/libc/arch/m68k/gen/bswap16.S | 15 +++++++-
common/lib/libc/arch/m68k/gen/bswap32.S | 18 ++++++++-
common/lib/libc/arch/m68k/gen/bswap64.S | 25 ++++++++++++-
common/lib/libc/arch/m68k/string/bcmp.S | 56 ++++++++++++++++++++++-------
common/lib/libc/arch/m68k/string/bcopy.S | 28 +++++++++++++-
common/lib/libc/arch/m68k/string/bzero.S | 18 ++++++++-
common/lib/libc/arch/m68k/string/ffs.S | 23 ++++++++++-
common/lib/libc/arch/m68k/string/memcmp.S | 26 +++++++++++--
common/lib/libc/arch/m68k/string/memset.S | 41 +++++++++++++++------
common/lib/libc/arch/m68k/string/strcmp.S | 36 ++++++++++++------
common/lib/libc/arch/m68k/string/strncmp.S | 45 ++++++++++++++++-------
common/lib/libc/arch/m68k/string/strncpy.S | 10 ++++-
12 files changed, 267 insertions(+), 74 deletions(-)
diffs (truncated from 814 to 300 lines):
diff -r 1f215ff1628d -r d23c8f1a736c common/lib/libc/arch/m68k/gen/bswap16.S
--- a/common/lib/libc/arch/m68k/gen/bswap16.S Thu Jul 18 22:40:58 2013 +0000
+++ b/common/lib/libc/arch/m68k/gen/bswap16.S Thu Jul 18 22:42:50 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bswap16.S,v 1.4 2013/07/16 23:24:18 matt Exp $ */
+/* $NetBSD: bswap16.S,v 1.5 2013/07/18 22:42:50 matt Exp $ */
/*
* Copyright (C) 1996 Scott Reynolds. All rights reserved.
@@ -35,7 +35,20 @@
#endif /* defined(_KERNEL) || defined(_STANDALONE) */
_ENTRY(BSWAP16)
+#ifdef __mcfisac__
+ mvzw 6(%sp),%d0
+ swap %d0
+ byterev %d0
+#elif defined(__mcoldfire__)
+ mvzw 6(%sp),%d0
+ movl %d0,%d1
+ mvzb %d0,%d0
+ lsll #8,%d0
+ lsrl #8,%d1
+ orl %d1,%d0
+#else
movl 4(%sp),%d0
rolw #8,%d0
+#endif
rts
END(BSWAP16)
diff -r 1f215ff1628d -r d23c8f1a736c common/lib/libc/arch/m68k/gen/bswap32.S
--- a/common/lib/libc/arch/m68k/gen/bswap32.S Thu Jul 18 22:40:58 2013 +0000
+++ b/common/lib/libc/arch/m68k/gen/bswap32.S Thu Jul 18 22:42:50 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bswap32.S,v 1.4 2013/07/16 23:24:18 matt Exp $ */
+/* $NetBSD: bswap32.S,v 1.5 2013/07/18 22:42:50 matt Exp $ */
/*
* Copyright (C) 1996 Scott Reynolds. All rights reserved.
@@ -36,8 +36,20 @@
_ENTRY(BSWAP32)
movl 4(%sp),%d0
+#ifdef __mcfisac__
+ byterev %d0
+#elif defined(__mcoldfire__)
+ movl %d0,%d1
+ lsrl #8,%d0 | ABCD -> 0ABC
+ andl #0x00ff00ff,%d0 | 0ABC -> 0A0C
+ andl #0x00ff00ff,%d1 | ABCD -> 0B0D
+ lsll #8,%d1 | 0B0D -> B0D0
+ orl %d1,%d0 | 0A0C | B0D0 -> BADC
+ swap %d0 | BADC -> DCBA
+#else
+ rolw #8,%d0
+ swap %d0
rolw #8,%d0
- swap %d0
- rolw #8,%d0
+#endif
rts
END(BSWAP32)
diff -r 1f215ff1628d -r d23c8f1a736c common/lib/libc/arch/m68k/gen/bswap64.S
--- a/common/lib/libc/arch/m68k/gen/bswap64.S Thu Jul 18 22:40:58 2013 +0000
+++ b/common/lib/libc/arch/m68k/gen/bswap64.S Thu Jul 18 22:42:50 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bswap64.S,v 1.3 2013/07/16 23:24:18 matt Exp $ */
+/* $NetBSD: bswap64.S,v 1.4 2013/07/18 22:42:50 matt Exp $ */
/*
* Copyright (C) 1996 Scott Reynolds. All rights reserved.
@@ -31,11 +31,34 @@
ENTRY(bswap64)
movl 4(%sp),%d1
movl 8(%sp),%d0
+#ifdef __mcfisac__
+ byterev %d0
+ byterev %d1
+#elif defined(__mcoldfire__)
+ movl %d3,-(%sp)
+ movl %d2,-(%sp)
+ movl #0x00ff00ff, %d3
+ movl %d0,%d2
+ andl %d3,%d2
+ lsll #8,%d2
+ lsrl #8,%d0
+ andl %d3,%d0
+ orl %d2,%d0
+ movl %d1,%d2
+ andl %d3,%d2
+ lsll #8,%d2
+ lsrl #8,%d1
+ andl %d3,%d1
+ orl %d2,%d1
+ movl (%sp)+,%d2
+ movl (%sp)+,%d3
+#else
rolw #8,%d1
rolw #8,%d0
swap %d1
swap %d0
rolw #8,%d0
rolw #8,%d1
+#endif
rts
END(bswap64)
diff -r 1f215ff1628d -r d23c8f1a736c common/lib/libc/arch/m68k/string/bcmp.S
--- a/common/lib/libc/arch/m68k/string/bcmp.S Thu Jul 18 22:40:58 2013 +0000
+++ b/common/lib/libc/arch/m68k/string/bcmp.S Thu Jul 18 22:42:50 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bcmp.S,v 1.4 2013/07/16 23:24:19 matt Exp $ */
+/* $NetBSD: bcmp.S,v 1.5 2013/07/18 22:42:50 matt Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -68,14 +68,27 @@
#if 0
RCSID("from: @(#)bcmp.s 5.1 (Berkeley) 5/12/90")
#else
- RCSID("$NetBSD: bcmp.S,v 1.4 2013/07/16 23:24:19 matt Exp $")
+ RCSID("$NetBSD: bcmp.S,v 1.5 2013/07/18 22:42:50 matt Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
+#ifdef __mcoldfire__
+#define CMPMB(a,b) movb b,%d2; cmpb a,%d2
+#define CMPMW(a,b) movw b,%d2; cmpw a,%d2
+#define CMPML(a,b) movl b,%d2; cmpl a,%d2
+#else
+#define CMPMB(a,b) cmpmb a,b
+#define CMPMW(a,b) cmpmw a,b
+#define CMPML(a,b) cmpml a,b
+#endif
+
ENTRY(bcmp)
movl 4(%sp),%a0 | string 1
movl 8(%sp),%a1 | string 2
movl 12(%sp),%d1 | length
+#ifdef __mcoldfire__
+ movl %d2,-(%sp) | save temp
+#endif
/*
* It isn't worth the overhead of aligning to {long}word boundries
@@ -100,14 +113,14 @@
movl %a0,%d0
btst #0,%d0
jeq Lbcalgndw
- cmpmb (%a0)+,(%a1)+
+ CMPMB((%a0)+,(%a1)+)
jne Lbcnoteq
subql #1,%d1
Lbcalgndw:
/* long word align */
btst #1,%d0
jeq Lbcalgndl
- cmpmw (%a0)+,(%a1)+
+ CMPMW((%a0)+,(%a1)+)
jne Lbcnoteq
subql #2,%d1
Lbcalgndl:
@@ -118,24 +131,26 @@
andl #31,%d1 | len %= 32
subql #1,%d0 | set up for dbf
Lbc32loop:
- cmpml (%a0)+,(%a1)+ | compare 8 longwords
+ CMPML((%a0)+,(%a1)+) | compare 1 of 8 longwords
jne Lbcnoteq | not equal, return non-zero
- cmpml (%a0)+,(%a1)+
+ CMPML((%a0)+,(%a1)+) | compare 2 of 8 longwords
jne Lbcnoteq
- cmpml (%a0)+,(%a1)+
+ CMPML((%a0)+,(%a1)+) | compare 3 of 8 longwords
jne Lbcnoteq
- cmpml (%a0)+,(%a1)+
+ CMPML((%a0)+,(%a1)+) | compare 4 of 8 longwords
jne Lbcnoteq
- cmpml (%a0)+,(%a1)+
+ CMPML((%a0)+,(%a1)+) | compare 5 of 8 longwords
jne Lbcnoteq
- cmpml (%a0)+,(%a1)+
+ CMPML((%a0)+,(%a1)+) | compare 6 of 8 longwords
jne Lbcnoteq
- cmpml (%a0)+,(%a1)+
+ CMPML((%a0)+,(%a1)+) | compare 7 of 8 longwords
jne Lbcnoteq
- cmpml (%a0)+,(%a1)+
+ CMPML((%a0)+,(%a1)+) | compare 8 of 8 longwords
jne Lbcnoteq
+#ifndef __mcoldfire__
dbf %d0,Lbc32loop | till done
clrw %d0
+#endif
subql #1,%d0
jcc Lbc32loop
@@ -146,19 +161,32 @@
jeq Lbcbyte | if (cnt)
subql #1,%d0 | set up for dbf
Lbclloop:
- cmpml (%a0)+,(%a1)+ | compare a longword
+ CMPML((%a0)+,(%a1)+) | compare a longword
jne Lbcnoteq | not equal, return non-zero
+#ifdef __mcoldfire__
+ subql #1,%d0 | decrement
+ jcc Lbclloop | till done
+#else
dbf %d0,Lbclloop | till done
+#endif
andl #3,%d1 | len %= 4
jeq Lbcdone
subql #1,%d1 | set up for dbf
Lbcbloop:
- cmpmb (%a0)+,(%a1)+ | compare a byte
+ CMPMB((%a0)+,(%a1)+) | compare a byte
jne Lbcnoteq | not equal, return non-zero
Lbcbyte:
+#ifdef __mcoldfire__
+ subql #1,%d0 | decrement
+ jcc Lbcbloop | till done
+#else
dbf %d1,Lbcbloop
+#endif
Lbcdone:
+#ifdef __mcoldfire__
+ movl (%sp)+,%d2 | restore temp
+#endif
movql #0,%d0
rts
diff -r 1f215ff1628d -r d23c8f1a736c common/lib/libc/arch/m68k/string/bcopy.S
--- a/common/lib/libc/arch/m68k/string/bcopy.S Thu Jul 18 22:40:58 2013 +0000
+++ b/common/lib/libc/arch/m68k/string/bcopy.S Thu Jul 18 22:42:50 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bcopy.S,v 1.4 2013/07/16 23:24:19 matt Exp $ */
+/* $NetBSD: bcopy.S,v 1.5 2013/07/18 22:42:50 matt Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
#if 0
RCSID("from: @(#)bcopy.s 5.1 (Berkeley) 5/12/90")
#else
- RCSID("$NetBSD: bcopy.S,v 1.4 2013/07/16 23:24:19 matt Exp $")
+ RCSID("$NetBSD: bcopy.S,v 1.5 2013/07/18 22:42:50 matt Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
@@ -141,8 +141,10 @@
movl (%a0)+,(%a1)+
movl (%a0)+,(%a1)+
movl (%a0)+,(%a1)+
+#ifndef __mcoldfire__
dbf %d0,Lbcf32loop | till done
clrw %d0
+#endif
subql #1,%d0
jcc Lbcf32loop
@@ -154,7 +156,12 @@
subql #1,%d0 | set up for dbf
Lbcflloop:
movl (%a0)+,(%a1)+ | copy longwords
+#ifdef __mcoldfire__
+ subql #1,%d0 | decrement
+ jcc Lbcflloop | til done
+#else
dbf %d0,Lbcflloop | til done
+#endif
andl #3,%d1 | len %= 4
jeq Lbcdone
@@ -162,7 +169,12 @@
Lbcfbloop:
movb (%a0)+,(%a1)+ | copy bytes
Lbcfbyte:
+#ifdef __mcoldfire__
+ subql #1,%d0 | decrement
+ jcc Lbcfbloop | til done
+#else
dbf %d1,Lbcfbloop | till done
+#endif
Lbcdone:
#if defined(MEMCOPY) || defined(MEMMOVE)
movl 4(%sp),%d0 | dest address
@@ -224,8 +236,10 @@
movl -(%a0),-(%a1)
movl -(%a0),-(%a1)
movl -(%a0),-(%a1)
+#ifndef __mcoldfire__
dbf %d0,Lbcb32loop | till done
clrw %d0
+#endif
subql #1,%d0
jcc Lbcb32loop
@@ -237,7 +251,12 @@
subql #1,%d0 | set up for dbf
Lbcblloop:
Home |
Main Index |
Thread Index |
Old Index