L4Re - L4 Runtime Environment
Memory allocator

Memory allocator C interface. More...

+ Collaboration diagram for Memory allocator:

Enumerations

enum  l4re_ma_flags
 Flags for requesting memory at the memory allocator. More...
 

Functions

long l4re_ma_alloc (long size, l4re_ds_t const mem, unsigned long flags) L4_NOTHROW
 Allocate memory. More...
 
long l4re_ma_alloc_align (long size, l4re_ds_t const mem, unsigned long flags, unsigned long align) L4_NOTHROW
 Allocate memory. More...
 
long l4re_ma_free (l4re_ds_t const mem) L4_NOTHROW
 Free memory. More...
 
long l4re_ma_alloc_align_srv (l4_cap_idx_t srv, long size, l4re_ds_t const mem, unsigned long flags, unsigned long align) L4_NOTHROW
 Allocate memory. More...
 
long l4re_ma_free_srv (l4_cap_idx_t srv, l4re_ds_t const mem) L4_NOTHROW
 Free memory. More...
 

Detailed Description

Memory allocator C interface.

Enumeration Type Documentation

◆ l4re_ma_flags

Flags for requesting memory at the memory allocator.

See also
L4Re::Mem_alloc::Mem_alloc_flags

Definition at line 42 of file mem_alloc.h.

Function Documentation

◆ l4re_ma_alloc()

long l4re_ma_alloc ( long  size,
l4re_ds_t const  mem,
unsigned long  flags 
)
inline

Allocate memory.

Parameters
sizeSize to be requested in bytes (granularity is (super)pages and the size is rounded up to this granularity).
memCapability slot to put the requested dataspace in
flagsFlags, see l4re_ma_flags
Returns
0 on success, <0 on error
See also
L4Re::Mem_alloc::alloc

The memory allocator returns a dataspace.

Note
This function is using the L4Re::Env::env()->mem_alloc() service.
Examples:
examples/libs/l4re/c/ma+rm.c.

Definition at line 167 of file mem_alloc.h.

References l4re_ma_alloc_align_srv().

+ Here is the call graph for this function:

◆ l4re_ma_alloc_align()

long l4re_ma_alloc_align ( long  size,
l4re_ds_t const  mem,
unsigned long  flags,
unsigned long  align 
)
inline

Allocate memory.

Parameters
sizeSize to be requested in bytes (granularity is (super)pages and the size is rounded up to this granularity).
memCapability slot to put the requested dataspace in
flagsFlags, see l4re_ma_flags
alignLog2 alignment of dataspace if supported by allocator, will be at least L4_PAGESHIFT, with Super_pages flag set at least L4_SUPERPAGESHIFT, default 0
Returns
0 on success, <0 on error
See also
L4Re::Mem_alloc::alloc and
l4re_ma_alloc

The memory allocator returns a dataspace.

Note
This function is using the L4Re::Env::env()->mem_alloc() service.

Definition at line 175 of file mem_alloc.h.

References l4re_ma_alloc_align_srv().

+ Here is the call graph for this function:

◆ l4re_ma_alloc_align_srv()

long l4re_ma_alloc_align_srv ( l4_cap_idx_t  srv,
long  size,
l4re_ds_t const  mem,
unsigned long  flags,
unsigned long  align 
)

Allocate memory.

Parameters
srvMemory allocator service.
sizeSize to be requested.
memCapability slot to put the requested dataspace in
flagsFlags, see l4re_ma_flags
alignLog2 alignment of dataspace if supported by allocator, will be at least L4_PAGESHIFT, with Super_pages flag set at least L4_SUPERPAGESHIFT, default 0
Returns
0 on success, <0 on error
See also
L4Re::Mem_alloc::alloc

The memory allocator returns a dataspace.

Referenced by l4re_ma_alloc(), and l4re_ma_alloc_align().

+ Here is the caller graph for this function:

◆ l4re_ma_free()

long l4re_ma_free ( l4re_ds_t const  mem)
inline

Free memory.

Parameters
memDataspace to free.
Returns
0 on success, <0 on error
See also
L4Re::Mem_alloc::free
Note
This function is using the L4Re::Env::env()->mem_alloc() service.
Deprecated:
This function is deprecated. Use l4_task_unmap() or similar means to remove a dataspace.

Definition at line 183 of file mem_alloc.h.

References l4re_ma_free_srv().

+ Here is the call graph for this function:

◆ l4re_ma_free_srv()

long l4re_ma_free_srv ( l4_cap_idx_t  srv,
l4re_ds_t const  mem 
)

Free memory.

Parameters
srvMemory allocator service.
memDataspace to free.
Returns
0 on success, <0 on error
See also
L4Re::Mem_alloc::free
Deprecated:
This function is deprecated. Use l4_task_unmap() or similar means to remove a dataspace.

Referenced by l4re_ma_free().

+ Here is the caller graph for this function: