diff --git a/base-nova/src/core/platform.cc b/base-nova/src/core/platform.cc
index 965780c79..fee2f6209 100644
--- a/base-nova/src/core/platform.cc
+++ b/base-nova/src/core/platform.cc
@@ -17,7 +17,6 @@
#include
#include
#include
-#include
/* core includes */
#include
@@ -629,6 +628,32 @@ Platform::Platform() :
printf(":phys_alloc: "); _core_mem_alloc.phys_alloc()->raw()->dump_addr_tree();
printf(":io_mem_alloc: "); _io_mem_alloc.raw()->dump_addr_tree();
}
+
+ /* add capability selector ranges to map */
+ unsigned index = 0x2000;
+ for (unsigned i = 0; i < 16; i++)
+ {
+ void * phys_ptr = 0;
+ ram_alloc()->alloc(4096, &phys_ptr);
+
+ addr_t phys_addr = reinterpret_cast(phys_ptr);
+ addr_t core_local_addr = _map_page(phys_addr >> get_page_size_log2(),
+ 1, false);
+
+ Cap_range * range = reinterpret_cast(core_local_addr);
+ *range = Cap_range(index);
+
+ cap_map()->insert(range);
+
+/*
+ if (verbose_boot_info)
+ printf("add cap range [0x%8lx:0x%8lx) - physical 0x%8lx -> 0x%8lx\n",
+ range->base(),
+ range->base() + range->elements(), phys_addr, core_local_addr);
+*/
+
+ index = range->base() + range->elements();
+ }
}
diff --git a/base-nova/src/platform/main_bootstrap.cc b/base-nova/src/platform/main_bootstrap.cc
index fe716fe89..2d6ce3f79 100644
--- a/base-nova/src/platform/main_bootstrap.cc
+++ b/base-nova/src/platform/main_bootstrap.cc
@@ -12,4 +12,60 @@
* under the terms of the GNU General Public License version 2.
*/
-namespace Genode { void platform_main_bootstrap() { /* dummy */ } }
+#include
+#include
+
+#include
+
+namespace Genode { void platform_main_bootstrap(); }
+
+enum { CAP_RANGE_START = 4096 };
+
+Genode::Cap_range * initial_range()
+{
+ static Genode::Cap_range range(CAP_RANGE_START);
+ return ⦥
+}
+
+extern "C" Genode::addr_t __initial_sp;
+
+void Genode::platform_main_bootstrap()
+{
+ static struct Bootstrap
+ {
+ Bootstrap()
+ {
+ cap_map()->insert(initial_range());
+
+ /* for Core we can't perform the following code so early */
+ if (__initial_sp)
+ return;
+
+ unsigned index = initial_range()->base() + initial_range()->elements();
+
+/*
+ printf("initial selector range [0x%8lx:0x%8lx)\n",
+ initial_range()->base(), initial_range()->base() +
+ initial_range()->elements());
+*/
+
+ for (unsigned i = 0; i < 16; i++) {
+
+ Ram_dataspace_capability ds = env()->ram_session()->alloc(4096);
+ addr_t local = env()->rm_session()->attach(ds);
+
+ Cap_range * range = reinterpret_cast(local);
+ *range = Cap_range(index);
+
+ cap_map()->insert(range);
+
+/*
+ printf("add cap selector range [0x%8lx:0x%8lx)\n",
+ range->base(), range->base() + range->elements());
+*/
+
+ index = range->base() + range->elements();
+ }
+ }
+ } bootstrap;
+}