-
Notifications
You must be signed in to change notification settings - Fork 9
/
memtool.1
101 lines (95 loc) · 2.31 KB
/
memtool.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
.TH memtool "1" "December 2015" "memtool - display and modify memory"
.SH NAME
memtool \- display and modify memory
.SH SYNOPSIS
.B memtool -V
.br
.B memtool md
.RB [\| \-b \||\| \-w \||\| \-l \||\| \-q \|]
.RB [\| \-x \|]
.RB [\| \-s
.IR filename \|]
.I region
.br
.B memtool mw
.RB [\| \-b \||\| \-w \||\| \-l \||\| \-q \|]
.RB [\| \-d
.IR filename \|]
.I start
.I data...
.SH DESCRIPTION
memtool allows one to read and write regions of files. When applied to
.I /dev/mem
(which is the default file) the regions represent memory mapped registers.
.PP
There are currently two subcommands:
.B mw
to write to memory/a file; and
.B md
to read from memory/a file.
Usually memtool operates on files (regular or devices) using mmap(2). If
.I filename
is of the form
.RI mdio: ethname . id
with
.I ethname
being the name of an ethernet device and
.I id
being an MDIO address, the phy with address
.I id
on the MDIO bus related to the ethernet device
.I ethname
is accessed instead. To prevent ambiguities when using the mmap access method, use
.RI mmap: filename
as parameter.
Note that on some machines there are alignment restrictions that forbid for
example to read a word from an address that is not word aligned. memtool
doesn't try to be smart here but simply tries what is requested by the caller.
This might result in all kind of errors which are not considered to be a bug of
the tool, but either the machine or the caller.
.SH OPTIONS
.TP
.B \-V
Dump memtool version and exit
.SH COMMON OPTIONS FOR SUBCOMMANDS
.TP
.B \-b
Use byte wise (8-bit) access
.TP
.B \-w
Use word wise (16-bit) access
.TP
.B \-l
Use long wise (32-bit) access
.TP
.BR \-q
Use quad wise (64-bit) access
.TP
\fB\-d \fIfilename
Write to
.IR filename .
.TP
\fB\-s \fIfilename
Read from
.IR filename .
.TP
.B \-x
Swap bytes at output
.SH REGIONS
Memory regions can be specified in two different forms:
.TP
\fIstart\fR[\fB+\fIsize\fR]
.TP
.IB start \- end
.PP
.I start
specifies the byte offset of the region's beginning, i.e. the first included
address.
.I size
specifies the size of the region in bytes and defaults to 0x100. Alternatively
.I end
specifies the offset of the last included address.
Offsets can be specified in decimal or hexadecimal with a prefix 0x.
Additionally you can use suffixes
.BR G ", " M ", and " k ,
which multiply by 1024^3, 1024^2, and 1024 respectively.