Loading...
Searching...
No Matches
L4::Cap_base Class Reference

Base class for all kinds of capabilities. More...

`#include <l4/sys/capability>`

Inheritance diagram for L4::Cap_base:
Collaboration diagram for L4::Cap_base:

## Public Types

enum | No_init_type { No_init }
| Special value for uninitialized capability objects. More...
enum | Cap_type { Invalid = L4_INVALID_CAP }
| Invalid capability type. More...

## Public Member Functions

l4_cap_idx_t | cap () const noexcept
| Return capability selector.
bool | is_valid () const noexcept
| Test whether the capability is a valid capability index (i.e., not L4_INVALID_CAP).
int | invalid_cap_error () const noexcept
| Return the transported error code in an invalid capability index.
l4_fpage_t | fpage (unsigned rights=L4_CAP_FPAGE_RWS) const noexcept
| Return flexpage for the capability.
l4_umword_t | snd_base (unsigned grant=L4_MAP_ITEM_MAP, l4_cap_idx_t base=L4_INVALID_CAP) const noexcept
| Return send base.
bool | operator== (Cap_base const &o) const noexcept
| Test if two capabilities are equal.
bool | operator!= (Cap_base const &o) const noexcept
| Test if two capabilities are not equal.
l4_msgtag_t | validate (l4_utcb_t *u=l4_utcb()) const noexcept
| Check whether a capability is present (refers to an object).
l4_msgtag_t | validate (Cap< Task > task, l4_utcb_t *u=l4_utcb()) const noexcept
| Check whether a capability is present (refers to an object).
void | invalidate () noexcept
| Set this capability to invalid (L4_INVALID_CAP).

## Protected Member Functions

| Cap_base (l4_cap_idx_t c) noexcept
| Generate a capability from its C representation.
| Cap_base (Cap_type cap) noexcept
| Constructor to create an invalid capability.
| Cap_base (l4_default_caps_t cap) noexcept
| Initialize capability with one of the default capabilities.
| Cap_base () noexcept
| Create an uninitialized instance.
void | move (Cap_base const &src) const
| Replace this capability with the contents of src.
void | copy (Cap_base const &src) const
| Copy a capability.

## Protected Attributes

l4_cap_idx_t | _c
| The C representation of a capability selector.

## Detailed Description

Base class for all kinds of capabilities.

Attention
  This class is not for direct use, use L4::Cap instead.

This class contains all the things that are independent of the type of the object referred by the capability.

See also
  L4::Cap for typed capabilities.

Definition at line 25 of file capability.h.

## Member Enumeration Documentation

## Cap_type

enum L4::Cap_base::Cap_type

Invalid capability type.

Enumerator
Invalid | Invalid capability selector.

Definition at line 40 of file capability.h.

## No_init_type

enum L4::Cap_base::No_init_type

Special value for uninitialized capability objects.

Enumerator
No_init | Special value for constructing uninitialized Cap objects.

Definition at line 29 of file capability.h.

## Constructor & Destructor Documentation

## Cap_base() [1/2]

L4::Cap_base::Cap_base | ( | l4_cap_idx_t | c | ) |

inlineexplicitprotectednoexcept

Generate a capability from its C representation.

Parameters

  c | The C capability

Definition at line 149 of file capability.h.

References _c.

Referenced by L4::Cap< A >::Cap(), L4::Cap< A >::Cap(), L4::Cap< A >::Cap(), L4::Cap< A >::Cap(), copy(), move(), operator!=(), and operator==().

Here is the caller graph for this function:

## Cap_base() [2/2]

L4::Cap_base::Cap_base | ( | l4_default_caps_t | cap | ) |

inlineexplicitprotectednoexcept

Initialize capability with one of the default capabilities.

Parameters

  cap | Capability.

Definition at line 160 of file capability.h.

References _c, and cap().

Here is the call graph for this function:

## Member Function Documentation

## cap()

l4_cap_idx_t L4::Cap_base::cap | ( |  | ) | const

inlinenoexcept

Return capability selector.

Returns
  Capability selector.

Definition at line 49 of file capability.h.

References _c.

Referenced by L4::Thread_group::add(), L4Re::Util::Br_manager::alloc_buffer_demand(), L4vbus::Vbus::assign_dma_domain(), L4vbus::Vbus::assign_dma_domain(), L4::Icu::bind(), L4::Rcv_endpoint::bind_snd_destination(), L4::Irq::bind_vcpu(), L4::Cap< A >::Cap(), L4::Cap< A >::Cap(), Cap_base(), Cap_base(), L4::Task::cap_equal(), L4::Task::cap_valid(), L4Re::Smart_count_cap< Unmap_flags >::copy(), L4Re::Util::Smart_count_cap< Unmap_flags >::copy(), L4::Factory::create_factory(), L4::Factory::create_gate(), L4::Factory::create_task(), L4::Factory::create_thread_group(), L4::Task::delete_obj(), L4Re::Util::Smart_cap_auto< Unmap_flags >::free(), L4::Task::map(), L4Re::Util::Event_buffer_consumer_t< Default_event_payload >::process(), L4Re::Util::Br_manager::realloc_rcv_cap(), L4::Thread::register_del_irq(), L4::Thread::register_doorbell_irq(), L4::Task::release_cap(), L4::Thread_group::remove(), L4::Icu::unbind(), and L4vbus::Icu::vicu().

