From 19edf139e900ed61825b32bc7a261e5f6606b8b1 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 8 May 2021 07:00:02 -0600 Subject: 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 --- lib/hexdump.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/hexdump.c b/lib/hexdump.c index e31784c..a76ea70 100644 --- a/lib/hexdump.c +++ b/lib/hexdump.c @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -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); -- cgit v1.1