Loading...
Searching...
No Matches
L4Re::Util Namespace Reference

Documentation of the L4 Runtime Environment utility functionality in C++. More...

## Data Structures

class | Cap_alloc_base
| Capability allocator. More...
class | Br_manager
| Buffer-register (BR) manager for L4::Server. More...
struct | Br_manager_hooks
| Predefined server-loop hooks for a server loop using the Br_manager. More...
struct | Br_manager_timeout_hooks
| Predefined server-loop hooks for a server with using the Br_manager and a timeout queue. More...
class | Smart_cap_auto
| Helper for Unique_cap and Unique_del_cap. More...
class | Smart_count_cap
| Helper for Ref_cap and Ref_del_cap. More...
struct | Ref_cap
| Automatic capability that implements automatic free and unmap of the capability selector. More...
struct | Ref_del_cap
| Automatic capability that implements automatic free and unmap+delete of the capability selector. More...
class | _Cap_alloc
| Adapter to expose the cap allocator implementation as L4Re::Cap_alloc compatible class. More...
struct | Counter
| Counter for Counting_cap_alloc with variable data width. More...
struct | Counter_atomic
| Thread safe version of counter for Counting_cap_alloc. More...
class | Counting_cap_alloc
| Internal reference-counting cap allocator. More...
class | Dataspace_svr
| Dataspace server class. More...
class | Event_t
| Convenience wrapper for getting access to an event object. More...
class | Event_buffer_t
| Event_buffer utility class. More...
class | Event_buffer_consumer_t
| An event buffer consumer. More...
class | Event_svr
| Convenience wrapper for implementing an event server. More...
class | Item_alloc_base
| Item allocator. More...
class | Object_registry
| A registry that manages server objects and their attached IPC gates for a single server loop for a specific thread. More...
class | Registry_server
| A server loop object which has a Object_registry included. More...
class | Vcon_svr
| Console server template class. More...
class | Bitmap_base
| Basic bitmap abstraction. More...
class | Bitmap
| A static bitmap. More...

## Typedefs

template<typename T>
using | Shared_cap = L4::Detail::Shared_cap_impl<T, Smart_count_cap<L4_FP_ALL_SPACES>>
| Shared capability that implements automatic free and unmap of the capability selector.
template<typename T>
using | shared_cap = L4::Detail::Shared_cap_impl<T, Smart_count_cap<L4_FP_ALL_SPACES>>
| Shared capability that implements automatic free and unmap of the capability selector.
template<typename T>
using | Shared_del_cap = L4::Detail::Shared_cap_impl<T, Smart_count_cap<L4_FP_DELETE_OBJ>>
| Shared capability that implements automatic free and unmap+delete of the capability selector.
template<typename T>
using | shared_del_cap = L4::Detail::Shared_cap_impl<T, Smart_count_cap<L4_FP_DELETE_OBJ>>
| Shared capability that implements automatic free and unmap+delete of the capability selector.
template<typename T>
using | Unique_cap = L4::Detail::Unique_cap_impl<T, Smart_cap_auto<L4_FP_ALL_SPACES>>
| Unique capability that implements automatic free and unmap of the capability selector.
template<typename T>
using | unique_cap = L4::Detail::Unique_cap_impl<T, Smart_cap_auto<L4_FP_ALL_SPACES>>
| Unique capability that implements automatic free and unmap of the capability selector.
template<typename T>
using | Unique_del_cap = L4::Detail::Unique_cap_impl<T, Smart_cap_auto<L4_FP_DELETE_OBJ>>
| Unique capability that implements automatic free and unmap+delete of the capability selector.
template<typename T>
using | unique_del_cap = L4::Detail::Unique_cap_impl<T, Smart_cap_auto<L4_FP_DELETE_OBJ>>
| Unique capability that implements automatic free and unmap+delete of the capability selector.

## Functions

template<typename T>
Ref_cap< T >::Cap | make_ref_cap ()
| Allocate a capability slot and wrap it in a Ref_cap.
template<typename T>
Ref_del_cap< T >::Cap | make_ref_del_cap ()
| Allocate a capability slot and wrap it in a Ref_del_cap.
int | kumem_alloc (l4_addr_t *mem, unsigned pages_order, L4::Cap< L4::Task > task=L4Re::Env::env() ->task(), L4::Cap< L4Re::Rm > rm=L4Re::Env::env() ->rm()) noexcept
| Allocate state area.
template<typename T>
Shared_cap< T > | make_shared_cap ()
| Allocate a capability slot and wrap it in a Shared_cap.
template<typename T>
Shared_del_cap< T > | make_shared_del_cap ()
| Allocate a capability slot and wrap it in a Shared_del_cap.
template<typename T>
Unique_cap< T > | make_unique_cap ()
| Allocate a capability slot and wrap it in an Unique_cap.
template<typename T>
Unique_del_cap< T > | make_unique_del_cap ()
| Allocate a capability slot and wrap it in an Unique_del_cap.

## Variables

_Cap_alloc & | cap_alloc
| Capability allocator.

## Detailed Description

