mem.4 (90463) | mem.4 (117011) |
---|---|
1.\" Copyright (c) 1991 The Regents of the University of California. 2.\" All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. --- 16 unchanged lines hidden (view full) --- 25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" 32.\" @(#)mem.4 5.3 (Berkeley) 5/2/91 | 1.\" Copyright (c) 1991 The Regents of the University of California. 2.\" All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. --- 16 unchanged lines hidden (view full) --- 25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" 32.\" @(#)mem.4 5.3 (Berkeley) 5/2/91 |
33.\" $FreeBSD: head/share/man/man4/mem.4 90463 2002-02-10 08:52:25Z dd $ | 33.\" $FreeBSD: head/share/man/man4/mem.4 117011 2003-06-28 23:53:39Z ru $ |
34.\" 35.Dd May 2, 1991 36.Dt MEM 4 37.Os 38.Sh NAME 39.Nm mem , 40.Nm kmem 41.Nd memory files 42.Sh DESCRIPTION 43The special file | 34.\" 35.Dd May 2, 1991 36.Dt MEM 4 37.Os 38.Sh NAME 39.Nm mem , 40.Nm kmem 41.Nd memory files 42.Sh DESCRIPTION 43The special file |
44.Nm /dev/mem | 44.Pa /dev/mem |
45is an interface to the physical memory of the computer. 46Byte offsets in this file are interpreted as physical memory addresses. 47Reading and writing this file is equivalent to reading and writing 48memory itself. 49Only offsets within the bounds of | 45is an interface to the physical memory of the computer. 46Byte offsets in this file are interpreted as physical memory addresses. 47Reading and writing this file is equivalent to reading and writing 48memory itself. 49Only offsets within the bounds of |
50.Nm /dev/mem | 50.Pa /dev/mem |
51are allowed. 52.Pp 53Kernel virtual memory is accessed through the interface | 51are allowed. 52.Pp 53Kernel virtual memory is accessed through the interface |
54.Nm /dev/kmem | 54.Pa /dev/kmem |
55in the same manner as | 55in the same manner as |
56.Nm /dev/mem . | 56.Pa /dev/mem . |
57Only kernel virtual addresses that are currently mapped to memory are allowed. 58.Pp 59On 60.Tn ISA 61the 62.Tn I/O 63memory space begins at physical address 0x000a0000 64and runs to 0x00100000. 65The 66per-process data 67size 68for the current process 69is 70.Dv UPAGES 71long, and ends at virtual 72address 0xf0000000. 73.Sh IOCTL INTERFACE 74Several architectures allow attributes to be associated with ranges of physical | 57Only kernel virtual addresses that are currently mapped to memory are allowed. 58.Pp 59On 60.Tn ISA 61the 62.Tn I/O 63memory space begins at physical address 0x000a0000 64and runs to 0x00100000. 65The 66per-process data 67size 68for the current process 69is 70.Dv UPAGES 71long, and ends at virtual 72address 0xf0000000. 73.Sh IOCTL INTERFACE 74Several architectures allow attributes to be associated with ranges of physical |
75memory. These attributes can be manipulated via | 75memory. 76These attributes can be manipulated via |
76.Fn ioctl 77calls performed on | 77.Fn ioctl 78calls performed on |
78.Nm /dev/mem . | 79.Pa /dev/mem . |
79Declarations and data types are to be found in | 80Declarations and data types are to be found in |
80.Pa <sys/memrange.h> | 81.Aq Pa sys/memrange.h . |
81.Pp 82The specific attributes, and number of programmable ranges may vary between | 82.Pp 83The specific attributes, and number of programmable ranges may vary between |
83architectures. The full set of supported attributes is: | 84architectures. 85The full set of supported attributes is: |
84.Bl -tag -width indent | 86.Bl -tag -width indent |
85.It MDF_UNCACHEABLE | 87.It Dv MDF_UNCACHEABLE |
86The region is not cached. | 88The region is not cached. |
87.It MDF_WRITECOMBINE | 89.It Dv MDF_WRITECOMBINE |
88Writes to the region may be combined or performed out of order. | 90Writes to the region may be combined or performed out of order. |
89.It MDF_WRITETHROUGH | 91.It Dv MDF_WRITETHROUGH |
90Writes to the region are committed synchronously. | 92Writes to the region are committed synchronously. |
91.It MDF_WRITEBACK | 93.It Dv MDF_WRITEBACK |
92Writes to the region are committed asynchronously. | 94Writes to the region are committed asynchronously. |
93.It MDF_WRITEPROTECT | 95.It Dv MDF_WRITEPROTECT |
94The region cannot be written to. 95.El 96.Pp 97Memory ranges are described by | 96The region cannot be written to. 97.El 98.Pp 99Memory ranges are described by |
98.Fa struct mem_range_desc : | 100.Vt struct mem_range_desc : |
99.Bd -literal -offset indent 100u_int64_t mr_base; /\(** physical base address \(**/ 101u_int64_t mr_len; /\(** physical length of region \(**/ 102int mr_flags; /\(** attributes of region \(**/ 103char mr_owner[8]; 104.Ed 105.Pp 106In addition to the region attributes listed above, the following flags --- 21 unchanged lines hidden (view full) --- 128Operations are performed using 129.Fa struct mem_range_op : 130.Bd -literal -offset indent 131struct mem_range_desc *mo_desc; 132int mo_arg[2]; 133.Ed 134.Pp 135The | 101.Bd -literal -offset indent 102u_int64_t mr_base; /\(** physical base address \(**/ 103u_int64_t mr_len; /\(** physical length of region \(**/ 104int mr_flags; /\(** attributes of region \(**/ 105char mr_owner[8]; 106.Ed 107.Pp 108In addition to the region attributes listed above, the following flags --- 21 unchanged lines hidden (view full) --- 130Operations are performed using 131.Fa struct mem_range_op : 132.Bd -literal -offset indent 133struct mem_range_desc *mo_desc; 134int mo_arg[2]; 135.Ed 136.Pp 137The |
136.Fa MEMRANGE_GET | 138.Dv MEMRANGE_GET |
137ioctl is used to retrieve current memory range attributes. 138If | 139ioctl is used to retrieve current memory range attributes. 140If |
139.Fa mo_arg[0] | 141.Va mo_arg[0] |
140is set to 0, it will be updated with the total number of memory range | 142is set to 0, it will be updated with the total number of memory range |
141descriptors. If greater than 0, the array at 142.Fa mo_desc | 143descriptors. 144If greater than 0, the array at 145.Va mo_desc |
143will be filled with a corresponding number of descriptor structures, 144or the maximum, whichever is less. 145.Pp 146The | 146will be filled with a corresponding number of descriptor structures, 147or the maximum, whichever is less. 148.Pp 149The |
147.Fa MEMRANGE_SET | 150.Dv MEMRANGE_SET |
148ioctl is used to add, alter and remove memory range attributes. A range | 151ioctl is used to add, alter and remove memory range attributes. A range |
149with the MDF_FIXACTIVE flag may not be removed; a range with the MDF_BUSY | 152with the 153.Dv MDF_FIXACTIVE 154flag may not be removed; a range with the 155.Dv MDF_BUSY |
150flag may not be removed or updated. 151.Pp | 156flag may not be removed or updated. 157.Pp |
152.Fa mo_arg[0] 153should be set to MEMRANGE_SET_UPDATE to update an existing 154or establish a new range, or to MEMRANGE_SET_REMOVE to remove a range. | 158.Va mo_arg[0] 159should be set to 160.Dv MEMRANGE_SET_UPDATE 161to update an existing or establish a new range, or to 162.Dv MEMRANGE_SET_REMOVE 163to remove a range. |
155.Sh RETURN VALUES 156.Bl -tag -width Er 157.It Bq Er EOPNOTSUPP 158Memory range operations are not supported on this architecture. 159.It Bq Er ENXIO 160No memory range descriptors are available (eg. firmware has not enabled 161any). 162.It Bq Er EINVAL --- 17 unchanged lines hidden (view full) --- 180.Bl -tag -width /dev/kmem -compact 181.It Pa /dev/mem 182.It Pa /dev/kmem 183.El 184.Sh SEE ALSO 185.Xr memcontrol 8 186.Sh HISTORY 187The | 164.Sh RETURN VALUES 165.Bl -tag -width Er 166.It Bq Er EOPNOTSUPP 167Memory range operations are not supported on this architecture. 168.It Bq Er ENXIO 169No memory range descriptors are available (eg. firmware has not enabled 170any). 171.It Bq Er EINVAL --- 17 unchanged lines hidden (view full) --- 189.Bl -tag -width /dev/kmem -compact 190.It Pa /dev/mem 191.It Pa /dev/kmem 192.El 193.Sh SEE ALSO 194.Xr memcontrol 8 195.Sh HISTORY 196The |
188.Nm , | 197.Nm mem 198and |
189.Nm kmem 190files appeared in 191.At v6 . 192The ioctl interface for memory range attributes was added in 193.Fx 3.2 . | 199.Nm kmem 200files appeared in 201.At v6 . 202The ioctl interface for memory range attributes was added in 203.Fx 3.2 . |