pthread_spin_trylock.S 606 B

123456789101112131415161718192021222324
  1. ! Copyright (C) 2013 Imagination Technologies Ltd.
  2. ! Licensed under LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
  3. #include <pthread-errnos.h>
  4. .text
  5. .global _pthread_spin_trylock
  6. .type _pthread_spin_trylock,function
  7. _pthread_spin_trylock:
  8. 1: MOVT D0Re0, #HI(#EBUSY)
  9. ADD D0Re0, D0Re0, #LO(#EBUSY)
  10. LNKGETD D0Ar2, [D1Ar1]
  11. CMP D0Ar2, #0
  12. ADD D0Ar2, D0Ar2, #1
  13. LNKSETDEQ [D1Ar1], D0Ar2
  14. BNE 2f
  15. DEFR D0Ar2, TXSTAT
  16. ANDT D0Ar2, D0Ar2, #HI(0x3f000000)
  17. CMPT D0Ar2, #HI(0x02000000)
  18. BNZ 1b
  19. MOV D0Re0, #0
  20. 2: MOV PC, D1RtP
  21. .size _pthread_spin_trylock,.-_pthread_spin_trylock