From c177c8cf5044f97c52e715779394083730c01ddd Mon Sep 17 00:00:00 2001 From: Michael Mueller Date: Tue, 13 Feb 2024 18:53:16 +0100 Subject: [PATCH] Create and map Tukija signal page on initialization. --- src/mx/tasking/runtime.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/mx/tasking/runtime.h b/src/mx/tasking/runtime.h index 9d2fb1f..42aaaf0 100644 --- a/src/mx/tasking/runtime.h +++ b/src/mx/tasking/runtime.h @@ -6,9 +6,12 @@ #include #include #include +#include #include #include #include +#include +#include namespace mx::tasking { /** @@ -30,6 +33,14 @@ public: static bool init(const util::core_set &core_set, const std::uint16_t prefetch_distance, const bool use_system_allocator) { + // Create the Tukija signal page if necessary + if (!_signal_page) { + Genode::Ram_dataspace_capability ds = mx::system::Environment::ram().alloc(4096); + _signal_page = static_cast(mx::system::Environment::rm().attach(ds)); + std::memset(_signal_page, 0, 4096); + + Nova::mxinit(0, 0, reinterpret_cast(_signal_page)); + } // Are we ready to re-initialize the scheduler? if (_scheduler != nullptr && _scheduler->is_running()) { @@ -70,7 +81,7 @@ public: if (need_new_scheduler) { _scheduler.reset(new (memory::GlobalHeap::allocate_cache_line_aligned(sizeof(Scheduler))) - Scheduler(core_set, prefetch_distance, *_resource_allocator)); + Scheduler(core_set, prefetch_distance, *_resource_allocator, _signal_page)); } else { @@ -244,6 +255,9 @@ private: // Allocator to allocate data objects. inline static std::unique_ptr _resource_builder = {nullptr}; + + // Shared page holding the signal channels for each Worker + static std::uint64_t *volatile _signal_page; }; /**