NOVA: force to map cap in pd_session::assing_pd

This commit is contained in:
Alexander Boettcher 2012-07-30 11:32:06 +02:00 committed by Norman Feske
parent 9c57fd7229
commit 5620eca7b9
7 changed files with 66 additions and 16 deletions

View File

@ -17,15 +17,18 @@
#include <base/ipc_generic.h>
inline void Genode::Ipc_ostream::_marshal_capability(Genode::Native_capability const &cap)
inline void
Genode::Ipc_ostream::_marshal_capability(Genode::Native_capability const &cap)
{
if (cap.valid())
_snd_msg->snd_append_pt_sel(cap.local_name(),
cap.dst().rights());
cap.dst().rights(),
cap.trans_map());
}
inline void Genode::Ipc_istream::_unmarshal_capability(Genode::Native_capability &cap)
inline void
Genode::Ipc_istream::_unmarshal_capability(Genode::Native_capability &cap)
{
addr_t pt_sel = _rcv_msg->rcv_pt_sel();
cap = Native_capability(pt_sel);

View File

@ -31,7 +31,10 @@ namespace Genode {
{
public:
enum { MAX_CAP_ARGS_LOG2 = 2, MAX_CAP_ARGS = 1 << MAX_CAP_ARGS_LOG2 };
enum {
MAX_CAP_ARGS_LOG2 = 2,
MAX_CAP_ARGS = 1 << MAX_CAP_ARGS_LOG2
};
protected:
@ -48,6 +51,7 @@ namespace Genode {
struct {
addr_t sel;
unsigned rights;
bool trans_map;
} _snd_pt_sel [MAX_CAP_ARGS];
/**
@ -61,13 +65,15 @@ namespace Genode {
} _rcv_pt_sel [MAX_CAP_ARGS];
/**
* Read counter for unmarshalling portal capability selectors
* Read counter for unmarshalling portal capability
* selectors
*/
unsigned _rcv_pt_sel_cnt;
unsigned _rcv_pt_sel_max;
/**
* Number of capabilities which has been received, reported by the kernel.
* Number of capabilities which has been received,
* reported by the kernel.
*/
unsigned _rcv_items;
@ -113,13 +119,15 @@ namespace Genode {
* Append portal capability selector to message buffer
*/
inline bool snd_append_pt_sel(addr_t pt_sel,
unsigned rights)
unsigned rights,
bool trans_map)
{
if (_snd_pt_sel_cnt >= MAX_CAP_ARGS - 1)
return false;
_snd_pt_sel[_snd_pt_sel_cnt ].sel = pt_sel;
_snd_pt_sel[_snd_pt_sel_cnt++].rights = rights;
_snd_pt_sel[_snd_pt_sel_cnt ].sel = pt_sel;
_snd_pt_sel[_snd_pt_sel_cnt ].rights = rights;
_snd_pt_sel[_snd_pt_sel_cnt++].trans_map = trans_map;
return true;
}
@ -139,11 +147,12 @@ namespace Genode {
* \return portal-capability selector, or
* -1 if index is invalid
*/
Nova::Obj_crd snd_pt_sel(addr_t i)
Nova::Obj_crd snd_pt_sel(addr_t i, bool &trans_map)
{
if (i >= _snd_pt_sel_cnt)
return Nova::Obj_crd();
trans_map = _snd_pt_sel[i].trans_map;
return Nova::Obj_crd(_snd_pt_sel[i].sel, 0,
_snd_pt_sel[i].rights);
}

View File

@ -0,0 +1,36 @@
/*
* \brief Client-side pd session interface
* \author Christian Helmuth
* \date 2006-07-12
*/
/*
* 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__PD_SESSION__CLIENT_H_
#define _INCLUDE__PD_SESSION__CLIENT_H_
#include <pd_session/capability.h>
#include <base/rpc_client.h>
namespace Genode {
struct Pd_session_client : Rpc_client<Pd_session>
{
explicit Pd_session_client(Pd_session_capability session)
: Rpc_client<Pd_session>(session) { }
int bind_thread(Thread_capability thread) {
return call<Rpc_bind_thread>(thread); }
int assign_parent(Parent_capability parent) {
parent.solely_map();
return call<Rpc_assign_parent>(parent); }
};
}
#endif /* _INCLUDE__PD_SESSION__CLIENT_H_ */

View File

View File

@ -82,10 +82,11 @@ static bool copy_msgbuf_to_utcb(Nova::Utcb *utcb, Msgbuf_base *snd_msg,
/* append portal capability selectors */
for (unsigned i = 0; i < snd_msg->snd_pt_sel_cnt(); i++) {
Nova::Obj_crd crd = snd_msg->snd_pt_sel(i);
bool trans_map = true;
Nova::Obj_crd crd = snd_msg->snd_pt_sel(i, trans_map);
if (crd.base() == ~0UL) continue;
if (!utcb->append_item(crd, i, false, false, true))
if (!utcb->append_item(crd, i, false, false, trans_map))
return false;
}

View File

@ -114,15 +114,16 @@ void Rpc_entrypoint::_activation_entry()
ep->_curr_obj = ep->obj_by_id(id_pt);
if (!ep->_curr_obj || !id_pt) {
/*
ep->_curr_obj = ep->obj_by_id(srv.badge());
if (!ep->_curr_obj) {
*/
PERR("could not look up server object, "
" return from call badge=%lx id_pt=%lx",
srv.badge(), id_pt);
ep->_curr_obj_lock.unlock();
srv << IPC_REPLY;
}
// }
}
ep->_curr_obj->lock();

View File

@ -26,7 +26,7 @@ namespace Genode {
int _thread_cnt;
Native_capability _parent;
int _id;
int _pd_sel;
addr_t _pd_sel;
public:
@ -68,7 +68,7 @@ namespace Genode {
/**
* Assign PD selector to PD
*/
void assign_pd(int pd_sel) { _pd_sel = pd_sel; }
void assign_pd(addr_t pd_sel) { _pd_sel = pd_sel; }
addr_t pd_sel() { return _pd_sel; }