putuser.S 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * __put_user functions.
  3. *
  4. * (C) Copyright 1998 Linus Torvalds
  5. * (C) Copyright 2001 Hirokazu Takata
  6. *
  7. * These functions have a non-standard call interface
  8. * to make them more efficient.
  9. */
  10. #include <linux/config.h>
  11. /*
  12. * __put_user_X
  13. *
  14. * Inputs: r0 contains the address
  15. * r1 contains the value
  16. *
  17. * Outputs: r0 is error code (0 or -EFAULT)
  18. * r1 is corrupted (will contain "current_task").
  19. *
  20. * These functions should not modify any other registers,
  21. * as they get called from within inline assembly.
  22. */
  23. #ifdef CONFIG_ISA_DUAL_ISSUE
  24. .text
  25. .balign 4
  26. .globl __put_user_1
  27. __put_user_1:
  28. 1: stb r1, @r0 || ldi r0, #0
  29. jmp r14
  30. .balign 4
  31. .globl __put_user_2
  32. __put_user_2:
  33. 2: sth r1, @r0 || ldi r0, #0
  34. jmp r14
  35. .balign 4
  36. .globl __put_user_4
  37. __put_user_4:
  38. 3: st r1, @r0 || ldi r0, #0
  39. jmp r14
  40. bad_put_user:
  41. ldi r0, #-14 || jmp r14
  42. #else /* not CONFIG_ISA_DUAL_ISSUE */
  43. .text
  44. .balign 4
  45. .globl __put_user_1
  46. __put_user_1:
  47. 1: stb r1, @r0
  48. ldi r0, #0
  49. jmp r14
  50. .balign 4
  51. .globl __put_user_2
  52. __put_user_2:
  53. 2: sth r1, @r0
  54. ldi r0, #0
  55. jmp r14
  56. .balign 4
  57. .globl __put_user_4
  58. __put_user_4:
  59. 3: st r1, @r0
  60. ldi r0, #0
  61. jmp r14
  62. bad_put_user:
  63. ldi r0, #-14
  64. jmp r14
  65. #endif /* not CONFIG_ISA_DUAL_ISSUE */
  66. .section __ex_table,"a"
  67. .long 1b,bad_put_user
  68. .long 2b,bad_put_user
  69. .long 3b,bad_put_user
  70. .previous