base-hw: cache maintenance

touch each page before flushing to ensure that it's present in the page table

genodelabs/genode#4279
This commit is contained in:
Johannes Schlatow 2021-09-23 16:32:17 +02:00 committed by Norman Feske
parent 350353885e
commit ef8a43c546

View File

@ -16,6 +16,7 @@
#include <base/internal/page_size.h>
#include <cpu/cache.h>
#include <util/misc_math.h>
#include <util/touch.h>
using namespace Genode;
@ -32,6 +33,7 @@ static void for_cachelines(addr_t addr, size_t size, FN const & fn)
while (size) {
addr_t next_page = align_addr(addr+1, get_page_size_log2());
size_t s = min(size, next_page - addr);
touch_read(reinterpret_cast<unsigned char *>(addr));
fn(addr, s);
addr += s;
size -= s;