[PATCH 02/10] memory_display: Add 64bit support

Sascha Hauer s.hauer at pengutronix.de
Thu May 28 03:34:36 PDT 2015


Add support for showing hexdumps in 64bit width.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 common/memory_display.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/common/memory_display.c b/common/memory_display.c
index 1ad0f05..ea91985 100644
--- a/common/memory_display.c
+++ b/common/memory_display.c
@@ -16,6 +16,7 @@ int memory_display(const void *addr, loff_t offs, unsigned nbytes, int size, int
 	 */
 	do {
 		unsigned char linebuf[DISP_LINE_LEN];
+		uint64_t *ullp = (uint64_t *)linebuf;
 		uint32_t *uip = (uint32_t *)linebuf;
 		uint16_t *usp = (uint16_t *)linebuf;
 		uint8_t *ucp = (uint8_t *)linebuf;
@@ -25,7 +26,20 @@ int memory_display(const void *addr, loff_t offs, unsigned nbytes, int size, int
 		linebytes = (nbytes > DISP_LINE_LEN) ? DISP_LINE_LEN : nbytes;
 
 		for (i = 0; i < linebytes; i += size) {
-			if (size == 4) {
+			if (size == 8) {
+				uint64_t res;
+				data_abort_mask();
+				res = *((uint64_t *)addr);
+				if (swab)
+					res = __swab64(res);
+				if (data_abort_unmask()) {
+					res = 0xffffffffffffffffULL;
+					count -= printf(" xxxxxxxxxxxxxxxx");
+				} else {
+					count -= printf(" %016llx", res);
+				}
+				*ullp++ = res;
+			} else if (size == 4) {
 				uint32_t res;
 				data_abort_mask();
 				res = *((uint32_t *)addr);
-- 
2.1.4




More information about the barebox mailing list