nova: extend pd_session by assign_pci function

This commit is contained in:
Alexander Boettcher 2013-02-11 11:44:04 +01:00 committed by Norman Feske
parent c114014c1c
commit c36f6a04a7
6 changed files with 151 additions and 2 deletions

View File

@ -27,9 +27,14 @@ namespace Genode {
int bind_thread(Thread_capability thread) {
return call<Rpc_bind_thread>(thread); }
int assign_parent(Parent_capability parent) {
int assign_parent(Parent_capability parent)
{
parent.solely_map();
return call<Rpc_assign_parent>(parent); }
return call<Rpc_assign_parent>(parent);
}
bool assign_pci(addr_t pci_config_memory_address) {
return call<Rpc_assign_pci>(pci_config_memory_address); }
};
}

View File

@ -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 <thread/capability.h>
#include <parent/capability.h>
#include <session/session.h>
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_ */

View File

@ -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 <base/rpc_server.h>
#include <pd_session/pd_session.h>
/* core includes */
#include <platform_pd.h>
namespace Genode {
class Pd_session_component : public Rpc_object<Pd_session>
{
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_ */

View File

@ -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 <pd_session_component.h>
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;
}

View File

@ -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

View File

@ -29,6 +29,8 @@ namespace Genode {
int assign_parent(Parent_capability parent) {
return call<Rpc_assign_parent>(parent); }
bool assign_pci(addr_t) { return false; }
};
}