Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ memregion(7) — Motorola System V 88k Release 4 Version 4.3

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

edt_data(4)

mem(7)

memdiag(4)

memregion(7)  —  SPECIAL FILES AND DEVICES

NAME

memregion − core memory by region

SYNOPSIS

#include <sys/types.h>
#include <sys/mem.h>
#include <sys/nvram.h>

int ioctl (int fildes, int command, . . . /∗ arg ∗/);

DESCRIPTION

The special files in the directory /dev/memregion provide access to individual memory regions defined in the system’s edt_data file.  Each memory region has at least one entry named /dev/memregion/N, where N is the id specified in the edt_data file.  Each region can also have an additional alias in the directory. 

Offsets in a /dev/memregion file correspond to byte offsets from the start of the associated memory region, not to physical addresses within the region. 

COMMAND FUNCTIONS

The following ioctl commands can be used to obtain information about the memory region:

MEM_START
Returns the starting physical address of the memory region.

MEM_SIZE Returns the size of the memory region, in bytes. 

MEM_FIRST_PAGE
Return the offset from the start of the region of the beginning of pagable memory in the region.

MEM_LAST_PAGE
Return the offset from the start of the region of the end of pagable memory in the region.

The following ioctl commands are only available if the memory error list facility (module MEMELIST) has been included in the kernel. 

MEM_PHYS_TO_BRD
Returns a memory board and offset representation for an address in the memory region. The third argument specifies the address, and is taken as an offset from the beginning of the region. The return value is a long in the format of an err_entry_t, defined in <sys/nvram.h>, which contains the following fields:

ee_board This is the board number containing the memory.  It is only meaningful on an MVME188; on other CPUs it is zero. 
ee_page This is the offset, in pages, from the start of the board. 
ee_num This is a count of bad pages.  It is not used by the ioctl commands. 
ee_total This is the entire error entry, taken as a long.  It overlaps the other elements of an err_entry_t, so storing the return value from an MEM_PHYS_TO_BRD command into ee_board then permits reading the board and page from ee_board and ee_page. 

MEM_PHYS_TO_BRD is not supported on the MVME197. 

MEM_BRD_TO_PHYS
Returns the byte offset in the memory region corresponding to the board and offset specified by the third argument, taken as a long. The board and offset are in the same format as returned by MEM_PHYS_TO_BRD. 

MEM_BRD_TO_PHYS is not supported on the MVME197. 

MEM_RESERVE_PAGE
The system attempts to remove any uses of the specified page, and prevent it from being otherwise used by the system. The page is specified by the third argument, which is a byte offset from the start of the region. If this ioctl is successful, then the calling process can use mmap to map in the page and then modify it with impunity.  The calling process should release the page using MEM_RELEASE_PAGE before closing.  The system will not automatically release pages before close, but it is unspecified if and when it will do so after close. 

An error return of EBUSY means that the given page has already been marked as bad.  An error return of EAGAIN means that the system could not free the specified page.  EINVAL means that the specified address either is not page aligned or is not pagable memory. 

The file must have been opened for write. 

MEM_RELEASE_PAGE
This releases a page previously reserved via MEM_RESERVE_PAGE.  The page is specified by the third argument, which is taken as an offset from the start of the region. 

MEM_KILL_PAGE
This tells the system the specified page, which must have been previously reserved via MEM_RESERVE_PAGE, must not be returned back to the system even after the file is closed.  The page is specified by the third argument, which is taken as an offset from the start of the region. 

The following ioctl commands are only available if the memory diagnostic facility (module MEMDIAG) has been included in the kernel. 

MEM_REQUEST_CHECK
If boot-time memory diagnostics are running, this flags a single page as needing memory diagnostics. The page is specified by the third argument, which is taken as an offset from the start of the region. This call does not wait for the diagnostics to run.

The file must have been opened for write. 

MEM_CHECK_WAIT
This waits until the page specified by the third argument has completed memory diagnostics. Note that, if the page is currently in use by the system, it might be a long time (or never) before this returns.

