base: apply thread.cc fix of foc to base*

With commit 1389b63050 in thread.cc for base-foc
a bug was fixed, where the memory of the context got freed up before running
the de-constructor.

Apply the fix also to base and base-mb.
This commit is contained in:
Alexander Boettcher 2012-12-04 15:14:06 +01:00 committed by Norman Feske
parent 1211516c08
commit 68156918ee
2 changed files with 3 additions and 4 deletions

View File

@ -164,9 +164,9 @@ void Thread_base::_free_context()
{ {
addr_t ds_addr = _context->stack_base - Native_config::context_area_virtual_base(); addr_t ds_addr = _context->stack_base - Native_config::context_area_virtual_base();
Ram_dataspace_capability ds_cap = _context->ds_cap; Ram_dataspace_capability ds_cap = _context->ds_cap;
_context_allocator()->free(this);
Genode::env_context_area_rm_session()->detach((void *)ds_addr); Genode::env_context_area_rm_session()->detach((void *)ds_addr);
Genode::env_context_area_ram_session()->free(ds_cap); Genode::env_context_area_ram_session()->free(ds_cap);
_context_allocator()->free(this);
} }

View File

@ -161,12 +161,11 @@ Thread_base::Context *Thread_base::_alloc_context(size_t stack_size)
void Thread_base::_free_context() void Thread_base::_free_context()
{ {
addr_t ds_addr = _context->stack_base - addr_t ds_addr = _context->stack_base - Native_config::context_area_virtual_base();
Native_config::context_area_virtual_base();
Ram_dataspace_capability ds_cap = _context->ds_cap; Ram_dataspace_capability ds_cap = _context->ds_cap;
_context_allocator()->free(this);
Genode::env_context_area_rm_session()->detach((void *)ds_addr); Genode::env_context_area_rm_session()->detach((void *)ds_addr);
Genode::env_context_area_ram_session()->free(ds_cap); Genode::env_context_area_ram_session()->free(ds_cap);
_context_allocator()->free(this);
} }