summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread/qbasicatomic.h
diff options
context:
space:
mode:
authorThiago Macieira <thiago@kde.org>2011-07-31 18:57:16 -0300
committerQt by Nokia <qt-info@nokia.com>2012-01-24 01:08:36 +0100
commitdc5388e79b71d796c1207681235cf007c39810bd (patch)
tree5e8b2a2ae4da9a1d44fea7283710fb4bce47468b /src/corelib/thread/qbasicatomic.h
parent835a2b9902346600cdc2d6b1f2dd2282e804bf4a (diff)
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 <bradley.hughes@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/thread/qbasicatomic.h')
-rw-r--r--src/corelib/thread/qbasicatomic.h2
1 files changed, 2 insertions, 0 deletions
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 <QtCore/qatomic_arm.h>
#elif defined(__i386) || defined(__i386__)
# include <QtCore/qatomic_i386.h>
#elif defined(__x86_64) || defined(__x86_64__) || defined(__amd64)