From 3e4eb0d135cc945db08b2b2eb8f68ef98af1bd04 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Mon, 28 Apr 2014 19:50:01 +0200 Subject: [PATCH] os: Refine Attached_rom_dataspace::update --- os/include/os/attached_rom_dataspace.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/os/include/os/attached_rom_dataspace.h b/os/include/os/attached_rom_dataspace.h index f86182b4a..e88e8e6cc 100644 --- a/os/include/os/attached_rom_dataspace.h +++ b/os/include/os/attached_rom_dataspace.h @@ -40,6 +40,20 @@ class Genode::Attached_rom_dataspace */ void _try_attach() { + /* + * Normally, '_ds.construct()' would implicitly destruct an + * existing dataspace upon re-construction. However, we have to + * explicitly destruct the original dataspace prior calling + * '_rom.dataspace()'. + * + * The ROM server may destroy the original dataspace when the + * 'dataspace()' function is called. In this case, all existing + * mappings of the dataspace will be flushed by core. A destruction + * of 'Attached_dataspace' after this point will attempt to detach + * the already flushed mappings, thereby producing error messages + * at core. + */ + _ds.destruct(); try { _ds.construct(_rom.dataspace()); } catch (Attached_dataspace::Invalid_dataspace) { } }