1 .\" Copyright (c) 1991 The Regents of the University of California.
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 3. Neither the name of the University nor the names of its contributors
13 .\" may be used to endorse or promote products derived from this software
14 .\" without specific prior written permission.
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 .\" @(#)mem.4 5.3 (Berkeley) 5/2/91
29 .\" $FreeBSD: src/share/man/man4/mem.4,v 1.7.2.5 2002/02/27 03:39:23 dd Exp $
30 .\" $DragonFly: src/share/man/man4/mem.4,v 1.8 2007/05/17 08:19:01 swildner Exp $
42 is an interface to the physical memory of the computer.
43 Byte offsets in this file are interpreted as physical memory addresses.
44 Reading and writing this file is equivalent to reading and writing
46 Only offsets within the bounds of
50 Kernel virtual memory is accessed through the interface
54 Only kernel virtual addresses that are currently mapped to memory are allowed.
60 memory space begins at physical address 0x000a0000
61 and runs to 0x00100000.
65 for the current process
68 long, and ends at virtual
71 Several architectures allow attributes to be associated with ranges of physical
73 These attributes can be manipulated via
77 Declarations and data types are to be found in
80 The specific attributes, and number of programmable ranges may vary between
82 The full set of supported attributes is:
83 .Bl -tag -width indent
84 .It Dv MDF_UNCACHEABLE
85 The region is not cached.
86 .It Dv MDF_WRITECOMBINE
87 Writes to the region may be combined or performed out of order.
88 .It Dv MDF_WRITETHROUGH
89 Writes to the region are committed synchronously.
91 Writes to the region are committed asynchronously.
92 .It Dv MDF_WRITEPROTECT
93 The region cannot be written to.
96 Memory ranges are described by
97 .Vt struct mem_range_desc :
98 .Bd -literal -offset indent
99 u_int64_t mr_base; /\(** physical base address \(**/
100 u_int64_t mr_len; /\(** physical length of region \(**/
101 int mr_flags; /\(** attributes of region \(**/
105 In addition to the region attributes listed above, the following flags
106 may also be set in the
109 .Bl -tag -width indent
111 The region's base address cannot be changed.
113 The region's length cannot be changed.
115 The region is believed to have been established by the system firmware.
117 The region is currently active.
119 We believe the region to be invalid or otherwise erroneous.
121 The region cannot be disabled.
123 The region is currently owned by another process and may not be
127 Operations are performed using
128 .Fa struct mem_range_op :
129 .Bd -literal -offset indent
130 struct mem_range_desc *mo_desc;
136 ioctl is used to retrieve current memory range attributes.
139 is set to 0, it will be updated with the total number of memory range
141 If greater than 0, the array at
143 will be filled with a corresponding number of descriptor structures,
144 or the maximum, whichever is less.
148 ioctl is used to add, alter and remove memory range attributes. A range
151 flag may not be removed; a range with the
153 flag may not be removed or updated.
157 .Dv MEMRANGE_SET_UPDATE
158 to update an existing or establish a new range, or to
159 .Dv MEMRANGE_SET_REMOVE
164 Memory range operations are not supported on this architecture.
166 No memory range descriptors are available (eg. firmware has not enabled
169 The memory range supplied as an argument is invalid or overlaps another
170 range in a fashion not supported by this architecture.
172 An attempt to remove or update a range failed because the range is busy.
174 An attempt to create a new range failed due to a shortage of hardware
175 resources (eg. descriptor slots).
177 An attempt to remove a range failed because no range matches the descriptor
178 base/length supplied.
180 An attempt to remove a range failed because the range is permanently
184 .Bl -tag -width /dev/kmem -compact
197 The ioctl interface for memory range attributes was added in
200 Busy range attributes are not yet managed correctly.