diff options
author | Simon Glass <sjg@chromium.org> | 2021-05-08 07:00:02 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-06-08 11:39:09 -0400 |
commit | 19edf139e900ed61825b32bc7a261e5f6606b8b1 (patch) | |
tree | de0e963dcee194db7e6283db64967ee427bb326f /lib/hexdump.c | |
parent | 2f410fe55766de190bcc2c3dd18245a00aad1d4f (diff) | |
download | u-boot-19edf139e900ed61825b32bc7a261e5f6606b8b1.tar.gz |
hexdump: Add support for sandbox
The current implementation outputs an address as a pointer. Update the
code to use an address instead, respecting the 32/64 nature of the CPU.
Add some initial tests copied from print_test_display_buffer(), just the
ones that can pass with the current implementation.
Note that for this case print_hex_dump() and print_bufffer() produce the
same result. For now the tests are duplicated sine we have separate
functions.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'lib/hexdump.c')
-rw-r--r-- | lib/hexdump.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/hexdump.c b/lib/hexdump.c index e31784cc11..a76ea707b6 100644 --- a/lib/hexdump.c +++ b/lib/hexdump.c @@ -10,6 +10,7 @@ #include <common.h> #include <hexdump.h> +#include <mapmem.h> #include <linux/ctype.h> #include <linux/compat.h> #include <linux/log2.h> @@ -139,7 +140,9 @@ void print_hex_dump(const char *prefix_str, int prefix_type, int rowsize, switch (prefix_type) { case DUMP_PREFIX_ADDRESS: - printf("%s%p: %s\n", prefix_str, ptr + i, linebuf); + printf("%s%0*lx: %s\n", prefix_str, + IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, + (ulong)map_to_sysmem(ptr) + i, linebuf); break; case DUMP_PREFIX_OFFSET: printf("%s%.8x: %s\n", prefix_str, i, linebuf); |