diff --git a/base-hw/src/base/console.cc b/base-hw/src/base/console.cc
index ddb863675..5b0c53f89 100644
--- a/base-hw/src/base/console.cc
+++ b/base-hw/src/base/console.cc
@@ -16,8 +16,8 @@
#include
#include
-/* base-hw includes */
-#include "singleton.h"
+/* base includes */
+#include
namespace Genode
{
@@ -66,7 +66,7 @@ using namespace Genode;
*/
static Platform_console * platform_console()
{
- return unsynchronized_singleton();
+ return unmanaged_singleton();
}
diff --git a/base-hw/src/base/placement_new.h b/base-hw/src/base/placement_new.h
index 147dbbb1c..64cc33d06 100644
--- a/base-hw/src/base/placement_new.h
+++ b/base-hw/src/base/placement_new.h
@@ -14,9 +14,9 @@
#ifndef _PLACEMENT_NEW_H_
#define _PLACEMENT_NEW_H_
-/**
- * Placement new operator
- */
-inline void *operator new(Genode::size_t, void *at) { return at; }
+/* base includes */
+#include
+
+/* FIXME: remove this header as soon as the Placeable template is public */
#endif /* _PLACEMENT_NEW_H_ */
diff --git a/base-hw/src/base/singleton.h b/base-hw/src/base/singleton.h
deleted file mode 100644
index ad5c4a90a..000000000
--- a/base-hw/src/base/singleton.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * \brief Helper for creating singleton objects
- * \author Norman Feske
- * \date 2013-05-14
- *
- * Before enabling the MMU on ARM, the 'cmpxchg' implementation is not always
- * guaranteed to work. For example, on the Raspberry Pi, the 'ldrex' as used by
- * 'cmpxchg' causes the machine to reboot. After enabling the MMU, everything
- * is fine. Hence, we need to avoid executing 'cmpxchg' prior this point.
- * Unfortunately, 'cmpxchg' is implicitly called each time when creating a
- * singleton object via a local-static object pattern. In this case, the
- * compiler generates code that calls the '__cxa_guard_acquire' function of the
- * C++ runtime, which, in turn, relies 'cmpxchg' for synchronization.
- *
- * The utility provided herein is an alternative way to create single object
- * instances without implicitly calling 'cmpxchg'. Because object creation is
- * not synchronized via a spin lock, it must not be used in scenarios where
- * multiple threads may contend.
- */
-
-/*
- * Copyright (C) 2013 Genode Labs GmbH
- *
- * This file is part of the Genode OS framework, which is distributed
- * under the terms of the GNU General Public License version 2.
- */
-
-#ifndef _SINGLETON_H_
-#define _SINGLETON_H_
-
-/* Genode includes */
-#include
-
-/* base-hw includes */
-#include
-
-template
-static inline T *unsynchronized_singleton(Args... args)
-{
- /*
- * Each instantiation of the function template with a different type 'T'
- * yields a dedicated instance of the local static variables, thereby
- * creating the living space for the singleton objects.
- */
- static bool initialized;
- static int inst[sizeof(T)/sizeof(int) + 1] __attribute__((aligned(ALIGN)));
-
- /* execute constructor on first call */
- if (!initialized) {
- initialized = true;
- new (&inst) T(args...);
- }
- return reinterpret_cast(inst);
-}
-
-#endif /* _SINGLETON_H_ */
diff --git a/base-hw/src/core/kernel/kernel.cc b/base-hw/src/core/kernel/kernel.cc
index 5b5b8e2fb..10bbe5203 100644
--- a/base-hw/src/core/kernel/kernel.cc
+++ b/base-hw/src/core/kernel/kernel.cc
@@ -31,8 +31,10 @@
#include
#include
+/* base includes */
+#include
+
/* base-hw includes */
-#include
#include
using namespace Kernel;
@@ -47,7 +49,7 @@ namespace Kernel
/**
* Return interrupt-controller singleton
*/
- Pic * pic() { return unsynchronized_singleton(); }
+ Pic * pic() { return unmanaged_singleton(); }
/* import Genode types */
typedef Genode::umword_t umword_t;
@@ -64,15 +66,15 @@ namespace Kernel
*/
static void idle_main() { while (1) ; }
- Pd_ids * pd_ids() { return unsynchronized_singleton(); }
- Thread_ids * thread_ids() { return unsynchronized_singleton(); }
- Signal_context_ids * signal_context_ids() { return unsynchronized_singleton(); }
- Signal_receiver_ids * signal_receiver_ids() { return unsynchronized_singleton(); }
+ Pd_ids * pd_ids() { return unmanaged_singleton(); }
+ Thread_ids * thread_ids() { return unmanaged_singleton(); }
+ Signal_context_ids * signal_context_ids() { return unmanaged_singleton(); }
+ Signal_receiver_ids * signal_receiver_ids() { return unmanaged_singleton(); }
- Pd_pool * pd_pool() { return unsynchronized_singleton(); }
- Thread_pool * thread_pool() { return unsynchronized_singleton(); }
- Signal_context_pool * signal_context_pool() { return unsynchronized_singleton(); }
- Signal_receiver_pool * signal_receiver_pool() { return unsynchronized_singleton(); }
+ Pd_pool * pd_pool() { return unmanaged_singleton(); }
+ Thread_pool * thread_pool() { return unmanaged_singleton(); }
+ Signal_context_pool * signal_context_pool() { return unmanaged_singleton(); }
+ Signal_receiver_pool * signal_receiver_pool() { return unmanaged_singleton(); }
/**
* Access to static kernel timer
@@ -92,9 +94,8 @@ namespace Kernel
static Pd * core()
{
constexpr int tlb_align = 1 << Core_tlb::ALIGNM_LOG2;
-
- Core_tlb *core_tlb = unsynchronized_singleton();
- Pd *pd = unsynchronized_singleton(core_tlb, nullptr);
+ Core_tlb *core_tlb = unmanaged_singleton();
+ Pd *pd = unmanaged_singleton(core_tlb, nullptr);
return pd;
}
@@ -262,8 +263,8 @@ Kernel::Mode_transition_control * Kernel::mtc()
sp = (addr_t)&_kernel_stack_high;
core()->admit(this);
}
- } * const k = unsynchronized_singleton();
+ } * const k = unmanaged_singleton();
/* initialize mode transition page */
- return unsynchronized_singleton(k);
+ return unmanaged_singleton(k);
}
diff --git a/base-hw/src/core/kernel/object.h b/base-hw/src/core/kernel/object.h
index 407d4bdf2..2f391087e 100644
--- a/base-hw/src/core/kernel/object.h
+++ b/base-hw/src/core/kernel/object.h
@@ -21,9 +21,6 @@
/* core includes */
#include
-/* base-hw includes */
-#include
-
namespace Kernel
{
template class Avl_tree : public Genode::Avl_tree { };
diff --git a/base-hw/src/core/kernel/vm.cc b/base-hw/src/core/kernel/vm.cc
index b9a495c89..1cc85ea4a 100644
--- a/base-hw/src/core/kernel/vm.cc
+++ b/base-hw/src/core/kernel/vm.cc
@@ -16,6 +16,6 @@
namespace Kernel
{
- Vm_ids * vm_ids() { return unsynchronized_singleton(); }
- Vm_pool * vm_pool() { return unsynchronized_singleton(); }
+ Vm_ids * vm_ids() { return unmanaged_singleton(); }
+ Vm_pool * vm_pool() { return unmanaged_singleton(); }
}
diff --git a/base-hw/src/core/target.inc b/base-hw/src/core/target.inc
index ad6551119..0675373c2 100644
--- a/base-hw/src/core/target.inc
+++ b/base-hw/src/core/target.inc
@@ -22,7 +22,8 @@ INC_DIR += $(REP_DIR)/src/core \
$(BASE_DIR)/src/core/include \
$(BASE_DIR)/include \
$(BASE_DIR)/src/platform \
- $(BASE_DIR)/src/base/thread
+ $(BASE_DIR)/src/base/thread \
+ $(BASE_DIR)/src/base/include
# add C++ sources
SRC_CC += console.cc \