atomic_32.S 683 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /* atomic.S: Move this stuff here for better ICACHE hit rates.
  2. *
  3. * Copyright (C) 1996 David S. Miller (davem@caipfs.rutgers.edu)
  4. */
  5. #include <asm/ptrace.h>
  6. #include <asm/psr.h>
  7. .text
  8. .align 4
  9. .globl __atomic_begin
  10. __atomic_begin:
  11. #ifndef CONFIG_SMP
  12. .globl ___xchg32_sun4c
  13. ___xchg32_sun4c:
  14. rd %psr, %g3
  15. andcc %g3, PSR_PIL, %g0
  16. bne 1f
  17. nop
  18. wr %g3, PSR_PIL, %psr
  19. nop; nop; nop
  20. 1:
  21. andcc %g3, PSR_PIL, %g0
  22. ld [%g1], %g7
  23. bne 1f
  24. st %g2, [%g1]
  25. wr %g3, 0x0, %psr
  26. nop; nop; nop
  27. 1:
  28. mov %g7, %g2
  29. jmpl %o7 + 8, %g0
  30. mov %g4, %o7
  31. .globl ___xchg32_sun4md
  32. ___xchg32_sun4md:
  33. swap [%g1], %g2
  34. jmpl %o7 + 8, %g0
  35. mov %g4, %o7
  36. #endif
  37. .globl __atomic_end
  38. __atomic_end: