Loading...
Searching...
No Matches
capability
Go to the documentation of this file.
// vim:set ft=cpp: -*- Mode: C++ -*-
/*
* (c) 2008-2009,2015 Author(s)
* economic rights: Technische Universität Dresden (Germany)
*
* License: see LICENSE.spdx (in this directory or the directories above)
*/
#pragma once
#include <l4/sys/consts.h>
#include <l4/sys/types.h>
#include <l4/sys/kobject>
#include <l4/sys/task.h>
namespace L4
{
/* Forward declarations for our kernel object classes. */
class Task;
class Thread;
class Thread_group;
class Factory;
class Irq;
class Log;
class Vm;
class Vcpu_context;
class Kobject;
#if __cplusplus >= 201103L
# define L4_DISABLE_COPY(_class) \
public: \
_class(_class const &) = delete; \
_class operator = (_class const &) = delete; \
private:
#else
# define L4_DISABLE_COPY(_class) \
private: \
_class(_class const &); \
_class operator = (_class const &);
#endif
#define L4_KOBJECT_DISABLE_COPY(_class) \
protected: \
_class(); \
L4_DISABLE_COPY(_class)
#define L4_KOBJECT(_class) L4_KOBJECT_DISABLE_COPY(_class)
inline l4_msgtag_t
Cap_base::validate(Cap<Task> task, l4_utcb_t *u) const noexcept
{
return is_valid() ? l4_task_cap_valid_u(task.cap(), _c, u)
: l4_msgtag(0, 0, 0, 0);
}
inline l4_msgtag_t
Cap_base::validate(l4_utcb_t *u) const noexcept
{
return is_valid() ? l4_task_cap_valid_u(L4_BASE_TASK_CAP, _c, u)
: l4_msgtag(0, 0, 0, 0);
}
}; // namespace L4
#include <l4/sys/meta>
namespace L4 {
template< typename T, typename F >
inline
Cap<T> cap_dynamic_cast(Cap<F> const &c) noexcept
{
if (!c.is_valid())
return Cap<T>::Invalid;
Cap<Meta> mc = cap_reinterpret_cast<Meta>(c);
Type_info const *m = kobject_typeid<T>();
if (m->proto() && l4_error(mc->supports(m->proto())) > 0)
return Cap<T>(c.cap());
// FIXME: use generic checker
#if 0
if (l4_error(mc->supports(T::kobject_proto())) > 0)
return Cap<T>(c.cap());
#endif
return Cap<T>::Invalid;
}
}
L4::Cap_base::_c
l4_cap_idx_t _c
The C representation of a capability selector.
Definition capability.h:203
L4::Cap_base::is_valid
bool is_valid() const noexcept
Test whether the capability is a valid capability index (i.e., not L4_INVALID_CAP).
Definition capability.h:57
L4::Cap_base::Invalid
@ Invalid
Invalid capability selector.
Definition capability.h:42
L4::Cap_base::validate
l4_msgtag_t validate(l4_utcb_t *u=l4_utcb()) const noexcept
Check whether a capability is present (refers to an object).
Definition capability:81
L4::Cap
C++ interface for capabilities.
Definition capability.h:224
L4::Factory
C++ Factory interface, see Factory for the C interface.
Definition factory:39
L4::Irq
C++ Irq interface, see IRQs for the C interface.
Definition irq:121
L4::Kobject
Base class for all kinds of kernel objects and remote objects, referenced by capabilities.
Definition kobject:37
L4::Task
C++ interface of the Task kernel object, see Task for the C interface.
Definition task:36
L4::Thread_group
C++ L4 kernel thread group interface, see Thread groups for the C interface.
Definition thread_group:37
L4::Thread
C++ L4 kernel thread interface, see Thread for the C interface.
Definition thread:55
L4::Vm
Virtual machine host address space.
Definition __vm-arm.h:18
L4_BASE_TASK_CAP
@ L4_BASE_TASK_CAP
Capability selector for the current task.
Definition consts.h:327
l4_error
long l4_error(l4_msgtag_t tag) L4_NOTHROW
Get IPC error code if any or message tag label otherwise for an IPC call.
Definition ipc.h:646
L4::kobject_typeid
Type_info const * kobject_typeid() noexcept
Get the L4::Type_info for the L4Re interface given in T.
Definition __typeinfo.h:682
l4_msgtag
l4_msgtag_t l4_msgtag(long label, unsigned words, unsigned items, unsigned flags) L4_NOTHROW
Create a message tag from the specified values.
Definition types.h:405
l4_utcb_t
struct l4_utcb_t l4_utcb_t
Opaque type for the UTCB.
Definition utcb.h:56
consts.h
Common constants.
task.h
Common task related definitions.
types.h
Common L4 ABI Data Types.
L4
L4 low-level kernel interface.
Definition l4sys-l4f-groups.dox:50
L4::cap_reinterpret_cast
Cap< T > cap_reinterpret_cast(Cap< F > const &c) noexcept
reinterpret_cast for capabilities.
Definition capability.h:447
L4::cap_dynamic_cast
Cap< T > cap_dynamic_cast(Cap< F > const &c) noexcept
dynamic_cast for capabilities.
Definition capability:116
L4::Type_info
Dynamic Type Information for L4Re Interfaces.
Definition __typeinfo.h:500
l4_msgtag_t
Message tag data structure.
Definition types.h:154
meta
Meta interface for getting dynamic type information about objects behind capabilities.