meta data for this page
  •  

Exclusive Monitor

The Cortex-M4 processor implements a local exclusive monitor. For more information about semaphores and the local exclusive monitor see the ARMv7M ARM Architecture Reference Manual.

Instructions:

  • LDREX - Load-Exclusive
  • STREX - Store-Exclusive
  • CLREX - Clear-Exclusive

Exclusive instructions must be used in pairs:

  • LDREX:
    • Tags memory for exclusive access.
    • Always successfully reads a value from memory address x.
  • STREX:
    • Clears tagged memory for exclusive access.
    • Success only memory was tagger == if no other processor or process performed a more recent store of address x.
    • returns status bit that indicates whether the memory write succeeded.

So LDEX/STREX must be placed in loop, to repeat LDREX/modify/STREX if STREX fails.