mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2025-08-24 23:41:23 +01:00
lib: sbi: Implement aligned memory allocators
This change adds a simple implementation of sbi_aligned_alloc(), for future use in allocating aligned memory for SMMTT tables. Signed-off-by: Gregor Haas <gregorhaas1997@gmail.com> Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
@@ -31,6 +31,15 @@ static inline void *sbi_malloc(size_t size)
|
||||
return sbi_malloc_from(&global_hpctrl, size);
|
||||
}
|
||||
|
||||
/** Allocate aligned from heap area */
|
||||
void *sbi_aligned_alloc_from(struct sbi_heap_control *hpctrl,
|
||||
size_t alignment,size_t size);
|
||||
|
||||
static inline void *sbi_aligned_alloc(size_t alignment, size_t size)
|
||||
{
|
||||
return sbi_aligned_alloc_from(&global_hpctrl, alignment, size);
|
||||
}
|
||||
|
||||
/** Zero allocate from heap area */
|
||||
void *sbi_zalloc_from(struct sbi_heap_control *hpctrl, size_t size);
|
||||
|
||||
|
Reference in New Issue
Block a user