Sujet : Re: Arm ldaxr / stxr loop question
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.archDate : 08. Nov 2024, 04:17:51
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vgjvsv$31l0n$1@dont-email.me>
References : 1
User-Agent : Pan/0.160 (Toresk; )
On Mon, 28 Oct 2024 15:13:03 -0400, jseigh wrote:
So if were to implement a spinlock using the above instructions
something along the lines of
>
.L0
ldaxr -- load lockword exclusive w/ acquire membar
cmp -- compare to zero
bne .LO -- loop if currently locked
stxr -- store 1
cbnz .LO -- retry if stxr failed
The closest I could find to this was on page 8367
of DDI0487G_a_armv8_arm.pdf from infocenter.arm.com:
Loop
LDAXR W5, [X1] ; read lock with acquire
CBNZ W5, Loop ; check if 0
STXR W5, W0, [X1] ; attempt to store new value
CBNZ W5, Loop ; test if store succeeded and retry if not