diff --git a/repos/base-hw/src/core/kernel/thread.cc b/repos/base-hw/src/core/kernel/thread.cc index da0412ab1c..6842590165 100644 --- a/repos/base-hw/src/core/kernel/thread.cc +++ b/repos/base-hw/src/core/kernel/thread.cc @@ -17,8 +17,6 @@ #include /* base-internal includes */ -#include -#include #include /* core includes */ @@ -884,24 +882,20 @@ Core_main_thread::Core_main_thread(Irq::Pool &user_irq_pool, { using namespace Genode; - static Native_utcb * const utcb = - unmanaged_singleton(); - static addr_t const utcb_phys = Platform::core_phys_addr((addr_t)utcb); - - /* map UTCB */ - Genode::map_local(utcb_phys, (addr_t)utcb_main_thread(), + Genode::map_local(Platform::core_phys_addr((addr_t)&_utcb_instance), + (addr_t)utcb_main_thread(), sizeof(Native_utcb) / get_page_size()); - utcb->cap_add(core_capid()); - utcb->cap_add(cap_id_invalid()); - utcb->cap_add(cap_id_invalid()); + _utcb_instance.cap_add(core_capid()); + _utcb_instance.cap_add(cap_id_invalid()); + _utcb_instance.cap_add(cap_id_invalid()); /* start thread with stack pointer at the top of stack */ regs->sp = (addr_t)&__initial_stack_base[0] + DEFAULT_STACK_SIZE; regs->ip = (addr_t)&_core_start; affinity(_cpu_pool.primary_cpu()); - _utcb = utcb; + _utcb = &_utcb_instance; Thread::_pd = &core_pd; _become_active(); } diff --git a/repos/base-hw/src/core/kernel/thread.h b/repos/base-hw/src/core/kernel/thread.h index 495daa7272..fd2c413141 100644 --- a/repos/base-hw/src/core/kernel/thread.h +++ b/repos/base-hw/src/core/kernel/thread.h @@ -445,6 +445,10 @@ class Kernel::Thread : private Kernel::Object, public Cpu_job, private Timeout */ class Kernel::Core_main_thread : public Core_object { + private: + + Native_utcb _utcb_instance alignas(Hw::get_page_size()) { }; + public: Core_main_thread(Irq::Pool &user_irq_pool,