diff options
Diffstat (limited to 'include/asm-x86_64/semaphore.h')
-rw-r--r-- | include/asm-x86_64/semaphore.h | 44 |
1 files changed, 16 insertions, 28 deletions
diff --git a/include/asm-x86_64/semaphore.h b/include/asm-x86_64/semaphore.h index 064df08b9a0f..1194888536b9 100644 --- a/include/asm-x86_64/semaphore.h +++ b/include/asm-x86_64/semaphore.h | |||
@@ -107,12 +107,9 @@ static inline void down(struct semaphore * sem) | |||
107 | __asm__ __volatile__( | 107 | __asm__ __volatile__( |
108 | "# atomic down operation\n\t" | 108 | "# atomic down operation\n\t" |
109 | LOCK_PREFIX "decl %0\n\t" /* --sem->count */ | 109 | LOCK_PREFIX "decl %0\n\t" /* --sem->count */ |
110 | "js 2f\n" | 110 | "jns 1f\n\t" |
111 | "1:\n" | 111 | "call __down_failed\n" |
112 | LOCK_SECTION_START("") | 112 | "1:" |
113 | "2:\tcall __down_failed\n\t" | ||
114 | "jmp 1b\n" | ||
115 | LOCK_SECTION_END | ||
116 | :"=m" (sem->count) | 113 | :"=m" (sem->count) |
117 | :"D" (sem) | 114 | :"D" (sem) |
118 | :"memory"); | 115 | :"memory"); |
@@ -130,15 +127,12 @@ static inline int down_interruptible(struct semaphore * sem) | |||
130 | 127 | ||
131 | __asm__ __volatile__( | 128 | __asm__ __volatile__( |
132 | "# atomic interruptible down operation\n\t" | 129 | "# atomic interruptible down operation\n\t" |
130 | "xorl %0,%0\n\t" | ||
133 | LOCK_PREFIX "decl %1\n\t" /* --sem->count */ | 131 | LOCK_PREFIX "decl %1\n\t" /* --sem->count */ |
134 | "js 2f\n\t" | 132 | "jns 2f\n\t" |
135 | "xorl %0,%0\n" | 133 | "call __down_failed_interruptible\n" |
136 | "1:\n" | 134 | "2:\n" |
137 | LOCK_SECTION_START("") | 135 | :"=&a" (result), "=m" (sem->count) |
138 | "2:\tcall __down_failed_interruptible\n\t" | ||
139 | "jmp 1b\n" | ||
140 | LOCK_SECTION_END | ||
141 | :"=a" (result), "=m" (sem->count) | ||
142 | :"D" (sem) | 136 | :"D" (sem) |
143 | :"memory"); | 137 | :"memory"); |
144 | return result; | 138 | return result; |
@@ -154,15 +148,12 @@ static inline int down_trylock(struct semaphore * sem) | |||
154 | 148 | ||
155 | __asm__ __volatile__( | 149 | __asm__ __volatile__( |
156 | "# atomic interruptible down operation\n\t" | 150 | "# atomic interruptible down operation\n\t" |
151 | "xorl %0,%0\n\t" | ||
157 | LOCK_PREFIX "decl %1\n\t" /* --sem->count */ | 152 | LOCK_PREFIX "decl %1\n\t" /* --sem->count */ |
158 | "js 2f\n\t" | 153 | "jns 2f\n\t" |
159 | "xorl %0,%0\n" | 154 | "call __down_failed_trylock\n\t" |
160 | "1:\n" | 155 | "2:\n" |
161 | LOCK_SECTION_START("") | 156 | :"=&a" (result), "=m" (sem->count) |
162 | "2:\tcall __down_failed_trylock\n\t" | ||
163 | "jmp 1b\n" | ||
164 | LOCK_SECTION_END | ||
165 | :"=a" (result), "=m" (sem->count) | ||
166 | :"D" (sem) | 157 | :"D" (sem) |
167 | :"memory","cc"); | 158 | :"memory","cc"); |
168 | return result; | 159 | return result; |
@@ -179,12 +170,9 @@ static inline void up(struct semaphore * sem) | |||
179 | __asm__ __volatile__( | 170 | __asm__ __volatile__( |
180 | "# atomic up operation\n\t" | 171 | "# atomic up operation\n\t" |
181 | LOCK_PREFIX "incl %0\n\t" /* ++sem->count */ | 172 | LOCK_PREFIX "incl %0\n\t" /* ++sem->count */ |
182 | "jle 2f\n" | 173 | "jg 1f\n\t" |
183 | "1:\n" | 174 | "call __up_wakeup\n" |
184 | LOCK_SECTION_START("") | 175 | "1:" |
185 | "2:\tcall __up_wakeup\n\t" | ||
186 | "jmp 1b\n" | ||
187 | LOCK_SECTION_END | ||
188 | :"=m" (sem->count) | 176 | :"=m" (sem->count) |
189 | :"D" (sem) | 177 | :"D" (sem) |
190 | :"memory"); | 178 | :"memory"); |