Move bcopy/ovbcopy/memcpy into m68/m68k/copy.s, which is used by all

m68k ports already anyhow.  No use in keeping 6 identical copies of this
function around.
This commit is contained in:
thorpej 1995-12-11 02:37:55 +00:00
parent d51f726204
commit de6dad9228
7 changed files with 82 additions and 454 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.s,v 1.47 1995/11/30 00:56:36 jtc Exp $ */
/* $NetBSD: locore.s,v 1.48 1995/12/11 02:37:59 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -1707,81 +1707,6 @@ ENTRY(_remque)
movw d0,sr
rts
ENTRY(memcpy)
movl sp@(12),d0 | get count
jeq Lcpyexit | if zero, return
movl sp@(8), a0 | src address
movl sp@(4), a1 | dest address
jra Ldocopy | jump into bcopy
/*
* {ov}bcopy(from, to, len)
*
* Works for counts up to 128K.
*/
ALTENTRY(ovbcopy, _bcopy)
ENTRY(bcopy)
movl sp@(12),d0 | get count
jeq Lcpyexit | if zero, return
movl sp@(4),a0 | src address
movl sp@(8),a1 | dest address
Ldocopy:
cmpl a1,a0 | src before dest?
jlt Lcpyback | yes, copy backwards (avoids overlap)
movl a0,d1
btst #0,d1 | src address odd?
jeq Lcfeven | no, go check dest
movb a0@+,a1@+ | yes, copy a byte
subql #1,d0 | update count
jeq Lcpyexit | exit if done
Lcfeven:
movl a1,d1
btst #0,d1 | dest address odd?
jne Lcfbyte | yes, must copy by bytes
movl d0,d1 | no, get count
lsrl #2,d1 | convert to longwords
jeq Lcfbyte | no longwords, copy bytes
subql #1,d1 | set up for dbf
Lcflloop:
movl a0@+,a1@+ | copy longwords
dbf d1,Lcflloop | til done
andl #3,d0 | get remaining count
jeq Lcpyexit | done if none
Lcfbyte:
subql #1,d0 | set up for dbf
Lcfbloop:
movb a0@+,a1@+ | copy bytes
dbf d0,Lcfbloop | til done
Lcpyexit:
rts
Lcpyback:
addl d0,a0 | add count to src
addl d0,a1 | add count to dest
movl a0,d1
btst #0,d1 | src address odd?
jeq Lcbeven | no, go check dest
movb a0@-,a1@- | yes, copy a byte
subql #1,d0 | update count
jeq Lcpyexit | exit if done
Lcbeven:
movl a1,d1
btst #0,d1 | dest address odd?
jne Lcbbyte | yes, must copy by bytes
movl d0,d1 | no, get count
lsrl #2,d1 | convert to longwords
jeq Lcbbyte | no longwords, copy bytes
subql #1,d1 | set up for dbf
Lcblloop:
movl a0@-,a1@- | copy longwords
dbf d1,Lcblloop | til done
andl #3,d0 | get remaining count
jeq Lcpyexit | done if none
Lcbbyte:
subql #1,d0 | set up for dbf
Lcbbloop:
movb a0@-,a1@- | copy bytes
dbf d0,Lcbbloop | til done
rts
#ifdef FPCOPROC
/*
* Save and restore 68881 state.

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.s,v 1.11 1995/11/30 21:52:46 leo Exp $ */
/* $NetBSD: locore.s,v 1.12 1995/12/11 02:38:01 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -1758,83 +1758,6 @@ ENTRY(_remque)
movw d0,sr
rts
/*
* {ov}bcopy(from, to, len)
* memcpy(to, from, len)
*
* Works for counts up to 128K.
*/
ENTRY(memcpy)
movl sp@(12),d0 | get count
jeq Lcpyexit | if zero, return
movl sp@(8),a0 | src address
movl sp@(4),a1 | dest address
jra Ldocopy
ALTENTRY(ovbcopy, _bcopy)
ENTRY(bcopy)
movl sp@(12),d0 | get count
jeq Lcpyexit | if zero, return
movl sp@(4),a0 | src address
movl sp@(8),a1 | dest address
Ldocopy:
cmpl a1,a0 | src before dest?
jlt Lcpyback | yes, copy backwards (avoids overlap)
movl a0,d1
btst #0,d1 | src address odd?
jeq Lcfeven | no, go check dest
movb a0@+,a1@+ | yes, copy a byte
subql #1,d0 | update count
jeq Lcpyexit | exit if done
Lcfeven:
movl a1,d1
btst #0,d1 | dest address odd?
jne Lcfbyte | yes, must copy by bytes
movl d0,d1 | no, get count
lsrl #2,d1 | convert to longwords
jeq Lcfbyte | no longwords, copy bytes
subql #1,d1 | set up for dbf
Lcflloop:
movl a0@+,a1@+ | copy longwords
dbf d1,Lcflloop | til done
andl #3,d0 | get remaining count
jeq Lcpyexit | done if none
Lcfbyte:
subql #1,d0 | set up for dbf
Lcfbloop:
movb a0@+,a1@+ | copy bytes
dbf d0,Lcfbloop | til done
Lcpyexit:
rts
Lcpyback:
addl d0,a0 | add count to src
addl d0,a1 | add count to dest
movl a0,d1
btst #0,d1 | src address odd?
jeq Lcbeven | no, go check dest
movb a0@-,a1@- | yes, copy a byte
subql #1,d0 | update count
jeq Lcpyexit | exit if done
Lcbeven:
movl a1,d1
btst #0,d1 | dest address odd?
jne Lcbbyte | yes, must copy by bytes
movl d0,d1 | no, get count
lsrl #2,d1 | convert to longwords
jeq Lcbbyte | no longwords, copy bytes
subql #1,d1 | set up for dbf
Lcblloop:
movl a0@-,a1@- | copy longwords
dbf d1,Lcblloop | til done
andl #3,d0 | get remaining count
jeq Lcpyexit | done if none
Lcbbyte:
subql #1,d0 | set up for dbf
Lcbbloop:
movb a0@-,a1@- | copy bytes
dbf d0,Lcbbloop | til done
rts
/*
* Save and restore 68881 state.
* Pretty awful looking since our assembler does not

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.s,v 1.44 1995/10/08 20:19:22 thorpej Exp $ */
/* $NetBSD: locore.s,v 1.45 1995/12/11 02:38:04 thorpej Exp $ */
#undef STACKCHECK /* doesn't work any more */
@ -1988,82 +1988,6 @@ ENTRY(_remque)
movw d0,sr
rts
/*
* {ov}bcopy(from, to, len)
* memcpy(to, from len)
*
* Works for counts up to 128K.
*/
ENTRY(memcpy)
movl sp@(12),d0 | get count
jeq Lcpyexit | if zero, return
movl sp@(8), a0 | src address
movl sp@(4), a1 | dest address
jra Ldocopy | jump into bcopy
ALTENTRY(ovbcopy, _bcopy)
ENTRY(bcopy)
movl sp@(12),d0 | get count
jeq Lcpyexit | if zero, return
movl sp@(4),a0 | src address
movl sp@(8),a1 | dest address
Ldocopy:
cmpl a1,a0 | src before dest?
jlt Lcpyback | yes, copy backwards (avoids overlap)
movl a0,d1
btst #0,d1 | src address odd?
jeq Lcfeven | no, go check dest
movb a0@+,a1@+ | yes, copy a byte
subql #1,d0 | update count
jeq Lcpyexit | exit if done
Lcfeven:
movl a1,d1
btst #0,d1 | dest address odd?
jne Lcfbyte | yes, must copy by bytes
movl d0,d1 | no, get count
lsrl #2,d1 | convert to longwords
jeq Lcfbyte | no longwords, copy bytes
subql #1,d1 | set up for dbf
Lcflloop:
movl a0@+,a1@+ | copy longwords
dbf d1,Lcflloop | til done
andl #3,d0 | get remaining count
jeq Lcpyexit | done if none
Lcfbyte:
subql #1,d0 | set up for dbf
Lcfbloop:
movb a0@+,a1@+ | copy bytes
dbf d0,Lcfbloop | til done
Lcpyexit:
rts
Lcpyback:
addl d0,a0 | add count to src
addl d0,a1 | add count to dest
movl a0,d1
btst #0,d1 | src address odd?
jeq Lcbeven | no, go check dest
movb a0@-,a1@- | yes, copy a byte
subql #1,d0 | update count
jeq Lcpyexit | exit if done
Lcbeven:
movl a1,d1
btst #0,d1 | dest address odd?
jne Lcbbyte | yes, must copy by bytes
movl d0,d1 | no, get count
lsrl #2,d1 | convert to longwords
jeq Lcbbyte | no longwords, copy bytes
subql #1,d1 | set up for dbf
Lcblloop:
movl a0@-,a1@- | copy longwords
dbf d1,Lcblloop | til done
andl #3,d0 | get remaining count
jeq Lcpyexit | done if none
Lcbbyte:
subql #1,d0 | set up for dbf
Lcbbloop:
movb a0@-,a1@- | copy bytes
dbf d0,Lcbbloop | til done
rts
#ifdef FPCOPROC
/*
* Save and restore 68881 state.

View File

@ -1,4 +1,4 @@
/* $NetBSD: copy.s,v 1.21 1995/02/11 21:59:29 mycroft Exp $ */
/* $NetBSD: copy.s,v 1.22 1995/12/11 02:37:55 thorpej Exp $ */
/*-
* Copyright (c) 1994, 1995 Charles Hannum.
@ -455,3 +455,78 @@ Lsdone:
clrl a1@(PCB_ONFAULT) | clear fault handler
rts
/*
* {ov}bcopy(from, to, len)
* memcpy(to, from, len)
*
* Works for counts up to 128K.
*/
ENTRY(memcpy)
movl sp@(12),d0 | get count
jeq Lbccpyexit | if zero, return
movl sp@(8), a0 | src address
movl sp@(4), a1 | dest address
jra Lbcdocopy | jump into bcopy
ALTENTRY(ovbcopy, _bcopy)
ENTRY(bcopy)
movl sp@(12),d0 | get count
jeq Lbccpyexit | if zero, return
movl sp@(4),a0 | src address
movl sp@(8),a1 | dest address
Lbcdocopy:
cmpl a1,a0 | src before dest?
jlt Lbccpyback | yes, copy backwards (avoids overlap)
movl a0,d1
btst #0,d1 | src address odd?
jeq Lbccfeven | no, go check dest
movb a0@+,a1@+ | yes, copy a byte
subql #1,d0 | update count
jeq Lbccpyexit | exit if done
Lbccfeven:
movl a1,d1
btst #0,d1 | dest address odd?
jne Lbccfbyte | yes, must copy by bytes
movl d0,d1 | no, get count
lsrl #2,d1 | convert to longwords
jeq Lbccfbyte | no longwords, copy bytes
subql #1,d1 | set up for dbf
Lbccflloop:
movl a0@+,a1@+ | copy longwords
dbf d1,Lbccflloop | til done
andl #3,d0 | get remaining count
jeq Lbccpyexit | done if none
Lbccfbyte:
subql #1,d0 | set up for dbf
Lbccfbloop:
movb a0@+,a1@+ | copy bytes
dbf d0,Lbccfbloop | til done
Lbccpyexit:
rts
Lbccpyback:
addl d0,a0 | add count to src
addl d0,a1 | add count to dest
movl a0,d1
btst #0,d1 | src address odd?
jeq Lbccbeven | no, go check dest
movb a0@-,a1@- | yes, copy a byte
subql #1,d0 | update count
jeq Lbccpyexit | exit if done
Lbccbeven:
movl a1,d1
btst #0,d1 | dest address odd?
jne Lbccbbyte | yes, must copy by bytes
movl d0,d1 | no, get count
lsrl #2,d1 | convert to longwords
jeq Lbccbbyte | no longwords, copy bytes
subql #1,d1 | set up for dbf
Lbccblloop:
movl a0@-,a1@- | copy longwords
dbf d1,Lbccblloop | til done
andl #3,d0 | get remaining count
jeq Lbccpyexit | done if none
Lbccbbyte:
subql #1,d0 | set up for dbf
Lbccbbloop:
movb a0@-,a1@- | copy bytes
dbf d0,Lbccbbloop | til done
rts

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.s,v 1.51 1995/10/10 04:14:18 briggs Exp $ */
/* $NetBSD: locore.s,v 1.52 1995/12/11 02:38:08 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -1758,81 +1758,6 @@ ENTRY(_remque)
movw d0,sr
rts
ENTRY(memcpy)
movl sp@(12),d0 | get count
jeq Lcpyexit | if zero, return
movl sp@(8), a0 | src address
movl sp@(4), a1 | dest address
jra Ldocopy | jump into bcopy
/*
* {ov}bcopy(from, to, len)
*
* Works for counts up to 128K.
*/
ALTENTRY(ovbcopy, _bcopy)
ENTRY(bcopy)
movl sp@(12),d0 | get count
jeq Lcpyexit | if zero, return
movl sp@(4),a0 | src address
movl sp@(8),a1 | dest address
Ldocopy:
cmpl a1,a0 | src before dest?
jlt Lcpyback | yes, copy backwards (avoids overlap)
movl a0,d1
btst #0,d1 | src address odd?
jeq Lcfeven | no, go check dest
movb a0@+,a1@+ | yes, copy a byte
subql #1,d0 | update count
jeq Lcpyexit | exit if done
Lcfeven:
movl a1,d1
btst #0,d1 | dest address odd?
jne Lcfbyte | yes, must copy by bytes
movl d0,d1 | no, get count
lsrl #2,d1 | convert to longwords
jeq Lcfbyte | no longwords, copy bytes
subql #1,d1 | set up for dbf
Lcflloop:
movl a0@+,a1@+ | copy longwords
dbf d1,Lcflloop | til done
andl #3,d0 | get remaining count
jeq Lcpyexit | done if none
Lcfbyte:
subql #1,d0 | set up for dbf
Lcfbloop:
movb a0@+,a1@+ | copy bytes
dbf d0,Lcfbloop | til done
Lcpyexit:
rts
Lcpyback:
addl d0,a0 | add count to src
addl d0,a1 | add count to dest
movl a0,d1
btst #0,d1 | src address odd?
jeq Lcbeven | no, go check dest
movb a0@-,a1@- | yes, copy a byte
subql #1,d0 | update count
jeq Lcpyexit | exit if done
Lcbeven:
movl a1,d1
btst #0,d1 | dest address odd?
jne Lcbbyte | yes, must copy by bytes
movl d0,d1 | no, get count
lsrl #2,d1 | convert to longwords
jeq Lcbbyte | no longwords, copy bytes
subql #1,d1 | set up for dbf
Lcblloop:
movl a0@-,a1@- | copy longwords
dbf d1,Lcblloop | til done
andl #3,d0 | get remaining count
jeq Lcpyexit | done if none
Lcbbyte:
subql #1,d0 | set up for dbf
Lcbbloop:
movb a0@-,a1@- | copy bytes
dbf d0,Lcbbloop | til done
rts
/*
* Save and restore 68881 state.
* Pretty awful looking since our assembler does not

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.s,v 1.2 1995/10/12 20:00:40 chuck Exp $ */
/* $NetBSD: locore.s,v 1.3 1995/12/11 02:38:11 thorpej Exp $ */
#undef STACKCHECK /* doesn't work any more */
@ -1665,74 +1665,6 @@ ENTRY(_remque)
movw d0,sr
rts
/*
* {ov}bcopy(from, to, len)
*
* Works for counts up to 128K.
*/
ALTENTRY(ovbcopy, _bcopy)
ENTRY(bcopy)
movl sp@(12),d0 | get count
jeq Lcpyexit | if zero, return
movl sp@(4),a0 | src address
movl sp@(8),a1 | dest address
cmpl a1,a0 | src before dest?
jlt Lcpyback | yes, copy backwards (avoids overlap)
movl a0,d1
btst #0,d1 | src address odd?
jeq Lcfeven | no, go check dest
movb a0@+,a1@+ | yes, copy a byte
subql #1,d0 | update count
jeq Lcpyexit | exit if done
Lcfeven:
movl a1,d1
btst #0,d1 | dest address odd?
jne Lcfbyte | yes, must copy by bytes
movl d0,d1 | no, get count
lsrl #2,d1 | convert to longwords
jeq Lcfbyte | no longwords, copy bytes
subql #1,d1 | set up for dbf
Lcflloop:
movl a0@+,a1@+ | copy longwords
dbf d1,Lcflloop | til done
andl #3,d0 | get remaining count
jeq Lcpyexit | done if none
Lcfbyte:
subql #1,d0 | set up for dbf
Lcfbloop:
movb a0@+,a1@+ | copy bytes
dbf d0,Lcfbloop | til done
Lcpyexit:
rts
Lcpyback:
addl d0,a0 | add count to src
addl d0,a1 | add count to dest
movl a0,d1
btst #0,d1 | src address odd?
jeq Lcbeven | no, go check dest
movb a0@-,a1@- | yes, copy a byte
subql #1,d0 | update count
jeq Lcpyexit | exit if done
Lcbeven:
movl a1,d1
btst #0,d1 | dest address odd?
jne Lcbbyte | yes, must copy by bytes
movl d0,d1 | no, get count
lsrl #2,d1 | convert to longwords
jeq Lcbbyte | no longwords, copy bytes
subql #1,d1 | set up for dbf
Lcblloop:
movl a0@-,a1@- | copy longwords
dbf d1,Lcblloop | til done
andl #3,d0 | get remaining count
jeq Lcpyexit | done if none
Lcbbyte:
subql #1,d0 | set up for dbf
Lcbbloop:
movb a0@-,a1@- | copy bytes
dbf d0,Lcbbloop | til done
rts
#ifdef FPCOPROC
/*
* Save and restore 68881 state.

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.s,v 1.33 1995/10/10 21:35:42 gwr Exp $ */
/* $NetBSD: locore.s,v 1.34 1995/12/11 02:38:13 thorpej Exp $ */
/*
* Copyright (c) 1994, 1995 Gordon W. Ross
@ -1157,82 +1157,6 @@ ENTRY(_remque)
movw d0,sr
rts
/*
* {ov}bcopy(from, to, len)
* memcpy(to, from, len)
*
* Works for counts up to 128K.
*/
ENTRY(memcpy)
movl sp@(12),d0 | get count
jeq Lcpyexit | if zero, return
movl sp@(8), a0 | src address
movl sp@(4), a1 | dest address
jra Ldocopy | jump into bcopy
ALTENTRY(ovbcopy, _bcopy)
ENTRY(bcopy)
movl sp@(12),d0 | get count
jeq Lcpyexit | if zero, return
movl sp@(4),a0 | src address
movl sp@(8),a1 | dest address
Ldocopy:
cmpl a1,a0 | src before dest?
jlt Lcpyback | yes, copy backwards (avoids overlap)
movl a0,d1
btst #0,d1 | src address odd?
jeq Lcfeven | no, go check dest
movb a0@+,a1@+ | yes, copy a byte
subql #1,d0 | update count
jeq Lcpyexit | exit if done
Lcfeven:
movl a1,d1
btst #0,d1 | dest address odd?
jne Lcfbyte | yes, must copy by bytes
movl d0,d1 | no, get count
lsrl #2,d1 | convert to longwords
jeq Lcfbyte | no longwords, copy bytes
subql #1,d1 | set up for dbf
Lcflloop:
movl a0@+,a1@+ | copy longwords
dbf d1,Lcflloop | til done
andl #3,d0 | get remaining count
jeq Lcpyexit | done if none
Lcfbyte:
subql #1,d0 | set up for dbf
Lcfbloop:
movb a0@+,a1@+ | copy bytes
dbf d0,Lcfbloop | til done
Lcpyexit:
rts
Lcpyback:
addl d0,a0 | add count to src
addl d0,a1 | add count to dest
movl a0,d1
btst #0,d1 | src address odd?
jeq Lcbeven | no, go check dest
movb a0@-,a1@- | yes, copy a byte
subql #1,d0 | update count
jeq Lcpyexit | exit if done
Lcbeven:
movl a1,d1
btst #0,d1 | dest address odd?
jne Lcbbyte | yes, must copy by bytes
movl d0,d1 | no, get count
lsrl #2,d1 | convert to longwords
jeq Lcbbyte | no longwords, copy bytes
subql #1,d1 | set up for dbf
Lcblloop:
movl a0@-,a1@- | copy longwords
dbf d1,Lcblloop | til done
andl #3,d0 | get remaining count
jeq Lcpyexit | done if none
Lcbbyte:
subql #1,d0 | set up for dbf
Lcbbloop:
movb a0@-,a1@- | copy bytes
dbf d0,Lcbbloop | til done
rts
/*
* Save and restore 68881 state.
* Pretty awful looking since our assembler does not