diff --git a/base-nova/include/pd_session/client.h b/base-nova/include/pd_session/client.h index 738c51302..18f78dc7e 100644 --- a/base-nova/include/pd_session/client.h +++ b/base-nova/include/pd_session/client.h @@ -27,9 +27,14 @@ namespace Genode { int bind_thread(Thread_capability thread) { return call(thread); } - int assign_parent(Parent_capability parent) { + int assign_parent(Parent_capability parent) + { parent.solely_map(); - return call(parent); } + return call(parent); + } + + bool assign_pci(addr_t pci_config_memory_address) { + return call(pci_config_memory_address); } }; } diff --git a/base-nova/include/pd_session/pd_session.h b/base-nova/include/pd_session/pd_session.h new file mode 100644 index 000000000..41e3e7776 --- /dev/null +++ b/base-nova/include/pd_session/pd_session.h @@ -0,0 +1,67 @@ +/* + * \brief Protection domain (PD) session interface + * \author Christian Helmuth + * \date 2006-06-27 + * + * A pd session represents the protection domain of a program. + */ + +/* + * Copyright (C) 2006-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. + */ + +#ifndef _INCLUDE__PD_SESSION__PD_SESSION_H_ +#define _INCLUDE__PD_SESSION__PD_SESSION_H_ + +#include +#include +#include + +namespace Genode { + + struct Pd_session : Session + { + static const char *service_name() { return "PD"; } + + virtual ~Pd_session() { } + + /** + * Bind thread to protection domain + * + * \param thread capability of thread to bind + * + * \return 0 on success or negative error code + * + * After successful bind, the thread will execute inside this + * protection domain when started. + */ + virtual int bind_thread(Thread_capability thread) = 0; + + /** + * Assign parent to protection domain + * + * \param parent capability of parent interface + * \return 0 on success, or negative error code + */ + virtual int assign_parent(Parent_capability parent) = 0; + + + virtual bool assign_pci(addr_t) = 0; + + /********************* + ** RPC declaration ** + *********************/ + + GENODE_RPC(Rpc_bind_thread, int, bind_thread, Thread_capability); + GENODE_RPC(Rpc_assign_parent, int, assign_parent, Parent_capability); + GENODE_RPC(Rpc_assign_pci, bool, assign_pci, addr_t); + + GENODE_RPC_INTERFACE(Rpc_bind_thread, Rpc_assign_parent, + Rpc_assign_pci); + }; +} + +#endif /* _INCLUDE__PD_SESSION__PD_SESSION_H_ */ diff --git a/base-nova/src/core/include/pd_session_component.h b/base-nova/src/core/include/pd_session_component.h new file mode 100644 index 000000000..4177b040e --- /dev/null +++ b/base-nova/src/core/include/pd_session_component.h @@ -0,0 +1,50 @@ +/* + * \brief Core-specific instance of the PD session interface + * \author Christian Helmuth + * \date 2006-07-17 + */ + +/* + * Copyright (C) 2006-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. + */ + +#ifndef _CORE__INCLUDE__PD_SESSION_COMPONENT_H_ +#define _CORE__INCLUDE__PD_SESSION_COMPONENT_H_ + +/* Genode includes */ +#include +#include + +/* core includes */ +#include + +namespace Genode { + + class Pd_session_component : public Rpc_object + { + private: + + Platform_pd _pd; + Parent_capability _parent; + Rpc_entrypoint *_thread_ep; + + public: + + Pd_session_component(Rpc_entrypoint *thread_ep, const char *args) + : _thread_ep(thread_ep) { } + + + /**************************/ + /** PD session interface **/ + /**************************/ + + int bind_thread(Thread_capability); + int assign_parent(Parent_capability); + bool assign_pci(addr_t); + }; +} + +#endif /* _CORE__INCLUDE__PD_SESSION_COMPONENT_H_ */ diff --git a/base-nova/src/core/pd_session_extension.cc b/base-nova/src/core/pd_session_extension.cc new file mode 100644 index 000000000..a0f38f025 --- /dev/null +++ b/base-nova/src/core/pd_session_extension.cc @@ -0,0 +1,24 @@ +/* + * \brief Extension of core implementation of the PD session interface + * \author Alexander Boettcher + * \date 2013-01-11 + */ + +/* + * Copyright (C) 2013-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. + */ + +/* Core */ +#include + +using namespace Genode; + + +bool Pd_session_component::assign_pci(addr_t pci_config_memory) +{ + uint8_t res = Nova::assign_pci(_pd.pd_sel(), pci_config_memory, 0); + return res == Nova::NOVA_OK; +} diff --git a/base-nova/src/core/target.inc b/base-nova/src/core/target.inc index e65266759..cf721f485 100644 --- a/base-nova/src/core/target.inc +++ b/base-nova/src/core/target.inc @@ -32,6 +32,7 @@ SRC_CC = main.cc \ echo.cc \ dump_alloc.cc \ cpu_session_extension.cc \ + pd_session_extension.cc \ core_printf.cc \ pager.cc diff --git a/base/include/pd_session/client.h b/base/include/pd_session/client.h index 296ef9c48..fa495e88a 100644 --- a/base/include/pd_session/client.h +++ b/base/include/pd_session/client.h @@ -29,6 +29,8 @@ namespace Genode { int assign_parent(Parent_capability parent) { return call(parent); } + + bool assign_pci(addr_t) { return false; } }; }