Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ sysmips(2) — svr3 — mips UMIPS RISC/os 5.01

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

sync(2)

fpi(3)

unaligned(3)

a.out(4)

swap(1M)



SYSMIPS(2-SVR3)     RISC/os Reference Manual      SYSMIPS(2-SVR3)



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 FLUSHCACHE
     Expects no arguments. This command causes a writeback of any
     dirty data to main memory, and a full invalidation of all
     caches:  instruction, data, and secondary (if it exists).

   Command MIPSATOMICSET
     Expects two arguments.  The first argument should be a type
     int * variable, and the second argument a type int value.
     This command atomically sets the variable to the value sup-
     plied and returns the old value of the variable.  Note that
     the old value of the variable may be -1, in which case it is
     not possible to distinguish 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.

   Command MIPSEXECMAP
     Expects three arguments.  This command maps dynamic shared
     objects into the process address space.  The first argument
     should be a type char *.  If non-zero, it specifies the
     pathname of the file which contains the text and/or data to
     be mapped.  If the first argument is zero, then the third
     argument should be a type int file descriptor of an already
     open file.  The second argument should be a type long value
     which, if 255, specifies that the file contents be mapped at
     the precise virtual addresses specified in the file header;
     otherwise, the file will be mapped into the process' address
     space at addresses chosen by the kernel.

   Command MIPSEXECUNMAP
     Expects two arguments.  This command unmaps pieces of the
     process' address space.  The first argument should be a type
     char * which specifies a valid virtual address of text
     and/or data to be unmapped.  The second argument should be a
     type int which specifies the number of bytes to unmap.

   Command MIPSFILEOUT
     Expects three arguments.  The first and second arguments



                        Printed 11/19/92                   Page 1





SYSMIPS(2-SVR3)     RISC/os Reference Manual      SYSMIPS(2-SVR3)



     should be type int file descriptors of an input file and an
     output file, respectively, and the third argument should be
     a type int byte count of data to copy from the input file to
     the output file.

   Command MIPSFIXADE
     Expects an argument of type long.  This command enables
     (argument is nonzero) or disables (argument is zero) kernel
     fix up of misaligned memory references.  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 command MIPS_FIXADE can be used as
     a method of last resort.  It directs the kernel to handle
     misaligned traps transparently and emulate an unaligned
     reference.  The program no longer receives a SIGBUS signal.
     This emulation is slow, and heavy use will significantly
     slow down program execution.

     If the program gets an address exception when making a
     reference outside its address space, it will still get a
     SIGBUS signal even if MIPS_FIXADE is enabled.

   Command MIPSFPSIGINTR
     Expects an argument of type long.  This command causes every
     second floating-point interrupt to generate a SIGFPE signal.
     If the argument is 1, then 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 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



 Page 2                 Printed 11/19/92





SYSMIPS(2-SVR3)     RISC/os Reference Manual      SYSMIPS(2-SVR3)



     cause a signal.

     This is intended for use by fpi(3) to analyze the causes of
     floating-point interrupts.

   Command MIPSFPU
     Expects an argument of type long.  If the argument is zero,
     then the hardware floating-point unit is logically disabled,
     and all user floating-point operations are transparently
     emulated by kernel software.  If the argument is non-zero,
     then the hardware floating-point unit (if it exists) is log-
     ically enabled.  This command is only available to the
     superuser.

   Command MIPSGETAVAILSMEM
     Expects one argument of type int *.  The command copies the
     kernel availsmem variable to the user variable.  This is the
     current maximum number of allocateable, swappable pages.

   Command MIPSGETAVENRUN
     Expects one argument of type fix *, which should be an
     address of an array of 3 elements of type fix
     (<sys/fixpoint.h>).  The command copies the kernel avenrun
     array to the user array.  The avenrun array is the system
     load average history, with the elements in fixed point
     representation.  The elements correspond, in order, to the
     load average over periods of 60, 300 and 900 seconds.

   Command MIPSGETBOOTTIME
     Expects one argument of type struct timeval *.  The command
     copies the kernel boottime variable to the user variable.

   Command MIPSGETCCPU
     Expects one argument of type fix *.  The command copies the
     kernel ccpu variable to the user variable.  This value is a
     delay constant used to compute CPU time percentages reported
     by the ps command.

   Command MIPSGETDEFICIT
     Expects one argument of type int *.  The command copies the
     kernel deficit variable to the user variable.

   Command MIPSGETDISKSTATS
     Expects one argument of type struct iotime *, which should
     be the address of an array of num_bstats elements of type
     struct iotime (<sys/elog.h>).  The command copies the kernel
     bstat_list array to the user variable.  Use the command
     MIPS_GET_NUMDISKS to determine the value num_bstats.

   Command MIPSGETFILECOUNT
     Expects one argument of type int *.  The command computes
     the number of open files in the system, and copies this



                        Printed 11/19/92                   Page 3