Documentation of the L4 Runtime Environment utility functionality in C++.

## Typedef Documentation

## Shared_cap

template<typename T>

using L4Re::Util::Shared_cap = L4::Detail::Shared_cap_impl<T, Smart_count_cap<L4_FP_ALL_SPACES>>

Shared capability that implements automatic free and unmap of the capability selector.

Template Parameters

  T | Type of the object the capability refers to.

This shared capability implements a counted reference to a capability selector. The capability shall be unmapped and freed when the reference count in the allocator goes to zero.

Usage:

    L4Re::Util::Shared_cap<L4Re::Dataspace> global_ds_cap;

    {
      L4Re::Util::Shared_cap<L4Re::Dataspace>
        ds_cap = make_shared_cap<L4Re::Dataspace>();
      // reference count for the allocated cap selector is now 1

      // use the dataspace cap
      L4Re::chksys(mem_alloc->alloc(4096, ds_cap.get()));

      global_ds_cap = ds_cap;
      // reference count is now 2
      ...
    }
    // reference count dropped to 1 (ds_cap is no longer existing).

Definition at line 48 of file shared_cap.

## shared_cap

template<typename T>

using L4Re::Util::shared_cap = L4::Detail::Shared_cap_impl<T, Smart_count_cap<L4_FP_ALL_SPACES>>

Shared capability that implements automatic free and unmap of the capability selector.

Template Parameters

  T | Type of the object the capability refers to.

This shared capability implements a counted reference to a capability selector. The capability shall be unmapped and freed when the reference count in the allocator goes to zero.

Usage:

    L4Re::Util::Shared_cap<L4Re::Dataspace> global_ds_cap;

    {
      L4Re::Util::Shared_cap<L4Re::Dataspace>
        ds_cap = make_shared_cap<L4Re::Dataspace>();
      // reference count for the allocated cap selector is now 1

      // use the dataspace cap
      L4Re::chksys(mem_alloc->alloc(4096, ds_cap.get()));

      global_ds_cap = ds_cap;
      // reference count is now 2
      ...
    }
    // reference count dropped to 1 (ds_cap is no longer existing).

Definition at line 51 of file shared_cap.

## Shared_del_cap

template<typename T>

using L4Re::Util::Shared_del_cap = L4::Detail::Shared_cap_impl<T, Smart_count_cap<L4_FP_DELETE_OBJ>>

Shared capability that implements automatic free and unmap+delete of the capability selector.

Template Parameters

  T | Type of the object the capability refers to.

This shared capability implements a counted reference to a capability selector. The capability shall be unmapped and freed when the reference count in the allocator goes to zero. The main difference to Shared_cap is that the unmap is done with the deletion flag enabled and this leads to the deletion of the object if the current task holds appropriate deletion rights.

Usage:

    L4Re::Util::Shared_del_cap<L4Re::Dataspace> global_ds_cap;

    {
      L4Re::Util::Shared_del_cap<L4Re::Dataspace>
        ds_cap = make_shared_del_cap<L4Re::Dataspace>();
      // reference count for the allocated cap selector is now 1

      // use the dataspace cap
      L4Re::chksys(mem_alloc->alloc(4096, ds_cap.get()));

      global_ds_cap = ds_cap;
      // reference count is now 2
      ...
    }
    // reference count dropped to 1 (ds_cap is no longer existing).
    ...
    global_ds_cap = L4_INVALID_CAP;
    // reference count dropped to 0 (data space shall be deleted).

Definition at line 98 of file shared_cap.

## shared_del_cap

template<typename T>

using L4Re::Util::shared_del_cap = L4::Detail::Shared_cap_impl<T, Smart_count_cap<L4_FP_DELETE_OBJ>>

Shared capability that implements automatic free and unmap+delete of the capability selector.

Template Parameters

  T | Type of the object the capability refers to.

This shared capability implements a counted reference to a capability selector. The capability shall be unmapped and freed when the reference count in the allocator goes to zero. The main difference to Shared_cap is that the unmap is done with the deletion flag enabled and this leads to the deletion of the object if the current task holds appropriate deletion rights.

Usage:

    L4Re::Util::Shared_del_cap<L4Re::Dataspace> global_ds_cap;

    {
      L4Re::Util::Shared_del_cap<L4Re::Dataspace>
        ds_cap = make_shared_del_cap<L4Re::Dataspace>();
      // reference count for the allocated cap selector is now 1

      // use the dataspace cap
      L4Re::chksys(mem_alloc->alloc(4096, ds_cap.get()));

      global_ds_cap = ds_cap;
      // reference count is now 2
      ...
    }
    // reference count dropped to 1 (ds_cap is no longer existing).
    ...
    global_ds_cap = L4_INVALID_CAP;
    // reference count dropped to 0 (data space shall be deleted).

Definition at line 101 of file shared_cap.

## Unique_cap

template<typename T>

using L4Re::Util::Unique_cap = L4::Detail::Unique_cap_impl<T, Smart_cap_auto<L4_FP_ALL_SPACES>>

Unique capability that implements automatic free and unmap of the capability selector.

