summaryrefslogtreecommitdiffstats
path: root/src/vppinfra/mem.c
diff options
context:
space:
mode:
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
*