SYSMIPS(2-SVR3)     RISC/os Reference Manual      SYSMIPS(2-SVR3)



     value to the user variable.

   Command MIPSGETFIRSTFREE
     Expects one argument of type int *.  The command copies the
     kernel firstfree variable to the user variable.  This is the
     page address of the first free page, after the kernel ini-
     tialized itself.

   Command MIPSGETFLCKINFO
     Expects one argument of type struct flckinfo *
     (<sys/flock.h>).  The command copies the kernel flckinfo
     variable to the user variable.

   Command MIPSGETFREEMEM
     Expects one argument of type int *.  The command copies the
     kernel freemem variable to the user variable.  This is the
     current number of free, clean pages on the freelist.

   Command MIPSGETIDSTRING
     Expects one argument of type char *.  The command copies the
     kernel id_string variable to the user variable.  This string
     describes the kernel by its version and timestamp of when it
     was built.

   Command MIPSGETINODECOUNT
     Expects one argument of type int *.  The command computes
     the number of active inodes, and copies this value to the
     user variable.

   Command MIPSGETKMEMSTATS
     Expects one argument of type struct kmemstats *
     (<sys/kmem.h>).  The command copies the kernel kmemstats
     variable to the user variable.

   Command MIPSGETLOADAVG
     Expects one argument of type ufix *, which should be the
     address of an array of 6 elements of type ufix
     <sys/fixpoint.h>).  The command copies the kernel loadavg
     array to the user array.  The loadavg array is the system
     load average history, with the elements in fixed point
     representation. The elements correspond, in order, to the
     load average over periods of 1, 5, 20, 60, 300 and 900
     seconds.

   Command MIPSGETMAXFREE
     Expects one argument of type int *.  The command copies the
     kernel maxfree variable to the user variable.  This is the
     page address of the last free page, after the kernel has
     initialized itself.

   Command MIPSGETMAXMEM
     Expects one argument of type int *.  The command copies the



 Page 4                 Printed 11/19/92





SYSMIPS(2-SVR3)     RISC/os Reference Manual      SYSMIPS(2-SVR3)



     kernel maxmem variable to the user variable.  This is the
     total number of pages of physical memory in the system,
     minus that used by the kernel itself.

   Command MIPSGETMBSTAT
     Expects one argument of type struct mbstat * (<sys/mbuf.h>).
     The command copies the kernel mbstat variable to the user
     variable.

   Command MIPSGETMINFO
     Expects one argument of type struct minfo *
     (<sys/sysinfo.h>).  The command copies the kernel minfo
     variable to the user variable.

   Command MIPSGETMPID
     Expects one argument of type pid_t * (<sys/types.h>).  The
     command copies the kernel mpid variable to the user vari-
     able.  This value is the latest processID value assigned by
     the kernel.

   Command MIPSGETNCSTATS
     Expects one argument of type struct ncstats *
     (<sys/dnlc.h>).  The command copies the kernel ncstats vari-
     able to the user variable.

   Command MIPSGETNUMDISKS
     Expects one argument of type int *.  The command copies the
     kernel num_bstats variable to the user variable.  This is
     the count of the number of disk and/or SCSI devices in the
     system.  More specifically, it is the number of devices for
     which struct iotime statistics structures have been allo-
     cated by the kernel device drivers.

   Command MIPSGETSQAVENRUN
     Expects one argument of type fix *, which should be the
     address of an array of 3 elements of type fix
     (<sys/fixpoint.h>).  The command copies the kernel
     sq_avenrun array to the user array.  The sq_avenrun array is
     the rolling system load average history, with the elements
     in fixed point representation.  The elements correspond, in
     order, to the load average over periods of 60, 300 and 900
     seconds.

   Command MIPSGETSWAPTABNAMES
     Expects one argument of type struct swpt_t *, which should
     be the address of an array of MSFILES elements of type
     struct swpt_t (<sys/swap.h>).  The command copies the kernel
     swaptab variable to the user variable.  If the st_name field
     points to allocated buffer space, the kernel will copy in
     the names of the swap partitions.  This is a table of infor-
     mation about swap files.




                        Printed 11/19/92                   Page 5





