Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

MEM(4)  —  UNIX Programmer’s Manual

NAME

mem, kmem, kMBmem, kMWmem − main memory

DESCRIPTION

Mem is a special file that is an image of the main memory of the computer.  It may be used, for example, to examine (and even to patch) the system. 

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

Examining and patching device registers is likely to lead to unexpected results when read-only or write-only bits are present. 

The file kmem is the same as mem except that kernel virtual memory rather than physical memory is accessed. 

The files kMBmem and kMWmem represent MULTIBUS address space, consecutively mapped 1 megabyte per MULTIBUS controller, starting at 0 for the first controller.  (Deconfigured controllers still reserve their own address space.)  Accesses via kMBmem are one byte at a time, while accesses via kMWmem are two bytes at a time (one 16-bit word). 

MAPPING INTERFACES

Through the mmap(2) system call, these memory files may be mapped, subject to the following restrictions:

/dev/mem
All of what /dev/mem can access through read and write system calls may be mapped; that is, contiguous physical memory starting at physical address zero (limited by reserved memory, if any).  ENXIO results if a mapping attempts to reference memory outside of this range.  /dev/mem maps as non-paged memory (MM_NPMEM). 

/dev/kmem
All of what /dev/kmem can read and write may be mapped.  A read-write file descriptor may not be used to map any part of system code.  Parts of the system address space that change dynamically will map to a generic page if the relevant part of the system address space is invalid at the time of the map.  This generic page is initially zero, but is subject to change as the result of a PROT_WRITE mapping.  /dev/kmem maps as non-paged memory (MM_NPMEM). 

/dev/kMBmem, /dev/kMWmem
All of what these devices can read or write may be mapped. A mapping request cannot cross an MBAd boundary, and must be made to an existing MBAd. There is no checking to prevent a mapping request from referencing non-existent MBAd or I/O address space. These devices map as physical maps (MM_PHYS).

FILES

/dev/mem
/dev/kmem
/dev/kMBmem
/dev/kMWmem

BUGS

Memory files /dev/mem and /dev/kmem are accessed one byte at a time, an inappropriate method for some device registers. 

4BSD/DYNIX

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026