semaphore.S 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * linux/arch/m68k/lib/semaphore.S
  3. *
  4. * Copyright (C) 1996 Linus Torvalds
  5. *
  6. * m68k version by Andreas Schwab
  7. *
  8. * MAR/1999 -- modified to support ColdFire (gerg@snapgear.com)
  9. */
  10. #include <linux/linkage.h>
  11. #include <linux/config.h>
  12. #include <asm/semaphore.h>
  13. /*
  14. * "down_failed" is called with the eventual return address
  15. * in %a0, and the address of the semaphore in %a1. We need
  16. * to increment the number of waiters on the semaphore,
  17. * call "__down()", and then eventually return to try again.
  18. */
  19. ENTRY(__down_failed)
  20. #ifdef CONFIG_COLDFIRE
  21. subl #12,%sp
  22. moveml %a0/%d0/%d1,(%sp)
  23. #else
  24. moveml %a0/%d0/%d1,-(%sp)
  25. #endif
  26. movel %a1,-(%sp)
  27. jbsr __down
  28. movel (%sp)+,%a1
  29. movel (%sp)+,%d0
  30. movel (%sp)+,%d1
  31. rts
  32. ENTRY(__down_failed_interruptible)
  33. movel %a0,-(%sp)
  34. movel %d1,-(%sp)
  35. movel %a1,-(%sp)
  36. jbsr __down_interruptible
  37. movel (%sp)+,%a1
  38. movel (%sp)+,%d1
  39. rts
  40. ENTRY(__up_wakeup)
  41. #ifdef CONFIG_COLDFIRE
  42. subl #12,%sp
  43. moveml %a0/%d0/%d1,(%sp)
  44. #else
  45. moveml %a0/%d0/%d1,-(%sp)
  46. #endif
  47. movel %a1,-(%sp)
  48. jbsr __up
  49. movel (%sp)+,%a1
  50. movel (%sp)+,%d0
  51. movel (%sp)+,%d1
  52. rts
  53. ENTRY(__down_failed_trylock)
  54. movel %a0,-(%sp)
  55. movel %d1,-(%sp)
  56. movel %a1,-(%sp)
  57. jbsr __down_trylock
  58. movel (%sp)+,%a1
  59. movel (%sp)+,%d1
  60. movel (%sp)+,%a0
  61. rts