mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-31 00:24:51 +00:00
nova: extend pd_session by assign_pci function
This commit is contained in:
parent
c114014c1c
commit
c36f6a04a7
@ -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); }
|
||||
};
|
||||
}
|
||||
|
||||
|
67
base-nova/include/pd_session/pd_session.h
Normal file
67
base-nova/include/pd_session/pd_session.h
Normal 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_ */
|
50
base-nova/src/core/include/pd_session_component.h
Normal file
50
base-nova/src/core/include/pd_session_component.h
Normal 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_ */
|
24
base-nova/src/core/pd_session_extension.cc
Normal file
24
base-nova/src/core/pd_session_extension.cc
Normal 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;
|
||||
}
|
@ -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
|
||||
|
||||
|
@ -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; }
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user