Source-Changes-HG archive

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

[src/netbsd-1-5]: src/sys Pull up revision memcpy.S 1.4-1.5 and locore.S 1.10...



details:   https://anonhg.NetBSD.org/src/rev/87ee9326e8cc
branches:  netbsd-1-5
changeset: 488577:87ee9326e8cc
user:      jeffs <jeffs%NetBSD.org@localhost>
date:      Wed Jul 19 06:34:22 2000 +0000

description:
Pull up revision memcpy.S 1.4-1.5 and locore.S 1.105 (approved by thorpej).
  Make memcpy() the favored interface an swizzle the args for ovbcopy.  Also
  move bcopy XLEAF here from locore.S.  For 64b clean compilation add a
  ld/sd section to the block copy.

diffstat:

 sys/arch/mips/mips/locore.S        |   13 +---
 sys/lib/libkern/arch/mips/memcpy.S |  139 +++++++++++++++++++++---------------
 2 files changed, 82 insertions(+), 70 deletions(-)

diffs (258 lines):

diff -r 911052c9de10 -r 87ee9326e8cc sys/arch/mips/mips/locore.S
--- a/sys/arch/mips/mips/locore.S       Wed Jul 19 02:53:03 2000 +0000
+++ b/sys/arch/mips/mips/locore.S       Wed Jul 19 06:34:22 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.S,v 1.104 2000/06/10 02:43:49 soren Exp $       */
+/*     $NetBSD: locore.S,v 1.104.2.1 2000/07/19 06:34:23 jeffs Exp $   */
 
 /*
  * Copyright (c) 1992, 1993
@@ -988,17 +988,6 @@
        li      v0, -1
 END(fswintrberr)
 
-#if 1
-/*
- * temporary glue for bcopy
- */
-bcopy:
-       move    v0, a0
-       move    a0, a1
-       j       _C_LABEL(memcpy)
-       move    a1, v0
-#endif
-
 #if defined(NS) || defined(ISO) || defined(CCITT) || defined(CODA)
 /*
  * Insert 'p' after 'q'.
diff -r 911052c9de10 -r 87ee9326e8cc sys/lib/libkern/arch/mips/memcpy.S
--- a/sys/lib/libkern/arch/mips/memcpy.S        Wed Jul 19 02:53:03 2000 +0000
+++ b/sys/lib/libkern/arch/mips/memcpy.S        Wed Jul 19 06:34:22 2000 +0000
@@ -1,6 +1,7 @@
-/*     $NetBSD: memcpy.S,v 1.3 1999/03/15 07:04:04 jonathan Exp $      */
+/*     $NetBSD: memcpy.S,v 1.3.18.1 2000/07/19 06:34:22 jeffs Exp $    */
 /* XXXX We need to define this in a way which supports multiple architectures */
 
+#include <machine/cdefs.h>     /* Get SZREG correct */
 #include <mips/asm.h>
 #include <machine/endian.h>
 
@@ -8,27 +9,28 @@
 .set noreorder
 
        .text
+
 /*
- * memcpy(to, from, len)
+ * {ov}bcopy(from, to, len)
  */
-
-ALEAF(memmove)
-LEAF(memcpy)
-       move    v0, a0                  # swap from and to
+LEAF(bcopy)
+XLEAF(ovbcopy)
+       move    v0, a0          # swap from and to for compat interface.
        move    a0, a1
        move    a1, v0
 
 /*
- * {ov}bcopy(from, to, len)
+ * memcpy(to, from, len)
  */
-ALEAF(ovbcopy)
+XLEAF(memmove)
+XLEAF(memcpy)
        .set    noat
        /*
         *      Make sure we can copy forwards.
         */
-       sltu    t0,a0,a1        # t0 == a0 < a1
-       addu    a3,a0,a2        # a3 == end of source
-       sltu    t1,a1,a3        # t1 == a1 < a0+a2
+       sltu    t0,a1,a0        # t0 == a1 < a0
+       addu    a3,a1,a2        # a3 == end of source
+       sltu    t1,a0,a3        # t1 == a0 < a1+a2
        and     t2,t0,t1        # overlap -- copy backwards
        bne     t2,zero,backcopy
 
@@ -46,44 +48,67 @@
         *      copy is alignable.  eg if src and dest are both
         *      on a halfword boundary.
         */
-       andi    t1,a1,3         # get last 3 bits of dest
+       andi    t1,a0,3         # BDSLOT: get last 2 bits of dest
        bne     t1,zero,bytecopy
-       andi    t0,a0,3         # get last 3 bits of src
+       andi    t0,a1,3         # BDSLOT: get last 2 bits of src
        bne     t0,zero,destaligned
 
        /*
         *      Forward aligned->aligned copy, 8*4 bytes at a time.
         */
-       li      AT,-32
-       and     t0,a2,AT        /* count truncated to multiple of 32 */
-       addu    a3,a0,t0        /* run fast loop up to this address */
-       sltu    AT,a0,a3        /* any work to do? */
+       li      AT,-32          # BDSLOT
+       and     t0,a2,AT        # count truncated to multiple of 32
+       addu    a3,a1,t0        # run fast loop up to this address
+       sltu    AT,a1,a3        # any work to do?
        beq     AT,zero,wordcopy
