a99989af40
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
49 lines
1.0 KiB
C++
49 lines
1.0 KiB
C++
/*
|
|
* \brief Core implementation of the CPU session interface extension
|
|
* \author Norman Feske
|
|
* \date 2016-04-21
|
|
*/
|
|
|
|
/*
|
|
* Copyright (C) 2016 Genode Labs GmbH
|
|
*
|
|
* This file is part of the Genode OS framework, which is distributed
|
|
* under the terms of the GNU General Public License version 2.
|
|
*/
|
|
|
|
/* Genode includes */
|
|
#include <base/stdint.h>
|
|
|
|
/* core-local includes */
|
|
#include <native_cpu_component.h>
|
|
#include <cpu_session_component.h>
|
|
|
|
using namespace Genode;
|
|
|
|
|
|
Native_capability
|
|
Native_cpu_component::pager_cap(Thread_capability thread_cap)
|
|
{
|
|
auto lambda = [] (Cpu_thread_component *thread) {
|
|
if (!thread)
|
|
return Native_capability();
|
|
|
|
return thread->platform_thread().pager()->cap();
|
|
};
|
|
return _thread_ep.apply(thread_cap, lambda);
|
|
}
|
|
|
|
|
|
Native_cpu_component::Native_cpu_component(Cpu_session_component &cpu_session, char const *)
|
|
:
|
|
_cpu_session(cpu_session), _thread_ep(*_cpu_session._thread_ep)
|
|
{
|
|
_thread_ep.manage(this);
|
|
}
|
|
|
|
|
|
Genode::Native_cpu_component::~Native_cpu_component()
|
|
{
|
|
_thread_ep.dissolve(this);
|
|
}
|