__clear_user.S 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /*
  2. * __clear_user_page, __clear_user, clear_page implementation of SuperH
  3. *
  4. * Copyright (C) 2001 Kaz Kojima
  5. * Copyright (C) 2001, 2002 Niibe Yutaka
  6. * Copyright (C) 2006 Paul Mundt
  7. */
  8. #include <linux/linkage.h>
  9. #include <asm/page.h>
  10. ENTRY(__clear_user)
  11. !
  12. mov #0, r0
  13. mov #0xffffffe0, r1
  14. !
  15. ! r4..(r4+31)&~32 -------- not aligned [ Area 0 ]
  16. ! (r4+31)&~32..(r4+r5)&~32 -------- aligned [ Area 1 ]
  17. ! (r4+r5)&~32..r4+r5 -------- not aligned [ Area 2 ]
  18. !
  19. ! Clear area 0
  20. mov r4, r2
  21. !
  22. tst r1, r5 ! length < 32
  23. bt .Larea2 ! skip to remainder
  24. !
  25. add #31, r2
  26. and r1, r2
  27. cmp/eq r4, r2
  28. bt .Larea1
  29. mov r2, r3
  30. sub r4, r3
  31. mov r3, r7
  32. mov r4, r2
  33. !
  34. .L0: dt r3
  35. 0: mov.b r0, @r2
  36. bf/s .L0
  37. add #1, r2
  38. !
  39. sub r7, r5
  40. mov r2, r4
  41. .Larea1:
  42. mov r4, r3
  43. add r5, r3
  44. and r1, r3
  45. cmp/hi r2, r3
  46. bf .Larea2
  47. !
  48. ! Clear area 1
  49. #if defined(CONFIG_CPU_SH4)
  50. 1: movca.l r0, @r2
  51. #else
  52. 1: mov.l r0, @r2
  53. #endif
  54. add #4, r2
  55. 2: mov.l r0, @r2
  56. add #4, r2
  57. 3: mov.l r0, @r2
  58. add #4, r2
  59. 4: mov.l r0, @r2
  60. add #4, r2
  61. 5: mov.l r0, @r2
  62. add #4, r2
  63. 6: mov.l r0, @r2
  64. add #4, r2
  65. 7: mov.l r0, @r2
  66. add #4, r2
  67. 8: mov.l r0, @r2
  68. add #4, r2
  69. cmp/hi r2, r3
  70. bt/s 1b
  71. nop
  72. !
  73. ! Clear area 2
  74. .Larea2:
  75. mov r4, r3
  76. add r5, r3
  77. cmp/hs r3, r2
  78. bt/s .Ldone
  79. sub r2, r3
  80. .L2: dt r3
  81. 9: mov.b r0, @r2
  82. bf/s .L2
  83. add #1, r2
  84. !
  85. .Ldone: rts
  86. mov #0, r0 ! return 0 as normal return
  87. ! return the number of bytes remained
  88. .Lbad_clear_user:
  89. mov r4, r0
  90. add r5, r0
  91. rts
  92. sub r2, r0
  93. .section __ex_table,"a"
  94. .align 2
  95. .long 0b, .Lbad_clear_user
  96. .long 1b, .Lbad_clear_user
  97. .long 2b, .Lbad_clear_user
  98. .long 3b, .Lbad_clear_user
  99. .long 4b, .Lbad_clear_user
  100. .long 5b, .Lbad_clear_user
  101. .long 6b, .Lbad_clear_user
  102. .long 7b, .Lbad_clear_user
  103. .long 8b, .Lbad_clear_user
  104. .long 9b, .Lbad_clear_user
  105. .previous