mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-31 00:24:51 +00:00
parent
f330b55227
commit
63d902543b
@ -17,7 +17,6 @@
|
||||
#include <base/printf.h>
|
||||
#include <base/sleep.h>
|
||||
#include <base/thread.h>
|
||||
#include <base/cap_sel_alloc.h>
|
||||
|
||||
/* core includes */
|
||||
#include <core_parent.h>
|
||||
@ -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<addr_t>(phys_ptr);
|
||||
addr_t core_local_addr = _map_page(phys_addr >> get_page_size_log2(),
|
||||
1, false);
|
||||
|
||||
Cap_range * range = reinterpret_cast<Cap_range *>(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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -12,4 +12,60 @@
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
namespace Genode { void platform_main_bootstrap() { /* dummy */ } }
|
||||
#include <base/cap_map.h>
|
||||
#include <base/env.h>
|
||||
|
||||
#include <base/printf.h>
|
||||
|
||||
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<Cap_range *>(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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user