diff options
| author | Simon Glass <[email protected]> | 2024-10-28 13:47:57 +0100 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2024-11-03 21:27:12 -0600 |
| commit | 5400c4bc0528b1f2bebd97de1deed62cbd65039b (patch) | |
| tree | 41c5bd417f61cfa78a0667e2b10491901cc9a92d /arch | |
| parent | ec6d30649cd5026acf64301cca3d1721c16e69e7 (diff) | |
sandbox: Add a way to show the sandbox memory-mapping
This is mostly hidden in the background, but it is sometimes useful to
look at it. Add a function to allow this.
Signed-off-by: Simon Glass <[email protected]>
Diffstat (limited to 'arch')
| -rw-r--r-- | arch/sandbox/cpu/cpu.c | 13 | ||||
| -rw-r--r-- | arch/sandbox/include/asm/cpu.h | 3 |
2 files changed, 16 insertions, 0 deletions
diff --git a/arch/sandbox/cpu/cpu.c b/arch/sandbox/cpu/cpu.c index 06f8c13fab9..d1c4dcf0764 100644 --- a/arch/sandbox/cpu/cpu.c +++ b/arch/sandbox/cpu/cpu.c @@ -253,6 +253,19 @@ phys_addr_t map_to_sysmem(const void *ptr) return mentry->tag; } +void sandbox_map_list(void) +{ + struct sandbox_mapmem_entry *mentry; + struct sandbox_state *state = state_get_current(); + + printf("Sandbox memory-mapping\n"); + printf("%8s %16s %6s\n", "Addr", "Mapping", "Refcnt"); + list_for_each_entry(mentry, &state->mapmem_head, sibling_node) { + printf("%8lx %p %6d\n", mentry->tag, mentry->ptr, + mentry->refcnt); + } +} + unsigned long sandbox_read(const void *addr, enum sandboxio_size_t size) { struct sandbox_state *state = state_get_current(); diff --git a/arch/sandbox/include/asm/cpu.h b/arch/sandbox/include/asm/cpu.h index c97ac7ba95b..682bb3376d1 100644 --- a/arch/sandbox/include/asm/cpu.h +++ b/arch/sandbox/include/asm/cpu.h @@ -8,4 +8,7 @@ void cpu_sandbox_set_current(const char *name); +/* show the mapping of sandbox addresses to pointers */ +void sandbox_map_list(void); + #endif /* __SANDBOX_CPU_H */ |
