/* * \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 #include namespace Genode { struct Cpu_thread_client; } struct Genode::Cpu_thread_client : Rpc_client { explicit Cpu_thread_client(Thread_capability cap) : Rpc_client(cap) { } Dataspace_capability utcb() override { return call(); } void start(addr_t ip, addr_t sp) override { call(ip, sp); } void pause() override { for (;;) { call(); try { /* check if the thread state is valid */ state(); /* the thread is paused */ return; } catch (State_access_failed) { /* the thread is (most likely) running on a different CPU */ } } } void resume() override { call(); } void cancel_blocking() override { call(); } Thread_state state() override { return call(); } void state(Thread_state const &state) override { call(state); } void exception_sigh(Signal_context_capability handler) override { call(handler); } void single_step(bool enabled) override { call(enabled); } void affinity(Affinity::Location location) override { call(location); } unsigned trace_control_index() override { return call(); } Dataspace_capability trace_buffer() override { return call(); } Dataspace_capability trace_policy() override { return call(); } }; #endif /* _INCLUDE__CPU_THREAD__CLIENT_H_ */