-/* $NetBSD: locore.s,v 1.46.2.1 1995/11/24 07:51:10 chopps Exp $ */
+/* $NetBSD: locore.s,v 1.48 1995/12/11 02:37:59 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
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.