From 410ae2fe8e5d78cbce7b20be87828c5595e76842 Mon Sep 17 00:00:00 2001 From: Ashok Bhat Date: Thu, 19 Jun 2014 11:03:32 +0100 Subject: pixelflinger: Use pointer arithmetic to determine cache flush parameters CodeCache casts base address to long and then adds size (of type ssize_t) to get end address. This can cause sign-extension problems. This patch instead uses simple pointer arithmetic. Change-Id: Ib71d515a6fd6a7f4762cf974d6cf4eba9a601fa8 Signed-off-by: Ashok Bhat --- libpixelflinger/codeflinger/CodeCache.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libpixelflinger/codeflinger/CodeCache.cpp b/libpixelflinger/codeflinger/CodeCache.cpp index 8afe0a9..cfd2b37 100644 --- a/libpixelflinger/codeflinger/CodeCache.cpp +++ b/libpixelflinger/codeflinger/CodeCache.cpp @@ -201,9 +201,9 @@ int CodeCache::cache( const AssemblyKeyBase& keyBase, mCacheInUse += assemblySize; mWhen++; // synchronize caches... - const long base = long(assembly->base()); - const long curr = base + long(assembly->size()); - __builtin___clear_cache((void*)base, (void*)curr); + void* base = assembly->base(); + void* curr = (uint8_t*)base + assembly->size(); + __builtin___clear_cache(base, curr); } pthread_mutex_unlock(&mLock); -- cgit v1.1