1mem(7D) Devices mem(7D)
2
3
4
6 mem, kmem, allkmem - physical or virtual memory access
7
9 /dev/mem
10
11
12 /dev/kmem
13
14
15 /dev/allkmem
16
17
19 The file /dev/mem is a special file that provides access to the physi‐
20 cal memory of the computer.
21
22
23 The file /dev/kmem is a special file that provides access to the vir‐
24 tual address space of the operating system kernel, excluding memory
25 that is associated with an I/O device.
26
27
28 The file /dev/allkmem is a special file that provides access to the
29 virtual address space of the operating system kernel, including memory
30 that is associated with an I/O device. You can use any of these
31 devices to examine and modify the system.
32
33
34 Byte addresses in /dev/mem are interpreted as physical memory
35 addresses. Byte addresses in /dev/kmem and /dev/allkmem are interpreted
36 as kernel virtual memory addresses. A reference to a non-existent loca‐
37 tion returns an error. See ERRORS for more information.
38
39
40 The file /dev/mem accesses physical memory; the size of the file is
41 equal to the amount of physical memory in the computer. This size may
42 be larger than 4GB on a system running the 32-bit operating environ‐
43 ment. In this case, you can access memory beyond 4GB using a series of
44 read(2) and write(2) calls, a pread64() or pwrite64() call, or a combi‐
45 nation of llseek(2) and read(2) or write(2).
46
48 EFAULT Occurs when trying to write(2) a read-only location (allk‐
49 mem), read(2) a write-only location (allkmem), or read(2) or
50 write(2) a non-existent or unimplemented location (mem, kmem,
51 allkmem).
52
53
54 EIO Occurs when trying to read(2) or write(2) a memory location
55 that is associated with an I/O device using the /dev/kmem
56 special file.
57
58
59 ENXIO Results from attempting to mmap(2) a non-existent physical
60 (mem) or virtual (kmem, allkmem) memory address.
61
62
64 /dev/mem Provides access to the computer's physical memory.
65
66
67 /dev/kmem Provides access to the virtual address space of the
68 operating system kernel, excluding memory that is asso‐
69 ciated with an I/O device.
70
71
72 /dev/allkmem Provides access to the virtual address space of the
73 operating system kernel, including memory that is asso‐
74 ciated with an I/O device.
75
76
78 llseek(2), mmap(2), read(2), write(2)
79
81 Using these devices to modify (that is, write to) the address space of
82 a live running operating system or to modify the state of a hard‐
83 ware device is extremely dangerous and may result in a system panic if
84 kernel data structures are damaged or if device state is changed.
85
86
87
88SunOS 5.11 18 Feb 2002 mem(7D)