Manpages

NAME

mem, kmem − physical or virtual memory

SYNOPSIS

/dev/mem

/dev/kmem

DESCRIPTION

The file /dev/mem is a special file that is an image of the physical memory of the computer. The file /dev/kmem is a special file that is an image of the kernel virtual memory of the computer. Either may be used, for example, to examine, and even patch the system.

Byte addresses in /dev/mem are interpreted as physical memory addresses. Byte addresses in /dev/kmem are interpreted as kernel virtual memory addresses. References to non-existent locations cause errors to be returned.

The file /dev/kmem accesses up to 4GB of kernel virtual memory. The file /dev/mem accesses physical memory; the size of the file is equal to the amount of physical memory in the computer. This can be larger than 4GB; in which case, memory beyond 4GB can be accessed using a series of read(2) and write(2) commands or a combination of llseek(2) and read(2) and write(2).

ERRORS

EFAULT

Bad address. This error can occur when trying to: write(2) a read-only location, read(2) a write-only location, or read(2) or write(2) a non-existent or unimplemented location.

ENXIO

This error results from attempting to mmap(2) a non-existent physical (mem) or virtual (kmem) memory address.

FILES

/dev/mem

File containing image of physical memory of computer.

/dev/kmem

File containing image of kernel virtual memory of computer.

SEE ALSO

llseek(2), mmap(2), read(2), write(2)

NOTES

Some of /dev/kmem cannot be read because of write-only addresses or unequipped memory addresses.

COMMENTS