1/* 2 * Copyright (c) 1983 Regents of the University of California. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms are permitted 6 * provided that this notice is preserved and that due credit is given 7 * to the University of California at Berkeley. The name of the University 8 * may not be used to endorse or promote products derived from this 9 * software without specific written prior permission. This software 10 * is provided ``as is'' without express or implied warranty. 11 */ 12 13#if defined(SYSLIBC_SCCS) && !defined(lint) 14_sccsid:.asciz "@(#)strcpy.s 5.4 (Berkeley) 05/25/88" 15#endif /* SYSLIBC_SCCS and not lint */ 16 17/* 18 * Copy string s2 over top of s1. 19 * Return base of s1. 20 * 21 * char * 22 * strcpy(s1, s2) 23 * char *s1, *s2; 24 */ 25#include "DEFS.h" 26 27ENTRY(strcpy, R6) 28 movl 4(ap), r3 # r3 = s1 29 movl 8(ap), r6 # r6 = s2 301: 31 locc $0,$65535,(r6) # find length of s2 32 bneq 2f 33 movc3 $65535,(r6),(r3)# copy full block 34 movl r1,r6 35 jbr 1b 362: 37 subl2 r6,r1 # calculate length 38 incl r1 39 movc3 r1,(r6),(r3) # copy remainder 40 movl 4(ap),r0 # return base of s1 41 ret 42