aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid-Horner <ds2horner@gmail.com>2019-05-15 15:55:06 -0400
committerAndrew Waterman <andrew@sifive.com>2019-05-15 12:55:06 -0700
commit2ff4f572360f49c716a4fbc72c912397cece842e (patch)
tree0c7629eb318bcd6d1ad0b353fc0e27baf969d81e /src
parentba63c32418dcb3b72859957f83373b8a5644e169 (diff)
downloadriscv-isa-manual-2ff4f572360f49c716a4fbc72c912397cece842e.zip
riscv-isa-manual-2ff4f572360f49c716a4fbc72c912397cece842e.tar.gz
riscv-isa-manual-2ff4f572360f49c716a4fbc72c912397cece842e.tar.bz2
Correct iteration in LR/SC CAS example. (#384)
Address argument was clobbered. Signed-off-by: David Horner <ds2horner@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/a.tex5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/a.tex b/src/a.tex
index c4a8d26..2502b43 100644
--- a/src/a.tex
+++ b/src/a.tex
@@ -232,8 +232,9 @@ only take four instructions.
cas:
lr.w t0, (a0) # Load original value.
bne t0, a1, fail # Doesn't match, so fail.
- sc.w a0, a2, (a0) # Try to update.
- bnez a0, cas # Retry if store-conditional failed.
+ sc.w t0, a2, (a0) # Try to update.
+ bnez t0, cas # Retry if store-conditional failed.
+ li a0, 0 # Set return to success.
jr ra # Return.
fail:
li a0, 1 # Set return to failure.