Debian Codegraph @

upstream/debian-unstable/man4/mem.4

raw
1 .\" Copyright, the authors of the Linux man-pages project
2 .\"
3 .\" SPDX-License-Identifier: GPL-2.0-or-later
4 .\"
5 .TH mem 4 2025-05-17 "Linux man-pages 6.18"
6 .SH NAME
7 mem, kmem, port \- system memory, kernel memory and system ports
8 .SH DESCRIPTION
9 .I /dev/mem
10 is a character device file
11 that is an image of the main memory of the computer.
12 It may be used, for example, to examine (and even patch) the system.
13 .P
14 Byte addresses in
15 .I /dev/mem
16 are interpreted as physical memory addresses.
17 References to nonexistent locations cause errors to be returned.
18 .P
19 Examining and patching is likely to lead to unexpected results
20 when read-only or write-only bits are present.
21 .P
22 Since Linux 2.6.26, and depending on the architecture, the
23 .B CONFIG_STRICT_DEVMEM
24 kernel configuration option limits the areas
25 which can be accessed through this file.
26 For example: on x86, RAM access is not allowed but accessing
27 memory-mapped PCI regions is.
28 .P
29 It is typically created by:
30 .P
31 .in +4n
32 .EX
33 mknod \-m 660 /dev/mem c 1 1
34 chown root:kmem /dev/mem
35 .EE
36 .in
37 .P
38 The file
39 .I /dev/kmem
40 is the same as
41 .IR /dev/mem ,
42 except that the kernel virtual memory
43 rather than physical memory is accessed.
44 Since Linux 2.6.26, this file is available only if the
45 .B CONFIG_DEVKMEM
46 kernel configuration option is enabled.
47 .P
48 It is typically created by:
49 .P
50 .in +4n
51 .EX
52 mknod \-m 640 /dev/kmem c 1 2
53 chown root:kmem /dev/kmem
54 .EE
55 .in
56 .P
57 .I /dev/port
58 is similar to
59 .IR /dev/mem ,
60 but the I/O ports are accessed.
61 .P
62 It is typically created by:
63 .P
64 .in +4n
65 .EX
66 mknod \-m 660 /dev/port c 1 4
67 chown root:kmem /dev/port
68 .EE
69 .in
70 .SH FILES
71 .I /dev/mem
72 .br
73 .I /dev/kmem
74 .br
75 .I /dev/port
76 .SH SEE ALSO
77 .BR chown (1),
78 .BR mknod (1),
79 .BR ioperm (2)