Can WRS.STO replace LR/SC?
No. It waits on a reservation set; LR/SC, AMO, or CAS updates shared state.
Wait on reservation set with short timeout
WRS-STO uses opcode 1110011 (0x73), funct3 000, funct12 000000011101, rs2 fixed x0. This fixed SYSTEM encoding has no explicit assembly register or immediate operand; funct12, rs1, funct3, rd, and opcode must match the constants listed in the manual.
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.
Understand this scenario with real code like «retry: lr.w x10, (x11) ; ... ; wrs.sto ; j retry».
Understand this scenario with real code like «retry: lr.w x10, (x11) ; ... ; wrs.sto ; j retry».
No. It waits on a reservation set; LR/SC, AMO, or CAS updates shared state.
No. An implementation may end the stall for any reason; software must re-check the condition.