Template Parameters

  T | Type of the object the capability refers to.

The ownership of the capability is managed in the same way as unique_ptr.

Usage:

    {
      L4Re::Util::Unique_cap<L4Re::Dataspace>
        ds_cap = L4Re::Util::make_unique_cap<L4Re::Dataspace>();

      // use the dataspace cap
      L4Re::chksys(mem_alloc->alloc(L4_PAGESIZE, ds_cap.get()));

      ...

      // At the end of the scope ds_cap is unmapped and the capability
      // selector is freed.
    }

Definition at line 43 of file unique_cap.

## unique_cap

template<typename T>

using L4Re::Util::unique_cap = L4::Detail::Unique_cap_impl<T, Smart_cap_auto<L4_FP_ALL_SPACES>>

Unique capability that implements automatic free and unmap of the capability selector.

Template Parameters

  T | Type of the object the capability refers to.

The ownership of the capability is managed in the same way as unique_ptr.

Usage:

    {
      L4Re::Util::Unique_cap<L4Re::Dataspace>
        ds_cap = L4Re::Util::make_unique_cap<L4Re::Dataspace>();

      // use the dataspace cap
      L4Re::chksys(mem_alloc->alloc(L4_PAGESIZE, ds_cap.get()));

      ...

      // At the end of the scope ds_cap is unmapped and the capability
      // selector is freed.
    }

Definition at line 46 of file unique_cap.

## Unique_del_cap

template<typename T>

using L4Re::Util::Unique_del_cap = L4::Detail::Unique_cap_impl<T, Smart_cap_auto<L4_FP_DELETE_OBJ>>

Unique capability that implements automatic free and unmap+delete of the capability selector.

Template Parameters

  T | Type of the object the capability refers to.

The main difference to Unique_cap is that the unmap is done with the deletion flag enabled and this leads to the deletion of the object if the current task holds appropriate deletion rights.

Usage:

    {
      L4Re::Util::Unique_del_cap<L4Re::Dataspace>
        ds_cap = make_unique_del_cap<L4Re::Dataspace>());

      // use the dataspace cap
      L4Re::chksys(mem_alloc->alloc(L4_PAGESIZE, ds_cap.get()));

      ...

      // At the end of the scope ds_cap is unmapped and the capability
      // selector is freed. Because the deletion flag is set the data space
      // shall also be deleted (even if there are other references to this
      // data space).
    }

Definition at line 86 of file unique_cap.

## unique_del_cap

template<typename T>

using L4Re::Util::unique_del_cap = L4::Detail::Unique_cap_impl<T, Smart_cap_auto<L4_FP_DELETE_OBJ>>

Unique capability that implements automatic free and unmap+delete of the capability selector.

Template Parameters

  T | Type of the object the capability refers to.

The main difference to Unique_cap is that the unmap is done with the deletion flag enabled and this leads to the deletion of the object if the current task holds appropriate deletion rights.

Usage:

    {
      L4Re::Util::Unique_del_cap<L4Re::Dataspace>
        ds_cap = make_unique_del_cap<L4Re::Dataspace>());

      // use the dataspace cap
      L4Re::chksys(mem_alloc->alloc(L4_PAGESIZE, ds_cap.get()));

      ...

      // At the end of the scope ds_cap is unmapped and the capability
      // selector is freed. Because the deletion flag is set the data space
      // shall also be deleted (even if there are other references to this
      // data space).
    }

Definition at line 89 of file unique_cap.

## Function Documentation

## make_shared_cap()

template<typename T>

Shared_cap< T > L4Re::Util::make_shared_cap | ( |  | ) |

Allocate a capability slot and wrap it in a Shared_cap.

Template Parameters

  T | Type of the object the capability refers to.

Definition at line 60 of file shared_cap.

References cap_alloc.

Referenced by L4virtio::Svr::Dev_config::Dev_config().

Here is the caller graph for this function:

## make_shared_del_cap()

template<typename T>

Shared_del_cap< T > L4Re::Util::make_shared_del_cap | ( |  | ) |

Allocate a capability slot and wrap it in a Shared_del_cap.

Template Parameters

  T | Type of the object the capability refers to.

Definition at line 110 of file shared_cap.

References cap_alloc.

## make_unique_cap()

template<typename T>

Unique_cap< T > L4Re::Util::make_unique_cap | ( |  | ) |

Allocate a capability slot and wrap it in an Unique_cap.

Template Parameters

  T | Type of the object the capability refers to.

Definition at line 55 of file unique_cap.

References cap_alloc.

Referenced by L4virtio::Driver::Device::driver_connect(), L4virtio::Driver::Block_device::setup_device(), and L4virtio::Driver::Virtio_net_device::setup_device().

Here is the caller graph for this function:

## make_unique_del_cap()

template<typename T>

Unique_del_cap< T > L4Re::Util::make_unique_del_cap | ( |  | ) |

Allocate a capability slot and wrap it in an Unique_del_cap.

Template Parameters

  T | Type of the object the capability refers to.

Definition at line 98 of file unique_cap.

References cap_alloc.