|
7 | 7 | *
|
8 | 8 | *
|
9 | 9 | * IDENTIFICATION
|
10 |
| - * $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.11 1997/10/30 05:24:19 momjian Exp $ |
| 10 | + * $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.12 1997/11/07 21:35:41 momjian Exp $ |
11 | 11 | *
|
12 | 12 | *-------------------------------------------------------------------------
|
13 | 13 | */
|
|
24 | 24 | *;
|
25 | 25 | *}
|
26 | 26 | *
|
27 |
| - *In addition to modifying this file you will need to modify |
28 |
| - *the appropriate ...src/include/port/...h file to define |
29 |
| - *HAS_TEST_AND_SET for the appropriate circumstances. |
30 |
| - * |
31 | 27 | *If this is not done, POSTGRES will default to using System V
|
32 | 28 | *semaphores (and take a large performance hit -- around 40% of
|
33 | 29 | *its time on a DS5000/240 is spent in semop(3)...).
|
@@ -232,31 +228,6 @@ tas_dummy()
|
232 | 228 |
|
233 | 229 | #endif/* sun3 */
|
234 | 230 |
|
235 |
| -/* |
236 |
| - *M68000 ports under NetBSD. |
237 |
| - * |
238 |
| - *This version should also work on a sun3, but I can't test it. |
239 |
| - *Conversely the sun3 version should work under NetBSD/m68k, but |
240 |
| - *it doesn't. |
241 |
| - */ |
242 |
| -#if defined(__NetBSD__)&& defined(__m68k__) |
243 |
| - |
244 |
| -staticvoidS_LOCK(char*lock) |
245 |
| -{ |
246 |
| -asm(" |
247 |
| -movela6@(8),a0 |
248 |
| -LOOP: |
249 |
| -tasa0@ |
250 |
| -bmiLOOP |
251 |
| -"); |
252 |
| -} |
253 |
| - |
254 |
| -#defineS_UNLOCK(lock)(*(lock) = 0) |
255 |
| - |
256 |
| -#defineS_INIT_LOCK(lock)S_UNLOCK(lock) |
257 |
| - |
258 |
| -#endif/* M68000 && NetBSD */ |
259 |
| - |
260 | 231 | /*
|
261 | 232 | * sparc machines
|
262 | 233 | */
|
@@ -342,29 +313,28 @@ tas_dummy()
|
342 | 313 |
|
343 | 314 | #if defined(__alpha__)&& defined(linux)
|
344 | 315 |
|
345 |
| -#defineS_LOCK(lock)do \ |
346 |
| -{ \ |
347 |
| -slock_t_res; \ |
348 |
| -do \ |
349 |
| -{ \ |
350 |
| -__asm__(" ldq $0, %0 \n\ |
351 |
| - bne $0, already_set \n\ |
352 |
| - ldq_l $0, %0 \n\ |
353 |
| - bne $0, already_set \n\ |
354 |
| - or $31, 1, $0 \n\ |
355 |
| - stq_c $0, %0 \n\ |
356 |
| - beq $0, stqc_fail \n\ |
357 |
| -success: bis $31, $31, %1 \n\ |
358 |
| - mb \n\ |
359 |
| - jmp $31, end \n\ |
360 |
| -stqc_fail: or $31, 1, $0 \n\ |
361 |
| -already_set: bis $0, $0, %1 \n\ |
362 |
| -end: nop ": "=m"(*lock), "=r"(_res): :"0"); \ |
363 |
| -} while (_res != 0); \ |
364 |
| -} while (0) |
| 316 | +#defineS_LOCK(lock)do { \ |
| 317 | +slock_t_res; \ |
| 318 | +do { \ |
| 319 | +__asm__(" ldq $0, %0 \n\ |
| 320 | + bne $0, already_set%= \n\ |
| 321 | + ldq_l $0, %0 \n\ |
| 322 | + bne $0, already_set%= \n\ |
| 323 | + or $31, 1, $0 \n\ |
| 324 | + stq_c $0, %0 \n\ |
| 325 | + beq $0, stqc_fail%= \n\ |
| 326 | +success%=: \n\ |
| 327 | + bis $31, $31, %1 \n\ |
| 328 | + mb \n\ |
| 329 | + jmp $31, end%= \n\ |
| 330 | +stqc_fail%=: or $31, 1, $0 \n\ |
| 331 | +already_set%=: bis $0, $0, %1 \n\ |
| 332 | +end%=: nop ": "=m"(*lock), "=r"(_res): :"0"); \ |
| 333 | +} while (_res != 0); \ |
| 334 | +} while (0) |
365 | 335 |
|
366 | 336 |
|
367 |
| -#defineS_UNLOCK(lock)(__asm__("mb"),*(lock) = 0) |
| 337 | +#defineS_UNLOCK(lock)({__asm__("mb \n");*(lock) = 0; }) |
368 | 338 |
|
369 | 339 | #defineS_INIT_LOCK(lock)S_UNLOCK(lock)
|
370 | 340 |
|
|