Use ldrex/strex instead of ldr/str

Also use dmb (memory barrier) in unlock_mutex.