mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-15 15:07:16 +00:00
hw: correctly flush cache on ARM (fix #1257)
* When flushing the data and unified cache on ARM, clean and invalidate instead of just cleaning the corresponding cache lines * After zero-ing a freshly constructed dataspace in core, invalidate corresponding cache lines from the instruction cache
This commit is contained in:
parent
23dcbff998
commit
3befb64afe
@ -192,12 +192,12 @@ class Genode::Arm
|
||||
};
|
||||
|
||||
/**
|
||||
* Data Cache Clean by MVA to PoC
|
||||
* Data Cache Clean and Invalidate by MVA to PoC
|
||||
*/
|
||||
struct Dccmvac : Register<32>
|
||||
struct Dccimvac : Register<32>
|
||||
{
|
||||
static void write(access_t const v) {
|
||||
asm volatile ("mcr p15, 0, %0, c7, c10, 1" :: "r" (v) : ); }
|
||||
asm volatile ("mcr p15, 0, %0, c7, c14, 1" :: "r" (v) : ); }
|
||||
};
|
||||
|
||||
/**
|
||||
@ -495,7 +495,7 @@ class Genode::Arm
|
||||
{
|
||||
addr_t const top = base + size;
|
||||
base &= line_align_mask;
|
||||
for (; base < top; base += line_size) { Dccmvac::write(base); }
|
||||
for (; base < top; base += line_size) { Dccimvac::write(base); }
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -50,10 +50,13 @@ void Ram_session_component::_clear_ds (Dataspace_component * ds)
|
||||
/* clear dataspace */
|
||||
memset(virt_addr, 0, page_rounded_size);
|
||||
|
||||
/* uncached dataspaces need to be flushed */
|
||||
/* uncached dataspaces need to be flushed from the data cache */
|
||||
if (ds->cacheability() != CACHED)
|
||||
Kernel::update_data_region((addr_t)virt_addr, page_rounded_size);
|
||||
|
||||
/* invalidate the dataspace memory from instruction cache */
|
||||
Kernel::update_instr_region((addr_t)virt_addr, page_rounded_size);
|
||||
|
||||
/* unmap dataspace from core */
|
||||
if (!unmap_local((addr_t)virt_addr, num_pages))
|
||||
PERR("could not unmap core-local address range at %p", virt_addr);
|
||||
|
Loading…
x
Reference in New Issue
Block a user