Hello everybody,
Section 18.8 Exclusive access of Cortex-A Series Programmer's Guide says the following:
STREX can be considered as a conditional store. The store is performed only if the physical address is still marked as exclusive access (this means it was previously tagged by this core and no other core has since written to it). STREX returns a status value showing if the store succeeded. STREX always clears the exclusive access tag.
So my question is:
Could it be possible that STREX clears the exclusive access tag even when (for any reason) the operation did not succeed?
Thanks in advance!
Hi Martin,
Thank you very much for the answer and for pointing me out to the ARMv7-A/R Reference Manual.
This absolutely helped me a lot to clarify my doubts regarding Exclusive Access in general.
I think the most likely scenarios for this would be:
What (2) implies is that you the STREX wasn't to the address you last performed a LDREX to. This usually means a code bug. As you are expected to have LDREX/STREX instructions in pairs (accessing the same address, and same sized data). It could mean, for example, that you'd failed to perform a CLREX on a context switch. If you are interested in these rules see section A3.4.5 Load-Exclusive and Store-Exclusive usage restrictions of the ARMv7-A/R Architecture Reference Manual.
Note: The granularity of the tagged address if defined by the ERG - Exclusive Reservation Granule.