genode/repos/base/include/cpu_thread/client.h
Norman Feske a99989af40 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
2016-05-23 15:52:39 +02:00

69 lines
1.6 KiB
C++

/*
* \brief Client-side CPU thread interface
* \author Norman Feske
* \date 2016-05-10
*/
/*
* 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.
*/
#ifndef _INCLUDE__CPU_THREAD__CLIENT_H_
#define _INCLUDE__CPU_THREAD__CLIENT_H_
#include <cpu_thread/cpu_thread.h>
#include <base/rpc_client.h>
namespace Genode { struct Cpu_thread_client; }
struct Genode::Cpu_thread_client : Rpc_client<Cpu_thread>
{
explicit Cpu_thread_client(Thread_capability cap)
: Rpc_client<Cpu_thread>(cap) { }
Dataspace_capability utcb() override {
return call<Rpc_utcb>(); }
void start(addr_t ip, addr_t sp) override {
call<Rpc_start>(ip, sp); }
void pause() override {
call<Rpc_pause>(); }
void resume() override {
call<Rpc_resume>(); }
void cancel_blocking() override {
call<Rpc_cancel_blocking>(); }
Thread_state state() override {
return call<Rpc_get_state>(); }
void state(Thread_state const &state) override {
call<Rpc_set_state>(state); }
void exception_sigh(Signal_context_capability handler) override {
call<Rpc_exception_sigh>(handler); }
void single_step(bool enabled) override {
call<Rpc_single_step>(enabled); }
void affinity(Affinity::Location location) override {
call<Rpc_affinity>(location); }
unsigned trace_control_index() override {
return call<Rpc_trace_control_index>(); }
Dataspace_capability trace_buffer() override {
return call<Rpc_trace_buffer>(); }
Dataspace_capability trace_policy() override {
return call<Rpc_trace_policy>(); }
};
#endif /* _INCLUDE__CPU_THREAD__CLIENT_H_ */