From 6e21ab42d28b928ba77c6d7e91f50e0be099207b Mon Sep 17 00:00:00 2001 From: Martin Stein Date: Fri, 7 Mar 2014 15:58:01 +0100 Subject: [PATCH] hw: apply MMU cache-flushes to all processors ref #1076 --- base-hw/src/core/rm_session_support.cc | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/base-hw/src/core/rm_session_support.cc b/base-hw/src/core/rm_session_support.cc index d8e80a5d8b..de9de024a5 100644 --- a/base-hw/src/core/rm_session_support.cc +++ b/base-hw/src/core/rm_session_support.cc @@ -19,18 +19,32 @@ #include #include #include +#include #include using namespace Genode; +/************************************** + ** Helpers for processor broadcasts ** + **************************************/ + +struct Update_pd_data { unsigned const pd_id; }; + +void update_pd(void * const data) +{ + auto const d = reinterpret_cast(data); + Kernel::update_pd(d->pd_id); +} + + /*************** ** Rm_client ** ***************/ void Rm_client::unmap(addr_t, addr_t virt_base, size_t size) { - /* get software TLB of the thread that we serve */ + /* remove mapping from the translation table of the thread that we serve */ Platform_thread * const pt = (Platform_thread *)badge(); if (!pt) { PERR("failed to get platform thread of RM client"); @@ -41,9 +55,14 @@ void Rm_client::unmap(addr_t, addr_t virt_base, size_t size) PERR("failed to get page table of RM client"); return; } - /* update all translation caches */ tlb->remove_region(virt_base, size); - Kernel::update_pd(pt->pd_id()); + + /* update translation caches of all processors */ + Update_pd_data data { pt->pd_id() }; + Processor_broadcast_operation const operation(update_pd, &data); + processor_broadcast()->execute(&operation); + + /* try to get back released memory from the translation table */ regain_ram_from_tlb(tlb); }