diff options
author | Andrew Waterman <andrew@sifive.com> | 2019-05-07 11:22:13 -0700 |
---|---|---|
committer | Andrew Waterman <andrew@sifive.com> | 2019-05-07 11:22:13 -0700 |
commit | 169da704eb3eec1c729f98d11532a9b10b7fd158 (patch) | |
tree | 84beaa87ed2f05f06bb09ec7d05bafb3f232e5d9 | |
parent | 8772ea6f0f0e7136c21981d75ad25cd799a83c33 (diff) | |
parent | ae455e12d533bce4b1a696f306740e8b9e8c543a (diff) | |
download | riscv-isa-manual-169da704eb3eec1c729f98d11532a9b10b7fd158.zip riscv-isa-manual-169da704eb3eec1c729f98d11532a9b10b7fd158.tar.gz riscv-isa-manual-169da704eb3eec1c729f98d11532a9b10b7fd158.tar.bz2 |
Merge branch 'Columbus240-ClarifyLRSC'
-rw-r--r-- | src/a.tex | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -77,19 +77,21 @@ address domain. \multicolumn{1}{c|}{opcode} \\ \hline 5 & 1 & 1 & 5 & 5 & 3 & 5 & 7 \\ -LR & \multicolumn{2}{c}{ordering} & 0 & addr & width & dest & AMO \\ -SC & \multicolumn{2}{c}{ordering} & src & addr & width & dest & AMO \\ +LR.W/D & \multicolumn{2}{c}{ordering} & 0 & addr & width & dest & AMO \\ +SC.W/D & \multicolumn{2}{c}{ordering} & src & addr & width & dest & AMO \\ \end{tabular} \end{center} -Complex atomic memory operations on a single memory word are performed +Complex atomic memory operations on a single memory word or doubleword are performed with the load-reserved (LR) and store-conditional (SC) instructions. -LR loads a word from the address in {\em rs1}, places the +LR.W loads a word from the address in {\em rs1}, places the sign-extended value in {\em rd}, and registers a reservation on the memory address and a range of bytes including at least all bytes of -the addressed word. SC writes a word in {\em rs2} to the address in +the addressed word. SC.W writes a word in {\em rs2} to the address in {\em rs1}, provided a valid reservation still exists on that address. -SC writes zero to {\em rd} on success or a nonzero code on failure. +SC.W writes zero to {\em rd} on success or a nonzero code on failure. +LR.D and SC.D act analogously on doublewords and are only available on RV64. +For RV64, LR.W and SC.W sign-extend the value placed in {\em rd}. \begin{commentary} Both compare-and-swap (CAS) and LR/SC can be used to build lock-free @@ -191,7 +193,7 @@ not meet the forward-progress guarantee. An implementation can reserve an arbitrarily large subset of the address space on each LR, provided the memory range includes all bytes -of the addressed data word. +of the addressed data word or doubleword. An SC can only pair with the most recent LR in program order. An SC may succeed if no store from another hart to the address range reserved by the LR can be observed to have occurred between the LR and |