summaryrefslogtreecommitdiff
path: root/usr/src/man/man7d/mem.7d
blob: ab430b70929ccb8c057680ac25d7ffeb0e5e91a6 (plain)
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
'\" te
.\" Copyright 2002 Sun Microsystems Inc. All Rights Reserved.
.\" Copyright 1989 AT&T
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH MEM 7D "Feb 18, 2002"
.SH NAME
mem, kmem, allkmem \- physical or virtual memory access
.SH SYNOPSIS
.LP
.nf
/dev/mem
.fi

.LP
.nf
/dev/kmem
.fi

.LP
.nf
/dev/allkmem
.fi

.SH DESCRIPTION
.sp
.LP
The file \fB/dev/mem\fR is a special file that provides access to the physical
memory of the computer.
.sp
.LP
The file \fB/dev/kmem\fR is a special file that provides access to the virtual
address space of the operating system kernel, excluding memory that is
associated with an I/O device.
.sp
.LP
The file \fB/dev/allkmem\fR is a special file that provides access to the
virtual address space of the operating system kernel, including memory that is
associated with an I/O device.  You can use any of these devices to examine and
modify the system.
.sp
.LP
Byte addresses in \fB/dev/mem\fR are interpreted as physical memory addresses.
Byte addresses in \fB/dev/kmem\fR and \fB/dev/allkmem\fR are interpreted as
kernel virtual memory addresses. A reference to a non-existent location returns
an error. See ERRORS for more information.
.sp
.LP
The file \fB/dev/mem\fR accesses physical memory; the size of the file is equal
to the amount of physical memory in the computer. This size may be larger than
4GB on a system running the 32-bit operating environment. In this case, you can
access memory beyond 4GB using a series of \fBread\fR(2) and \fBwrite\fR(2)
calls, a \fBpread64()\fR or \fBpwrite64()\fR call, or a combination of
\fBllseek\fR(2) and \fBread\fR(2) or \fBwrite\fR(2).
.SH ERRORS
.sp
.ne 2
.na
\fB\fBEFAULT\fR\fR
.ad
.RS 10n
Occurs when trying to  \fBwrite\fR(2) a read-only location (\fBallkmem\fR),
\fBread\fR(2) a write-only location (\fBallkmem\fR), or \fBread\fR(2) or
\fBwrite\fR(2) a non-existent or unimplemented location (\fBmem\fR, \fBkmem\fR,
\fBallkmem\fR).
.RE

.sp
.ne 2
.na
\fB\fBEIO\fR\fR
.ad
.RS 10n
Occurs when trying to \fBread\fR(2) or \fBwrite\fR(2) a memory location that is
associated with an I/O device using the \fB/dev/kmem\fR special file.
.RE

.sp
.ne 2
.na
\fB\fBENXIO\fR\fR
.ad
.RS 10n
Results from attempting to \fBmmap\fR(2) a non-existent physical (\fBmem\fR) or
virtual (\fBkmem\fR, \fBallkmem\fR) memory address.
.RE

.SH FILES
.sp
.ne 2
.na
\fB\fB/dev/mem\fR\fR
.ad
.RS 16n
Provides access to the computer's physical memory.
.RE

.sp
.ne 2
.na
\fB\fB/dev/kmem\fR\fR
.ad
.RS 16n
Provides access to the virtual address space of the operating system kernel,
excluding memory that is associated with an I/O device.
.RE

.sp
.ne 2
.na
\fB\fB/dev/allkmem\fR\fR
.ad
.RS 16n
Provides access to the virtual address space of the operating system kernel,
including memory that is associated with an I/O device.
.RE

.SH SEE ALSO
.sp
.LP
\fBllseek\fR(2), \fBmmap\fR(2), \fBread\fR(2), \fBwrite\fR(2)
.SH WARNINGS
.sp
.LP
Using these devices to modify (that is, write to) the address space of a live
running operating system or to modify the state of      a hardware device is
extremely dangerous and may result in a system panic if kernel data structures
are damaged or if device state is changed.