getuser_32.S 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * __get_user functions.
  3. *
  4. * (C) Copyright 1998 Linus Torvalds
  5. *
  6. * These functions have a non-standard call interface
  7. * to make them more efficient, especially as they
  8. * return an error value in addition to the "real"
  9. * return value.
  10. */
  11. #include <linux/linkage.h>
  12. #include <asm/dwarf2.h>
  13. #include <asm/thread_info.h>
  14. /*
  15. * __get_user_X
  16. *
  17. * Inputs: %eax contains the address
  18. *
  19. * Outputs: %eax is error code (0 or -EFAULT)
  20. * %edx contains zero-extended value
  21. *
  22. * These functions should not modify any other registers,
  23. * as they get called from within inline assembly.
  24. */
  25. .text
  26. ENTRY(__get_user_1)
  27. CFI_STARTPROC
  28. GET_THREAD_INFO(%edx)
  29. cmpl TI_addr_limit(%edx),%eax
  30. jae bad_get_user
  31. 1: movzbl (%eax),%edx
  32. xorl %eax,%eax
  33. ret
  34. CFI_ENDPROC
  35. ENDPROC(__get_user_1)
  36. ENTRY(__get_user_2)
  37. CFI_STARTPROC
  38. addl $1,%eax
  39. jc bad_get_user
  40. GET_THREAD_INFO(%edx)
  41. cmpl TI_addr_limit(%edx),%eax
  42. jae bad_get_user
  43. 2: movzwl -1(%eax),%edx
  44. xorl %eax,%eax
  45. ret
  46. CFI_ENDPROC
  47. ENDPROC(__get_user_2)
  48. ENTRY(__get_user_4)
  49. CFI_STARTPROC
  50. addl $3,%eax
  51. jc bad_get_user
  52. GET_THREAD_INFO(%edx)
  53. cmpl TI_addr_limit(%edx),%eax
  54. jae bad_get_user
  55. 3: movl -3(%eax),%edx
  56. xorl %eax,%eax
  57. ret
  58. CFI_ENDPROC
  59. ENDPROC(__get_user_4)
  60. bad_get_user:
  61. CFI_STARTPROC
  62. xorl %edx,%edx
  63. movl $-14,%eax
  64. ret
  65. CFI_ENDPROC
  66. END(bad_get_user)
  67. .section __ex_table,"a"
  68. .long 1b,bad_get_user
  69. .long 2b,bad_get_user
  70. .long 3b,bad_get_user
  71. .previous