summaryrefslogtreecommitdiffstats
path: root/common/memory_display.c
Commit message (Collapse)AuthorAgeFilesLines
* memory_display: Fix type of argument passed to %*sAndrey Smirnov2019-01-091-1/+1
| | | | | | | | | On AArch64, pointer arithmetic in (pos - line) resolves into "long int", whereas "%*s" is expecting regular "int". Add explicit cast to avoid compiler warnings. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Add pr_memory_displaySascha Hauer2018-12-031-5/+32
| | | | | | | | | pr_memory_display is a memory_display variant that takes a MSG_* loglevel priority with which the hexdump is printed. Like the normal pr_* function this is optimized out when the priority is below the compile time priority. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* memory_display: Print whole line at onceSascha Hauer2018-12-031-17/+18
| | | | | | | | Instead of using many printf assemble a printed line first and print it at once. This has the purpose of being able to pick different output functions in the next step. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* memory_display: add padding to simplify countingRoland Hieber2018-11-211-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Trying to count single bytes (e.g. when adding an offset) in 'word' or 'byte' output mode is not easy in the current formatting, and (at least for me) has a high chance of miscounting or losing track of groups: barebox@boardname:/ md -b 0x149983f0+32 149983f0: 18 00 00 00 00 00 0d 86 00 00 00 00 00 00 00 00 ................ 14998400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ barebox@boardname:/ md -w 0x149983f0+32 149983f0: 0018 0000 0000 860d 0000 0000 0000 0000 ................ 14998400: 0000 0000 0000 0000 0000 0000 0000 0000 ................ With an additional space after 8 bytes, counting becomes easier: barebox@boardname:/ md -b 0x149983f0+32 149983f0: 18 00 00 00 00 00 0d 86 00 00 00 00 00 00 00 00 ................ 14998400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ barebox@boardname:/ md -w 0x149983f0+32 149983f0: 0018 0000 0000 860d 0000 0000 0000 0000 ................ 14998400: 0000 0000 0000 0000 0000 0000 0000 0000 ................ The 'quad' and 'long' output modes stay the same and are already much more easier to count because they build bigger and therefore less groups of bytes per line. Signed-off-by: Roland Hieber <r.hieber@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* memory_display: Add 64bit supportSascha Hauer2015-05-281-1/+15
| | | | | | Add support for showing hexdumps in 64bit width. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* memory_display: Use consistent typesSascha Hauer2015-05-281-13/+13
| | | | | | | | memory_display uses three different types for 32bit variables, three types for 16bit variables and three types for 8bit variables. Clean up this mess and use one type per variable width. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM/mem: handle data aborts gracefully for mdJan Luebbe2015-02-271-5/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sometimes memory ranges contain inaccessible registers which trigger a data abort when accessed. To handle this gracefully, we extend the data abort exception handler to ignore the exception when configured to do so. This allows detecting inaccessible memory from the md command. It will show XX for unreadable bytes instead. The previous behaviour: barebox@TI AM335x BeagleBone:/ md 0x50000000 unable to handle paging request at address 0x500000ac pc : [<8fe2e0dc>] lr : [<8fe2e0b9>] sp : 8ffff898 ip : 00000024 fp : 00000000 r10: 8bfa0204 r9 : 00000000 r8 : 8bfa0204 r7 : 00000100 r6 : 50000000 r5 : 8bfa0204 r4 : 00000004 r3 : 00000f00 r2 : 000000ac r1 : 00000004 r0 : 00000014 Flags: nZCv IRQs off FIQs on Mode SVC_32 [<8fe2e0dc>] (memcpy_sz+0x40/0x48) from [<8fe2f337>] (mem_read+0x3b/0x48) [<8fe2f337>] (mem_read+0x3b/0x48) from [<8fe2bb13>] (cdev_read+0x25/0x2e) [<8fe2bb13>] (cdev_read+0x25/0x2e) from [<8fe2c15b>] (devfs_read+0x1b/0x1e) [<8fe2c15b>] (devfs_read+0x1b/0x1e) from [<8fe2df5b>] (__read+0x43/0x5c) [<8fe2df5b>] (__read+0x43/0x5c) from [<8fe2e61f>] (read+0x2b/0x48) [<8fe2e61f>] (read+0x2b/0x48) from [<8fe1e4a5>] (do_mem_md+0xc1/0x144) [<8fe1e4a5>] (do_mem_md+0xc1/0x144) from [<8fe02889>] (execute_command+0x21/0x48) [<8fe02889>] (execute_command+0x21/0x48) from [<8fe061c1>] (run_list_real+0x549/0x634) [<8fe061c1>] (run_list_real+0x549/0x634) from [<8fe05b43>] (parse_stream_outer+0xdb/0x174) [<8fe05b43>] (parse_stream_outer+0xdb/0x174) from [<8fe06435>] (run_shell+0x29/0x54) [<8fe06435>] (run_shell+0x29/0x54) from [<8fe02889>] (execute_command+0x21/0x48) [<8fe02889>] (execute_command+0x21/0x48) from [<8fe061c1>] (run_list_real+0x549/0x634) [<8fe061c1>] (run_list_real+0x549/0x634) from [<8fe05efb>] (run_list_real+0x283/0x634) [<8fe31e1d>] (unwind_backtrace+0x1/0x64) from [<8fe24e61>] (panic+0x1d/0x34) [<8fe24e61>] (panic+0x1d/0x34) from [<8fe322c1>] (do_exception+0xd/0x10) [<8fe322c1>] (do_exception+0xd/0x10) from [<8fe32329>] (do_data_abort+0x21/0x2c) [<8fe32329>] (do_data_abort+0x21/0x2c) from [<8fe31fe8>] (data_abort+0x48/0x60) The new behaviour: barebox@TI AM335x BeagleBone:/ md 0x50000000 50000000: 00000060 00000000 00000000 00000000 `............... 50000010: 00000000 00000001 00000000 00000000 ................ 50000020: 00000000 00000000 00000000 00000000 ................ 50000030: 00000000 00000000 00000000 00000000 ................ 50000040: 00001ff0 400000ac 00000211 00000000 .......@........ 50000050: 00000a00 00000001 00000000 00000000 ................ 50000060: 00000000 00101001 22060514 10057016 ...........".p.. 50000070: 010f1111 8f070000 00000f40 00000000 ........@....... 50000080: 00000000 00000000 00000000 00000000 ................ 50000090: 00001000 00101001 22060514 10057016 ...........".p.. 500000a0: 010f1111 8f070000 00000f00 XXXXXXXX ................ 500000b0: XXXXXXXX XXXXXXXX 00000000 00000000 ................ 500000c0: 00001000 00101001 22060514 10057016 ...........".p.. 500000d0: 010f1111 8f070000 00000f00 XXXXXXXX ................ 500000e0: XXXXXXXX XXXXXXXX 00000000 00000000 ................ 500000f0: 00001000 00101001 22060514 10057016 ...........".p.. The current implementation breaks everything except ARM and takes several shortcuts which need to be implemented more cleanly. Suggestions are very welcome! Signed-off-by: Jan Luebbe <jlu@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: Add missing includesSascha Hauer2013-11-081-0/+1
| | | | | | | | A lot of files rely on include/driver.h including include/of.h (and this including include/errno.h. include the files explicitly so we can eventually get rid of including of.h from driver.h Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* memory_display: Change address pointer to type const void *Sascha Hauer2013-07-221-1/+1
| | | | | | | No need to force a width of the pointer, so use void *. Also it's not modified in memory_display, so also add a const. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* memory commands: move memory_display to separate fileSascha Hauer2013-04-171-0/+64
memory_display is a function which should generally be available. Currently it depends on memory command support being compiled in, so move the function to a separate file. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>