Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ sysm68k(2) — Atari System V 1.1-06

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

sync(2)

a.out(4)

cunix(1M)

swap(1M)





   sysm68k(2)                                                       sysm68k(2)


   NAME
         sysm68k - machine-specific functions

   SYNOPSIS
         #include <sys/sysm68k.h>

         int sysm68k(int cmd, ...);

   DESCRIPTION
         sysm68k implements machine-specific functions.  The cmd argument
         determines the function performed.  The type and number of arguments
         expected depends on the function.

      Command RTODC
         When cmd is RTODC, an argument of type timet * is expected.

         This function reads the hardware time-of-day clock and returns the
         number of seconds since midnight, Jan 01 1970, in the timet
         structure referred to by the argument.  This command is available
         only to the super-user.

      Command SM68KSYM
         When cmd is SM68KSYM, the symbol table created when a new bootable
         operating system is configured may be accessed.  The symbols
         available via this command are defined in one of two places: the
         driver routines loaded or the variable specifications in the files in
         the /etc/master.d directory.  Two arguments are expected:  the first
         must be a pointer to a buffer into which the symbol table is copied,
         and the second must be an integer containing the total size of the
         buffer.  The format of the symbol table is:

               int size;         /* symbol size in bytes */
               int count;        /* total number of symbols */
                                 /* Each symbol is stored as: */
                                 /*      char name[]; (padded */
                                 /*      with '\0' to next */
                                 /*      sizeof(long) boundary */
                                 /*      long value;  the symbol's value */

         The SM68KSVAL macro in sys/sysm68k.h takes a pointer to a symbol name
         in the table and returns its value.  The SM68KNXTSYM macro takes a
         pointer to a symbol name in the table and returns a pointer to the
         next entry.

         Typically, the symbol table would be retrieved with two calls to
         sysm68k.  First, the size of the symbol table is obtained by calling
         sysm68k with a buffer of one integer.  This integer is then used to
         obtain a buffer large enough to contain the entire symbol table.  The
         second invocation of sysm68k with this newly obtained buffer
         retrieves the entire symbol table.



   8/91                                                                 Page 1









   sysm68k(2)                                                       sysm68k(2)


               #include <sys/sysm68k.h>
               int            size;           /* size of buffer needed */
               struct sm68ksym  *buffer;        /* buffer pointer */
               sysm68k( SM68KSYM, (struct sm68ksym *) &size, sizeof(size) );
               buffer = (struct sm68ksym *) malloc( size );
               sysm68k( SM68KSYM, buffer, size );

      Command SM68KCONF
         When cmd is SM68KCONF, the configuration table created during the
         configuration of a new bootable operating system may be accessed.
         This table contains the names and locations of the devices supported
         by the currently running UNIX system, the names of all software
         modules included in the system, and the names of all devices in the
         EDT that were ignored.  Two arguments are expected:  the first must
         be a pointer to a buffer into which the configuration table is
         copied, and the second must be an integer containing the total size
         of the buffer.  The format of the configuration table is:

               int  count;   /* total number of entries */
                             /* for each entry ... */
               timet        timestamp;/*     ftimdat from file header */
               char name[DIRSIZ];/*     name of device/module */
               unsigned char flag;/*     configuration information */
                             /*          0x80: device ignored */
                             /*          0x40: name[] is a driver */
                             /*          0x20: name[] is a software module */
               unsigned char mmajor;/* external major device number*/

         Typically, the configuration table would be retrieved with two calls
         to sysm68k.  First, the number of entries is obtained by calling
         sysm68k with a buffer of one integer.  This integer is then used to
         calculate and obtain a buffer large enough to contain the entire
         configuration table.  The second invocation of sysm68k with this
         newly obtained buffer retrieves the configuration table.

               #include <sys/sysm68k.h>
               int  count;      /* total number of devices */
               int  size;       /* size of buffer needed */
               struct           smconf *buffer;/* buffer pointer */
               sysm68k( SM68KCONF, (struct smconf *)&count, sizeof(count));
               size = sizeof(int);
               size += count * sizeof(struct smc);
               buffer = (struct smconf *)malloc(size);
               sysm68k(SM68KCONF, buffer, size);

      Command XGETEDT
         When cmd is XGETEDT, the extended EDT table for a specified device
         controller is returned.  This table contains the names and locations
         of the devices supported by the currently running version of the
         operating system, the names of all software modules included in the
         system, and the names of all devices in the EDT that were ignored.


   Page 2                                                                 8/91









   sysm68k(2)                                                       sysm68k(2)


         Three arguments are expected:  the first must be a devt that
         specifies the controller to be accessed, the second is a pointer to a
         buffer into which the extended EDT table is copied, and the third
         must be an integer containing the total size of the buffer.  The
         format of the extended EDT table is:

               int  count;   /* total number of entries */
                             /* for each entry ... */
               char xname[XXNAMLEN];/*     device name/information */
               int  xunit;  /*     unit number on controller */
               uint         xksize;/*     size in kbytes */

         Typically, the extended EDT table is retrieved with two calls to
         sysm68k.  First, the number of extended EDT entries for the
         controller specified by the device argument is obtained by calling
         sysm68k with a buffer of one integer.  This integer is then used to
         calculate how large a buffer is needed to contain the entire extended
         EDT table for the controller, and that buffer is then obtained.  The
         second invocation of sysm68k with this newly obtained buffer
         retrieves the extended EDT table.

               #include <sys/sysm68k.h>
               #include <sys/edt.h>
               int  count;      /* total number of devices */
               int  size;       /* size of buffer needed */
               struct           kxedt *buffer;/* buffer pointer */
               sysm68k( XGETEDT, dev, &count, sizeof(count));
               size = sizeof(int);
               size += count * sizeof(struct xedt);
               buffer = (struct kxedt *)malloc(size);
               sysm68k( XGETEDT, dev, buffer, size);

      Command SM68KBOOT
         When cmd is SM68KBOOT, the timestamp and path name of the program
         last used to bootstrap the machine may be accessed.  The path name of
         the a.out format file which was booted, and the timestamp from the
         file header [see a.out(4)] are saved.  One argument is expected:  a
         pointer to a buffer into which the information is copied.  The format
         of this information is:

               timet         timestamp;/* ftimdat from file header */
               char path[100];/* path name */

         This information would be retrieved with a single call to sysm68k.

               #include <sys/sysm68k.h>

               struct sm68kboot buffer;  /* buffer */





   8/91                                                                 Page 3









   sysm68k(2)                                                       sysm68k(2)


               sysm68k(SM68KBOOT, &buffer);

      Command SM68KAUTO
         When cmd is SM68KAUTO, no arguments are expected.  This function
         returns a boolean value in answer to the question, ``Was the
         operating system reconfigured during the last boot, or was an
         existing bootable operating system booted?''  The value returned is
         zero if an existing bootable (such as /stand/stand/unix or
         /stand/unix) was booted.  The integer value 1 is returned if the
         bootable operating system was configured during the preceding boot
         process.  The value is undefined if the system was booted in ``magic
         mode.''  This command is available only to the super-user.

      Command SM68KSWPI
         Note:  This cmd is available only with UNIX System V Release 2.1 and
         Release 3 software.  Its function is subsumed by the swap command;
         see swap(1M).

         When cmd is SM68KSWPI, 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 the sys/swap.h header file for details of loading the
         buffer.)

         The format of the swap buffer is:

               struct swapint {
                    char sicmd;/*command: list, add, delete*/
                    char *sibuf;/*swap file path pointer*/
                    int  siswplo;/*start block*/
                    int  sinblks;/*swap size*/
               }

         Note that the add and delete options of the command may be exercised
         only by the super-user.

         Typically, a swap area is added by a single call to sysm68k. First,
         the swap buffer is primed with appropriate entries for the structure
         members.  Then sysm68k is invoked.

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

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

               sysm68k(SM68KSWPI, &swapbuf);

         If this command succeeds, it returns 0 to the calling process.  It
         fails and returns -1 if one or more of the following is true:




   Page 4                                                                 8/91









   sysm68k(2)                                                       sysm68k(2)


         EFAULT      swapbuf points to an invalid address.

         EFAULT      swapbuf.sibuf points to an invalid address.

         ENOTBLK     The swap area specified is not a block special device.

         EEXIST      The swap area specified has already been added.

         ENOSPC      Too many swap areas are in use (if adding).

         ENOMEM      The swap area specified is the last remaining swap area.

         ENOMEM      There is no place to put swapped pages when deleting a
                     swap area.

         EINVAL      An argument is invalid.

      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 UTC January 1, 1970. This
         command is available only to the super-user.

      Command SM68KTRAPLOCORE
         Prior to release 4.0, user processes could read low memory (for
         example, read accesses using NULL pointers were permitted from user
         programs).  When cmd is SM68KTRAPLOCORE, user level access permission
         on low core memory can be changed and user accesses of low core
         memory can be trapped.  Only read access is affected;  user level
         write access to low core is not allowed under any circumstances.

         A single argument of type int is expected.  This argument may have
         one of the following five values, defined in <sys/sysm68k.h>:

         SM68KTLCDISABLE
               Disable low core trapping.  Read accesses to low core are
               allowed from user processes.

         SM68KTLCSIGNAL
               Trap low core accesses.  Any user process which attempts to
               read low core will be sent a SIGSEGV signal with sicode set to
               SEGVMAPERR.

         SM68KTLCPRINT
               Trap low core accesses.  Any user process which attempts to
               read low core will be sent a SIGSEGV signal with sicode set to
               SEGVMAPERR.  In addition, a message will be printed on the
               system console each time a process attempts to read low core.





   8/91                                                                 Page 5









   sysm68k(2)                                                       sysm68k(2)


         SM68KTLCWARN
               Trap low core accesses and print a message on the system
               console identifying the process and the address accessed.  Do
               not send signals to the process.

         SM68KTLCSTATUS
               Return current state of low core trapping.  The state of low
               core trapping is unchanged.

         If this command succeeds, it returns one of SM68KTLCDISABLE,
         SM68KTLCSIGNAL, SM68KTLCPRINT, to indicate the setting of low core
         protection prior to the call.  NOTE this command changes behavior for
         all processes, not just for the current process.  The command fails
         and returns -1 if one or more of the following is true:

         EPERM  The caller is not super-user (not required for
                SM68KTLCSTATUS).

         EINVAL An argument is invalid.

   DIAGNOSTICS
         On success, sysm68k returns a value that depends on cmd as follows:

               SM68KSYM  A value of zero.
               SM68KCONF A value of zero.
               SM68KBOOT A value of zero.
               SM68KAUTO A value of zero if an existing bootable operating
                         system (such as /stand/stand/unix or /stand/unix) was
                         last booted.  A value of one if a new bootable
                         operating system was configured during the last boot
                         process.
               SM68KTRAPLOCORE
                         Returns the setting of low core protection prior to
                         the call.

         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.

   SEE ALSO
         sync(2), a.out(4).
         cunix(1M), swap(1M), in the System Administrator's Reference Manual.












   Page 6                                                                 8/91





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