mirror of
https://github.com/mmueller41/genode.git
synced 2026-01-21 12:32:56 +01:00
Increased number of caps available to core.
This commit is contained in:
@@ -23,6 +23,8 @@
|
|||||||
|
|
||||||
#include <base/mutex.h>
|
#include <base/mutex.h>
|
||||||
|
|
||||||
|
#include <base/log.h>
|
||||||
|
|
||||||
#include <util/avl_tree.h>
|
#include <util/avl_tree.h>
|
||||||
#include <util/noncopyable.h>
|
#include <util/noncopyable.h>
|
||||||
|
|
||||||
@@ -36,9 +38,10 @@ namespace Genode {
|
|||||||
addr_t _base = 0;
|
addr_t _base = 0;
|
||||||
addr_t _last = 0;
|
addr_t _last = 0;
|
||||||
|
|
||||||
enum {
|
enum
|
||||||
|
{
|
||||||
HEADER = sizeof(_base) + sizeof(_mutex) + sizeof(_last),
|
HEADER = sizeof(_base) + sizeof(_mutex) + sizeof(_last),
|
||||||
CAP_RANGE_SIZE = 4096,
|
CAP_RANGE_SIZE = 131072,
|
||||||
WORDS = (CAP_RANGE_SIZE - HEADER - sizeof(Avl_node<Cap_range>)) / sizeof(addr_t),
|
WORDS = (CAP_RANGE_SIZE - HEADER - sizeof(Avl_node<Cap_range>)) / sizeof(addr_t),
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -51,8 +54,8 @@ namespace Genode {
|
|||||||
|
|
||||||
Cap_range(addr_t base) : _base(base)
|
Cap_range(addr_t base) : _base(base)
|
||||||
{
|
{
|
||||||
static_assert(sizeof(*this) == CAP_RANGE_SIZE,
|
//static_assert(sizeof(*this) == CAP_RANGE_SIZE,
|
||||||
"Cap_range misconfigured");
|
//"Cap_range misconfigured");
|
||||||
|
|
||||||
for (unsigned i = 0; i < elements(); i++)
|
for (unsigned i = 0; i < elements(); i++)
|
||||||
_cap_array[i] = 0;
|
_cap_array[i] = 0;
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ namespace Nova {
|
|||||||
ALWAYS_INLINE
|
ALWAYS_INLINE
|
||||||
inline mword_t rdi(Syscall s, uint8_t flags, mword_t sel)
|
inline mword_t rdi(Syscall s, uint8_t flags, mword_t sel)
|
||||||
{
|
{
|
||||||
return sel << 12 | (flags & 0xf) << 8 | s;
|
return sel << 9 | (flags & 0xf) << 5 | s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -454,9 +454,13 @@ namespace Nova {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ALWAYS_INLINE
|
ALWAYS_INLINE
|
||||||
inline uint8_t alloc_cores(mword_t count, mword_t &allocated)
|
inline uint8_t alloc_cores(mword_t count, mword_t &allocated, mword_t &remainder)
|
||||||
{
|
{
|
||||||
return syscall_5(NOVA_ALLOC_CORES, 0, 0, count, allocated);
|
Nova::mword_t rest = 0;
|
||||||
|
Nova::mword_t null = 0;
|
||||||
|
Nova::uint8_t res = syscall_6(NOVA_ALLOC_CORES, 0, 0, count, allocated, rest, null);
|
||||||
|
remainder = rest;
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
ALWAYS_INLINE
|
ALWAYS_INLINE
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ addr_t Platform::_map_pages(addr_t const phys_addr, addr_t const pages,
|
|||||||
*****************************/
|
*****************************/
|
||||||
|
|
||||||
|
|
||||||
enum { CORE_PAGER_UTCB_ADDR = 0xbff02000 };
|
enum { CORE_PAGER_UTCB_ADDR = 0xfff02000 };
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -200,7 +200,7 @@ static void page_fault_handler()
|
|||||||
|
|
||||||
static addr_t core_pager_stack_top()
|
static addr_t core_pager_stack_top()
|
||||||
{
|
{
|
||||||
enum { STACK_SIZE = 4*1024 };
|
enum { STACK_SIZE = 8*1024 };
|
||||||
static char stack[STACK_SIZE];
|
static char stack[STACK_SIZE];
|
||||||
return (addr_t)&stack[STACK_SIZE - sizeof(addr_t)];
|
return (addr_t)&stack[STACK_SIZE - sizeof(addr_t)];
|
||||||
}
|
}
|
||||||
@@ -824,26 +824,28 @@ Platform::Platform()
|
|||||||
log(Number_of_bytes(kernel_memory), " kernel memory"); log("");
|
log(Number_of_bytes(kernel_memory), " kernel memory"); log("");
|
||||||
|
|
||||||
/* add capability selector ranges to map */
|
/* add capability selector ranges to map */
|
||||||
unsigned const first_index = 0x2000;
|
unsigned const first_index = 0x0000;
|
||||||
unsigned index = first_index;
|
unsigned index = first_index;
|
||||||
for (unsigned i = 0; i < 32; i++)
|
for (unsigned i = 0; i < 32; i++)
|
||||||
{
|
{
|
||||||
void * phys_ptr = nullptr;
|
void * phys_ptr = nullptr;
|
||||||
|
|
||||||
ram_alloc().alloc_aligned(get_page_size(), get_page_size_log2()).with_result(
|
ram_alloc().alloc_aligned(128*get_page_size(), get_page_size_log2()).with_result(
|
||||||
[&] (void *ptr) { phys_ptr = ptr; },
|
[&] (void *ptr) { phys_ptr = ptr; },
|
||||||
[&] (Range_allocator::Alloc_error) { /* covered by nullptr test below */ });
|
[&] (Range_allocator::Alloc_error) { /* covered by nullptr test below */ });
|
||||||
|
|
||||||
if (phys_ptr == nullptr)
|
if (phys_ptr == nullptr)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
log("Mapping mem for cap range ", i);
|
||||||
addr_t phys_addr = reinterpret_cast<addr_t>(phys_ptr);
|
addr_t phys_addr = reinterpret_cast<addr_t>(phys_ptr);
|
||||||
addr_t core_local_addr = _map_pages(phys_addr, 1);
|
addr_t core_local_addr = _map_pages(phys_addr, 128);
|
||||||
|
|
||||||
if (!core_local_addr) {
|
if (!core_local_addr) {
|
||||||
ram_alloc().free(phys_ptr);
|
ram_alloc().free(phys_ptr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
log("Creating cap range ", i, " at ", reinterpret_cast<void*>(core_local_addr));
|
||||||
|
|
||||||
Cap_range &range = *reinterpret_cast<Cap_range *>(core_local_addr);
|
Cap_range &range = *reinterpret_cast<Cap_range *>(core_local_addr);
|
||||||
construct_at<Cap_range>(&range, index);
|
construct_at<Cap_range>(&range, index);
|
||||||
@@ -851,6 +853,7 @@ Platform::Platform()
|
|||||||
cap_map().insert(range);
|
cap_map().insert(range);
|
||||||
|
|
||||||
index = (unsigned)(range.base() + range.elements());
|
index = (unsigned)(range.base() + range.elements());
|
||||||
|
log("Created cap range ", i, " at ", reinterpret_cast<void*>(core_local_addr));
|
||||||
}
|
}
|
||||||
_max_caps = index - first_index;
|
_max_caps = index - first_index;
|
||||||
|
|
||||||
@@ -924,6 +927,7 @@ Platform::Platform()
|
|||||||
(unsigned)(sc_idle_base + kernel_cpu_id),
|
(unsigned)(sc_idle_base + kernel_cpu_id),
|
||||||
"killed");
|
"killed");
|
||||||
});
|
});
|
||||||
|
log("Added idle ECs to trace sources");
|
||||||
|
|
||||||
/* add exception handler EC for core and EC root thread to trace sources */
|
/* add exception handler EC for core and EC root thread to trace sources */
|
||||||
struct Core_trace_source : public Trace::Source::Info_accessor,
|
struct Core_trace_source : public Trace::Source::Info_accessor,
|
||||||
@@ -972,6 +976,7 @@ Platform::Platform()
|
|||||||
registry.insert(this);
|
registry.insert(this);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
log("Added exception handler EC");
|
||||||
|
|
||||||
new (core_mem_alloc())
|
new (core_mem_alloc())
|
||||||
Core_trace_source(Trace::sources(),
|
Core_trace_source(Trace::sources(),
|
||||||
@@ -982,9 +987,9 @@ Platform::Platform()
|
|||||||
Core_trace_source(Trace::sources(),
|
Core_trace_source(Trace::sources(),
|
||||||
Affinity::Location(0, 0, _cpus.width(), 1),
|
Affinity::Location(0, 0, _cpus.width(), 1),
|
||||||
hip.sel_exc + 1, "root");
|
hip.sel_exc + 1, "root");
|
||||||
|
log("Created trace sources");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
addr_t Platform::_rom_module_phys(addr_t virt)
|
addr_t Platform::_rom_module_phys(addr_t virt)
|
||||||
{
|
{
|
||||||
return virt - (addr_t)&_prog_img_beg + _core_phys_start;
|
return virt - (addr_t)&_prog_img_beg + _core_phys_start;
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ class Core_child : public Child_policy
|
|||||||
Pd_session &ref_pd() override { return _core_pd; }
|
Pd_session &ref_pd() override { return _core_pd; }
|
||||||
Pd_session_capability ref_pd_cap() const override { return _core_pd_cap; }
|
Pd_session_capability ref_pd_cap() const override { return _core_pd_cap; }
|
||||||
|
|
||||||
size_t session_alloc_batch_size() const override { return 128; }
|
size_t session_alloc_batch_size() const override { return 2*128; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user