summaryrefslogtreecommitdiff
path: root/sys/src/9/bcm64
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2020-05-07 23:27:27 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2020-05-07 23:27:27 +0200
commit04066fe973c628476fbe9eb65bf62a67334987f7 (patch)
treec0a9371675c12af3581d60b0a615bc2d48686321 /sys/src/9/bcm64
parent7de7414e885c3fa3c52200c49528e1e8da5adcc9 (diff)
bcm64: fix kernels cmpswap() function
spectacular bug. cmpswap() had a sign extension bug using sign extending MOV to load the old compare value and LDXRW using zero extension while the CMP instruction compared 64 bit registers. this caused cmpswap with negative old value always to fail. interestingly, libc's version of this function was fine.
Diffstat (limited to 'sys/src/9/bcm64')
-rw-r--r--sys/src/9/bcm64/l.s4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/src/9/bcm64/l.s b/sys/src/9/bcm64/l.s
index 2e7e9ebc1..d6ad02184 100644
--- a/sys/src/9/bcm64/l.s
+++ b/sys/src/9/bcm64/l.s
@@ -229,8 +229,8 @@ TEXT touser(SB), 1, $-4
TEXT cas(SB), 1, $-4
TEXT cmpswap(SB), 1, $-4
- MOVW ov+8(FP), R1
- MOVW nv+16(FP), R2
+ MOVWU ov+8(FP), R1
+ MOVWU nv+16(FP), R2
_cas1:
LDXRW (R0), R3
CMP R3, R1