shithub: mc

Download patch

ref: ca1d3da271cc83157b0e0578942a71e6abd130da
parent: aa9e46aae152515edaf54c41c33b73eee550fec0
author: Ori Bernstein <ori@eigenstate.org>
date: Tue Jan 5 12:26:13 EST 2016

add atomics for plan9

--- /dev/null
+++ b/lib/thread/atomic-impl+plan9-x64.s
@@ -1,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
--- a/lib/thread/bld.proj
+++ b/lib/thread/bld.proj
@@ -14,6 +14,12 @@
 	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
 ;;