Here is the caller graph for this function:

## copy()

void L4::Cap_base::copy | ( | Cap_base const & | src | ) | const

inlineprotected

Copy a capability.

Parameters

  src | the source capability.

After this operation this capability refers to the same object as src.

Definition at line 192 of file capability.h.

References Cap_base(), fpage(), is_valid(), L4_BASE_TASK_CAP, L4_CAP_FPAGE_RWSD, L4_FPAGE_C_OBJ_RIGHTS, l4_task_map(), and snd_base().

Referenced by L4::Cap< A >::copy().

Here is the call graph for this function:
Here is the caller graph for this function:

## fpage()

l4_fpage_t L4::Cap_base::fpage | ( | unsigned | rights = L4_CAP_FPAGE_RWS | ) | const

inlinenoexcept

Return flexpage for the capability.

Parameters

  rights | Rights, defaults to 'rws'

Returns
  flexpage

Definition at line 74 of file capability.h.

References _c, L4_CAP_FPAGE_RWS, and l4_obj_fpage().

Referenced by copy(), move(), and L4Re::Util::Object_registry::unregister_obj().

Here is the call graph for this function:
Here is the caller graph for this function:

## is_valid()

bool L4::Cap_base::is_valid | ( |  | ) | const

inlinenoexcept

Test whether the capability is a valid capability index (i.e., not L4_INVALID_CAP).

Returns
  True if capability is not invalid, false if invalid

Examples
  examples/libs/l4re/c++/mem_alloc/ma+rm.cc, and examples/libs/l4re/c++/shared_ds/ds_clnt.cc.

Definition at line 57 of file capability.h.

References _c.

Referenced by copy(), L4Re::Smart_count_cap< Unmap_flags >::copy(), L4Re::Util::Smart_cap_auto< Unmap_flags >::free(), L4Re::Util::Event_t< Default_event_payload >::init(), L4Re::Util::Event_t< Default_event_payload >::init_poll(), L4Re::Util::Smart_cap_auto< Unmap_flags >::invalidate(), move(), L4Re::Util::Object_registry::unregister_obj(), validate(), and validate().

Here is the caller graph for this function:

## move()

void L4::Cap_base::move | ( | Cap_base const & | src | ) | const

inlineprotected

Replace this capability with the contents of src.

Parameters

  src | the source capability.

After the operation this capability refers to the object formerly referred to by the source capability src, and the source capability no longer refers to an object.

Definition at line 176 of file capability.h.

References Cap_base(), fpage(), is_valid(), L4_BASE_TASK_CAP, L4_CAP_FPAGE_RWSD, L4_FPAGE_C_OBJ_RIGHTS, L4_MAP_ITEM_GRANT, l4_task_map(), and snd_base().

Referenced by L4::Cap< A >::move().

Here is the call graph for this function:
Here is the caller graph for this function:

## snd_base()

l4_umword_t L4::Cap_base::snd_base | ( | unsigned | grant = L4_MAP_ITEM_MAP,
|  | l4_cap_idx_t | base = L4_INVALID_CAP ) const

inlinenoexcept

Return send base.

Parameters

  grant | Indicates if object shall be granted. Allowed values: L4_MAP_ITEM_MAP, L4_MAP_ITEM_GRANT.
  base | Base capability (first in a bundle of aligned capabilities)

Returns
  Map object.

Definition at line 86 of file capability.h.

References _c, L4_INVALID_CAP, L4_MAP_ITEM_MAP, and l4_map_obj_control().

Referenced by copy(), and move().

Here is the call graph for this function:
Here is the caller graph for this function:

## validate() [1/2]

l4_msgtag_t L4::Cap_base::validate | ( | Cap< Task > | task,
|  | l4_utcb_t * | u = l4_utcb() ) const

inlinenoexcept

Check whether a capability is present (refers to an object).

Parameters

  task | Task to check the capability in.
  u | UTCB to be used for this operation, shall be the UTCB of the calling thread. See l4_utcb.

Return values

  l4_msgtag_t::label() > 0 | Capability is present (refers to an object).
  l4_msgtag_t::label() == 0 | No capability present (void object or invalid capability slot).

A capability is considered present when it refers to an existing kernel object.

Definition at line 74 of file capability.

References _c, is_valid(), and l4_msgtag().

Here is the call graph for this function:

## validate() [2/2]

l4_msgtag_t L4::Cap_base::validate | ( | l4_utcb_t * | u = l4_utcb() | ) | const

inlinenoexcept

Check whether a capability is present (refers to an object).

Parameters

  u | UTCB to be used for this operation, shall be the UTCB of the calling thread. See l4_utcb.

Return values

  l4_msgtag_t::label() > 0 | Capability is present (refers to an object).
  l4_msgtag_t::label() == 0 | No capability present (void object or invalid capability slot).

A capability is considered present when it refers to an existing kernel object.

Definition at line 81 of file capability.

References _c, is_valid(), L4_BASE_TASK_CAP, and l4_msgtag().

Here is the call graph for this function:

The documentation for this class was generated from the following files:

- l4/sys/cxx/capability.h
- l4/sys/capability