SYSMIPS(2-SVR3)     RISC/os Reference Manual      SYSMIPS(2-SVR3)



   Command MIPSGETSWPLO
     Expects one argument of type daddr_t *.  The command copies
     the kernel swplo variable to the user variable.  This is the
     disk block number (of 512-byte blocks) of the first block of
     the system swap partition that is used for swapping pur-
     poses.  (Typically, this is 0 but it can be non-zero, par-
     ticularly during installation of a new operating system
     release).

   Command MIPSGETSYSERR
     Expects one argument of type struct syserr *
     (<sys/sysinfo.h>).  The command copies the kernel syserr
     variable to the user variable.

   Command MIPSGETSYSINFO
     Expects one argument of type struct sysinfo *
     (<sys/sysinfo.h>).  The command copies the kernel sysinfo
     variable to the user variable.

   Command MIPSGETVAR
     Expects one argument of type struct var * (<sys/var.h>).
     The command copies the kernel var variable to the user vari-
     able.

   Command MIPSGETVMRATE
     Expects one argument of type struct bsd43_vmmeter *
     (<bsd43/sys/vmmeter.h>).  The command copies the kernel rate
     variable to the user variable.

   Command MIPSGETVMSUM
     Expects one argument of type struct bsd43_vmmeter *
     (<bsd43/sys/vmmeter.h>).  The command copies the kernel sum
     variable to the user variable.

   Command MIPSGETVMTOTAL
     Expects one argument of type struct bsd43_vmtotal *
     (<bsd43/sys/vmmeter.h>).  The command copies the kernel
     total variable to the user variable.

   Command MIPSKEYLOCKED
     Expects no arguments. If the system has a keyswitch, and if
     the keyswitch is in the locked position, then this command
     returns 1.  If the switch is not locked, or if the system
     has no switch, the command returns 0.

   Command MIPSMINSLICE
     Expects no arguments.  The process is granted the "minslice"
     privilege to reduce involuntary context switches.  This
     allows the process to execute for a minimum time before it
     can be preempted by a higher priority process.  That minimum
     time is defined by the kernel variable min_csw_thresh which
     is a count of HZ time ticks (typically 10 milliseconds).



 Page 6                 Printed 11/19/92





SYSMIPS(2-SVR3)     RISC/os Reference Manual      SYSMIPS(2-SVR3)



     This command is only available to the superuser.

   Command MIPSPRIVILEGEDCHOWN
     Expects an argument of type long.  If the argument value is
     non-zero, then the command tells the kernel to use SysV res-
     trictions on chown.  If the argument is zero, then the ker-
     nel will use BSD (and Posix) restrictions.  SysV restric-
     tions are to accept chown only from the file owner, or from
     the superuser.  The command returns the current value of the
     flag.  This command is only available to the superuser.

   Command MIPSSBREAK
     Expects two arguments.  The command maps or unmaps a virtual
     address range.  The first argument should be a type integer,
     and it specifies a byte length.  The second argument should
     be a type long *, which specifies a base address from which
     to add (expand), or subtract (contract), that number of
     bytes.

   Command MIPSSETVMSUM
     Expects one argument of type struct bsd43_vmmeter *
     (<bsd43/sys/vmmeter.h>).  The command copies the user vari-
     able to the kernel sum variable.

   Command SETNAME
     Expects an argument of type char *, which points to a string
     that has a length less than SYS_NMLN (<limits.h>). This com-
     mand renames the system name, which is sometimes referred to
     as the node name or host name.  This feature is important
     for networking.  This command is only available to the
     superuser.

   Command SMIPSSWPI
     Expects one argument of type struct swapint *
     (<sys/swap.h>).  This command adds, deletes, or lists indi-
     vidual swapping areas.

     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*/
       }

     The add and delete options of the command are only available
     to the superuser.

     Typically, the swap buffer is initialized with appropriate
     entries for the structure members.  Then sysmips is invoked.




                        Printed 11/19/92                   Page 7





SYSMIPS(2-SVR3)     RISC/os Reference Manual      SYSMIPS(2-SVR3)



       #include <sys/sysmips.h>
       #include <sys/swap.h>

       struct swapint swapbuf;          /*swap into buffer ptr*/

       sysmips(SMIPSSWPI, &swapbuf);

     If this command succeeds, it returns 0 to the calling pro-
     cess.

   Command STIME
     Expects an argument of type long. This command sets the sys-
     tem time and date.  The argument contains the time as meas-
     ured in seconds from 00:00:00 GMT January 1, 1970. This com-
     mand is only available to the superuser.

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

     [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 8                 Printed 11/19/92



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