MEMCTL(2) (For 88k Systems Only) MEMCTL(2)
NAME
memctl - control write/execute attributes of memory
SYNOPSIS
#include <sys/m88kbcs.h>
int memctl (start, length, mode);
char *start;
int length;
int mode;
DESCRIPTION
memctl can change the access mode of a part of memory. It
recognizes these modes:
MCT_TEXT 1 Readable and executable
MCT_TEXT 2 Readable and writable
MCT_TEXT 3 Readable only
The text section of a process is initially in mode 1. The
data, bss, and stack sections are initially in mode 2. A
process should only access its memory in the ways supported
by the current mode, or unpredictable problems will result.
The main purpose of this facility is to allow code to be
written in the data section of a process and the be
executed. This will not work correctly unless memctl() is
called to make the relevant part of the data section
executable after it has been modified and before it has been
executed. If the memory is shared by several processes, all
the processes must follow this procedure. start and length
must be specified in bytes, and must be multiples of 4k.
RETURN VALUE
If the call fails, -1 will be returned, and the global errno
set to reflect the error. Otherwise 0 will be returned.
returns the previous value of the Processor Status Register.
getpsr() returns the current value of the Processor Status
Register.
ERRORS
Page 1 May 1989
MEMCTL(2) (For 88k Systems Only) MEMCTL(2)
[EINVAL] The mode is invalid, or the start or length are
not multiples of 4k.
[EFAULT] The region of memory specified by the start and
length parameters is not valid for the process.
Page 2 May 1989