aboutsummaryrefslogtreecommitdiff
path: root/src/os/unix/ngx_gcc_atomic_ppc.h
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2006-12-21 15:20:15 +0000
committerIgor Sysoev <igor@sysoev.ru>2006-12-21 15:20:15 +0000
commit053d1c4da805b6545990031457270f5c7ce973ec (patch)
treef43199f1be8c39eba43e2ef521b80a4d970fcb5a /src/os/unix/ngx_gcc_atomic_ppc.h
parent4e08b9c17a06e41afda9be9c8b547b1aa3331d2d (diff)
downloadnginx-053d1c4da805b6545990031457270f5c7ce973ec.tar.gz
nginx-053d1c4da805b6545990031457270f5c7ce973ec.zip
larx/stcx. should cycle if the reservation was cleared
Diffstat (limited to 'src/os/unix/ngx_gcc_atomic_ppc.h')
-rw-r--r--src/os/unix/ngx_gcc_atomic_ppc.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/os/unix/ngx_gcc_atomic_ppc.h b/src/os/unix/ngx_gcc_atomic_ppc.h
index 68d244e41..cfa58f92a 100644
--- a/src/os/unix/ngx_gcc_atomic_ppc.h
+++ b/src/os/unix/ngx_gcc_atomic_ppc.h
@@ -28,15 +28,16 @@ ngx_atomic_cmp_set(ngx_atomic_t *lock, ngx_atomic_uint_t old,
__asm__ volatile (
" li %0, 0 \n" /* preset "0" to "res" */
+ "1: \n"
" ldarx %1, 0, %2 \n" /* load from [lock] into "temp" */
/* and store reservation */
" cmpd %1, %3 \n" /* compare "temp" and "old" */
- " bne- 1f \n" /* not equal */
+ " bne- 2f \n" /* not equal */
" stdcx. %4, 0, %2 \n" /* store "set" into [lock] if reservation */
/* is not cleared */
- " bne- 1f \n" /* the reservation was cleared */
+ " bne- 1b \n" /* the reservation was cleared */
" li %0, 1 \n" /* set "1" to "res" */
- "1: \n"
+ "2: \n"
: "=&b" (res), "=&b" (temp)
: "b" (lock), "b" (old), "b" (set)
@@ -85,15 +86,16 @@ ngx_atomic_cmp_set(ngx_atomic_t *lock, ngx_atomic_uint_t old,
__asm__ volatile (
" li %0, 0 \n" /* preset "0" to "res" */
+ "1: \n"
" lwarx %1, 0, %2 \n" /* load from [lock] into "temp" */
/* and store reservation */
" cmpw %1, %3 \n" /* compare "temp" and "old" */
- " bne- 1f \n" /* not equal */
+ " bne- 2f \n" /* not equal */
" stwcx. %4, 0, %2 \n" /* store "set" into [lock] if reservation */
/* is not cleared */
- " bne- 1f \n" /* the reservation was cleared */
+ " bne- 1b \n" /* the reservation was cleared */
" li %0, 1 \n" /* set "1" to "res" */
- "1: \n"
+ "2: \n"
: "=&b" (res), "=&b" (temp)
: "b" (lock), "b" (old), "b" (set)