sel4: add revoke option to destruct cnode

Issue #2044
This commit is contained in:
Alexander Boettcher
2016-07-15 15:54:07 +02:00
committed by Christian Helmuth
parent c4ed38cfbc
commit 9c8676b2ae
2 changed files with 12 additions and 3 deletions

View File

@ -164,7 +164,7 @@ class Genode::Cnode : public Cnode_base, Noncopyable
create<Cnode_kobj>(untyped_pool, parent_sel, dst_idx, size_log2); create<Cnode_kobj>(untyped_pool, parent_sel, dst_idx, size_log2);
} }
void destruct(Range_allocator &phys_alloc) void destruct(Range_allocator &phys_alloc, bool revoke = false)
{ {
/* revert phys allocation */ /* revert phys allocation */
@ -173,6 +173,14 @@ class Genode::Cnode : public Cnode_base, Noncopyable
return; return;
} }
if (revoke) {
int ret = seL4_CNode_Revoke(seL4_CapInitThreadCNode,
sel().value(), 32);
if (ret)
error(__PRETTY_FUNCTION__, ": seL4_CNode_Revoke (",
Hex(sel().value()), ") returned ", ret);
}
int ret = seL4_CNode_Delete(seL4_CapInitThreadCNode, int ret = seL4_CNode_Delete(seL4_CapInitThreadCNode,
sel().value(), 32); sel().value(), 32);
if (ret != seL4_NoError) if (ret != seL4_NoError)

View File

@ -196,11 +196,12 @@ Platform_pd::~Platform_pd()
{ {
for (unsigned i = 0; i < sizeof(_cspace_cnode_2nd) / for (unsigned i = 0; i < sizeof(_cspace_cnode_2nd) /
sizeof(_cspace_cnode_2nd[0]); i++) { sizeof(_cspace_cnode_2nd[0]); i++) {
_cspace_cnode_2nd[i]->destruct(*platform()->ram_alloc()); _cspace_cnode_1st.remove(Cnode_index(i));
_cspace_cnode_2nd[i]->destruct(*platform()->ram_alloc(), true);
platform_specific()->core_sel_alloc().free(_cspace_cnode_2nd[i]->sel()); platform_specific()->core_sel_alloc().free(_cspace_cnode_2nd[i]->sel());
} }
_cspace_cnode_1st.destruct(*platform()->ram_alloc()); _cspace_cnode_1st.destruct(*platform()->ram_alloc(), true);
platform_specific()->core_sel_alloc().free(_cspace_cnode_1st.sel()); platform_specific()->core_sel_alloc().free(_cspace_cnode_1st.sel());
/* invalidate weak pointers to this object */ /* invalidate weak pointers to this object */