genode/repos/base-nova/src/core/cpu_session_extension.cc
Norman Feske 0c299c5e08 base: separate native CPU from CPU session
This patch unifies the CPU session interface across all platforms. The
former differences are moved to respective "native-CPU" interfaces.

NOVA is not covered by the patch and still relies on a custom version of
the core-internal 'cpu_session_component.h'. However, this will soon be
removed once the ongoing rework of pause/single-step on NOVA is
completed.

Fixes #1922
2016-04-25 10:47:57 +02:00

49 lines
1.1 KiB
C++

/**
* \brief Core implementation of the CPU session interface extension
* \author Alexander Boettcher
* \date 2012-07-27
*/
/*
* Copyright (C) 2012-2013 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 includes */
#include <cpu_session_component.h>
using namespace Genode;
Native_capability
Cpu_session_component::pause_sync(Thread_capability thread_cap)
{
auto lambda = [] (Cpu_thread_component *thread) {
if (!thread || !thread->platform_thread())
return Native_capability();
return thread->platform_thread()->pause();
};
return _thread_ep->apply(thread_cap, lambda);
}
Native_capability
Cpu_session_component::single_step_sync(Thread_capability thread_cap, bool enable)
{
using namespace Genode;
auto lambda = [enable] (Cpu_thread_component *thread) {
if (!thread || !thread->platform_thread())
return Native_capability();
return thread->platform_thread()->single_step_sync(enable);
};
return _thread_ep->apply(thread_cap, lambda);
}