I am trying to implement critical section locks for AVR and just realized that there is no compare-exchange type instruction available (unless I missed it - which is entirely possible). Assuming that I didn't just miss the instruction - what is the most efficient way to implement this on these processors. I had looked at the "skip if bit is set" flavor of instructions - but these only seem to work on registers and not directly on memory so that is no good for my purposes. Any insight or suggestions are greatly appreciated. Thanks.
16 years ago