summaryrefslogtreecommitdiff
path: root/lib/thread
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2016-01-05 17:26:13 -0800
committerOri Bernstein <ori@eigenstate.org>2016-01-05 17:26:13 -0800
commitca1d3da271cc83157b0e0578942a71e6abd130da (patch)
treec40b46489b04870dce156c8ee48df5f170e40952 /lib/thread
parentaa9e46aae152515edaf54c41c33b73eee550fec0 (diff)
downloadmc-ca1d3da271cc83157b0e0578942a71e6abd130da.tar.gz
add atomics for plan9
Diffstat (limited to 'lib/thread')
-rw-r--r--lib/thread/atomic-impl+plan9-x64.s65
-rw-r--r--lib/thread/bld.proj6
2 files changed, 71 insertions, 0 deletions
diff --git a/lib/thread/atomic-impl+plan9-x64.s b/lib/thread/atomic-impl+plan9-x64.s
new file mode 100644
index 0000000..809c480
--- /dev/null
+++ b/lib/thread/atomic-impl+plan9-x64.s
@@ -0,0 +1,65 @@
+TEXT thread$xget32+0(SB),1,$0
+ MOVL (DI), AX
+ RET
+TEXT thread$xget64+0(SB),1,$0
+ MOVQ (DI), AX
+ RET
+TEXT thread$xgetp+0(SB),1,$0
+ MOVQ (DI), AX
+ RET
+
+TEXT thread$xset32+0(SB),1,$0
+ MOVL SI, (DI)
+ RET
+TEXT thread$xset64+0(SB),1,$0
+ MOVQ SI, (DI)
+ RET
+TEXT thread$xsetp+0(SB),1,$0
+ MOVQ SI, (DI)
+ RET
+
+TEXT thread$xadd32+0(SB),1,$0
+ LOCK; XADDL SI, (DI)
+ RET
+TEXT thread$xadd64+0(SB),1,$0
+ LOCK; XADDQ SI, (DI)
+ RET
+TEXT thread$xaddp+0(SB),1,$0
+ LOCK; XADDQ SI, (DI)
+ RET
+
+TEXT thread$xsub32+0(SB),1,$0
+ LOCK; XADDL SI, (DI)
+ RET
+TEXT thread$xsub64+0(SB),1,$0
+ LOCK; XADDQ SI, (DI)
+ RET
+TEXT thread$xsubp+0(SB),1,$0
+ LOCK; XADDQ SI, (DI)
+ RET
+
+TEXT thread$xcas32+0(SB),1,$0
+ MOVL SI, AX
+ LOCK; CMPXCHGL DX, (DI)
+ RET
+TEXT thread$xcas64+0(SB),1,$0
+ MOVQ SI, AX
+ LOCK; CMPXCHGQ DX, (DI)
+ RET
+TEXT thread$xcasp+0(SB),1,$0
+ MOVQ SI, AX
+ LOCK; CMPXCHGQ DX, (DI)
+ RET
+
+TEXT thread$xchg32+0(SB),1,$0
+ MOVL SI, AX
+ LOCK; XCHGL (DI), AX
+ RET
+TEXT thread$xchg64+0(SB),1,$0
+ MOVQ SI, AX
+ LOCK; XCHGQ (DI), AX
+ RET
+TEXT thread$xchgp+0(SB),1,$0
+ MOVQ SI, AX
+ LOCK; XCHGQ (DI), AX
+ RET
diff --git a/lib/thread/bld.proj b/lib/thread/bld.proj
index c4aa392..e5adfae 100644
--- a/lib/thread/bld.proj
+++ b/lib/thread/bld.proj
@@ -14,6 +14,12 @@ lib thread =
spawn+freebsd.myr
exit+freebsd-x64.s
+ # 9front impl of thread primitives
+ #condvar+plan9.myr
+ #mutex+plan9.myr
+ #spawn+plan9.myr
+ atomic-impl+plan9-x64.s
+
atomic-impl+x64.s
atomic.myr
;;