blob: b7f6334e159f9d22fc34ccc2f003511009ca9b61 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/* 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
David S. Miller8695c372012-05-11 20:33:22 -07007#include <linux/linkage.h>
8
Linus Torvalds1da177e2005-04-16 15:20:36 -07009 .text
David S. Miller8695c372012-05-11 20:33:22 -070010ENTRY(memmove) /* o0=dst o1=src o2=len */
Linus Torvalds1da177e2005-04-16 15:20:36 -070011 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
David S. Miller8695c372012-05-11 20:33:22 -070030ENDPROC(memmove)