MEM_CHECK_WAIT_IMPATIENT
This is similar to MEM_CHECK_WAIT, except that it returns with errno EAGAIN if the wait time isn’t guaranteed to be finite. 

MEM_CHECK_STATUS
This command returns the memory diagnostic status of the page specified in the third argument. The returned value is the logical OR of zero or more of the following:

MEMF_CHECKNEEDED
Diagnostics need to be run on this page.

MEMF_BADPAGE
This page has either experienced a parity error, or has failed diagnostics.

MEMF_BUSY Diagnosics have been requested for this page, but it is currently in use by the system.  A MEM_CHECK_WAIT_IMPATIENT might fail with errno EAGAIN. 

MEM_SET_DIAG_LEVEL
This sets the level of diagnostics that will be performed on memory. The third argument can be DM_NORMAL, DM_QUICK or DM_COMPR, defined in <sys/diag-cntl.h>.  If it is set to DM_NORMAL, then the ramtest daemon will be stopped after it completes any diagnostic currently in progress.  Any memory that is currently marked as needing memory diagnostics will remain so marked, and will not be available to the system. 

Upon successful completion, this command returns the old value for the level of memory diagnostics.  If the third argument is −1, the the old level is returned and a new level is not set. 

This can only be performed by the superuser. 

DIAGNOSTICS

If an ioctl fails, it returns -1 and sets errno to one of the following values:

EINVAL cmd is is not one of the supported values. 

EINVAL A MEM_RESERVE_PAGE, MEM_RELEASE_PAGE, MEM_REQUEST_CHECK, MEM_CHECK_WAIT, MEM_CHECK_WAIT_IMPATIENT, MEM_SET_DIAG_LEVEL, MEM_CHECK_STATUS or MEM_KILL_PAGE command had an illegal value for arg. 

EINVAL A MEM_RELEASE_PAGE or MEM_KILL_PAGE command specified a page that was not previously reserved. 

EINVAL A MEM_BRD_TO_PHYS or MEM_PHYS_TO_BRD command was used on an MVME197. 

EPERM This operation can only be performed by the superuser, or the file must be open for write. 

ENODEV
There is no such memory region, or a given physical address does not exist.

ENODEV
A MEM_RESERVE_PAGE, MEM_RELEASE_PAGE, MEM_REQUEST_CHECK, MEM_CHECK_WAIT, MEM_CHECK_WAIT_IMPATIENT, MEM_CHECK_STATUS or MEM_KILL_PAGE command specified an address that is not paged memory.  It is outside of the range given by MEM_FIRST_PAGE and MEM_LAST_PAGE. 

ENXIO A MEM_PHYS_TO_BRD command specified an offset outside of the range of the memory region, or a MEM_BRD_TO_PHYS specified a board/offset that is outside of this memory region. 

EAGAIN
The page specified by a MEM_RESERVE_PAGE command is in use by the kernel and could not be reserved. 

EBUSY The page specified by a MEM_RESERVE_PAGE command has already been marked as a bad page.  It either had a parity error was was the target of a MEM_KILL_PAGE. 

EAGAIN
The page specified by a MEM_CHECK_WAIT_IMPATIENT command is in use by the system, and it isn’t possible to ensure that it will ever become free. 

EIO An error occurred reading or writing the error list in nvram during a MEM_KILL_PAGE command.  The page has been killed, but has not been entered into the nvram list, and therefore will not be automatically killed after the next reboot.  (This error is not returned on systems that do not support nvram.) 

ENOSPC
A page was not entered into the nvram error list by a MEM_KILL_PAGE command because the nvram is full. 

EINTR A MEM_CHECK_WAIT or MEM_CHECK_WAIT_IMPATIENT command was interrupted by a signal. 

FILES

/dev/memregion/∗

NOTES

The special file /dev/mem corresponds to the union of all files in /dev/memregion.  Offsets in /dev/mem correspond to physical addresses, so there will be “holes” if the memory regions are not contiguous. 

SEE ALSO

edt_data(4), mem(7), memdiag(4). 

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