/* * \brief Interface to obtain the parent capability for the component * \author Norman Feske * \date 2013-09-25 * * On Fiasco.OC, we transfer merely the 'local_name' part of the capability * via the '_parent_cap' field of the ELF binary. */ /* * Copyright (C) 2006-2017 Genode Labs GmbH * * This file is part of the Genode OS framework, which is distributed * under the terms of the GNU Affero General Public License version 3. */ #ifndef _INCLUDE__BASE__INTERNAL__PARENT_CAP_H_ #define _INCLUDE__BASE__INTERNAL__PARENT_CAP_H_ /* Genode includes */ #include #include #include /* base-internal includes */ #include #include namespace Genode { static inline Parent_capability parent_cap() { unsigned long const local_name = _parent_cap; static Cap_index *i = cap_map()->insert(local_name, Fiasco::PARENT_CAP); /* * Update local name after a parent capability got reloaded via * 'Platform_env::reload_parent_cap()'. */ if (i->id() != local_name) { cap_map()->remove(i); i = cap_map()->insert(local_name, Fiasco::PARENT_CAP); } return reinterpret_cap_cast(Native_capability(*i)); } } #endif /* _INCLUDE__BASE__INTERNAL__PARENT_CAP_H_ */