diff --git a/sys/arm64/arm64/swtch.S b/sys/arm64/arm64/swtch.S index fbffaed437a6..bc2e52103416 100644 --- a/sys/arm64/arm64/swtch.S +++ b/sys/arm64/arm64/swtch.S @@ -160,17 +160,18 @@ ENTRY(cpu_switch) dsb sy isb - /* Release the old thread */ + /* + * Release the old thread. This doesn't need to be a store-release + * as the above dsb instruction will provide release semantics. + */ str x2, [x0, #TD_LOCK] #if defined(SCHED_ULE) && defined(SMP) /* Read the value in blocked_lock */ ldr x0, =_C_LABEL(blocked_lock) - ldr x1, [x0] - /* Load curthread */ - ldr x2, [x18, #PC_CURTHREAD] + ldr x2, [x0] 1: - ldr x3, [x2, #TD_LOCK] - cmp x3, x1 + ldar x3, [x1, #TD_LOCK] + cmp x3, x2 b.eq 1b #endif