Source-Changes-HG archive

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

[src/trunk]: src/sys/lib/libkern/arch/sh3 asm bcopy() for sh3



details:   https://anonhg.NetBSD.org/src/rev/19b705b76ded
branches:  trunk
changeset: 485146:19b705b76ded
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Thu Apr 20 13:52:35 2000 +0000

description:
asm bcopy() for sh3

diffstat:

 sys/lib/libkern/arch/sh3/Makefile.inc |   3 +-
 sys/lib/libkern/arch/sh3/bcopy.S      |  87 +++++++++++++++++++++++++++++++++++
 sys/lib/libkern/arch/sh3/memcpy.S     |   4 +
 sys/lib/libkern/arch/sh3/memmove.S    |   4 +
 4 files changed, 97 insertions(+), 1 deletions(-)

diffs (121 lines):

diff -r 922b094bf7fe -r 19b705b76ded sys/lib/libkern/arch/sh3/Makefile.inc
--- a/sys/lib/libkern/arch/sh3/Makefile.inc     Thu Apr 20 13:48:14 2000 +0000
+++ b/sys/lib/libkern/arch/sh3/Makefile.inc     Thu Apr 20 13:52:35 2000 +0000
@@ -1,8 +1,9 @@
-#      $NetBSD: Makefile.inc,v 1.2 1999/10/21 15:05:08 msaitoh Exp $
+#      $NetBSD: Makefile.inc,v 1.3 2000/04/20 13:52:35 msaitoh Exp $
 
 SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \
        bswap64.c bcmp.c bzero.c ffs.c scanc.c skpc.c \
        strcat.c strcmp.c strcpy.c strlen.c strncasecmp.c strncmp.c \
        strncpy.c random.c __assert.c memchr.c memcmp.c memset.c \
+       bcopy.S memcpy.S memmove.S \
        ashiftrt.S ashlsi3.S ashrsi3.S lshrsi3.S movstr.S \
        mulsi3.S sdivsi3.S udivsi3.S
diff -r 922b094bf7fe -r 19b705b76ded sys/lib/libkern/arch/sh3/bcopy.S
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/lib/libkern/arch/sh3/bcopy.S  Thu Apr 20 13:52:35 2000 +0000
@@ -0,0 +1,87 @@
+/*     $NetBSD: bcopy.S,v 1.1 2000/04/20 13:52:35 msaitoh Exp $        */
+
+/*
+ * Copyright (c) 2000 SHIMIZU Ryo <ryo%misakimix.org@localhost>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <machine/asm.h>
+
+#if defined(MEMCOPY) || defined(MEMMOVE)
+#define        DST     r4
+#define        SRC     r5
+#else
+#define        SRC     r4
+#define        DST     r5
+#endif
+#define        LEN     r6
+
+
+#ifdef MEMCOPY
+ENTRY(memcpy)
+#else
+#ifdef MEMMOVE
+ENTRY(memmove)
+#else
+ENTRY(bcopy)
+#endif
+#endif
+       cmp/hi  DST,SRC
+       bf      bcopy_overlap
+
+       tst     LEN,LEN
+       bt      9f
+1:
+       mov.b   @SRC+,r0
+       mov.b   r0,@DST
+
+       add     #-1,LEN
+       tst     LEN,LEN
+       bf/s    1b
+       add     #1,DST
+
+9:
+       rts     
+       nop
+
+bcopy_overlap:
+       add     LEN,SRC
+       add     LEN,DST
+
+       tst     LEN,LEN
+       bt      9f
+1:
+       add     #-1,SRC
+       mov.b   @SRC,r0
+
+       add     #-1,LEN
+       tst     LEN,LEN
+       bf/s    1b
+       mov.b   r0,@-DST
+
+9:
+       rts     
+       nop
+
diff -r 922b094bf7fe -r 19b705b76ded sys/lib/libkern/arch/sh3/memcpy.S
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/lib/libkern/arch/sh3/memcpy.S Thu Apr 20 13:52:35 2000 +0000
@@ -0,0 +1,4 @@
+/*     $NetBSD: memcpy.S,v 1.1 2000/04/20 13:52:36 msaitoh Exp $       */
+
+#define MEMCOPY
+#include "bcopy.S"
diff -r 922b094bf7fe -r 19b705b76ded sys/lib/libkern/arch/sh3/memmove.S
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/lib/libkern/arch/sh3/memmove.S        Thu Apr 20 13:52:35 2000 +0000
@@ -0,0 +1,4 @@
+/*     $NetBSD: memmove.S,v 1.1 2000/04/20 13:52:36 msaitoh Exp $      */
+
+#define MEMMOVE
+#include "bcopy.S"



Home | Main Index | Thread Index | Old Index