aboutsummaryrefslogtreecommitdiff
path: root/src/lib/sync
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2009-06-02 23:22:12 -0700
committerRuss Cox <rsc@golang.org>2009-06-02 23:22:12 -0700
commit73c10dd96785c02d8e02f46ec79c1f3e9f1b34e9 (patch)
tree458fc0ea6921dc3405cdc5b09560d3db6977a22e /src/lib/sync
parentf1f970ad212dc096bb0d4dd959ec9e90489c0499 (diff)
downloadgo-73c10dd96785c02d8e02f46ec79c1f3e9f1b34e9.tar.xz
386 library updates
R=r DELTA=161 (153 added, 0 deleted, 8 changed) OCL=29802 CL=29809
Diffstat (limited to 'src/lib/sync')
-rw-r--r--src/lib/sync/asm_386.s23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/lib/sync/asm_386.s b/src/lib/sync/asm_386.s
new file mode 100644
index 0000000000..f71182b753
--- /dev/null
+++ b/src/lib/sync/asm_386.s
@@ -0,0 +1,23 @@
+// Copyright 2009 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// func cas(val *int32, old, new int32) bool
+// Atomically:
+// if *val == old {
+// *val = new;
+// return true;
+// }else
+// return false;
+TEXT sync·cas(SB), 7, $0
+ MOVL 4(SP), BX
+ MOVL 8(SP), AX
+ MOVL 12(SP), CX
+ LOCK
+ CMPXCHGL CX, 0(BX)
+ JZ ok
+ MOVL $0, 16(SP)
+ RET
+ok:
+ MOVL $1, 16(SP)
+ RET