Update.
[glibc.git] / db2 / mutex / uts4_cc.s
blobee5f4143bdeb709d08a3d3fb9861362b4a067b69
2 / int uts_lock ( int *p, int i );
3 / Update the lock word pointed to by p with the
4 / value i, using compare-and-swap.
5 / Returns 0 if update was successful.
6 / Returns 1 if update failed.
8 entry uts_lock
9 uts_lock:
10 using .,r15
11 st r2,8(sp) / Save R2
12 l r2,64+0(sp) / R2 -> word to update
13 slr r0, r0 / R0 = current lock value must be 0
14 l r1,64+4(sp) / R1 = new lock value
15 cs r0,r1,0(r2) / Try the update ...
16 be x / ... Success. Return 0
17 la r0,1 / ... Failure. Return 1
18 x: /
19 l r2,8(sp) / Restore R2
20 b 2(,r14) / Return to caller
21 drop r15