1: /* 2: * Copyright (c) 1983 Regents of the University of California. 3: * All rights reserved. The Berkeley software License Agreement 4: * specifies the terms and conditions for redistribution. 5: */ 6: 7: #ifdef LIBC_SCCS 8: .asciz "@(#)strcpy.s 5.3 (Berkeley) 3/9/86" 9: #endif LIBC_SCCS 10: 11: /* 12: * Copy string s2 over top of s1. 13: * Return base of s1. 14: * 15: * char * 16: * strcpy(s1, s2) 17: * char *s1, *s2; 18: */ 19: #include "DEFS.h" 20: 21: ENTRY(strcpy, R6) 22: movl 4(ap), r3 # r3 = s1 23: movl 8(ap), r6 # r6 = s2 24: 1: 25: locc $0,$65535,(r6) # find length of s2 26: bneq 2f 27: movc3 $65535,(r6),(r3)# copy full block 28: movl r1,r6 29: jbr 1b 30: 2: 31: subl2 r6,r1 # calculate length 32: incl r1 33: movc3 r1,(r6),(r3) # copy remainder 34: movl 4(ap),r0 # return base of s1 35: ret