1*aaeccf36Sderaadt.\" $OpenBSD: mem.4,v 1.4 2018/01/12 04:36:44 deraadt Exp $ 25425801eSmiod.\" 35425801eSmiod.\" Copyright (c) 2004, Miodrag Vallat. 45425801eSmiod.\" 55425801eSmiod.\" Redistribution and use in source and binary forms, with or without 65425801eSmiod.\" modification, are permitted provided that the following conditions 75425801eSmiod.\" are met: 85425801eSmiod.\" 1. Redistributions of source code must retain the above copyright 95425801eSmiod.\" notice, this list of conditions and the following disclaimer. 105425801eSmiod.\" 2. Redistributions in binary form must reproduce the above copyright 115425801eSmiod.\" notice, this list of conditions and the following disclaimer in the 125425801eSmiod.\" documentation and/or other materials provided with the distribution. 135425801eSmiod.\" 145425801eSmiod.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 155425801eSmiod.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 165425801eSmiod.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 175425801eSmiod.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 185425801eSmiod.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 195425801eSmiod.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 205425801eSmiod.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 215425801eSmiod.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 225425801eSmiod.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 235425801eSmiod.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 245425801eSmiod.\" POSSIBILITY OF SUCH DAMAGE. 255425801eSmiod.\" 26*aaeccf36Sderaadt.Dd $Mdocdate: January 12 2018 $ 275425801eSmiod.Dt MEM 4 hppa 285425801eSmiod.Os 295425801eSmiod.Sh NAME 305425801eSmiod.Nm mem , 315425801eSmiod.Nm kmem 325425801eSmiod.Nd memory files and memory controller 335425801eSmiod.Sh SYNOPSIS 345425801eSmiod.Cd "mem* at mainbus0 flags 0x0000" 355425801eSmiod.Sh DESCRIPTION 365425801eSmiodThe 375425801eSmiod.Nm 385425801eSmioddriver controls and restricts access to the systems memory 395425801eSmiodby the hardware buses and the processor. 405425801eSmiod.Pp 415425801eSmiodIt also provides an interface to userland through the special files 425425801eSmiod.Pa /dev/mem 435425801eSmiodand 445425801eSmiod.Pa /dev/kmem . 455425801eSmiodPhysical memory is accessed through 465425801eSmiod.Pa /dev/mem , 475425801eSmiodwhile kernel virtual memory is accessed through 485425801eSmiod.Pa /dev/kmem . 495425801eSmiodAccess to kernel virtual addresses not currently mapped to memory will fail. 505425801eSmiodOn hppa, the physical memory range is always contiguous and starts at 515425801eSmiodaddress 0; kernel virtual memory begins at address 0 as well. 525425801eSmiod.Pp 5320d80f81SschwarzeEven with sufficient file system permissions, 5420d80f81Sschwarzethese devices can only be opened when the 5520d80f81Sschwarze.Xr securelevel 7 5620d80f81Sschwarzeis insecure or when the 5720d80f81Sschwarze.Va kern.allowkmem 58*aaeccf36Sderaadt.Xr sysctl 2 5920d80f81Sschwarzevariable is set. 605425801eSmiod.Sh FILES 615425801eSmiod.Bl -tag -width /dev/kmem -compact 625425801eSmiod.It Pa /dev/mem 635425801eSmiod.It Pa /dev/kmem 645425801eSmiod.El 655425801eSmiod.Sh SEE ALSO 665425801eSmiod.Xr securelevel 7 675425801eSmiod.Sh CAVEATS 685425801eSmiodOn some systems featuring a 695425801eSmiod.Dq Viper 705425801eSmiodmemory controller, 715425801eSmiod.Ox 725425801eSmiodmay not configure bus arbitration correctly, causing the boot process 735425801eSmiodto freeze during either 745425801eSmiod.Nm 755425801eSmiodor 765425801eSmiod.Xr cpu 4 775425801eSmioddevice probe. 785425801eSmiod.Pp 795425801eSmiodIn this case, a different initialization strategy can be achieved by 805425801eSmiodsetting 815425801eSmiod.Ar flags 825425801eSmiodto 0x0001 835425801eSmiod.Po 845425801eSmiodsee 855425801eSmiod.Xr boot_config 8 865425801eSmiodfor details 875425801eSmiod.Pc . 88