3 ms·
Learning the LDREX/STREX instructions a couple of years back was a great "aha moment". I was/am fairly new to the ARM platform, and never really dug into x86 so
by unwind 9y ago
Learning the LDREX/STREX instructions a couple of years back was a great "aha moment". I was/am fairly new to the ARM platform, and never really dug into x86 so I'm not very familiar with the corresponding instructions there.
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.
- cesarb 9y ago> 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 https://en.wikipedia.org/wiki/Compare-and-swap versus https://en.wikipedia.org/wiki/Load-link/store-conditional https://en.wikipedia.org/wiki/Load-link/store-conditional