sem_post.S 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public
  5. License as published by the Free Software Foundation; either
  6. version 2.1 of the License, or (at your option) any later version.
  7. The GNU C Library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public
  12. License along with the GNU C Library; if not, write to the Free
  13. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  14. 02111-1307 USA. */
  15. #include <sysdep.h>
  16. #include <pthread-errnos.h>
  17. #include "lowlevel-atomic.h"
  18. #define SYS_gettimeofday __NR_gettimeofday
  19. #define FUTEX_WAIT 0
  20. #define FUTEX_WAKE 1
  21. .text
  22. .globl __new_sem_post
  23. .type __new_sem_post,@function
  24. .align 5
  25. __new_sem_post:
  26. INC (@r4, r6)
  27. mov #FUTEX_WAKE, r5
  28. mov #0, r7
  29. mov #SYS_futex, r3
  30. extu.b r3, r3
  31. trapa #0x14
  32. SYSCALL_INST_PAD
  33. cmp/pz r0
  34. bf 1f
  35. rts
  36. mov #0, r0
  37. 1:
  38. mov #EINVAL, r2
  39. mova .Lgot3, r0
  40. mov.l .Lgot3, r12
  41. add r0, r12
  42. #if USE___THREAD
  43. mov.l .Lerrno3, r0
  44. stc gbr, r1
  45. mov.l @(r0, r12), r0
  46. bra .Lexit
  47. add r1, r0
  48. .align 2
  49. .Lerrno3:
  50. .long errno@GOTTPOFF
  51. .Lexit:
  52. #else
  53. mov.l .Lerrloc3, r1
  54. bsrf r1
  55. nop
  56. .Lerrloc3b:
  57. #endif
  58. mov.l r2, @r0
  59. lds.l @r15+, pr
  60. mov.l @r15+, r12
  61. rts
  62. mov #-1, r0
  63. .align 2
  64. .Lgot3:
  65. .long _GLOBAL_OFFSET_TABLE_
  66. #if !USE___THREAD
  67. .Lerrloc3:
  68. .long __errno_location@PLT-(.Lerrloc3b-.)
  69. #endif
  70. .size __new_sem_post,.-__new_sem_post
  71. weak_alias(__new_sem_post, sem_post)