NAME | FEATURES | DESCRIPTION | IOCTL INTERFACE | BUGS | FILES | ATTRIBUTES | SEE ALSO
DEV_MEM
/dev/mem is an interface to the physical memory of the computer. Byte offsets in this file are interpreted as physical memory addresses. Therefore, reading and writing to this file is equivalent to reading and writing to the memory itself.
Microkernel virtual memory is accessed through the interface /dev/kmem in the same way as /dev/mem . Only microkernel virtual addresses that are currently mapped to memory can be accessed. The microkernel virtual memory is also called the supervisor address space.
The /dev/mem and /dev/kmem special files are available for all supported memory models (flat, protected, and virtual). When the memory model is virtual ( ON_DEMAND_PAGING and VIRTUAL_ADDRESS_SPACE are both set to true), /dev/mem is used to access physical memory and /dev/kmem is used to access the microkernel virtual memory. When the memory model is flat or protected, /dev/mem and /dev/kmem both access the physical memory.
The /dev/mem and /dev/kmem devices are built using the mknod utility as follows:
mknod /dev/kmem c 2 1
mknod /dev/mem c 2 0
The /dev/mem and /dev/kmem files may be read, written, and sought, but not memory-mapped, as mmap() is not supported.
In addition to the read(2POSIX) , write(2POSIX) , and lseek(2POSIX) operations, /dev/mem and /dev/kmem support specific ioctl() calls. Declarations and data types for these ioctl() calls are in the file chorus/memio.h .
int saddr; int kvmd; int res; kvmd = open("/dev/mem, O_RDONLY); res = ioctl(kvmd, MEMSTART, (caddr_t) &saddr);
Returns information about a list of symbols. ioctl() returns 0 when no error has occurred. It is possible that no symbol is found, in which case no value is copied out. Consequently, before calling this function, each symbol value must be erased as follows:
nl[i].n_value = NULL;
Any other returned value stored in n_value field will indicate that the symbol is found.
struct nlist nl[2]; MemSymb ioctl_args; int kvmd; int res; ioctl_args.nlistp = &nl[0]; ioctl_args.len = 2; kvmd = open(DEVMEM, O_RDONLY); res = ioctl(kvmd, MEMNLIST, &ioctl_args);
kvm_nlist() is available in the form of an ioctl MEMNLIST() performed on either the /dev/mem or /dev/kmem file.
/dev/kmem , /dev/mem
See attributes(5) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
---|---|
Interface Stability | Evolving |
NAME | FEATURES | DESCRIPTION | IOCTL INTERFACE | BUGS | FILES | ATTRIBUTES | SEE ALSO