clear_user.S 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * Copyright 2004-2006 Atmel Corporation
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. */
  8. #include <asm/page.h>
  9. #include <asm/thread_info.h>
  10. #include <asm/asm.h>
  11. .text
  12. .align 1
  13. .global clear_user
  14. .type clear_user, "function"
  15. clear_user:
  16. branch_if_kernel r8, __clear_user
  17. ret_if_privileged r8, r12, r11, r11
  18. .global __clear_user
  19. .type __clear_user, "function"
  20. __clear_user:
  21. mov r9, r12
  22. mov r8, 0
  23. andl r9, 3, COH
  24. brne 5f
  25. 1: sub r11, 4
  26. brlt 2f
  27. 10: st.w r12++, r8
  28. sub r11, 4
  29. brge 10b
  30. 2: sub r11, -4
  31. reteq 0
  32. /* Unaligned count or address */
  33. bld r11, 1
  34. brcc 12f
  35. 11: st.h r12++, r8
  36. sub r11, 2
  37. reteq 0
  38. 12: st.b r12++, r8
  39. retal 0
  40. /* Unaligned address */
  41. 5: cp.w r11, 4
  42. brlt 2b
  43. lsl r9, 2
  44. add pc, pc, r9
  45. 13: st.b r12++, r8
  46. sub r11, 1
  47. 14: st.b r12++, r8
  48. sub r11, 1
  49. 15: st.b r12++, r8
  50. sub r11, 1
  51. rjmp 1b
  52. .size clear_user, . - clear_user
  53. .size __clear_user, . - __clear_user
  54. .section .fixup, "ax"
  55. .align 1
  56. 18: sub r11, -4
  57. 19: retal r11
  58. .section __ex_table, "a"
  59. .align 2
  60. .long 10b, 18b
  61. .long 11b, 19b
  62. .long 12b, 19b
  63. .long 13b, 19b
  64. .long 14b, 19b
  65. .long 15b, 19b