1/* 2 * Copyright (c) 1988 Regents of the University of California. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Computer Consoles Inc. 7 * 8 * Redistribution and use in source and binary forms are permitted 9 * provided that this notice is preserved and that due credit is given 10 * to the University of California at Berkeley. The name of the University 11 * may not be used to endorse or promote products derived from this 12 * software without specific prior written permission. This software 13 * is provided ``as is'' without express or implied warranty. 14 */ 15 16#if defined(LIBC_SCCS) && !defined(lint) 17_sccsid:.asciz "@(#)bcopy.s 1.2 (Berkeley) 05/23/88" 18#endif /* LIBC_SCCS and not lint */ 19 20/* bcopy(from, to, size) */ 21#include "DEFS.h" 22 23ENTRY(bcopy, 0) 24 movl 4(fp),r0 25 movl 8(fp),r1 26 movl 12(fp),r2 27 cmpl r0,r1 28 bgtru 1f # normal forward case 29 beql 2f # equal, nothing to do 30 addl2 r2,r0 # may be overlapping 31 cmpl r0,r1 32 bgtru 3f 33 subl2 r2,r0 # normal forward case 341: 35 movblk 362: 37 ret 383: 39 addl2 r2,r1 # overlapping, must do backwards 40 subl3 r0,r1,r3 41 movl r2,r4 42 jbr 5f 434: 44 subl2 r3,r0 45 subl2 r3,r1 46 movl r3,r2 47 movblk 48 subl2 r3,r0 49 subl2 r3,r1 50 subl2 r3,r4 515: 52 cmpl r4,r3 53 jgtr 4b 54 movl r4,r2 55 subl2 r2,r0 56 subl2 r2,r1 57 movblk 58 ret 59