blob: 4c1073ea35458dc34b0de1f2dbe6e83fb2fcb5cf [file] [log] [blame]
Simon Glassbe1d5e82021-02-06 09:57:29 -07001.. SPDX-License-Identifier: GPL-2.0+:
2
3md command
4==========
5
6Synopis
7-------
8
9::
10
11 md <address>[<data_size>] [<length>]
12
13Description
14-----------
15
16The md command is used to dump the contents of memory. It uses a standard
17format that includes the address, hex data and ASCII display. It supports
18various data sizes and uses the endianness of the target.
19
20The specified data_size and length become the defaults for future memory
21commands commands.
22
23address
24 start address to display
25
26data_size
27 size of each value to display (defaults to .l):
28
29 ========= ===================
30 data_size Output size
31 ========= ===================
32 .b byte
33 .w word (16 bits)
34 .l long (32 bits)
35 .q quadword (64 bits)
36 ========= ===================
37
38length
39 number of values to dump. Defaults to 40 (0d64). Note that this is not
40 the same as the number of bytes, unless .b is used.
41
Simon Glasscbd59462021-02-06 09:57:30 -070042Note that the format of 'md.b' can be emulated from linux with::
43
44 # This works but requires using sed to get the extra spaces
45 # <addr> is the address, <f> is the filename
46 xxd -o <addr> -g1 <f> |sed 's/ / /' >bad
47
48 # This uses a single tool but the offset always starts at 0
49 # <f> is the filename
50 hexdump -v -e '"%08.8_ax: " 16/1 "%02x " " "' -e '16/1 "%_p" "\n" ' <f>
51
Simon Glassbe1d5e82021-02-06 09:57:29 -070052
53Example
54-------
55
56::
57
58 => md 10000
59 00010000: 00010000 00000000 f0f30f00 00005596 .............U..
60 00010010: 10011010 00000000 10011010 00000000 ................
61 00010020: 10011050 00000000 b96d4cd8 00007fff P........Lm.....
62 00010030: 00000000 00000000 f0f30f18 00005596 .............U..
63 00010040: 10011040 00000000 10011040 00000000 @.......@.......
64 00010050: b96d4cd8 00007fff 10011020 00000000 .Lm..... .......
65 00010060: 00000003 000000c3 00000000 00000000 ................
66 00010070: 00000000 00000000 f0e892f3 00005596 .............U..
67 00010080: 00000000 000000a1 00000000 00000000 ................
68 00010090: 00000000 00000000 f0e38aa6 00005596 .............U..
69 000100a0: 00000000 000000a6 00000022 00000000 ........".......
70 000100b0: 00000001 00000000 f0e38aa1 00005596 .............U..
71 000100c0: 00000000 000000be 00000000 00000000 ................
72 000100d0: 00000000 00000000 00000000 00000000 ................
73 000100e0: 00000000 00000000 00000000 00000000 ................
74 000100f0: 00000000 00000000 00000000 00000000 ................
75 => md.b 10000
76 00010000: 00 00 01 00 00 00 00 00 00 0f f3 f0 96 55 00 00 .............U..
77 00010010: 10 10 01 10 00 00 00 00 10 10 01 10 00 00 00 00 ................
78 00010020: 50 10 01 10 00 00 00 00 d8 4c 6d b9 ff 7f 00 00 P........Lm.....
79 00010030: 00 00 00 00 00 00 00 00 18 0f f3 f0 96 55 00 00 .............U..
80 => md.b 10000 10
81 00010000: 00 00 01 00 00 00 00 00 00 0f f3 f0 96 55 00 00 .............U..
82 =>
83 00010010: 10 10 01 10 00 00 00 00 10 10 01 10 00 00 00 00 ................
84 =>
85 00010020: 50 10 01 10 00 00 00 00 d8 4c 6d b9 ff 7f 00 00 P........Lm.....
86 =>
87 => md.q 10000
88 00010000: 0000000000010000 00005596f0f30f00 .............U..
89 00010010: 0000000010011010 0000000010011010 ................
90 00010020: 0000000010011050 00007fffb96d4cd8 P........Lm.....
91 00010030: 0000000000000000 00005596f0f30f18 .............U..
92 00010040: 0000000010011040 0000000010011040 @.......@.......
93 00010050: 00007fffb96d4cd8 0000000010011020 .Lm..... .......
94 00010060: 000000c300000003 0000000000000000 ................
95 00010070: 0000000000000000 00005596f0e892f3 .............U..
96
97The empty commands cause a 'repeat', so that md shows the next available data
98in the same format as before.
99
100
101Return value
102------------
103
104The return value $? is always 0 (true).
105
106