General Purpose Memory Allocator API
include/mem/alloc.h View source View on GitHubFunctions
Section titled “Functions”valloc_new
Section titled “valloc_new”void * valloc_new(size_t size, struct alloc_params params) source vfree_new
Section titled “vfree_new”void vfree_new(void *ptr, enum alloc_behavior behavior) source valloc_from_domain
Section titled “valloc_from_domain”void * valloc_from_domain(domain_id_t domain, size_t size) source valloc_full
Section titled “valloc_full”void * valloc_full(size_t size, struct alloc_params params) source vrealloc_full
Section titled “vrealloc_full”void * vrealloc_full(
void *ptr,
size_t size,
struct alloc_params params
) source size_t vsize(void *ptr) source valloc_aligned_full
Section titled “valloc_aligned_full”void * valloc_aligned_full(
size_t size,
size_t align,
struct alloc_params params
) source valloc_pages
Section titled “valloc_pages”void * valloc_pages(size_t page_count, enum alloc_flags flags) source valloc_ptr_in_slab_validate
Section titled “valloc_ptr_in_slab_validate”bool valloc_ptr_in_slab_validate(void *ptr) source Variables
Section titled “Variables”__log_handle_slab_flags
Section titled “__log_handle_slab_flags” LOG_HANDLE_EXTERN(slab_flags) (1 declaration) source
§
struct log_handle __log_handle_slab_flags Macros
Section titled “Macros”ALLOC_PARAMS_CONTRACT
Section titled “ALLOC_PARAMS_CONTRACT”#define ALLOC_PARAMS_CONTRACT(params) source Verify the contract
Expansion
#define ALLOC_PARAMS_CONTRACT(params) \
ct_precond(ALLOC_FLAGS_VALID((params).flags), \
"alloc flags set unavailable bits") \
ct_precond(ALLOC_BEHAVIOR_MAY_FAULT((params).behavior) || \
!ALLOC_FLAGS_CAN_FAULT((params).flags), \
"non-faulting alloc behavior cannot request pageable or " \
"movable memory") \
ct_precond(!ALLOC_BEHAVIOR_IS_ISR_SAFE((params).behavior) || \
!((params).flags & ALLOC_FLAG_PAGEABLE), \
"ISR-safe alloc behavior cannot request pageable " \
"memory") ALLOC_SIZE_CONTRACT
Section titled “ALLOC_SIZE_CONTRACT”#define ALLOC_SIZE_CONTRACT(size) source Expansion
#define ALLOC_SIZE_CONTRACT(size) \
cc_diagnose_if((size) == 0, "zero-size allocation", "warning") ALLOC_ALIGN_CONTRACT
Section titled “ALLOC_ALIGN_CONTRACT”#define ALLOC_ALIGN_CONTRACT(align) source Expansion
#define ALLOC_ALIGN_CONTRACT(align) \
ct_precond((align) != 0 && ((align) & ((align) - 1)) == 0, \
"alignment must be a nonzero power of two")