From 5620eca7b9be6d271acb628f468f4ab547efafd7 Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Mon, 30 Jul 2012 11:32:06 +0200 Subject: [PATCH] NOVA: force to map cap in pd_session::assing_pd --- base-nova/include/base/ipc.h | 9 ++++-- base-nova/include/base/ipc_msgbuf.h | 23 ++++++++++----- base-nova/include/pd_session/client.h | 36 ++++++++++++++++++++++++ base-nova/lib/mk/cap_copy.mk | 0 base-nova/src/base/ipc/ipc.cc | 5 ++-- base-nova/src/base/server/server.cc | 5 ++-- base-nova/src/core/include/platform_pd.h | 4 +-- 7 files changed, 66 insertions(+), 16 deletions(-) create mode 100644 base-nova/include/pd_session/client.h create mode 100644 base-nova/lib/mk/cap_copy.mk diff --git a/base-nova/include/base/ipc.h b/base-nova/include/base/ipc.h index cd4cbefe93..a6265e8cdb 100644 --- a/base-nova/include/base/ipc.h +++ b/base-nova/include/base/ipc.h @@ -17,15 +17,18 @@ #include -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); diff --git a/base-nova/include/base/ipc_msgbuf.h b/base-nova/include/base/ipc_msgbuf.h index dc52de26a7..8a32327ec0 100644 --- a/base-nova/include/base/ipc_msgbuf.h +++ b/base-nova/include/base/ipc_msgbuf.h @@ -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); } diff --git a/base-nova/include/pd_session/client.h b/base-nova/include/pd_session/client.h new file mode 100644 index 0000000000..e35bfcdec7 --- /dev/null +++ b/base-nova/include/pd_session/client.h @@ -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 +#include + +namespace Genode { + + struct Pd_session_client : Rpc_client + { + explicit Pd_session_client(Pd_session_capability session) + : Rpc_client(session) { } + + int bind_thread(Thread_capability thread) { + return call(thread); } + + int assign_parent(Parent_capability parent) { + parent.solely_map(); + return call(parent); } + }; +} + +#endif /* _INCLUDE__PD_SESSION__CLIENT_H_ */ diff --git a/base-nova/lib/mk/cap_copy.mk b/base-nova/lib/mk/cap_copy.mk new file mode 100644 index 0000000000..e69de29bb2 diff --git a/base-nova/src/base/ipc/ipc.cc b/base-nova/src/base/ipc/ipc.cc index e74c267982..88ddada0dd 100644 --- a/base-nova/src/base/ipc/ipc.cc +++ b/base-nova/src/base/ipc/ipc.cc @@ -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; } diff --git a/base-nova/src/base/server/server.cc b/base-nova/src/base/server/server.cc index b49aa74342..e86d63c4d5 100644 --- a/base-nova/src/base/server/server.cc +++ b/base-nova/src/base/server/server.cc @@ -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(); diff --git a/base-nova/src/core/include/platform_pd.h b/base-nova/src/core/include/platform_pd.h index 827b15d904..a652cf0989 100644 --- a/base-nova/src/core/include/platform_pd.h +++ b/base-nova/src/core/include/platform_pd.h @@ -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; }