From dc5388e79b71d796c1207681235cf007c39810bd Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 31 Jul 2011 18:57:16 -0300 Subject: Port the ARM atomics to the new QBasicAtomicXXX architecture The implementation is divided in two files, as it used to be in the previous implementation: one for ARMv5, one for ARMv6 and up. For the ARMv5 implementation: Drop the non-Linux EABI version of the atomics, as it's not ABI-compatible with the ARMv6 and ARMv7 implementations. This means this ARMv5 implementation only works on Linux. If other systems implement kernel helpers like Linux, they can be added too. We use the __kernel_cmpxchg located at 0xffff0fc0 to implement the operations, except for fetchAndStore, for which we use the SWP instruction. Also introduce the use of __kernel_dmb (at 0xffff0fa0) for the memory barrier. Now this code is SMP-safe even when built with ARMv5. The kernel cmpxchg helper was introduced in Linux 2.6.12, whereas the dmb helper was introduced in 2.6.15. That means 2.6.15 is the minimum version now. For ARMv6 and up: Introduce byte, half-word and doubleword atomics that work on ARMv6K and up. For ARMv6 specifically, the memory barrier instruction (DMB) isn't present, so we need to accomplish the same with the MCR coprocessor instruction. Change-Id: Ife7f9b920bcc7d1eef7611761f6c59ea940ec7df Reviewed-by: Bradley T. Hughes Reviewed-by: Thiago Macieira --- src/corelib/thread/qbasicatomic.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/corelib/thread') diff --git a/src/corelib/thread/qbasicatomic.h b/src/corelib/thread/qbasicatomic.h index 1960361f0f..198eed435d 100644 --- a/src/corelib/thread/qbasicatomic.h +++ b/src/corelib/thread/qbasicatomic.h @@ -48,6 +48,8 @@ #elif defined(Q_CC_MSVC) // not ported yet # define QT_OLD_ATOMICS +#elif defined(__arm__) || defined(__TARGET_ARCH_ARM) +# include #elif defined(__i386) || defined(__i386__) # include #elif defined(__x86_64) || defined(__x86_64__) || defined(__amd64) -- cgit v1.2.3