diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2015-06-09 09:26:43 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-06-09 09:26:43 +0200 |
commit | 0c3bb48db9249662db3b9e74dc4f6788b12f3c39 (patch) | |
tree | 3e26e6a94d31eb3011c1d3da6a646b3492bd5ca0 /common | |
parent | 11efb8022225d0ff2c6bd15eedc8da200c79be5a (diff) | |
parent | d7050d1a9d2b13a24421e13b2f5cdada6bf90182 (diff) | |
download | barebox-0c3bb48db9249662db3b9e74dc4f6788b12f3c39.tar.gz barebox-0c3bb48db9249662db3b9e74dc4f6788b12f3c39.tar.xz |
Merge branch 'for-next/mem64'
Diffstat (limited to 'common')
-rw-r--r-- | common/memory_display.c | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/common/memory_display.c b/common/memory_display.c index 7b1d35ec4b..ea91985e5d 100644 --- a/common/memory_display.c +++ b/common/memory_display.c @@ -6,8 +6,8 @@ int memory_display(const void *addr, loff_t offs, unsigned nbytes, int size, int swab) { - ulong linebytes, i; - u_char *cp; + unsigned long linebytes, i; + unsigned char *cp; /* Print the lines. * @@ -15,20 +15,34 @@ int memory_display(const void *addr, loff_t offs, unsigned nbytes, int size, int * once, and all accesses are with the specified bus width. */ do { - char linebuf[DISP_LINE_LEN]; - uint32_t *uip = (uint *)linebuf; - uint16_t *usp = (ushort *)linebuf; - uint8_t *ucp = (u_char *)linebuf; + 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; unsigned count = 52; printf("%08llx:", offs); linebytes = (nbytes > DISP_LINE_LEN) ? DISP_LINE_LEN : nbytes; for (i = 0; i < linebytes; i += size) { - if (size == 4) { - u32 res; + if (size == 8) { + uint64_t res; data_abort_mask(); - res = *((uint *)addr); + 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); if (swab) res = __swab32(res); if (data_abort_unmask()) { @@ -39,9 +53,9 @@ int memory_display(const void *addr, loff_t offs, unsigned nbytes, int size, int } *uip++ = res; } else if (size == 2) { - u16 res; + uint16_t res; data_abort_mask(); - res = *((ushort *)addr); + res = *((uint16_t *)addr); if (swab) res = __swab16(res); if (data_abort_unmask()) { @@ -52,9 +66,9 @@ int memory_display(const void *addr, loff_t offs, unsigned nbytes, int size, int } *usp++ = res; } else { - u8 res; + uint8_t res; data_abort_mask(); - res = *((u_char *)addr); + res = *((uint8_t *)addr); if (data_abort_unmask()) { res = 0xff; count -= printf(" xx"); @@ -70,7 +84,7 @@ int memory_display(const void *addr, loff_t offs, unsigned nbytes, int size, int while (count--) putchar(' '); - cp = (uint8_t *)linebuf; + cp = linebuf; for (i = 0; i < linebytes; i++) { if ((*cp < 0x20) || (*cp > 0x7e)) putchar('.'); |