]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[AARCH64] Fix __clear_cache.
authorSofiane Naci <sofiane.naci@arm.com>
Tue, 15 Jan 2013 15:49:13 +0000 (15:49 +0000)
committerSofiane Naci <sofiane@gcc.gnu.org>
Tue, 15 Jan 2013 15:49:13 +0000 (15:49 +0000)
From-SVN: r195203

libgcc/ChangeLog
libgcc/config/aarch64/sync-cache.c

index 3f8337ec79733578378c8554a9d5eccf3c4e8951..775044944776676c2850e2fef52e8b4dbc327b64 100644 (file)
@@ -1,3 +1,8 @@
+2013-01-15  Sofiane Naci  <sofiane.naci@arm.com>
+
+       * config/aarch64/sync-cache.c (__aarch64_sync_cache_range): Update
+       loop start address for cache clearing.
+
 2013-01-14  Georg-Johann Lay  <avr@gjlay.de>
 
        * config/avr/lib1funcs.S: Remove trailing blanks.
index d7b621ee6d8504371a547e616ffeac4f1f37a6a1..2512cb8e87ed07a39c3c2a1d8c5e68704dc926da 100644 (file)
@@ -39,7 +39,10 @@ __aarch64_sync_cache_range (const void *base, const void *end)
      instruction cache fetches the updated data.  'end' is exclusive,
      as per the GNU definition of __clear_cache.  */
 
-  for (address = base; address < (const char *) end; address += dcache_lsize)
+  /* Make the start address of the loop cache aligned.  */
+  address = (const char*) ((unsigned long) base & ~ (dcache_lsize - 1));
+
+  for (address; address < (const char *) end; address += dcache_lsize)
     asm volatile ("dc\tcvau, %0"
                  :
                  : "r" (address)
@@ -47,7 +50,10 @@ __aarch64_sync_cache_range (const void *base, const void *end)
 
   asm volatile ("dsb\tish" : : : "memory");
 
-  for (address = base; address < (const char *) end; address += icache_lsize)
+  /* Make the start address of the loop cache aligned.  */
+  address = (const char*) ((unsigned long) base & ~ (icache_lsize - 1));
+
+  for (address; address < (const char *) end; address += icache_lsize)
     asm volatile ("ic\tivau, %0"
                  :
                  : "r" (address)