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