mirror of
https://github.com/mmueller41/genode.git
synced 2026-01-21 20:42:56 +01:00
This patch establishes the sole use of generic headers across all kernels. The common 'native_capability.h' is based on the version of base-sel4. All traditional L4 kernels and Linux use the same implementation of the capability-lifetime management. On base-hw, NOVA, Fiasco.OC, and seL4, custom implementations (based on their original mechanisms) are used, with the potential to unify them further in the future. This change achieves binary compatibility of dynamically linked programs across all kernels. Furthermore, the patch introduces a Native_capability::print method, which allows the easy output of the kernel-specific capability representation using the base/log.h API. Issue #1993
41 lines
937 B
C++
41 lines
937 B
C++
/*
|
|
* \brief Capability helper
|
|
* \author Norman Feske
|
|
* \date 2016-06-22
|
|
*/
|
|
|
|
/*
|
|
* Copyright (C) 2016 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__INTERNAL__CAPABILITY_SPACE_H_
|
|
#define _INCLUDE__BASE__INTERNAL__CAPABILITY_SPACE_H_
|
|
|
|
/* Genode includes */
|
|
#include <base/capability.h>
|
|
|
|
/* base-hw includes */
|
|
#include <kernel/interface.h>
|
|
|
|
namespace Genode { namespace Capability_space {
|
|
|
|
/**
|
|
* Return kernel capability selector of Genode capability
|
|
*/
|
|
static inline Kernel::capid_t capid(Native_capability const &cap)
|
|
{
|
|
addr_t const index = (addr_t)cap.data();
|
|
return index;
|
|
}
|
|
|
|
static inline Native_capability import(Kernel::capid_t capid)
|
|
{
|
|
return Native_capability(*(Native_capability::Data *)(addr_t)capid);
|
|
}
|
|
} }
|
|
|
|
#endif /* _INCLUDE__BASE__INTERNAL__CAPABILITY_SPACE_H_ */
|