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:
Norman Feske
2016-05-10 18:05:38 +02:00
committed by Christian Helmuth
parent 59aec6114b
commit a99989af40
66 changed files with 1261 additions and 1384 deletions

View File

@ -32,16 +32,19 @@ using namespace Genode;
* thread. Those information will be provided to core by the constructor of
* the 'Platform_env' of the new process.
*/
Child::Process::Initial_thread::Initial_thread(Cpu_session &cpu,
Pd_session_capability pd,
char const *name)
Child::Initial_thread::Initial_thread(Cpu_session &cpu,
Pd_session_capability pd,
Name const &name)
:
cpu(cpu),
cap(cpu.create_thread(pd, name, Affinity::Location(), Cpu_session::Weight()))
_cpu(cpu),
_cap(cpu.create_thread(pd, name, Affinity::Location(), Cpu_session::Weight()))
{ }
Child::Process::Initial_thread::~Initial_thread() { }
Child::Initial_thread::~Initial_thread() { }
void Child::Initial_thread::start(addr_t) { }
/*
@ -60,13 +63,12 @@ Child::Process::Process(Dataspace_capability elf_ds,
Pd_session_capability pd_cap,
Pd_session &pd,
Ram_session &ram,
Cpu_session &cpu,
Initial_thread_base &initial_thread,
Region_map &local_rm,
Region_map &remote_rm,
Parent_capability parent_cap,
char const *name)
Parent_capability parent_cap)
:
initial_thread(cpu, pd_cap, name),
initial_thread(initial_thread),
loaded_executable(elf_ds, ldso_ds, ram, local_rm, remote_rm, parent_cap)
{
/* skip loading when called during fork */

View File

@ -18,6 +18,7 @@
#include <base/snprintf.h>
#include <base/sleep.h>
#include <linux_native_cpu/client.h>
#include <cpu_thread/client.h>
/* base-internal includes */
#include <base/internal/stack.h>
@ -154,5 +155,5 @@ void Thread::start()
void Thread::cancel_blocking()
{
_cpu_session->cancel_blocking(_thread_cap);
Cpu_thread_client(_thread_cap).cancel_blocking();
}