aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68k/lib
diff options
context:
space:
mode:
Diffstat (limited to 'arch/m68k/lib')
-rw-r--r--arch/m68k/lib/Makefile4
-rw-r--r--arch/m68k/lib/memmove.c2
-rw-r--r--arch/m68k/lib/string.c95
3 files changed, 2 insertions, 99 deletions
diff --git a/arch/m68k/lib/Makefile b/arch/m68k/lib/Makefile
index 3d85fb6e6d3b..ec479a9b9d7b 100644
--- a/arch/m68k/lib/Makefile
+++ b/arch/m68k/lib/Makefile
@@ -3,12 +3,12 @@
3# Makefile for m68k-specific library files.. 3# Makefile for m68k-specific library files..
4# 4#
5 5
6lib-y := ashldi3.o ashrdi3.o lshrdi3.o muldi3.o checksum.o 6lib-y := ashldi3.o ashrdi3.o lshrdi3.o muldi3.o memmove.o checksum.o
7 7
8ifdef CONFIG_MMU 8ifdef CONFIG_MMU
9lib-y += string.o uaccess.o 9lib-y += string.o uaccess.o
10else 10else
11lib-y += mulsi3.o divsi3.o udivsi3.o modsi3.o umodsi3.o \ 11lib-y += mulsi3.o divsi3.o udivsi3.o modsi3.o umodsi3.o \
12 memcpy.o memmove.o memset.o delay.o 12 memcpy.o memset.o delay.o
13endif 13endif
14 14
diff --git a/arch/m68k/lib/memmove.c b/arch/m68k/lib/memmove.c
index b3dcfe9dab7e..6519f7f349f6 100644
--- a/arch/m68k/lib/memmove.c
+++ b/arch/m68k/lib/memmove.c
@@ -4,8 +4,6 @@
4 * for more details. 4 * for more details.
5 */ 5 */
6 6
7#define __IN_STRING_C
8
9#include <linux/module.h> 7#include <linux/module.h>
10#include <linux/string.h> 8#include <linux/string.h>
11 9
diff --git a/arch/m68k/lib/string.c b/arch/m68k/lib/string.c
index d399c5f25636..711fa743e6be 100644
--- a/arch/m68k/lib/string.c
+++ b/arch/m68k/lib/string.c
@@ -148,98 +148,3 @@ void *memcpy(void *to, const void *from, size_t n)
148 return xto; 148 return xto;
149} 149}
150EXPORT_SYMBOL(memcpy); 150EXPORT_SYMBOL(memcpy);
151
152void *memmove(void *dest, const void *src, size_t n)
153{
154 void *xdest = dest;
155 size_t temp;
156
157 if (!n)
158 return xdest;
159
160 if (dest < src) {
161 if ((long)dest & 1) {
162 char *cdest = dest;
163 const char *csrc = src;
164 *cdest++ = *csrc++;
165 dest = cdest;
166 src = csrc;
167 n--;
168 }
169 if (n > 2 && (long)dest & 2) {
170 short *sdest = dest;
171 const short *ssrc = src;
172 *sdest++ = *ssrc++;
173 dest = sdest;
174 src = ssrc;
175 n -= 2;
176 }
177 temp = n >> 2;
178 if (temp) {
179 long *ldest = dest;
180 const long *lsrc = src;
181 temp--;
182 do
183 *ldest++ = *lsrc++;
184 while (temp--);
185 dest = ldest;
186 src = lsrc;
187 }
188 if (n & 2) {
189 short *sdest = dest;
190 const short *ssrc = src;
191 *sdest++ = *ssrc++;
192 dest = sdest;
193 src = ssrc;
194 }
195 if (n & 1) {
196 char *cdest = dest;
197 const char *csrc = src;
198 *cdest = *csrc;
199 }
200 } else {
201 dest = (char *)dest + n;
202 src = (const char *)src + n;
203 if ((long)dest & 1) {
204 char *cdest = dest;
205 const char *csrc = src;
206 *--cdest = *--csrc;
207 dest = cdest;
208 src = csrc;
209 n--;
210 }
211 if (n > 2 && (long)dest & 2) {
212 short *sdest = dest;
213 const short *ssrc = src;
214 *--sdest = *--ssrc;
215 dest = sdest;
216 src = ssrc;
217 n -= 2;
218 }
219 temp = n >> 2;
220 if (temp) {
221 long *ldest = dest;
222 const long *lsrc = src;
223 temp--;
224 do
225 *--ldest = *--lsrc;
226 while (temp--);
227 dest = ldest;
228 src = lsrc;
229 }
230 if (n & 2) {
231 short *sdest = dest;
232 const short *ssrc = src;
233 *--sdest = *--ssrc;
234 dest = sdest;
235 src = ssrc;
236 }
237 if (n & 1) {
238 char *cdest = dest;
239 const char *csrc = src;
240 *--cdest = *--csrc;
241 }
242 }
243 return xdest;
244}
245EXPORT_SYMBOL(memmove);