summaryrefslogtreecommitdiffstats
path: root/src/vppinfra/mem.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2020-09-11 22:16:53 +0200
committerDamjan Marion <damarion@cisco.com>2020-09-17 12:38:41 +0200
commit6bfd07670b991c30761ef74fb09f42181dbfd182 (patch)
treef82fa63e1b3ec6e4d31827efb553516936392288 /src/vppinfra/mem.c
parentc63e2a4f980e09b4274558f0562cee285f9741b5 (diff)
vppinfra: support main heap with different page sizes
Type: improvement Change-Id: I381fc3dec8580208d0e24637d791af69011aa83b Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vppinfra/mem.c')
-rw-r--r--src/vppinfra/mem.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/vppinfra/mem.c b/src/vppinfra/mem.c
index 3477e5f3c17..b417b8503ad 100644
--- a/src/vppinfra/mem.c
+++ b/src/vppinfra/mem.c
@@ -21,6 +21,56 @@
clib_mem_main_t clib_mem_main;
+void *
+clib_mem_vm_map (void *base, uword size, clib_mem_page_sz_t log2_page_sz,
+ char *fmt, ...)
+{
+ va_list va;
+ void *rv;
+ u8 *s;
+
+ va_start (va, fmt);
+ s = va_format (0, fmt, &va);
+ vec_add1 (s, 0);
+ rv = clib_mem_vm_map_internal (base, log2_page_sz, size, -1, 0, (char *) s);
+ va_end (va);
+ vec_free (s);
+ return rv;
+}
+
+void *
+clib_mem_vm_map_stack (uword size, clib_mem_page_sz_t log2_page_sz,
+ char *fmt, ...)
+{
+ va_list va;
+ void *rv;
+ u8 *s;
+
+ va_start (va, fmt);
+ s = va_format (0, fmt, &va);
+ vec_add1 (s, 0);
+ rv = clib_mem_vm_map_internal (0, log2_page_sz, size, -1, 0, (char *) s);
+ va_end (va);
+ vec_free (s);
+ return rv;
+}
+
+void *
+clib_mem_vm_map_shared (void *base, uword size, int fd, uword offset,
+ char *fmt, ...)
+{
+ va_list va;
+ void *rv;
+ u8 *s;
+ va_start (va, fmt);
+ s = va_format (0, fmt, &va);
+ vec_add1 (s, 0);
+ rv = clib_mem_vm_map_internal (base, 0, size, fd, offset, (char *) s);
+ va_end (va);
+ vec_free (s);
+ return rv;
+}
+
/*
* fd.io coding-style-patch-verification: ON
*