Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
| 11 | #include <linux/linkage.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | #include <asm/semaphore.h> |
| 13 | |
| 14 | /* |
| 15 | * "down_failed" is called with the eventual return address |
| 16 | * in %a0, and the address of the semaphore in %a1. We need |
| 17 | * to increment the number of waiters on the semaphore, |
| 18 | * call "__down()", and then eventually return to try again. |
| 19 | */ |
| 20 | ENTRY(__down_failed) |
| 21 | #ifdef CONFIG_COLDFIRE |
| 22 | subl #12,%sp |
| 23 | moveml %a0/%d0/%d1,(%sp) |
| 24 | #else |
| 25 | moveml %a0/%d0/%d1,-(%sp) |
| 26 | #endif |
| 27 | movel %a1,-(%sp) |
| 28 | jbsr __down |
| 29 | movel (%sp)+,%a1 |
| 30 | movel (%sp)+,%d0 |
| 31 | movel (%sp)+,%d1 |
| 32 | rts |
| 33 | |
| 34 | ENTRY(__down_failed_interruptible) |
| 35 | movel %a0,-(%sp) |
| 36 | movel %d1,-(%sp) |
| 37 | movel %a1,-(%sp) |
| 38 | jbsr __down_interruptible |
| 39 | movel (%sp)+,%a1 |
| 40 | movel (%sp)+,%d1 |
| 41 | rts |
| 42 | |
| 43 | ENTRY(__up_wakeup) |
| 44 | #ifdef CONFIG_COLDFIRE |
| 45 | subl #12,%sp |
| 46 | moveml %a0/%d0/%d1,(%sp) |
| 47 | #else |
| 48 | moveml %a0/%d0/%d1,-(%sp) |
| 49 | #endif |
| 50 | movel %a1,-(%sp) |
| 51 | jbsr __up |
| 52 | movel (%sp)+,%a1 |
| 53 | movel (%sp)+,%d0 |
| 54 | movel (%sp)+,%d1 |
| 55 | rts |
| 56 | |
| 57 | ENTRY(__down_failed_trylock) |
| 58 | movel %a0,-(%sp) |
| 59 | movel %d1,-(%sp) |
| 60 | movel %a1,-(%sp) |
| 61 | jbsr __down_trylock |
| 62 | movel (%sp)+,%a1 |
| 63 | movel (%sp)+,%d1 |
| 64 | movel (%sp)+,%a0 |
| 65 | rts |
| 66 | |