shithub: mc

Download patch

ref: 13b5870a91f904331fa58b396dd270716599dd98
parent: f3c06e95f5a15488e1a99a272c3f0123dc5516a7
author: Ori Bernstein <ori@eigenstate.org>
date: Wed Jan 6 07:33:00 EST 2016

Fix or remove the other broken operations

--- a/lib/thread/atomic-impl+plan9-x64.s
+++ b/lib/thread/atomic-impl+plan9-x64.s
@@ -32,13 +32,16 @@
 	RET
 
 TEXT thread$xsub32+0(SB),1,$0
-	LOCK; XADDL	SI, (DI)
+	LOCK; XSUBL	SI, (DI)
+	MOVL	SI, AX
 	RET
 TEXT thread$xsub64+0(SB),1,$0
-	LOCK; XADDQ	SI, (DI)
+	LOCK; XSUBQ	SI, (DI)
+	MOVQ	SI, AX
 	RET
 TEXT thread$xsubp+0(SB),1,$0
-	LOCK; XADDQ	SI, (DI)
+	LOCK; XSUBQ	SI, (DI)
+	MOVQ	SI, AX
 	RET
 
 TEXT thread$xcas32+0(SB),1,$0
--- a/lib/thread/atomic-impl+x64.s
+++ b/lib/thread/atomic-impl+x64.s
@@ -8,6 +8,7 @@
 thread$xgetp:
 	movq	(%rdi), %rax
 	ret
+
 .globl thread$xset32
 thread$xset32:
 	movl	%esi, (%rdi)
@@ -18,9 +19,11 @@
 thread$xsetp:
 	movq	%rsi, (%rdi)
 	ret
+
 .globl thread$xadd32
 thread$xadd32:
 	lock xaddl	%esi, (%rdi)
+	movl %esi,%eax
 	ret
 .globl thread$xadd64
 .globl thread$xaddp
@@ -27,17 +30,9 @@
 thread$xadd64:
 thread$xaddp:
 	lock xaddq	%rsi, (%rdi)
+	movq %rsi,%rax
 	ret
-.globl thread$xsub32
-thread$xsub32:
-	lock xaddl	%esi, (%rdi)
-	ret
-.globl thread$xsub64
-.globl thread$xsubp
-thread$xsub64:
-thread$xsubp:
-	lock xaddq	%rsi, (%rdi)
-	ret
+
 .globl thread$xcas32
 thread$xcas32:
 	movl	%esi, %eax
@@ -50,6 +45,7 @@
 	movq	%rsi, %rax
 	lock cmpxchgq	%rdx, (%rdi)
 	ret
+
 .globl thread$xchg32
 thread$xchg32:
 	movl	%esi, %eax