xref: /openbmc/linux/arch/sparc/lib/memmove.S (revision 275876e2)
1/* memmove.S: Simple memmove implementation.
2 *
3 * Copyright (C) 1997, 2004 David S. Miller (davem@redhat.com)
4 * Copyright (C) 1996, 1997, 1998, 1999 Jakub Jelinek (jj@ultra.linux.cz)
5 */
6
7#include <linux/linkage.h>
8
9	.text
10ENTRY(memmove) /* o0=dst o1=src o2=len */
11	mov		%o0, %g1
12	cmp		%o0, %o1
13	bleu,pt		%xcc, memcpy
14	 add		%o1, %o2, %g7
15	cmp		%g7, %o0
16	bleu,pt		%xcc, memcpy
17	 add		%o0, %o2, %o5
18	sub		%g7, 1, %o1
19
20	sub		%o5, 1, %o0
211:	ldub		[%o1], %g7
22	subcc		%o2, 1, %o2
23	sub		%o1, 1, %o1
24	stb		%g7, [%o0]
25	bne,pt		%icc, 1b
26	 sub		%o0, 1, %o0
27
28	retl
29	 mov		%g1, %o0
30ENDPROC(memmove)
31