mirror of
https://github.com/genodelabs/genode.git
synced 2025-03-25 21:38:25 +00:00
NOVA: extend cap session for base-nova
This commit is contained in:
parent
7aa75477e2
commit
cb859a4785
62
base-nova/include/cap_session/cap_session.h
Normal file
62
base-nova/include/cap_session/cap_session.h
Normal file
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* \brief CAP-session interface
|
||||
* \author Norman Feske
|
||||
* \date 2006-06-23
|
||||
*
|
||||
* A 'Cap_session' is an allocator of user-level capabilities.
|
||||
* User-level capabilities are used to reference server objects
|
||||
* across address spaces.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2006-2012 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__CAP_SESSION__CAP_SESSION_H_
|
||||
#define _INCLUDE__CAP_SESSION__CAP_SESSION_H_
|
||||
|
||||
#include <base/native_types.h>
|
||||
#include <session/session.h>
|
||||
|
||||
namespace Genode {
|
||||
|
||||
struct Cap_session : Session
|
||||
{
|
||||
static const char *service_name() { return "CAP"; }
|
||||
|
||||
virtual ~Cap_session() { }
|
||||
|
||||
/**
|
||||
* Allocate new unique userland capability
|
||||
*
|
||||
* \param ep entry point that will use this capability
|
||||
*
|
||||
* \return new userland capability
|
||||
*/
|
||||
virtual Native_capability alloc(Native_capability ep,
|
||||
addr_t entry = 0,
|
||||
addr_t flags = 0) = 0;
|
||||
|
||||
/**
|
||||
* Free userland capability
|
||||
*
|
||||
* \param cap userland capability to free
|
||||
*/
|
||||
virtual void free(Native_capability cap) = 0;
|
||||
|
||||
|
||||
/*********************
|
||||
** RPC declaration **
|
||||
*********************/
|
||||
|
||||
GENODE_RPC(Rpc_alloc, Native_capability, alloc,
|
||||
Native_capability, addr_t, addr_t);
|
||||
GENODE_RPC(Rpc_free, void, free, Native_capability);
|
||||
GENODE_RPC_INTERFACE(Rpc_alloc, Rpc_free);
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* _INCLUDE__CAP_SESSION__CAP_SESSION_H_ */
|
38
base-nova/include/cap_session/client.h
Normal file
38
base-nova/include/cap_session/client.h
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* \brief Client-side CAP session interface
|
||||
* \author Norman Feske
|
||||
* \date 2006-07-10
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2006-2012 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__CAP_SESSION__CLIENT_H_
|
||||
#define _INCLUDE__CAP_SESSION__CLIENT_H_
|
||||
|
||||
#include <cap_session/capability.h>
|
||||
#include <cap_session/cap_session.h>
|
||||
#include <base/rpc_client.h>
|
||||
|
||||
namespace Genode {
|
||||
|
||||
struct Cap_session_client : Rpc_client<Cap_session>
|
||||
{
|
||||
explicit Cap_session_client(Cap_session_capability session)
|
||||
: Rpc_client<Cap_session>(session) { }
|
||||
|
||||
Native_capability alloc(Native_capability ep, addr_t entry = 0,
|
||||
addr_t flags = 0)
|
||||
{
|
||||
return call<Rpc_alloc>(ep, entry, flags);
|
||||
}
|
||||
|
||||
void free(Native_capability cap) { call<Rpc_free>(cap); }
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* _INCLUDE__CAP_SESSION__CLIENT_H_ */
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* \brief Capability allocation service
|
||||
* \author Norman Feske
|
||||
* \date 2006-06-26
|
||||
* \author Alexander Boettcher
|
||||
* \date 2012-07-27
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -34,7 +34,9 @@ namespace Genode {
|
||||
|
||||
public:
|
||||
|
||||
Native_capability alloc(Native_capability ep)
|
||||
Native_capability alloc(Native_capability ep,
|
||||
addr_t entry,
|
||||
addr_t mtd)
|
||||
{
|
||||
Lock::Guard lock_guard(_lock());
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user