aboutsummaryrefslogtreecommitdiffstats
path: root/src/vppinfra/pmalloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vppinfra/pmalloc.c')
-rw-r--r--src/vppinfra/pmalloc.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/vppinfra/pmalloc.c b/src/vppinfra/pmalloc.c
index 5662a36939e..dd772f34381 100644
--- a/src/vppinfra/pmalloc.c
+++ b/src/vppinfra/pmalloc.c
@@ -59,10 +59,11 @@ pmalloc_validate_numa_node (u32 * numa_node)
}
int
-clib_pmalloc_init (clib_pmalloc_main_t * pm, uword size)
+clib_pmalloc_init (clib_pmalloc_main_t * pm, uword base_addr, uword size)
{
uword off, pagesize;
u64 *pt = 0;
+ int mmap_flags;
ASSERT (pm->error == 0);
@@ -82,8 +83,13 @@ clib_pmalloc_init (clib_pmalloc_main_t * pm, uword size)
pm->max_pages = size >> pm->def_log2_page_sz;
/* reserve VA space for future growth */
- pm->base = mmap (0, size + pagesize, PROT_NONE,
- MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+ mmap_flags = MAP_PRIVATE | MAP_ANONYMOUS;
+
+ if (base_addr)
+ mmap_flags |= MAP_FIXED;
+
+ pm->base = mmap (uword_to_pointer (base_addr, void *), size + pagesize,
+ PROT_NONE, mmap_flags, -1, 0);
if (pm->base == MAP_FAILED)
{