2 * copy_page, __copy_user_page, __copy_user implementation of SuperH
4 * Copyright (C) 2001 Niibe Yutaka & Kaz Kojima
5 * Copyright (C) 2002 Toshinobu Sugioka
6 * Copyright (C) 2006 Paul Mundt
8 #include <linux/linkage.h>
16 * void copy_page_slow(void *to, void *from)
20 * r0, r1, r2, r3, r4, r5, r6, r7 --- scratch
21 * r8 --- from + PAGE_SIZE
44 #if defined(CONFIG_CPU_SH3)
46 #elif defined(CONFIG_CPU_SH4)
58 #if defined(CONFIG_CPU_SH4)
71 #if defined(CONFIG_CPU_SH4)
74 * @to: P1 address (with same color)
76 * @orig_to: P1 address
78 * void __copy_user_page(void *to, void *from, void *orig_to)
82 * r0, r1, r2, r3, r4, r5, r6, r7 --- scratch
83 * r8 --- from + PAGE_SIZE
88 ENTRY(__copy_user_page)
133 .Lpsz: .long PAGE_SIZE
135 * __kernel_size_t __copy_user(void *to, const void *from, __kernel_size_t n);
136 * Return the number of bytes NOT copied
139 9999: __VA_ARGS__ ; \
140 .section __ex_table, "a"; \
141 .long 9999b, 6000f ; \
144 tst r6,r6 ! Check explicitly for zero
147 mov #0,r0 ! normal return
153 add r6,r3 ! last destination address
154 mov #12,r0 ! Check if small number of bytes
160 neg r5,r0 ! Calculate bytes needed to align source
168 ! Copy bytes to align source
177 mov r6,r2 ! Calculate number of longwords to copy
182 mov r4,r0 ! Jump to appropriate routine
215 EX( mov.l r8,@(4,r4) )
216 EX( mov.l r9,@(8,r4) )
217 EX( mov.l r10,@(12,r4) )
223 EX( mov.l r0,@(16,r4) )
224 EX( mov.l r8,@(20,r4) )
225 EX( mov.l r9,@(24,r4) )
226 EX( mov.l r10,@(28,r4) )
253 #ifdef __LITTLE_ENDIAN__
267 EX( mov.l r1,@(4,r4) )
268 EX( mov.l r8,@(8,r4) )
269 EX( mov.l r9,@(12,r4) )
278 EX( mov.l r10,@(16,r4) )
279 EX( mov.l r1,@(20,r4) )
280 EX( mov.l r8,@(24,r4) )
281 EX( mov.w r0,@(28,r4) )
285 EX( mov.l @(28,r5),r0 )
286 EX( mov.l @(24,r5),r8 )
287 EX( mov.l @(20,r5),r9 )
288 EX( mov.l @(16,r5),r10 )
289 EX( mov.w r0,@(30,r4) )
294 EX( mov.l r0,@(28,r4) )
295 EX( mov.l r8,@(24,r4) )
296 EX( mov.l r9,@(20,r4) )
298 EX( mov.l @(12,r5),r0 )
299 EX( mov.l @(8,r5),r8 )
301 EX( mov.l @(4,r5),r9 )
307 EX( mov.l r0,@(12,r4) )
308 EX( mov.l r8,@(8,r4) )
310 EX( mov.l r9,@(4,r4) )
311 EX( mov.w r0,@(2,r4) )
320 1: ! Read longword, write two words per iteration
323 #ifdef __LITTLE_ENDIAN__
326 EX( mov.w r0,@(2,r4) )
328 EX( mov.w r0,@(2,r4) )
338 ! Destination = 01 or 11
342 ! Read longword, write byte, word, byte per iteration
345 #ifdef __LITTLE_ENDIAN__
351 EX( mov.b r0,@(2,r4) )
355 EX( mov.b r0,@(3,r4) )
365 ! Cleanup last few bytes
381 mov #0,r0 ! normal return
385 .section .fixup, "ax"