From e0f8b6a0a070b748cf1666bc6eec6701453d8e2f Mon Sep 17 00:00:00 2001 From: Sofiane Naci Date: Tue, 15 Jan 2013 15:49:13 +0000 Subject: [PATCH] [AARCH64] Fix __clear_cache. From-SVN: r195203 --- libgcc/ChangeLog | 5 +++++ libgcc/config/aarch64/sync-cache.c | 10 ++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 3f8337e..7750449 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,8 @@ +2013-01-15 Sofiane Naci + + * config/aarch64/sync-cache.c (__aarch64_sync_cache_range): Update + loop start address for cache clearing. + 2013-01-14 Georg-Johann Lay * config/avr/lib1funcs.S: Remove trailing blanks. diff --git a/libgcc/config/aarch64/sync-cache.c b/libgcc/config/aarch64/sync-cache.c index d7b621e..2512cb8 100644 --- a/libgcc/config/aarch64/sync-cache.c +++ b/libgcc/config/aarch64/sync-cache.c @@ -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) -- 2.7.4