[haiku-commits] Re: haiku: hrev46863 - headers/private/kernel/arch/arm

  • From: Pawel Dziepak <pdziepak@xxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 14 Feb 2014 05:06:48 +0100

2014-02-13 6:07 GMT+01:00  <kallisti5@xxxxxxxxxxx>:
> +static inline int32
> +atomic_get_and_set_inline(int32* value, int32 newValue)
> +{
> +       // BIG TODO: ARM Atomic get and set
> +//     asm volatile("xchgl %0, (%1)"
> +//             : "+r" (newValue)
> +//             : "r" (value)
> +//             : "memory");
> +       return newValue;
> +}

As I explained in the other post [1] only memory barriers
implementation is required. Adding stubs for optional functions is
both unnecessary and harmful as they are consequently used instead of
proper implementation (which is, depending on the target architecture,
in /src/system/libroot/os/arch/x86/atomic.S or
/src/system/kernel/arch/arm/arch_atomic32.cpp) and as a result break
the kernel.

> +static inline int32
> +atomic_test_and_set_inline(int32* value, int32 newValue, int32 testAgainst)
> +{
> +       // BIG TODO: ARM Atomic test and set inline
> +//     asm volatile("lock; cmpxchgl %2, (%3)"
> +//             : "=a" (newValue)
> +//             : "0" (testAgainst), "r" (newValue), "r" (value)
> +//             : "memory");
> +       return newValue;
> +}

Ditto.

> +static inline int32
> +atomic_add_inline(int32* value, int32 newValue)
> +{
> +       // BIG TODO: ARM Atomic add inline
> +//     asm volatile("lock; xaddl %0, (%1)"
> +//             : "+r" (newValue)
> +//             : "r" (value)
> +//             : "memory");
> +       return newValue;
> +}

Ditto.

Paweł

[1] 
//www.freelists.org/post/haiku-development/Non-existing-arch-atomich-for-ARM-architectures,2

Other related posts: