putuser.S 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. * linux/arch/arm/lib/putuser.S
  3. *
  4. * Copyright (C) 2001 Russell King
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. *
  10. * Idea from x86 version, (C) Copyright 1998 Linus Torvalds
  11. *
  12. * These functions have a non-standard call interface to make
  13. * them more efficient, especially as they return an error
  14. * value in addition to the "real" return value.
  15. *
  16. * __put_user_X
  17. *
  18. * Inputs: r0 contains the address
  19. * r2, r3 contains the value
  20. * Outputs: r0 is the error code
  21. * lr corrupted
  22. *
  23. * No other registers must be altered. (see <asm/uaccess.h>
  24. * for specific ASM register usage).
  25. *
  26. * Note that ADDR_LIMIT is either 0 or 0xc0000000
  27. * Note also that it is intended that __put_user_bad is not global.
  28. */
  29. #include <linux/linkage.h>
  30. #include <asm/errno.h>
  31. #include <asm/domain.h>
  32. ENTRY(__put_user_1)
  33. 1: T(strb) r2, [r0]
  34. mov r0, #0
  35. mov pc, lr
  36. ENDPROC(__put_user_1)
  37. ENTRY(__put_user_2)
  38. mov ip, r2, lsr #8
  39. #ifdef CONFIG_THUMB2_KERNEL
  40. #ifndef __ARMEB__
  41. 2: T(strb) r2, [r0]
  42. 3: T(strb) ip, [r0, #1]
  43. #else
  44. 2: T(strb) ip, [r0]
  45. 3: T(strb) r2, [r0, #1]
  46. #endif
  47. #else /* !CONFIG_THUMB2_KERNEL */
  48. #ifndef __ARMEB__
  49. 2: T(strb) r2, [r0], #1
  50. 3: T(strb) ip, [r0]
  51. #else
  52. 2: T(strb) ip, [r0], #1
  53. 3: T(strb) r2, [r0]
  54. #endif
  55. #endif /* CONFIG_THUMB2_KERNEL */
  56. mov r0, #0
  57. mov pc, lr
  58. ENDPROC(__put_user_2)
  59. ENTRY(__put_user_4)
  60. 4: T(str) r2, [r0]
  61. mov r0, #0
  62. mov pc, lr
  63. ENDPROC(__put_user_4)
  64. ENTRY(__put_user_8)
  65. #ifdef CONFIG_THUMB2_KERNEL
  66. 5: T(str) r2, [r0]
  67. 6: T(str) r3, [r0, #4]
  68. #else
  69. 5: T(str) r2, [r0], #4
  70. 6: T(str) r3, [r0]
  71. #endif
  72. mov r0, #0
  73. mov pc, lr
  74. ENDPROC(__put_user_8)
  75. __put_user_bad:
  76. mov r0, #-EFAULT
  77. mov pc, lr
  78. ENDPROC(__put_user_bad)
  79. .pushsection __ex_table, "a"
  80. .long 1b, __put_user_bad
  81. .long 2b, __put_user_bad
  82. .long 3b, __put_user_bad
  83. .long 4b, __put_user_bad
  84. .long 5b, __put_user_bad
  85. .long 6b, __put_user_bad
  86. .popsection