summaryrefslogtreecommitdiffstats
path: root/src/vppinfra/pmalloc.c
diff options
context:
space:
mode:
authorMohsin Kazmi <sykazmi@cisco.com>2018-11-07 16:55:18 +0100
committerDamjan Marion <dmarion@me.com>2018-11-08 16:09:21 +0000
commit6ec99c3147f3e8fd608973cd8f4a25c156bb1490 (patch)
treef3723b346b010cbc17c01c92742f74088c9b972a /src/vppinfra/pmalloc.c
parent7040075ef16ba6dd85b49905929caa4e8ac4194f (diff)
physmem: Add physmem map support
This patch adds support for mapping the virtual address to physical address and size of memory allocated. Change-Id: I7659a1881308e89b215c486fecd7c973076d0773 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Diffstat (limited to 'src/vppinfra/pmalloc.c')
-rw-r--r--src/vppinfra/pmalloc.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/vppinfra/pmalloc.c b/src/vppinfra/pmalloc.c
index 46ccd7f6efc..62b4f60c2eb 100644
--- a/src/vppinfra/pmalloc.c
+++ b/src/vppinfra/pmalloc.c
@@ -687,6 +687,27 @@ format_pmalloc (u8 * s, va_list * va)
return s;
}
+u8 *
+format_pmalloc_map (u8 * s, va_list * va)
+{
+ clib_pmalloc_main_t *pm = va_arg (*va, clib_pmalloc_main_t *);
+
+ u32 index;
+ s = format (s, "%16s %13s %8s", "virtual-addr", "physical-addr", "size");
+ vec_foreach_index (index, pm->lookup_table)
+ {
+ uword *lookup_val, pa, va;
+ lookup_val = vec_elt_at_index (pm->lookup_table, index);
+ va = pointer_to_uword (pm->base) + (index << pm->lookup_log2_page_sz);
+ pa = va - *lookup_val;
+ s =
+ format (s, "\n %16p %13p %8U", uword_to_pointer (va, u64),
+ uword_to_pointer (pa, u64), format_log2_page_size,
+ pm->lookup_log2_page_sz);
+ }
+ return s;
+}
+
/*
* fd.io coding-style-patch-verification: ON
*