Can WRS.STO replace LR/SC?
No. It waits on a reservation set established by LR; it performs neither the LR load nor the SC conditional store.
Wait on reservation set with short timeout
No explicit operands; requires Zawrs. To wait for a memory store, first use LR to reserve a set containing the target bytes.
32-bit SYSTEM I-type fields: funct12=000000011101, rs1=00000, funct3=000, rd=00000, opcode=1110011.
A stall is possible while the reservation is valid and no pending interrupt is observed; an implementation-defined short timeout bounds it. The implementation may occasionally complete for any reason; software must recheck its condition.
Available in all privilege modes; the WRS.NTO bounded-time TW/VTW exception rules do not apply to WRS.STO.
WRS.STO uses opcode 1110011 (0x73), funct3 000, funct12 000000011101. 32-bit SYSTEM I-type fields: funct12=000000011101, rs1=00000, funct3=000, rd=00000, opcode=1110011.
May temporarily stall a hart while its LR-established reservation set is valid, no pending interrupt is observed, and an implementation-defined short timeout has not elapsed. A timeout, store to the reservation set, interrupt, or implementation-selected end can resume execution.
WRS.STO is a Zawrs wait-on-reservation-set instruction: a hart can temporarily stall while its reservation set is valid, no pending interrupt is observed, and the short timeout has not elapsed; LR establishes that reservation set.
In a polling loop, use LR to establish a reservation set covering the target bytes, then decide from the shared state whether to wait. Reload and test after returning; completion does not prove a target store occurred.
In a polling loop, use LR to establish a reservation set covering the target bytes, then decide from the shared state whether to wait. Reload and test after returning; completion does not prove a target store occurred.
No. It waits on a reservation set established by LR; it performs neither the LR load nor the SC conditional store.
No. An implementation may end the stall for any reason; software must re-check the condition.