Go to the documentation of this file.
5 #ifndef _CRIS_ARCH_UACCESS_H
6 #define _CRIS_ARCH_UACCESS_H
16 #define __put_user_asm(x, addr, err, op) \
17 __asm__ __volatile__( \
20 " .section .fixup,\"ax\"\n" \
25 " .section __ex_table,\"a\"\n" \
29 : "r" (x), "r" (addr), "g" (-EFAULT), "0" (err))
31 #define __put_user_asm_64(x, addr, err) do { \
32 int dummy_for_put_user_asm_64_; \
33 __asm__ __volatile__( \
34 "2: move.d %M2,[%1+]\n" \
35 "4: move.d %H2,[%1]\n" \
37 " .section .fixup,\"ax\"\n" \
41 " .section __ex_table,\"a\"\n" \
45 : "=r" (err), "=b" (dummy_for_put_user_asm_64_) \
46 : "r" (x), "1" (addr), "g" (-EFAULT), \
52 #define __get_user_asm(x, addr, err, op) \
53 __asm__ __volatile__( \
56 " .section .fixup,\"ax\"\n" \
61 " .section __ex_table,\"a\"\n" \
64 : "=r" (err), "=r" (x) \
65 : "r" (addr), "g" (-EFAULT), "0" (err))
67 #define __get_user_asm_64(x, addr, err) do { \
68 int dummy_for_get_user_asm_64_; \
69 __asm__ __volatile__( \
70 "2: move.d [%2+],%M1\n" \
71 "4: move.d [%2],%H1\n" \
73 " .section .fixup,\"ax\"\n" \
78 " .section __ex_table,\"a\"\n" \
82 : "=r" (err), "=r" (x), \
83 "=b" (dummy_for_get_user_asm_64_) \
84 : "2" (addr), "g" (-EFAULT), "0" (err));\
124 "5: move.b [%2+],$acr\n"
126 " move.b $acr,[%1+]\n"
130 " move.b [%2+],$acr\n"
135 " .section .fixup,\"ax\"\n"
145 " .section __ex_table,\"a\"\n"
149 :
"=r" (res),
"=b" (dst),
"=b" (src),
"=r" (count)
150 :
"3" (count),
"1" (dst),
"2" (src),
"g" (-
EFAULT)
162 #define __asm_copy_user_cont(to, from, ret, COPY, FIXUP, TENTRY) \
163 __asm__ __volatile__ ( \
166 " .section .fixup,\"ax\"\n" \
169 " .section __ex_table,\"a\"\n" \
172 : "=b" (to), "=b" (from), "=r" (ret) \
173 : "0" (to), "1" (from), "2" (ret) \
176 #define __asm_copy_from_user_1(to, from, ret) \
177 __asm_copy_user_cont(to, from, ret, \
178 "2: move.b [%1+],$acr\n" \
179 " move.b $acr,[%0+]\n", \
182 " clear.b [%0+]\n", \
185 #define __asm_copy_from_user_2x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
186 __asm_copy_user_cont(to, from, ret, \
188 "2: move.w [%1+],$acr\n" \
189 " move.w $acr,[%0+]\n", \
193 " clear.w [%0+]\n", \
197 #define __asm_copy_from_user_2(to, from, ret) \
198 __asm_copy_from_user_2x_cont(to, from, ret, "", "", "")
200 #define __asm_copy_from_user_3(to, from, ret) \
201 __asm_copy_from_user_2x_cont(to, from, ret, \
202 "4: move.b [%1+],$acr\n" \
203 " move.b $acr,[%0+]\n", \
205 " clear.b [%0+]\n", \
208 #define __asm_copy_from_user_4x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
209 __asm_copy_user_cont(to, from, ret, \
211 "2: move.d [%1+],$acr\n" \
212 " move.d $acr,[%0+]\n", \
216 " clear.d [%0+]\n", \
220 #define __asm_copy_from_user_4(to, from, ret) \
221 __asm_copy_from_user_4x_cont(to, from, ret, "", "", "")
223 #define __asm_copy_from_user_5(to, from, ret) \
224 __asm_copy_from_user_4x_cont(to, from, ret, \
225 "4: move.b [%1+],$acr\n" \
226 " move.b $acr,[%0+]\n", \
228 " clear.b [%0+]\n", \
231 #define __asm_copy_from_user_6x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
232 __asm_copy_from_user_4x_cont(to, from, ret, \
234 "4: move.w [%1+],$acr\n" \
235 " move.w $acr,[%0+]\n", \
238 " clear.w [%0+]\n", \
242 #define __asm_copy_from_user_6(to, from, ret) \
243 __asm_copy_from_user_6x_cont(to, from, ret, "", "", "")
245 #define __asm_copy_from_user_7(to, from, ret) \
246 __asm_copy_from_user_6x_cont(to, from, ret, \
247 "6: move.b [%1+],$acr\n" \
248 " move.b $acr,[%0+]\n", \
250 " clear.b [%0+]\n", \
253 #define __asm_copy_from_user_8x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
254 __asm_copy_from_user_4x_cont(to, from, ret, \
256 "4: move.d [%1+],$acr\n" \
257 " move.d $acr,[%0+]\n", \
260 " clear.d [%0+]\n", \
264 #define __asm_copy_from_user_8(to, from, ret) \
265 __asm_copy_from_user_8x_cont(to, from, ret, "", "", "")
267 #define __asm_copy_from_user_9(to, from, ret) \
268 __asm_copy_from_user_8x_cont(to, from, ret, \
269 "6: move.b [%1+],$acr\n" \
270 " move.b $acr,[%0+]\n", \
272 " clear.b [%0+]\n", \
275 #define __asm_copy_from_user_10x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
276 __asm_copy_from_user_8x_cont(to, from, ret, \
278 "6: move.w [%1+],$acr\n" \
279 " move.w $acr,[%0+]\n", \
282 " clear.w [%0+]\n", \
286 #define __asm_copy_from_user_10(to, from, ret) \
287 __asm_copy_from_user_10x_cont(to, from, ret, "", "", "")
289 #define __asm_copy_from_user_11(to, from, ret) \
290 __asm_copy_from_user_10x_cont(to, from, ret, \
291 "8: move.b [%1+],$acr\n" \
292 " move.b $acr,[%0+]\n", \
294 " clear.b [%0+]\n", \
297 #define __asm_copy_from_user_12x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
298 __asm_copy_from_user_8x_cont(to, from, ret, \
300 "6: move.d [%1+],$acr\n" \
301 " move.d $acr,[%0+]\n", \
304 " clear.d [%0+]\n", \
308 #define __asm_copy_from_user_12(to, from, ret) \
309 __asm_copy_from_user_12x_cont(to, from, ret, "", "", "")
311 #define __asm_copy_from_user_13(to, from, ret) \
312 __asm_copy_from_user_12x_cont(to, from, ret, \
313 "8: move.b [%1+],$acr\n" \
314 " move.b $acr,[%0+]\n", \
316 " clear.b [%0+]\n", \
319 #define __asm_copy_from_user_14x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
320 __asm_copy_from_user_12x_cont(to, from, ret, \
322 "8: move.w [%1+],$acr\n" \
323 " move.w $acr,[%0+]\n", \
326 " clear.w [%0+]\n", \
330 #define __asm_copy_from_user_14(to, from, ret) \
331 __asm_copy_from_user_14x_cont(to, from, ret, "", "", "")
333 #define __asm_copy_from_user_15(to, from, ret) \
334 __asm_copy_from_user_14x_cont(to, from, ret, \
335 "10: move.b [%1+],$acr\n" \
336 " move.b $acr,[%0+]\n", \
338 " clear.b [%0+]\n", \
341 #define __asm_copy_from_user_16x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
342 __asm_copy_from_user_12x_cont(to, from, ret, \
344 "8: move.d [%1+],$acr\n" \
345 " move.d $acr,[%0+]\n", \
348 " clear.d [%0+]\n", \
352 #define __asm_copy_from_user_16(to, from, ret) \
353 __asm_copy_from_user_16x_cont(to, from, ret, "", "", "")
355 #define __asm_copy_from_user_20x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
356 __asm_copy_from_user_16x_cont(to, from, ret, \
358 "10: move.d [%1+],$acr\n" \
359 " move.d $acr,[%0+]\n", \
362 " clear.d [%0+]\n", \
366 #define __asm_copy_from_user_20(to, from, ret) \
367 __asm_copy_from_user_20x_cont(to, from, ret, "", "", "")
369 #define __asm_copy_from_user_24x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
370 __asm_copy_from_user_20x_cont(to, from, ret, \
372 "12: move.d [%1+],$acr\n" \
373 " move.d $acr,[%0+]\n", \
376 " clear.d [%0+]\n", \
380 #define __asm_copy_from_user_24(to, from, ret) \
381 __asm_copy_from_user_24x_cont(to, from, ret, "", "", "")
385 #define __asm_copy_to_user_1(to, from, ret) \
386 __asm_copy_user_cont(to, from, ret, \
387 " move.b [%1+],$acr\n" \
388 "2: move.b $acr,[%0+]\n", \
393 #define __asm_copy_to_user_2x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
394 __asm_copy_user_cont(to, from, ret, \
396 " move.w [%1+],$acr\n" \
397 "2: move.w $acr,[%0+]\n", \
404 #define __asm_copy_to_user_2(to, from, ret) \
405 __asm_copy_to_user_2x_cont(to, from, ret, "", "", "")
407 #define __asm_copy_to_user_3(to, from, ret) \
408 __asm_copy_to_user_2x_cont(to, from, ret, \
409 " move.b [%1+],$acr\n" \
410 "4: move.b $acr,[%0+]\n", \
414 #define __asm_copy_to_user_4x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
415 __asm_copy_user_cont(to, from, ret, \
417 " move.d [%1+],$acr\n" \
418 "2: move.d $acr,[%0+]\n", \
425 #define __asm_copy_to_user_4(to, from, ret) \
426 __asm_copy_to_user_4x_cont(to, from, ret, "", "", "")
428 #define __asm_copy_to_user_5(to, from, ret) \
429 __asm_copy_to_user_4x_cont(to, from, ret, \
430 " move.b [%1+],$acr\n" \
431 "4: move.b $acr,[%0+]\n", \
435 #define __asm_copy_to_user_6x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
436 __asm_copy_to_user_4x_cont(to, from, ret, \
438 " move.w [%1+],$acr\n" \
439 "4: move.w $acr,[%0+]\n", \
445 #define __asm_copy_to_user_6(to, from, ret) \
446 __asm_copy_to_user_6x_cont(to, from, ret, "", "", "")
448 #define __asm_copy_to_user_7(to, from, ret) \
449 __asm_copy_to_user_6x_cont(to, from, ret, \
450 " move.b [%1+],$acr\n" \
451 "6: move.b $acr,[%0+]\n", \
455 #define __asm_copy_to_user_8x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
456 __asm_copy_to_user_4x_cont(to, from, ret, \
458 " move.d [%1+],$acr\n" \
459 "4: move.d $acr,[%0+]\n", \
465 #define __asm_copy_to_user_8(to, from, ret) \
466 __asm_copy_to_user_8x_cont(to, from, ret, "", "", "")
468 #define __asm_copy_to_user_9(to, from, ret) \
469 __asm_copy_to_user_8x_cont(to, from, ret, \
470 " move.b [%1+],$acr\n" \
471 "6: move.b $acr,[%0+]\n", \
475 #define __asm_copy_to_user_10x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
476 __asm_copy_to_user_8x_cont(to, from, ret, \
478 " move.w [%1+],$acr\n" \
479 "6: move.w $acr,[%0+]\n", \
485 #define __asm_copy_to_user_10(to, from, ret) \
486 __asm_copy_to_user_10x_cont(to, from, ret, "", "", "")
488 #define __asm_copy_to_user_11(to, from, ret) \
489 __asm_copy_to_user_10x_cont(to, from, ret, \
490 " move.b [%1+],$acr\n" \
491 "8: move.b $acr,[%0+]\n", \
495 #define __asm_copy_to_user_12x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
496 __asm_copy_to_user_8x_cont(to, from, ret, \
498 " move.d [%1+],$acr\n" \
499 "6: move.d $acr,[%0+]\n", \
505 #define __asm_copy_to_user_12(to, from, ret) \
506 __asm_copy_to_user_12x_cont(to, from, ret, "", "", "")
508 #define __asm_copy_to_user_13(to, from, ret) \
509 __asm_copy_to_user_12x_cont(to, from, ret, \
510 " move.b [%1+],$acr\n" \
511 "8: move.b $acr,[%0+]\n", \
515 #define __asm_copy_to_user_14x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
516 __asm_copy_to_user_12x_cont(to, from, ret, \
518 " move.w [%1+],$acr\n" \
519 "8: move.w $acr,[%0+]\n", \
525 #define __asm_copy_to_user_14(to, from, ret) \
526 __asm_copy_to_user_14x_cont(to, from, ret, "", "", "")
528 #define __asm_copy_to_user_15(to, from, ret) \
529 __asm_copy_to_user_14x_cont(to, from, ret, \
530 " move.b [%1+],$acr\n" \
531 "10: move.b $acr,[%0+]\n", \
535 #define __asm_copy_to_user_16x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
536 __asm_copy_to_user_12x_cont(to, from, ret, \
538 " move.d [%1+],$acr\n" \
539 "8: move.d $acr,[%0+]\n", \
545 #define __asm_copy_to_user_16(to, from, ret) \
546 __asm_copy_to_user_16x_cont(to, from, ret, "", "", "")
548 #define __asm_copy_to_user_20x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
549 __asm_copy_to_user_16x_cont(to, from, ret, \
551 " move.d [%1+],$acr\n" \
552 "10: move.d $acr,[%0+]\n", \
558 #define __asm_copy_to_user_20(to, from, ret) \
559 __asm_copy_to_user_20x_cont(to, from, ret, "", "", "")
561 #define __asm_copy_to_user_24x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
562 __asm_copy_to_user_20x_cont(to, from, ret, \
564 " move.d [%1+],$acr\n" \
565 "12: move.d $acr,[%0+]\n", \
571 #define __asm_copy_to_user_24(to, from, ret) \
572 __asm_copy_to_user_24x_cont(to, from, ret, "", "", "")
579 #define __asm_clear(to, ret, CLEAR, FIXUP, TENTRY) \
580 __asm__ __volatile__ ( \
583 " .section .fixup,\"ax\"\n" \
586 " .section __ex_table,\"a\"\n" \
589 : "=b" (to), "=r" (ret) \
590 : "0" (to), "1" (ret) \
593 #define __asm_clear_1(to, ret) \
594 __asm_clear(to, ret, \
595 "2: clear.b [%0+]\n", \
600 #define __asm_clear_2(to, ret) \
601 __asm_clear(to, ret, \
602 "2: clear.w [%0+]\n", \
607 #define __asm_clear_3(to, ret) \
608 __asm_clear(to, ret, \
609 "2: clear.w [%0+]\n" \
610 "3: clear.b [%0+]\n", \
617 #define __asm_clear_4x_cont(to, ret, CLEAR, FIXUP, TENTRY) \
618 __asm_clear(to, ret, \
620 "2: clear.d [%0+]\n", \
627 #define __asm_clear_4(to, ret) \
628 __asm_clear_4x_cont(to, ret, "", "", "")
630 #define __asm_clear_8x_cont(to, ret, CLEAR, FIXUP, TENTRY) \
631 __asm_clear_4x_cont(to, ret, \
633 "4: clear.d [%0+]\n", \
639 #define __asm_clear_8(to, ret) \
640 __asm_clear_8x_cont(to, ret, "", "", "")
642 #define __asm_clear_12x_cont(to, ret, CLEAR, FIXUP, TENTRY) \
643 __asm_clear_8x_cont(to, ret, \
645 "6: clear.d [%0+]\n", \
651 #define __asm_clear_12(to, ret) \
652 __asm_clear_12x_cont(to, ret, "", "", "")
654 #define __asm_clear_16x_cont(to, ret, CLEAR, FIXUP, TENTRY) \
655 __asm_clear_12x_cont(to, ret, \
657 "8: clear.d [%0+]\n", \
663 #define __asm_clear_16(to, ret) \
664 __asm_clear_16x_cont(to, ret, "", "", "")
666 #define __asm_clear_20x_cont(to, ret, CLEAR, FIXUP, TENTRY) \
667 __asm_clear_16x_cont(to, ret, \
669 "10: clear.d [%0+]\n", \
675 #define __asm_clear_20(to, ret) \
676 __asm_clear_20x_cont(to, ret, "", "", "")
678 #define __asm_clear_24x_cont(to, ret, CLEAR, FIXUP, TENTRY) \
679 __asm_clear_20x_cont(to, ret, \
681 "12: clear.d [%0+]\n", \
687 #define __asm_clear_24(to, ret) \
688 __asm_clear_24x_cont(to, ret, "", "", "")
731 " .section .fixup,\"ax\"\n"
737 " .section __ex_table,\"a\"\n"
740 :
"=r" (res),
"=r" (tmp1)