1/* 2 * Copyright (c) 1988, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 * 7 * This code is derived from software contributed to Berkeley by 8 * Computer Consoles Inc. 9 */ 10 11#if defined(LIBC_SCCS) && !defined(lint) 12 .asciz "@(#)bcopy.s 8.1 (Berkeley) 06/04/93" 13#endif /* LIBC_SCCS and not lint */ 14 15/* bcopy(from, to, size) */ 16#include "DEFS.h" 17 18ENTRY(bcopy, 0) 19 movl 4(fp),r0 20 movl 8(fp),r1 21 movl 12(fp),r2 22 cmpl r0,r1 23 bgtru 1f # normal forward case 24 beql 2f # equal, nothing to do 25 addl2 r2,r0 # may be overlapping 26 cmpl r0,r1 27 bgtru 3f 28 subl2 r2,r0 # normal forward case 291: 30 movblk 312: 32 ret 333: 34 addl2 r2,r1 # overlapping, must do backwards 35 subl3 r0,r1,r3 36 movl r2,r4 37 jbr 5f 384: 39 subl2 r3,r0 40 subl2 r3,r1 41 movl r3,r2 42 movblk 43 subl2 r3,r0 44 subl2 r3,r1 45 subl2 r3,r4 465: 47 cmpl r4,r3 48 jgtr 4b 49 movl r4,r2 50 subl2 r2,r0 51 subl2 r2,r1 52 movblk 53 ret 54