[PATCH v6 4/4] arm64: vdso32: Implement __vdso_futex_robust_try_unlock()
André Almeida
andrealmeid at igalia.com
Thu Jul 23 08:57:10 PDT 2026
Em 20/07/2026 13:03, André Almeida escreveu:
> Based on aarch64 implementation, provide a 32 bit entry point for
> this vDSO.
>
> In order to keep compatibility with arm64_futex_robust_unlock_get_pop(),
> make sure to store the pop address at r2 and the compare result value
> at r3.
>
> Signed-off-by: André Almeida <andrealmeid at igalia.com>
[...]
> +__u32 __vdso_futex_robust_list32_try_unlock(__u32 *lock, __u32 tid, __u32 *pop)
> +{
> + register __u32 *pop_reg asm("r2") = pop, result_reg asm("r3") = 0;
> + __u32 val, zero = 0;
> +
> + asm volatile (
> + ".globl "
> + "__futex_list32_try_unlock_cs_start, "
> + "__futex_list32_try_unlock_cs_success, "
> + "__futex_list32_try_unlock_cs_end \n"
> +
> + "retry: \n"
> + " ldrex %[val], %[lock] \n"
> + " cmp %[tid], %[val] \n"
> + " bne __futex_list32_try_unlock_cs_end \n"
> + " strex %[result], %[zero], %[lock] \n"
Actually, this should be `stlex` instead for the store release semantics.
> + "__futex_list32_try_unlock_cs_start: \n"
> + " cmp %[result], #0 \n"
> + " bne retry \n"
> + "__futex_list32_try_unlock_cs_success: \n"
> + " str %[zero], %[pop_reg] \n"
> + "__futex_list32_try_unlock_cs_end: \n"
> +
> + : [val] "=&r" (val), [result] "=r" (result_reg)
> + : [tid] "r" (tid), [lock] "Q" (*lock), [pop_reg] "Q" (*pop_reg), [zero] "r" (zero)
> + : "cc", "memory"
> + );
> +
> + return val;
> +}
>
More information about the linux-arm-kernel
mailing list