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.
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
19 l r2,8(sp
) / Restore
R2
20 b 2(,r14) / Return to caller