Sound Open Firmware
Loading...
Searching...
No Matches
vregion.h File Reference

Pre-allocated contiguous virtual memory region allocator (lifetime vs interim). More...

Include dependency graph for vregion.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  vregion_mem_type { VREGION_MEM_TYPE_INTERIM , VREGION_MEM_TYPE_LIFETIME , VREGION_MEM_TYPE_INVALID }
 Memory allocation modes within a virtual memory region. More...
 

Functions

struct vregion * vregion_create (size_t memsize)
 Create a new virtual region instance.
 
struct vregion * vregion_create_map (uintptr_t *vreg_start, size_t *vreg_size)
 Create and map a new virtual region instance accessible by user-space domains.
 
void vregion_set_interim (struct vregion *vr)
 Switch virtual region allocations to interim mode.
 
struct vregion * vregion_get (struct vregion *vr)
 Increment virtual region's user count.
 
struct vregion * vregion_put (struct vregion *vr)
 Decrement virtual region's user count or destroy it.
 
void * vregion_alloc_align (struct vregion *vr, size_t size, size_t alignment)
 Allocate aligned memory from the specified virtual region.
 
void * vregion_alloc_coherent_align (struct vregion *vr, size_t size, size_t alignment)
 Allocate aligned coherent (uncached) memory from the specified virtual region.
 
static void * vregion_alloc (struct vregion *vr, size_t size)
 Allocate memory from the specified virtual region.
 
static void * vregion_alloc_coherent (struct vregion *vr, size_t size)
 Allocate naturally aligned coherent (uncached) memory from the specified virtual region.
 
void vregion_free (struct vregion *vr, void *ptr)
 Free memory allocated from the specified virtual region.
 
void vregion_info (struct vregion *vr)
 Log virtual region memory usage.
 
void vregion_mem_info (struct vregion *vr, size_t *size, uintptr_t *start)
 Retrieve virtual region memory base address and size.
 
bool vregion_verify (struct vregion *vr)
 Validate that a virtual region handle is genuine and isolated from user space.
 

Detailed Description

Pre-allocated contiguous virtual memory region allocator (lifetime vs interim).