summaryrefslogtreecommitdiffstats
path: root/libs/binder/Binder.cpp
diff options
context:
space:
mode:
authorSerban Constantinescu <serban.constantinescu@arm.com>2013-11-05 16:53:55 +0000
committerDavid Butcher <david.butcher@arm.com>2014-01-31 10:49:40 +0000
commitf683e0163a84d93448b9388126902242367cd961 (patch)
tree9b1107fef6b054470d3edef320d22ecd36461568 /libs/binder/Binder.cpp
parent3a345f0df5f62d77e875a289e9aee89f0d1b526e (diff)
downloadframeworks_native-f683e0163a84d93448b9388126902242367cd961.zip
frameworks_native-f683e0163a84d93448b9388126902242367cd961.tar.gz
frameworks_native-f683e0163a84d93448b9388126902242367cd961.tar.bz2
Binder: Make binder portable
Changes include - Binder attempts to cast pointers to a int datatype which is not sufficient on a 64-bit platform. - This patch introduces new read/write functions into Parcel that allow pointers to be written using the uintptr_t datatype for compile-time data type size selection. - Change access specifier for the methods above. - Binder uses the 64bit android_atomic_release_cas64 (aka cmpxchg) Change-Id: I595280541e0ba1d19c94b2ca2127bf9d96efabf1 Signed-off-by: Matthew Leach <matthew.leach@arm.com> Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
Diffstat (limited to 'libs/binder/Binder.cpp')
-rw-r--r--libs/binder/Binder.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/libs/binder/Binder.cpp b/libs/binder/Binder.cpp
index 1f21f9c..320bdea 100644
--- a/libs/binder/Binder.cpp
+++ b/libs/binder/Binder.cpp
@@ -142,8 +142,13 @@ void BBinder::attachObject(
if (!e) {
e = new Extras;
+#ifdef __LP64__
+ if (android_atomic_release_cas64(0, reinterpret_cast<int64_t>(e),
+ reinterpret_cast<volatile int64_t*>(&mExtras)) != 0) {
+#else
if (android_atomic_cmpxchg(0, reinterpret_cast<int32_t>(e),
reinterpret_cast<volatile int32_t*>(&mExtras)) != 0) {
+#endif
delete e;
e = mExtras;
}