This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
libstdc++-v3/config/cpu/m68k/atomicity.h
- From: Sebastian Huber <sebastian dot huber at embedded-brains dot de>
- To: libstdc++ at gcc dot gnu dot org
- Date: Fri, 9 Sep 2016 10:28:23 +0200
- Subject: libstdc++-v3/config/cpu/m68k/atomicity.h
- Authentication-results: sourceware.org; auth=none
Hello,
for RTEMS there is a special case in:
libstdc++-v3/config/cpu/m68k/atomicity.h
[...]
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
[...]
#elif defined(__rtems__)
// TAS/JBNE is unsafe on systems with strict priority-based scheduling.
// Disable interrupts, which we can do only from supervisor mode.
_Atomic_word
__attribute__ ((__unused__))
__exchange_and_add(volatile _Atomic_word* __mem, int __val) throw ()
{
_Atomic_word __result;
short __level, __tmpsr;
__asm__ __volatile__ ("move%.w %%sr,%0\n\tor%.l %0,%1\n\tmove%.w
%1,%%sr"
: "=d"(__level), "=d"(__tmpsr) : "1"(0x700));
__result = *__mem;
*__mem = __result + __val;
__asm__ __volatile__ ("move%.w %0,%%sr" : : "d"(__level));
return __result;
}
#else
[...]
Since C++14 is the default for GCC 6, would it be possible to use the
standard atomic operations instead? For targets that don't support the
operations in hardware, this would lead to a libatomic dependency.
--
Sebastian Huber, embedded brains GmbH
Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail : sebastian.huber@embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.