summaryrefslogtreecommitdiff
path: root/db-4.8.30/mutex/uts4_cc.s
diff options
context:
space:
mode:
authorJesse Morgan <jesse@jesterpm.net>2016-12-17 21:28:53 -0800
committerJesse Morgan <jesse@jesterpm.net>2016-12-17 21:28:53 -0800
commit54df2afaa61c6a03cbb4a33c9b90fa572b6d07b8 (patch)
tree18147b92b969d25ffbe61935fb63035cac820dd0 /db-4.8.30/mutex/uts4_cc.s
Berkeley DB 4.8 with rust build script for linux.
Diffstat (limited to 'db-4.8.30/mutex/uts4_cc.s')
-rw-r--r--db-4.8.30/mutex/uts4_cc.s26
1 files changed, 26 insertions, 0 deletions
diff --git a/db-4.8.30/mutex/uts4_cc.s b/db-4.8.30/mutex/uts4_cc.s
new file mode 100644
index 0000000..1c67c8b
--- /dev/null
+++ b/db-4.8.30/mutex/uts4_cc.s
@@ -0,0 +1,26 @@
+ / See the file LICENSE for redistribution information.
+ /
+ / Copyright (c) 1997-2009 Oracle. All rights reserved.
+ /
+ / $Id$
+ /
+ / int uts_lock ( int *p, int i );
+ / Update the lock word pointed to by p with the
+ / value i, using compare-and-swap.
+ / Returns 0 if update was successful.
+ / Returns 1 if update failed.
+ /
+ entry uts_lock
+ uts_lock:
+ using .,r15
+ st r2,8(sp) / Save R2
+ l r2,64+0(sp) / R2 -> word to update
+ slr r0, r0 / R0 = current lock value must be 0
+ l r1,64+4(sp) / R1 = new lock value
+ cs r0,r1,0(r2) / Try the update ...
+ be x / ... Success. Return 0
+ la r0,1 / ... Failure. Return 1
+ x: /
+ l r2,8(sp) / Restore R2
+ b 2(,r14) / Return to caller
+ drop r15