The special file /dev/mem is an interface to the physical memory of the computer. Byte offsets in this file are interpreted as physical memory addresses. Reading and writing this file is equivalent to reading and writing memory itself. Only offsets within the bounds of /dev/mem are allowed.
Kernel virtual memory is accessed through the interface /dev/kmem in the same manner as /dev/mem. Only kernel virtual addresses that are currently mapped to memory are allowed.
On amd64, physical memory is discontiguous; especially, the ISA
I/O memory space covers the physical address range from
The kernel virtual memory begins at address
Even with sufficient file system permissions, these devices can only be opened when the securelevel(7) is insecure or when the kern.allowkmem sysctl(2) variable is set.
The /dev/mem and /dev/kmem files appeared in Version 6 AT&T UNIX.