[haiku-development] Re: Non existing arch_atomic.h for ARM architectures

  • From: Pawel Dziepak <pdziepak@xxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Mon, 10 Feb 2014 05:17:42 +0100

2014-02-08 0:19 GMT+01:00 Pedro Pinto <pemdpinto@xxxxxxxxx>:
> Currently the ARM build is failing because the
> headers/private/kernel/arch/atomic.h is referencing a non existing
> arch_atomic.h in the arm folder. What would be the best way to solve these
> cases? Should a dummy arm/arch_atomic.h be created?

The main purpose of headers/private/kernel/arch/*/arch_atomic.h is to
define memory barriers and atomic_*() functions in such way that they
can be inlined. Currently, the only functions that need to be defined
there are memory_{read, write}_barrier_inline() which replace old
arch_cpu_memory_{read, write}_barrier(). Moreover, the atomic_*()
functions interface has been changed (and I don't think that was the
last time it was changed) and that will also cause problems.
Basically, atomic_set() has been replaced by atomic_get_and_set() and
new atomic_set() has been introduced that only sets a value without
returning the old one. Unfortunately, implementing atomic functions
like that is much more tricky for ARM. For ARMv5 which do not have MP
implementations disabling interrupts is enough, for ARMv6+ you can use
LL/SC and issue appropriate barriers (write barrier before
atomic_set(), read barrier after atomic_get(), full barriers around
anything else). Finally, there are atomic_*64() functions which can
not be implemented without any serious performance penalties on ARMv6.

Paweł

Other related posts: