-/* $Id: locore.s,v 1.4 1995/11/07 08:50:19 deraadt Exp $ */
+/* $Id: locore.s,v 1.5 1995/12/15 02:24:11 deraadt Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
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.