genode/base-nova/include/base/ipc.h
Sebastian Sumpf bbce38cb36 Do not marshal invalid capabilities on NOVA/x86
We send a local name of ~0L instead, if this is encountered during the
unmarshalling we generate an invalid 'Native_capability' (Fixes #148).
2012-03-13 16:32:23 +01:00

39 lines
920 B
C

/*
* \brief NOVA-specific supplements to the IPC framework
* \author Norman Feske
* \date 2010-01-27
*/
/*
* Copyright (C) 2010-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__BASE__IPC_H_
#define _INCLUDE__BASE__IPC_H_
#include <base/ipc_generic.h>
inline void Genode::Ipc_ostream::_marshal_capability(Genode::Native_capability const &cap)
{
long unique_id = cap.valid() ? cap.local_name() : ~0L;
_write_to_buf(unique_id);
if (cap.valid())
_snd_msg->snd_append_pt_sel(cap.dst());
}
inline void Genode::Ipc_istream::_unmarshal_capability(Genode::Native_capability &cap)
{
long unique_id = 0;
_read_from_buf(unique_id);
int pt_sel = unique_id != ~0L ? _rcv_msg->rcv_pt_sel() : 0;
cap = Native_capability(pt_sel, unique_id);
}
#endif /* _INCLUDE__BASE__IPC_H_ */