mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-18 15:18:20 +00:00
Separation of thread operations from CPU session
This patch moves the thread operations from the 'Cpu_session' to the 'Cpu_thread' interface. A noteworthy semantic change is the meaning of the former 'exception_handler' function, which used to define both, the default exception handler or a thread-specific signal handler. Now, the 'Cpu_session::exception_sigh' function defines the CPU-session-wide default handler whereas the 'Cpu_thread::exception_sigh' function defines the thread-specific one. To retain the ability to create 'Child' objects without invoking a capability, the child's initial thread must be created outside the 'Child::Process'. It is now represented by the 'Child::Initial_thread', which is passed as argument to the 'Child' constructor. Fixes #1939
This commit is contained in:
committed by
Christian Helmuth
parent
59aec6114b
commit
a99989af40
@ -18,6 +18,7 @@
|
||||
#include <base/printf.h>
|
||||
#include <base/sleep.h>
|
||||
#include <base/env.h>
|
||||
#include <cpu_thread/client.h>
|
||||
|
||||
/* base-internal includes */
|
||||
#include <base/internal/stack.h>
|
||||
@ -76,9 +77,11 @@ void Thread::start()
|
||||
{
|
||||
using namespace Fiasco;
|
||||
|
||||
Cpu_thread_client cpu_thread(_thread_cap);
|
||||
|
||||
/* get gate-capability and badge of new thread */
|
||||
Thread_state state;
|
||||
try { state = _cpu_session->state(_thread_cap); }
|
||||
try { state = cpu_thread.state(); }
|
||||
catch (...) { throw Cpu_session::Thread_creation_failed(); }
|
||||
|
||||
/* remember UTCB of the new thread */
|
||||
@ -92,11 +95,11 @@ void Thread::start()
|
||||
l4_utcb_tcr_u(foc_utcb)->user[UTCB_TCR_THREAD_OBJ] = (addr_t)this;
|
||||
|
||||
/* register initial IP and SP at core */
|
||||
_cpu_session->start(_thread_cap, (addr_t)_thread_start, _stack->top());
|
||||
cpu_thread.start((addr_t)_thread_start, _stack->top());
|
||||
}
|
||||
|
||||
|
||||
void Thread::cancel_blocking()
|
||||
{
|
||||
_cpu_session->cancel_blocking(_thread_cap);
|
||||
Cpu_thread_client(_thread_cap).cancel_blocking();
|
||||
}
|
||||
|
Reference in New Issue
Block a user