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>
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp
index 38e019c..20cdb9a 100644
--- a/libs/binder/Parcel.cpp
+++ b/libs/binder/Parcel.cpp
@@ -633,6 +633,11 @@
return writeAligned(val);
}
+status_t Parcel::writePointer(uintptr_t val)
+{
+ return writeAligned(val);
+}
+
status_t Parcel::writeFloat(float val)
{
return writeAligned(val);
@@ -978,6 +983,17 @@
return readAligned<int64_t>();
}
+status_t Parcel::readPointer(uintptr_t *pArg) const
+{
+ return readAligned(pArg);
+}
+
+uintptr_t Parcel::readPointer() const
+{
+ return readAligned<uintptr_t>();
+}
+
+
status_t Parcel::readFloat(float *pArg) const
{
return readAligned(pArg);