1 /* $Id: memmove.S,v 1.2 2001/07/27 11:51:09 gniibe Exp $
3 * "memmove" implementation of SuperH
5 * Copyright (C) 1999 Niibe Yutaka
10 * void *memmove(void *dst, const void *src, size_t n);
11 * The memory areas may overlap.
14 #include <linux/linkage.h>
16 ! if dest > src, call memcpy (it copies in decreasing order)
25 sub r5,r4 ! From here, r4 has the distance to r0
27 bt/s 9f ! if n=0, do nothing
32 bt/s 8f ! if it's too small, copy a byte at once
36 ! [ ... ] DST [ ... ] SRC
39 ! r0+r4--> [ ... ] r0 --> [ ... ]
48 mov r0,r3 ! Save the value on R0 to R3
53 mov r3,r0 ! and back to R0
64 bf/s 8b ! while (r0<r5)
78 ! GHIJ KLMN OPQR --> GHIJ KLMN OPQR
80 ! First, align to long word boundary
93 2: ! Second, copy a long word at once
102 ! Third, copy a byte at once, if necessary
111 ! GHIJ KLMN OPQR --> ...G HIJK LMNO PQR.
113 ! First, align to long word boundary
126 2: ! Second, read a long word and write a long word at once
132 #ifdef __LITTLE_ENDIAN__
159 ! Third, copy a byte at once, if necessary
169 ! GHIJ KLMN OPQR --> ..GH IJKL MNOP QR..
171 ! First, align to word boundary
178 2: ! Second, read a word and write a word at once
188 ! Third, copy a byte at once, if necessary
199 ! GHIJ KLMN OPQR --> .GHI JKLM NOPQ R...
201 ! First, align to long word boundary
214 2: ! Second, read a long word and write a long word at once
219 #ifdef __LITTLE_ENDIAN__
243 bf/s 3b ! while(r0<r5)
248 ! Third, copy a byte at once, if necessary