-       subu    a2,t0
+       subu    a2,t0           # BDSLOT
 
        /*
         *      loop body
         */
+#if SZREG == 8
+       .set    mips3
+
+       or      v0,a0,a1        # 4 or 8 byte aligned?
+       andi    v0,v0,7
+       bne     v0,zero,cp
+       nop                     # BDSLOT
+cp8:
+       ld      v0,0(a1)
+       ld      v1,8(a1)
+       ld      t0,16(a1)
+       ld      t1,24(a1)
+       addu    a1,32
+       sd      v0,0(a0)
+       sd      v1,8(a0)
+       sd      t0,16(a0)
+       sd      t1,24(a0)
+       bne     a1,a3,cp8
+       addu    a0,32           # BDSLOT
+
+       b       wordcopy
+       nop                     # BDSLOT
+#endif
 cp:
-       lw      v0,0(a0)
-       lw      v1,4(a0)
-       lw      t0,8(a0)
-       lw      t1,12(a0)
+       lw      v0,0(a1)
+       lw      v1,4(a1)
+       lw      t0,8(a1)
+       lw      t1,12(a1)
+       addu    a1,32
+       sw      v0,0(a0)
+       sw      v1,4(a0)
+       sw      t0,8(a0)
+       sw      t1,12(a0)
+       lw      t1,-4(a1)
+       lw      t0,-8(a1)
+       lw      v1,-12(a1)
+       lw      v0,-16(a1)
        addu    a0,32
-       sw      v0,0(a1)
-       sw      v1,4(a1)
-       sw      t0,8(a1)
-       sw      t1,12(a1)
-       lw      t1,-4(a0)
-       lw      t0,-8(a0)
-       lw      v1,-12(a0)
-       lw      v0,-16(a0)
-       addu    a1,32
-       sw      t1,-4(a1)
-       sw      t0,-8(a1)
-       sw      v1,-12(a1)
-       bne     a0,a3,cp
-       sw      v0,-16(a1)
+       sw      t1,-4(a0)
+       sw      t0,-8(a0)
+       sw      v1,-12(a0)
+       bne     a1,a3,cp
+       sw      v0,-16(a0)      # BDSLOT
 
        /*
         *      Copy a word at a time, no loop unrolling.
@@ -92,30 +117,29 @@
        andi    t2,a2,3         # get byte count / 4
        subu    t2,a2,t2        # t2 = number of words to copy * 4
        beq     t2,zero,bytecopy
-       addu    t0,a0,t2        # stop at t0
+       addu    t0,a1,t2        # BDSLOT stop at t0
        subu    a2,a2,t2
 1:
-       lw      v0,0(a0)
-       addu    a0,4
-       sw      v0,0(a1)
-       bne     a0,t0,1b
+       lw      v0,0(a1)
        addu    a1,4
+       sw      v0,0(a0)
+       bne     a1,t0,1b
+       addu    a0,4            # BDSLOT
 
 bytecopy:
        beq     a2,zero,copydone        # nothing left to do?
        nop
 2:
-       lb      v0,0(a0)
-       addu    a0,1
-       sb      v0,0(a1)
+       lb      v0,0(a1)
+       addu    a1,1
+       sb      v0,0(a0)
        subu    a2,1
        bgtz    a2,2b
-       addu    a1,1
+       addu    a0,1            # BDSLOT
 
 copydone:
        j       ra
        nop
-
        /*
         *      Copy from unaligned source to aligned dest.
         */
@@ -123,17 +147,16 @@
        andi    t0,a2,3         # t0 = bytecount mod 4
        subu    a3,a2,t0        # number of words to transfer
        beq     a3,zero,bytecopy
-       nop
+       addu    a3,a1,a3        # BDSLOT: stop point for destaligned
        move    a2,t0           # this many to do after we are done
-       addu    a3,a0,a3        # stop point
 
 3:
-       LWHI    v0,0(a0)
-       LWLO    v0,3(a0)
-       addi    a0,4
-       sw      v0,0(a1)
-       bne     a0,a3,3b
+       LWHI    v0,0(a1)
+       LWLO    v0,3(a1)
        addi    a1,4
+       sw      v0,0(a0)
+       bne     a1,a3,3b
+       addi    a0,4            # BDSLOT
 
        j       bytecopy
        nop
@@ -143,17 +166,17 @@
         */
 backcopy:
        blez    a2,copydone     # nothing left to do?
-       addu    t0,a0,a2        # end of source
-       addu    t1,a1,a2        # end of destination
+       addu    t0,a1,a2        # BDSLOT: end of source
+       addu    t1,a0,a2        # end of destination
 4:
        lb      v0,-1(t0)       
        subu    t0,1
        sb      v0,-1(t1)
-       bne     t0,a0,4b
-       subu    t1,1
+       bne     t0,a1,4b
+       subu    t1,1            # BDSLOT
        j       ra
        nop
        
        .set    at
-END(memcpy)
+END(bcopy)
 .set   pop



Home | Main Index | Thread Index | Old Index