From 73e35cdf6aed6e665317436d57bb81f9b310038c Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Thu, 30 Jun 2016 17:33:22 +0200 Subject: [PATCH] sel4: handle threads in destruction - revoke utcb - suspend thread before destruction, less noise during destruction Issue #2044 --- repos/base-sel4/src/core/platform_pd.cc | 8 +++++++- repos/base-sel4/src/core/platform_thread.cc | 5 ++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/repos/base-sel4/src/core/platform_pd.cc b/repos/base-sel4/src/core/platform_pd.cc index 18fe3ab90a..32846a356f 100644 --- a/repos/base-sel4/src/core/platform_pd.cc +++ b/repos/base-sel4/src/core/platform_pd.cc @@ -79,7 +79,13 @@ bool Platform_pd::bind_thread(Platform_thread *thread) void Platform_pd::unbind_thread(Platform_thread *thread) { - PDBG("not implemented"); + if (!thread) + return; + + if (thread->_utcb) + _vm_space.unmap(thread->_utcb, 1); + else + _vm_space.unmap(thread->INITIAL_IPC_BUFFER_VIRT, 1); } diff --git a/repos/base-sel4/src/core/platform_thread.cc b/repos/base-sel4/src/core/platform_thread.cc index b084d3646f..6fcfdddb32 100644 --- a/repos/base-sel4/src/core/platform_thread.cc +++ b/repos/base-sel4/src/core/platform_thread.cc @@ -217,7 +217,10 @@ Platform_thread::Platform_thread(size_t, const char *name, unsigned priority, Platform_thread::~Platform_thread() { - PDBG("not completely implemented"); + if (_pd) { + seL4_TCB_Suspend(_info.tcb_sel.value()); + _pd->unbind_thread(this); + } platform_thread_registry().remove(*this); platform_specific()->core_sel_alloc().free(_pager_obj_sel);