genode/repos/base-nova/src/core/include/imprint_badge.h
Norman Feske 88b358c5ef Unification of native_capability.h
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
2016-07-11 13:07:37 +02:00

34 lines
804 B
C++

/*
* \brief Utility to imprint a badge into a NOVA portal
* \author Norman Feske
* \date 2016-03-03
*/
/*
* 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 _CORE__INCLUDE__IMPRINT_BADGE_H_
#define _CORE__INCLUDE__IMPRINT_BADGE_H_
/* NOVA includes */
#include <nova/syscalls.h>
static inline bool imprint_badge(unsigned long pt_sel, unsigned long badge)
{
using namespace Nova;
/* assign badge to portal */
if (pt_ctrl(pt_sel, badge) != NOVA_OK)
return false;
/* disable PT_CTRL permission to prevent subsequent imprint attempts */
revoke(Obj_crd(pt_sel, 0, Obj_crd::RIGHT_PT_CTRL));
return true;
}
#endif /* _CORE__INCLUDE__IMPRINT_BADGE_H_ */