From: <ml...@ma...> - 2009-09-15 00:36:47
|
Author: mlu Date: 2009-09-15 00:36:27 +0200 (Tue, 15 Sep 2009) New Revision: 2708 Modified: trunk/src/target/cortex_a8.c Log: Cache invalidation when writing to memory Modified: trunk/src/target/cortex_a8.c =================================================================== --- trunk/src/target/cortex_a8.c 2009-09-14 13:54:49 UTC (rev 2707) +++ trunk/src/target/cortex_a8.c 2009-09-14 22:36:27 UTC (rev 2708) @@ -1253,6 +1253,24 @@ exit(-1); } + /* The Cache handling will NOT work with MMU active, the wrong addresses will be invalidated */ + /* invalidate I-Cache */ + if (armv7a->armv4_5_mmu.armv4_5_cache.i_cache_enabled) + { + /* Invalidate ICache single entry with MVA, repeat this for all cache + lines in the address range, Cortex-A8 has fixed 64 byte line length */ + /* Invalidate Cache single entry with MVA to PoU */ + for (uint32_t cacheline=address; cacheline<address+size*count; cacheline+=64) + armv7a->write_cp15(target, 0, 1, 7, 5, cacheline); /* I-Cache to PoU */ + } + /* invalidate D-Cache */ + if (armv7a->armv4_5_mmu.armv4_5_cache.d_u_cache_enabled) + { + /* Invalidate Cache single entry with MVA to PoC */ + for (uint32_t cacheline=address; cacheline<address+size*count; cacheline+=64) + armv7a->write_cp15(target, 0, 1, 7, 6, cacheline); /* U/D cache to PoC */ + } + return retval; } |