hw: provide invalidate_instr_caches_by_virt_region

ref #1115
This commit is contained in:
Martin Stein 2014-04-04 17:33:59 +02:00 committed by Norman Feske
parent f8c2596259
commit fabea7fba1
1 changed files with 30 additions and 0 deletions

View File

@ -280,6 +280,21 @@ namespace Arm
}
};
/**
* Instruction Cache Invalidate by MVA to PoU
*/
struct Icimvau : Register<32>
{
/**
* Write register value
*/
static void write(access_t const v)
{
asm volatile (
"mcr p15, 0, %[v], c7, c5, 1\n" :: [v] "r" (v) : );
}
};
/**
* Data Cache Clean by MVA to PoC
*/
@ -668,6 +683,21 @@ namespace Arm
base = base & LINE_ALIGNM_MASK;
for (; base < top; base += LINE_SIZE) { Dccmvac::write(base); }
}
/**
* Invalidate every instruction-cache entry within a virtual region
*/
static void
invalidate_instr_caches_by_virt_region(addr_t base, size_t const size)
{
enum {
LINE_SIZE = 1 << Board::CACHE_LINE_SIZE_LOG2,
LINE_ALIGNM_MASK = ~(LINE_SIZE - 1),
};
addr_t const top = base + size;
base = base & LINE_ALIGNM_MASK;
for (; base < top; base += LINE_SIZE) { Icimvau::write(base); }
}
};
}