sel4: support up to 16K capabilities per pd

before we had 256 capabilities

Issue #2044
This commit is contained in:
Alexander Boettcher 2016-07-04 09:19:52 +02:00 committed by Christian Helmuth
parent 73e35cdf6a
commit a396fa9563
5 changed files with 44 additions and 20 deletions

View File

@ -42,9 +42,9 @@ class Genode::Platform_pd : public Address_space
Vm_space _vm_space;
Cap_sel const _cspace_cnode_sel;
Cnode _cspace_cnode_1st;
Cnode _cspace_cnode;
Lazy_volatile_object<Cnode> _cspace_cnode_2nd[1UL << CSPACE_SIZE_LOG2_1ST];
Native_capability _parent;
@ -105,7 +105,16 @@ class Genode::Platform_pd : public Address_space
void free_sel(Cap_sel sel);
Cnode &cspace_cnode() { return _cspace_cnode; }
Cnode &cspace_cnode(Cap_sel sel)
{
const unsigned index = sel.value() / (1 << CSPACE_SIZE_LOG2_2ND);
ASSERT(index < sizeof(_cspace_cnode_2nd) /
sizeof(_cspace_cnode_2nd[0]));
return *_cspace_cnode_2nd[index];
}
Cnode &cspace_cnode_1st() { return _cspace_cnode_1st; }
Cap_sel page_directory_sel() const { return _page_directory_sel; }

View File

@ -57,7 +57,7 @@ class Genode::Vm_space
/**
* Number of leaf CNodes
*/
NUM_LEAF_CNODES_LOG2 = 4UL,
NUM_LEAF_CNODES_LOG2 = 6UL,
NUM_LEAF_CNODES = 1UL << NUM_LEAF_CNODES_LOG2,
/**

View File

@ -100,9 +100,9 @@ void Platform_pd::assign_parent(Native_capability parent)
* Install parent endpoint selector at the predefined position
* INITIAL_SEL_PARENT within the PD's CSpace.
*/
_cspace_cnode.copy(platform_specific()->core_cnode(),
Cnode_index(ipc_cap_data.sel),
Cnode_index(INITIAL_SEL_PARENT));
_cspace_cnode_2nd[0]->copy(platform_specific()->core_cnode(),
Cnode_index(ipc_cap_data.sel),
Cnode_index(INITIAL_SEL_PARENT));
}
@ -166,15 +166,28 @@ Platform_pd::Platform_pd(Allocator * md_alloc, char const *,
platform_specific()->phys_cnode(),
_id,
_page_table_registry),
_cspace_cnode_sel(platform_specific()->core_sel_alloc().alloc()),
_cspace_cnode(platform_specific()->core_cnode().sel(), _cspace_cnode_sel,
CSPACE_SIZE_LOG2,
*platform()->ram_alloc())
_cspace_cnode_1st(platform_specific()->core_cnode().sel(),
platform_specific()->core_sel_alloc().alloc(),
CSPACE_SIZE_LOG2_1ST,
*platform()->ram_alloc())
{
/* add all 2nd level CSpace's to 1st level CSpace */
for (unsigned i = 0; i < sizeof(_cspace_cnode_2nd) /
sizeof(_cspace_cnode_2nd[0]); i++) {
_cspace_cnode_2nd[i].construct(platform_specific()->core_cnode().sel(),
platform_specific()->core_sel_alloc().alloc(),
CSPACE_SIZE_LOG2_2ND,
*platform()->ram_alloc());
_cspace_cnode_1st.copy(platform_specific()->core_cnode(),
_cspace_cnode_2nd[i]->sel(),
Cnode_index(i));
}
/* install CSpace selector at predefined position in the PD's CSpace */
_cspace_cnode.copy(platform_specific()->core_cnode(),
_cspace_cnode_sel,
Cnode_index(INITIAL_SEL_CNODE));
_cspace_cnode_2nd[0]->copy(platform_specific()->core_cnode(),
_cspace_cnode_1st.sel(),
Cnode_index(INITIAL_SEL_CNODE));
}

View File

@ -124,15 +124,15 @@ int Platform_thread::start(void *ip, void *sp, unsigned int cpu_no)
Cap_sel const pager_sel(Capability_space::ipc_cap_data(_pager->cap()).sel);
/* install page-fault handler endpoint selector to the PD's CSpace */
_pd->cspace_cnode().copy(platform_specific()->core_cnode(), pager_sel,
_fault_handler_sel);
_pd->cspace_cnode(_fault_handler_sel).copy(platform_specific()->core_cnode(),
pager_sel, _fault_handler_sel);
/* allocate endpoint selector in the PD's CSpace */
_ep_sel = _pd->alloc_sel();
/* install the thread's endpoint selector to the PD's CSpace */
_pd->cspace_cnode().copy(platform_specific()->core_cnode(), _info.ep_sel,
_ep_sel);
_pd->cspace_cnode(_ep_sel).copy(platform_specific()->core_cnode(),
_info.ep_sel, _ep_sel);
/*
* Populate the thread's IPC buffer with initial information about the
@ -148,7 +148,7 @@ int Platform_thread::start(void *ip, void *sp, unsigned int cpu_no)
seL4_CapData_t const no_cap_data = { { 0 } };
int const ret = seL4_TCB_SetSpace(_info.tcb_sel.value(), _fault_handler_sel.value(),
_pd->cspace_cnode().sel().value(), guard_cap_data,
_pd->cspace_cnode_1st().sel().value(), guard_cap_data,
_pd->page_directory_sel().value(), no_cap_data);
ASSERT(ret == 0);

View File

@ -101,7 +101,9 @@ namespace Genode
};
enum {
CSPACE_SIZE_LOG2 = 8,
CSPACE_SIZE_LOG2_1ST = 4,
CSPACE_SIZE_LOG2_2ND = 8,
CSPACE_SIZE_LOG2 = CSPACE_SIZE_LOG2_1ST + CSPACE_SIZE_LOG2_2ND,
NUM_CORE_MANAGED_SEL_LOG2 = 7,
};
};