> and never really dug into x86 so I'm not very familiar with the corresponding instructions there.
The x86 has no corresponding instructions (other than perhaps the very recent and not yet popular transactional extensions). Instead, the x86 world uses an "atomic compare and exchange" instruction. Wikipedia articles: https://en.wikipedia.org/wiki/Compare-and-swap versus https://en.wikipedia.org/wiki/Load-link/store-conditional
But it's a really elegant model, and it was really fun to use them directly to implement some primitives we needed.
Later, of course, I realized that since we build with GCC, we can use their atomic/sync functions instead that compile to LDREX/STREX but are more high-level in the C code.
Great find, this must have been very frustrating.