From 2d14fb7df369e8acb59c443bf50190ae76244f5a Mon Sep 17 00:00:00 2001 From: Waldemar Kozaczuk Date: Sun, 17 Mar 2024 19:17:07 -0400 Subject: [PATCH] memory: expose C functions to allocate and free contiguous area Signed-off-by: Waldemar Kozaczuk --- core/mempool.cc | 10 ++++++++++ core/mmu.cc | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/core/mempool.cc b/core/mempool.cc index 52173873a7..b5c202865b 100644 --- a/core/mempool.cc +++ b/core/mempool.cc @@ -2181,3 +2181,13 @@ bool throttling_needed() jvm_balloon_api *balloon_api = nullptr; } + +extern "C" void* alloc_contiguous_aligned(size_t size, size_t align) +{ + return memory::alloc_phys_contiguous_aligned(size, align, true); +} + +extern "C" void free_contiguous_aligned(void* p) +{ + memory::free_phys_contiguous_aligned(p); +} diff --git a/core/mmu.cc b/core/mmu.cc index 7d34231cb4..e579103b3c 100644 --- a/core/mmu.cc +++ b/core/mmu.cc @@ -2116,3 +2116,8 @@ std::string procfs_maps() } } + +extern "C" bool is_linear_mapped(const void *addr) +{ + return addr >= mmu::phys_mem; +}