Skip to content

Commit

Permalink
added memory clobber to prevent memory reordering
Browse files Browse the repository at this point in the history
  • Loading branch information
gullradriel committed Dec 18, 2024
1 parent 039ab0d commit 9bdf731
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions firmware/common/locking.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@
#else
static inline uint32_t load_exclusive(volatile uint32_t* addr)
{
__asm volatile("cpsid i");
__asm volatile("cpsid i" ::: "memory");
return *addr;
}

static inline uint32_t store_exclusive(uint32_t val, volatile uint32_t* addr)
{
*addr = val;
__asm volatile("cpsie i");
__asm volatile("cpsie i" ::: "memory");
return 0;
}
#endif
Expand Down

0 comments on commit 9bdf731

Please sign in to comment.