mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-08 03:45:24 +00:00
lx_emul: add lx_emul_heap_alloc/free
Allocator for not-DMA-capable meta data buffers. Issue #4809
This commit is contained in:
parent
dec1869e2c
commit
73bf682b62
@ -1,6 +1,7 @@
|
||||
/*
|
||||
* \brief Lx_emul support to allocate memory
|
||||
* \author Stefan Kalkowski
|
||||
* \author Christian Helmuth
|
||||
* \date 2021-03-25
|
||||
*/
|
||||
|
||||
@ -27,6 +28,13 @@ unsigned long lx_emul_mem_size(const void * ptr);
|
||||
void lx_emul_mem_cache_clean_invalidate(const void * ptr, unsigned long size);
|
||||
void lx_emul_mem_cache_invalidate(const void * ptr, unsigned long size);
|
||||
|
||||
/*
|
||||
* Heap for lx_emul metadata - cleared but unprepared for Linux code
|
||||
*/
|
||||
|
||||
void * lx_emul_heap_alloc(unsigned long size);
|
||||
void lx_emul_heap_free(void * ptr);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*
|
||||
* \brief Lx_emul backend for memory allocation
|
||||
* \author Stefan Kalkowski
|
||||
* \author Christian Helmuth
|
||||
* \date 2021-03-22
|
||||
*/
|
||||
|
||||
@ -17,6 +18,7 @@
|
||||
#include <lx_emul/page_virt.h>
|
||||
#include <lx_kit/env.h>
|
||||
|
||||
|
||||
extern "C" void * lx_emul_mem_alloc_aligned(unsigned long size, unsigned long align)
|
||||
{
|
||||
void * const ptr = Lx_kit::env().memory.alloc(size, align);
|
||||
@ -93,3 +95,22 @@ extern "C" void lx_emul_mem_cache_invalidate(const void * addr,
|
||||
{
|
||||
Genode::cache_invalidate_data((Genode::addr_t)addr, size);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Heap for lx_emul metadata - unprepared for Linux code
|
||||
*/
|
||||
|
||||
void * lx_emul_heap_alloc(unsigned long size)
|
||||
{
|
||||
void *ptr = Lx_kit::env().heap.alloc(size);
|
||||
if (ptr)
|
||||
Genode::memset(ptr, 0, size);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
void lx_emul_heap_free(void * ptr)
|
||||
{
|
||||
Lx_kit::env().heap.free(ptr, 0);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user