Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

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

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

edt_data(4)

mem(7)

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 (modules 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_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_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 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. 

DIAGNOSTICS

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

EINVAL cmd is illegal. 

EINVAL A MEM_RESERVE_PAGE, MEM_RELEASE_PAGE, or MEM_KILL_PAGE command had an illegal value for arg. 

EINVAL A MEL_RELEASE_PAGE or MEL_KILL_PAGE command specified a page that was not previously reserved. 

EPERM This operation can only be performed by the superuser. 

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

ENODEV
A MEM_RESERVE_PAGE, MEM_RELEASE_PAGE, or MEM_KILL_PAGE command specified an address that is not paged memory. 

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. 

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

EIO An error occurred reading or writing the error list in nvram during a MEL_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 MEL_KILL_PAGE command because the nvram is full. 

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). 

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