SYSMIPS(2-SysV) RISC/os Reference Manual SYSMIPS(2-SysV)
NAME
sysmips - machine specific functions
SYNOPSIS
#include <sys/sysmips.h>
int sysmips (cmd, arg1, arg2, arg3)
int cmd, arg1, arg2, arg3;
DESCRIPTION
sysmips implements machine specific functions. The cmd
argument determines the function performed. The number of
arguments expected is dependent on the function.
Command SETNAME
When cmd is SETNAME, an argument of type char * is expected.
This points to a string that has a length less than SYS_NMLN
(defined in syslimts.h). This function renames the system,
which is sometimes referred to as the node name or host
name. This feature is important for networking.
Command SMIPSSWPI
When cmd is SMIPSSWPI, individual swapping areas may be
added, deleted or the current areas determined. The address
of an appropriately primed swap buffer is passed as the only
argument. (Refer to sys/swap.h header file for details of
loading the buffer.)
The format of the swap buffer is:
struct swapint {
char si_cmd; /*command: list, add, delete*/
char *si_buf; /*swap file path pointer*/
int si_swplo; /*start block*/
int si_nblks; /*swap size*/
}
Note that the add and delete options of the command may only
be exercised by the super-user.
Typically, a swap area is added by a single call to sysmips.
First, the swap buffer is primed with appropriate entries
for the structure members. Then sysmips is invoked.
#include <sys/sysmips.h>
#include <sys/swap.h>
struct swapint swapbuf; /*swap into buffer ptr*/
sysmips(SMIPSSWPI, &swapbuf);
Printed 1/15/91 Page 1
SYSMIPS(2-SysV) RISC/os Reference Manual SYSMIPS(2-SysV)
If this command succeeds, it returns 0 to the calling pro-
cess.
Command STIME
When cmd is STIME, an argument of type long is expected.
This function sets the system time and date. The argument
contains the time as measured in seconds from 00:00:00 GMT
January 1, 1970. Note that this command is only available
to the super-user.
Command FLUSHCACHE
When command is FLUSH_CACHE, no arguments are expected.
This function flushes both the instruction and data caches.
Command MIPSFIXADE
When cmd is MIPS_FIXADE, an argument of type long is
expected. This system call enables or disables kernel fix
up of misaligned memory references. A non-zero argument
enables and a zero argument disables this fix up. The MIPS
hardware traps load and store operations where the address
is not a multiple of the number of bytes loaded or stored.
Usually this trap indicates incorrect program operation and
so by default the kernel converts this trap into a SIGBUS
signal to the process, typically causing a core dump for
debugging.
Older programs developed on systems with lax alignment con-
straints sometimes make occasional misaligned references in
course of correct operation. The best way to port such pro-
grams to MIPS hardware is to correct the program by aligning
the data. A SIGBUS handler exists to assist the programmer
in locating unaligned references. See unaligned(3).
Some applications, however, must deal with unaligned data.
The MIPS architecture provides special instructions, sup-
ported by builtin assembler macros, for loading and storing
unaligned data. These applications can use these instruc-
tions where appropriate. Non-assembler programs can access
these instructions via calls, also described in
unaligned(3).
When it is inappropriate to modify the application to either
align the data properly, or to use special access methods
for unaligned data, this system call, fixade, can be used as
a method of last resort. This system call directs the ker-
nel to handle misaligned traps and emulate an unaligned
reference. The program no longer receives a SIGBUS signal.
This emulation is slow, significantly slow down program exe-
cution.
If the program gets an address exception when making a
reference outside its address space, it will still get a
Page 2 Printed 1/15/91
SYSMIPS(2-SysV) RISC/os Reference Manual SYSMIPS(2-SysV)
SIGBUS signal even if this is enabled.
Command MIPSFPSIGINTR
When cmd is MIPS_FPSIGINTR, an argument of type long is
expected. This system call causes every other floating-
point interrupt to generate a SIGFPE signal. If the argu-
ment is 1 the next floating-point interrupt will cause a
signal with the following one not causing a signal. If the
argument is a 2 then the the next floating-point interrupt
will not cause a signal with the following one causing a
signal. If the argument is a 0 then the this feature is
disabled and floating-point interrupts will not cause a sig-
nal.
This is intended for use by fpi(3) to analyze the causes of
floating-point interrupts.
Command MIPSKEYLOCKED
When cmd is MIPS_KEYLOCKED, no arguments are expected. If
the system has a keyswitch, and the keyswitch is in the
locked position, then this function returns 1. If the
switch is not locked, or if the system has no switch, the
function returns 0.
Command MIPSATOMICSET
When cmd is MIPS_ATOMIC_SET, two arguments are expected.
The first argument should be the address of an int variable,
and the second argument should be an int value. This com-
mand atomically sets the variable to the value supplied and
returns the old value of the variable. Note that if the old
value of the variable may be -1, it is not possible to dis-
tinguish that return from an error return, except by setting
the errno variable to 0 before calling sysmips() and testing
whether errno is non-zero on return.
ERRORS
This command fails, returning -1, if one or more of the fol-
lowing is true:
[EFAULT] swapbuf points to an invalid address
[EFAULT] swapbuf.si_buf points to an invalid address
[ENOTBLK] Swap area specified is not a block special
device
[EEXIST] Swap area specified has already been added
[ENOSPC] Too many swap areas in use (if adding)
[ENOMEM] Tried to delete last remaining swap area
Printed 1/15/91 Page 3
SYSMIPS(2-SysV) RISC/os Reference Manual SYSMIPS(2-SysV)
[EINVAL] Bad arguments
[ENOMEM] No place to put swapped pages when deleting a
swap area
SEE ALSO
sync(2), fpi(3), unaligned(3), a.out(4).
swap(1M) in the System Administrator's Reference Manual.
R2010 Floating Point Coprocessor Architecture
R2360 Floating Point Board Product Description
DIAGNOSTICS
Upon successful completion, the value returned is zero,
except as noted above.
Otherwise, a value of -1 is returned and errno is set to
indicate the error. When cmd is invalid, errno is set to
EINVAL on return.
Page 4 Printed 1/15/91