|
NAME
SYNOPSIS
DESCRIPTIONThe 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 ISA the I/O memory space begins at physical address 0x000a0000
and runs to 0x00100000. The per-process data size for the current process is
IOCTL INTERFACEAddress PropertiesThe struct mem_extract {
uint64_t me_vaddr; /* input */
uint64_t me_paddr; /* output */
int me_domain; /* output */
int me_state; /* output */
};
The ioctl returns an error if the address is not valid. The
information returned by The me_state field provides information about the state of the virtual page:
Memory RangesSeveral architectures allow attributes to be associated with
ranges of physical memory. These attributes can be manipulated via
The specific attributes, and number of programmable ranges may vary between architectures. The full set of supported attributes is:
Memory ranges are described by struct mem_range_desc {
uint64_t mr_base; /* physical base address */
uint64_t mr_len; /* physical length of region */
int mr_flags; /* attributes of region */
char mr_owner[8];
};
In addition to the region attributes listed above, the following flags may also be set in the mr_flags field:
Operations are performed using struct mem_range_op {
struct mem_range_desc *mo_desc;
int mo_arg[2];
};
The The mo_arg[0] should be set to
Live Kernel DumpsThe struct mem_livedump_arg {
int fd; /* input */
int flags /* input */
uint8_t compression /* input */
};
The fd field is used to pass the file descriptor. The flags field is currently unused and must be set to zero. The compression field can be used to specify
the desired compression to be applied to the dump output. The supported
values are defined in
Kernel dumps taken against the running system may have inconsistent kernel data structures due to allocation, deallocation, or modification of memory concurrent to the dump procedure. Thus, the resulting core dump is not guaranteed to be usable. A system under load is more likely to produce an inconsistent result. Despite this, live kernel dumps can be useful for offline debugging of certain types of kernel bugs, such as deadlocks, or in inspecting a particular part of the system's state. RETURN VALUESMEM_EXTRACT_PADDRThe MEMRANGE_GET/MEMRANGE_SET
MEM_KERNELDUMP
FILES
HISTORYThe /dev/mem file appeared in Version 1 AT&T UNIX and /dev/kmem in Version 5 AT&T UNIX. The ioctl interface for memory range attributes was added in FreeBSD 3.2.
|