BSD 4 development
authorBill Joy <wnj@ucbvax.Berkeley.EDU>
Mon, 10 Nov 1980 14:51:24 +0000 (06:51 -0800)
committerBill Joy <wnj@ucbvax.Berkeley.EDU>
Mon, 10 Nov 1980 14:51:24 +0000 (06:51 -0800)
Work on file usr/src/sys/h/acct.h
Work on file usr/src/sys/h/buf.h
Work on file usr/src/sys/h/bk.h
Work on file usr/src/sys/h/clock.m
Work on file usr/src/sys/h/clock.h
Work on file usr/src/sys/h/callo.h
Work on file usr/src/sys/h/cmap.h
Work on file usr/src/sys/h/clist.h
Work on file usr/src/sys/h/dir.h
Work on file usr/src/sys/h/dmap.h
Work on file usr/src/sys/h/cons.m
Work on file usr/src/sys/h/cmap.m
Work on file usr/src/sys/h/dk.h
Work on file usr/src/sys/h/cons.h
Work on file usr/src/sys/h/conf.h
Work on file usr/src/sys/h/fblk.h
Work on file usr/src/sys/h/file.h
Work on file usr/src/sys/h/inline.h
Work on file usr/src/sys/h/flp.h
Work on file usr/src/sys/h/inode.h
Work on file usr/src/sys/h/ino.h
Work on file usr/src/sys/h/filsys.h
Work on file usr/src/sys/h/map.h
Work on file usr/src/sys/h/mba.h
Work on file usr/src/sys/h/ioctl.h
Work on file usr/src/sys/h/mba.m
Work on file usr/src/sys/h/mtpr.m
Work on file usr/src/sys/h/mount.h
Work on file usr/src/sys/h/mx.h
Work on file usr/src/sys/h/mtpr.h
Work on file usr/src/sys/h/page.m
Work on file usr/src/sys/h/pdma.h
Work on file usr/src/sys/h/param.h
Work on file usr/src/sys/h/proc.h
Work on file usr/src/sys/h/pcb.m
Work on file usr/src/sys/h/pcb.h
Work on file usr/src/sys/h/psl.h
Work on file usr/src/sys/h/proc.m
Work on file usr/src/sys/h/pte.h
Work on file usr/src/sys/h/seg.h
Work on file usr/src/sys/h/stat.h
Work on file usr/src/sys/h/reg.h
Work on file usr/src/sys/h/reboot.h
Work on file usr/src/sys/h/psl.m
Work on file usr/src/sys/h/timeb.h
Work on file usr/src/sys/h/text.h
Work on file usr/src/sys/h/times.h
Work on file usr/src/sys/h/systm.h
Work on file usr/src/sys/h/trap.m
Work on file usr/src/sys/h/trap.h
Work on file usr/src/sys/h/uba.h
Work on file usr/src/sys/h/tty.h
Work on file usr/src/sys/h/uba.m
Work on file usr/src/sys/h/vcmd.h
Work on file usr/src/sys/h/user.h
Work on file usr/src/sys/h/vm.m
Work on file usr/src/sys/h/vlimit.h
Work on file usr/src/sys/h/vm.h
Work on file usr/src/sys/h/vmklust.h
Work on file usr/src/sys/h/vmclust.h
Work on file usr/src/sys/h/vmmon.h
Work on file usr/src/sys/h/vmmeter.h
Work on file usr/src/sys/h/vmparam.h
Work on file usr/src/sys/h/vmmac.h
Work on file usr/src/sys/h/vmsysent.h
Work on file usr/src/sys/h/vmtotal.h
Work on file usr/src/sys/h/vmtune.h
Work on file usr/src/sys/h/vtimes.h
Work on file usr/src/sys/h/vmsystm.h

Synthesized-from: CSRG//cd1/4.0

69 files changed:
usr/src/sys/h/acct.h [new file with mode: 0644]
usr/src/sys/h/bk.h [new file with mode: 0644]
usr/src/sys/h/buf.h [new file with mode: 0644]
usr/src/sys/h/callo.h [new file with mode: 0644]
usr/src/sys/h/clist.h [new file with mode: 0644]
usr/src/sys/h/clock.h [new file with mode: 0644]
usr/src/sys/h/clock.m [new file with mode: 0644]
usr/src/sys/h/cmap.h [new file with mode: 0644]
usr/src/sys/h/cmap.m [new file with mode: 0644]
usr/src/sys/h/conf.h [new file with mode: 0644]
usr/src/sys/h/cons.h [new file with mode: 0644]
usr/src/sys/h/cons.m [new file with mode: 0644]
usr/src/sys/h/dir.h [new file with mode: 0644]
usr/src/sys/h/dk.h [new file with mode: 0644]
usr/src/sys/h/dmap.h [new file with mode: 0644]
usr/src/sys/h/fblk.h [new file with mode: 0644]
usr/src/sys/h/file.h [new file with mode: 0644]
usr/src/sys/h/filsys.h [new file with mode: 0644]
usr/src/sys/h/flp.h [new file with mode: 0644]
usr/src/sys/h/inline.h [new file with mode: 0644]
usr/src/sys/h/ino.h [new file with mode: 0644]
usr/src/sys/h/inode.h [new file with mode: 0644]
usr/src/sys/h/ioctl.h [new file with mode: 0644]
usr/src/sys/h/map.h [new file with mode: 0644]
usr/src/sys/h/mba.h [new file with mode: 0644]
usr/src/sys/h/mba.m [new file with mode: 0644]
usr/src/sys/h/mount.h [new file with mode: 0644]
usr/src/sys/h/mtpr.h [new file with mode: 0644]
usr/src/sys/h/mtpr.m [new file with mode: 0644]
usr/src/sys/h/mx.h [new file with mode: 0644]
usr/src/sys/h/page.m [new file with mode: 0644]
usr/src/sys/h/param.h [new file with mode: 0644]
usr/src/sys/h/pcb.h [new file with mode: 0644]
usr/src/sys/h/pcb.m [new file with mode: 0644]
usr/src/sys/h/pdma.h [new file with mode: 0644]
usr/src/sys/h/proc.h [new file with mode: 0644]
usr/src/sys/h/proc.m [new file with mode: 0644]
usr/src/sys/h/psl.h [new file with mode: 0644]
usr/src/sys/h/psl.m [new file with mode: 0644]
usr/src/sys/h/pte.h [new file with mode: 0644]
usr/src/sys/h/reboot.h [new file with mode: 0644]
usr/src/sys/h/reg.h [new file with mode: 0644]
usr/src/sys/h/seg.h [new file with mode: 0644]
usr/src/sys/h/stat.h [new file with mode: 0644]
usr/src/sys/h/systm.h [new file with mode: 0644]
usr/src/sys/h/text.h [new file with mode: 0644]
usr/src/sys/h/timeb.h [new file with mode: 0644]
usr/src/sys/h/times.h [new file with mode: 0644]
usr/src/sys/h/trap.h [new file with mode: 0644]
usr/src/sys/h/trap.m [new file with mode: 0644]
usr/src/sys/h/tty.h [new file with mode: 0644]
usr/src/sys/h/uba.h [new file with mode: 0644]
usr/src/sys/h/uba.m [new file with mode: 0644]
usr/src/sys/h/user.h [new file with mode: 0644]
usr/src/sys/h/vcmd.h [new file with mode: 0644]
usr/src/sys/h/vlimit.h [new file with mode: 0644]
usr/src/sys/h/vm.h [new file with mode: 0644]
usr/src/sys/h/vm.m [new file with mode: 0644]
usr/src/sys/h/vmclust.h [new file with mode: 0644]
usr/src/sys/h/vmklust.h [new file with mode: 0644]
usr/src/sys/h/vmmac.h [new file with mode: 0644]
usr/src/sys/h/vmmeter.h [new file with mode: 0644]
usr/src/sys/h/vmmon.h [new file with mode: 0644]
usr/src/sys/h/vmparam.h [new file with mode: 0644]
usr/src/sys/h/vmsysent.h [new file with mode: 0644]
usr/src/sys/h/vmsystm.h [new file with mode: 0644]
usr/src/sys/h/vmtotal.h [new file with mode: 0644]
usr/src/sys/h/vmtune.h [new file with mode: 0644]
usr/src/sys/h/vtimes.h [new file with mode: 0644]

diff --git a/usr/src/sys/h/acct.h b/usr/src/sys/h/acct.h
new file mode 100644 (file)
index 0000000..23bff90
--- /dev/null
@@ -0,0 +1,27 @@
+/*     acct.h  4.1     11/9/80 */
+
+/*
+ * Accounting structures
+ */
+
+typedef        unsigned short comp_t;  /* "floating pt": 3 bits base 8 exp, 13 bits fraction */
+struct acct
+{
+       char    ac_comm[10];            /* Accounting command name */
+       comp_t  ac_utime;               /* Accounting user time */
+       comp_t  ac_stime;               /* Accounting system time */
+       comp_t  ac_etime;               /* Accounting elapsed time */
+       time_t  ac_btime;               /* Beginning time */
+       short   ac_uid;                 /* Accounting user ID */
+       short   ac_gid;                 /* Accounting group ID */
+       short   ac_mem;                 /* average memory usage */
+       comp_t  ac_io;                  /* number of disk IO blocks */
+       dev_t   ac_tty;                 /* control typewriter */
+       char    ac_flag;                /* Accounting flag */
+};
+
+extern struct  acct    acctbuf;
+extern struct  inode   *acctp;         /* inode of accounting file */
+
+#define        AFORK   01              /* has executed fork, but no exec */
+#define        ASU     02              /* used super-user privileges */
diff --git a/usr/src/sys/h/bk.h b/usr/src/sys/h/bk.h
new file mode 100644 (file)
index 0000000..ce04079
--- /dev/null
@@ -0,0 +1,22 @@
+/*     bk.h    4.1     11/9/80 */
+
+/*
+ * Macro definition of bk.c/netinput().
+ * This is used to replace a call to
+ *             (*linesw[tp->t_line].l_rint)(c,tp);
+ * with
+ *
+ *             if (tp->t_line == NETLDISC)
+ *                     BKINPUT(c, tp);
+ *             else
+ *                     (*linesw[tp->t_line].l_rint)(c,tp);
+ */
+#define        BKINPUT(c, tp) { \
+       if ((tp)->t_rec == 0) { \
+               *(tp)->t_cp++ = c; \
+               if (++(tp)->t_inbuf == BSIZE || (c) == '\n') { \
+                       (tp)->t_rec = 1; \
+                       wakeup((caddr_t)&(tp)->t_rawq); \
+               } \
+       } \
+}
diff --git a/usr/src/sys/h/buf.h b/usr/src/sys/h/buf.h
new file mode 100644 (file)
index 0000000..8dcd5aa
--- /dev/null
@@ -0,0 +1,96 @@
+/*     buf.h   4.1     11/9/80 */
+
+/*
+ * Each buffer in the pool is usually doubly linked into 2 lists:
+ * the device with which it is currently associated (always)
+ * and also on a list of blocks available for allocation
+ * for other use (usually).
+ * The latter list is kept in last-used order, and the two
+ * lists are doubly linked to make it easy to remove
+ * a buffer from one list when it was found by
+ * looking through the other.
+ * A buffer is on the available list, and is liable
+ * to be reassigned to another disk block, if and only
+ * if it is not marked BUSY.  When a buffer is busy, the
+ * available-list pointers can be used for other purposes.
+ * Most drivers use the forward ptr as a link in their I/O
+ * active queue.
+ * A buffer header contains all the information required
+ * to perform I/O.
+ * Most of the routines which manipulate these things
+ * are in bio.c.
+ */
+struct buf
+{
+       int     b_flags;                /* see defines below */
+       struct  buf *b_forw;            /* headed by d_tab of conf.c */
+       struct  buf *b_back;            /*  "  */
+       struct  buf *av_forw;           /* position on free list, */
+       struct  buf *av_back;           /*     if not BUSY*/
+       dev_t   b_dev;                  /* major+minor device name */
+       unsigned b_bcount;              /* transfer count */
+       union {
+           caddr_t b_addr;             /* low order core address */
+           int *b_words;               /* words for clearing */
+           struct filsys *b_filsys;    /* superblocks */
+           struct dinode *b_dino;      /* ilist */
+           daddr_t *b_daddr;           /* indirect block */
+       } b_un;
+       daddr_t b_blkno;                /* block # on device */
+       char    b_xmem;                 /* high order core address */
+       char    b_error;                /* returned after I/O */
+       short   b_hlink;                /* hash links for buffer cache */
+       unsigned int b_resid;           /* words not transferred after error */
+       struct  proc  *b_proc;          /* process doing physical or swap I/O */
+};
+
+#ifdef KERNEL
+extern struct buf buf[];               /* The buffer pool itself */
+extern struct buf swbuf[];             /* swap I/O headers */
+extern struct buf bfreelist;           /* head of available list */
+extern struct buf bswlist;             /* head of free swap header list */
+extern struct buf *bclnlist;           /* head of cleaned page list */
+
+struct buf *alloc();
+struct buf *baddr();
+struct buf *getblk();
+struct buf *geteblk();
+struct buf *bread();
+struct buf *breada();
+
+unsigned minphys();
+#endif
+
+#define        NSWBUF  48                      /* number of swap I/O headers */
+
+/*
+ * These flags are kept in b_flags.
+ */
+#define        B_WRITE  0x0000 /* non-read pseudo-flag */
+#define        B_READ          0x0001  /* read when I/O occurs */
+#define        B_DONE          0x0002  /* transaction finished */
+#define        B_ERROR         0x0004  /* transaction aborted */
+#define        B_BUSY          0x0008  /* not on av_forw/back list */
+#define        B_PHYS          0x0010  /* physical IO */
+#define        B_MAP           0x0020  /* UNIBUS map allocated */
+#define        B_WANTED        0x0040  /* issue wakeup when BUSY goes off */
+#define        B_AGE           0x0080  /* delayed write for correct aging */
+#define        B_ASYNC         0x0100  /* don't wait for I/O completion */
+#define        B_DELWRI        0x0200  /* write at exit of avail list */
+#define        B_TAPE          0x0400  /* this is a magtape (no bdwrite) */
+#define        B_UAREA         0x0800  /* add u-area to a swap operation */
+#define        B_PAGET         0x1000  /* page in/out of page table space */
+#define        B_DIRTY         0x2000  /* dirty page to be pushed out async */
+#define        B_PGIN          0x4000  /* pagein op, so swap() can count it */
+#define        B_CACHE         0x8000  /* did bread find us in the cache ? */
+
+/*
+ * special redeclarations for
+ * the head of the queue per
+ * device driver.
+ */
+#define        b_actf          av_forw
+#define        b_actl          av_back
+#define        b_active        b_bcount
+#define        b_errcnt        b_resid
+#define        b_pfcent        b_resid
diff --git a/usr/src/sys/h/callo.h b/usr/src/sys/h/callo.h
new file mode 100644 (file)
index 0000000..c05450a
--- /dev/null
@@ -0,0 +1,19 @@
+/*     callo.h 4.1     11/9/80 */
+
+/*
+ * The callout structure is for
+ * a routine arranging
+ * to be called by the clock interrupt
+ * (clock.c) with a specified argument,
+ * in a specified amount of time.
+ * Used, for example, to time tab
+ * delays on typewriters.
+ */
+
+struct callo
+{
+       int     c_time;         /* incremental time */
+       caddr_t c_arg;          /* argument to routine */
+       int     (*c_func)();    /* routine */
+};
+struct callo   callout[NCALL];
diff --git a/usr/src/sys/h/clist.h b/usr/src/sys/h/clist.h
new file mode 100644 (file)
index 0000000..0128a33
--- /dev/null
@@ -0,0 +1,10 @@
+/*     clist.h 4.1     11/9/80 */
+
+/*
+ * Raw structures for the character list routines.
+ */
+struct cblock {
+       struct cblock *c_next;
+       char    c_info[CBSIZE];
+};
+struct cblock  cfree[];
diff --git a/usr/src/sys/h/clock.h b/usr/src/sys/h/clock.h
new file mode 100644 (file)
index 0000000..4bac49b
--- /dev/null
@@ -0,0 +1,34 @@
+/*     clock.h 4.1     11/9/80 */
+
+/*
+ * VAX clock registers
+ */
+
+#define        ICCS_RUN        0x1
+#define        ICCS_TRANS      0x10
+#define        ICCS_SS         0x20
+#define        ICCS_IE         0x40
+#define        ICCS_INT        0x80
+#define        ICCS_ERR        0x80000000
+       
+#define        SECDAY          ((unsigned)(24*60*60))          /* seconds per day */
+#define        SECYR           ((unsigned)(365*SECDAY))        /* per common year */
+/*
+ * TODRZERO is the what the TODR should contain when the ``year'' begins.
+ * The TODR should always contain a number between 0 and SECYR+SECDAY.
+ */
+#define        TODRZERO        ((unsigned)(1<<28))
+
+#define        YRREF           1970
+#define        LEAPYEAR(year)  ((year)%4==0 && year != 2000)   /* good till 2100 */
+
+/*
+ * Start a 60 HZ clock.
+ */
+#define        clkstart() {\
+       mtpr(NICR, -16667);     /* 16.667 milli-seconds */\
+       mtpr(ICCS, ICCS_RUN+ICCS_IE+ICCS_TRANS+ICCS_INT+ICCS_ERR);\
+}
+#define        clkreld()       mtpr(ICCS, ICCS_RUN+ICCS_IE+ICCS_INT+ICCS_ERR)
+
+#define        clkwrap()       (((unsigned)mfpr(TODR) - TODRZERO)/100 > SECYR+SECDAY)
diff --git a/usr/src/sys/h/clock.m b/usr/src/sys/h/clock.m
new file mode 100644 (file)
index 0000000..0f56547
--- /dev/null
@@ -0,0 +1,13 @@
+#
+#      clock.m 4.1     11/9/80
+#
+#
+# VAX clock registers
+#
+
+       .set    ICCS_RUN,0x1
+       .set    ICCS_TRANS,0x10
+       .set    ICCS_SS,0x20
+       .set    ICCS_IE,0x40
+       .set    ICCS_INT,0x80
+       .set    ICCS_ERR,0x80000000
diff --git a/usr/src/sys/h/cmap.h b/usr/src/sys/h/cmap.h
new file mode 100644 (file)
index 0000000..2a219a6
--- /dev/null
@@ -0,0 +1,54 @@
+/*     cmap.h  4.1     11/9/80 */
+
+/*
+ * core map entry
+ *
+ * NB: THE SIZE OF THIS STRUCTURE IS WELL KNOWN IN cmap.m
+ */
+struct cmap
+{
+unsigned int   c_next:13,      /* index of next free list entry */
+               c_prev:13,      /* index of previous free list entry */
+               c_mdev:4,       /* which mounted dev this is from */
+               c_lock:1,       /* locked for raw i/o or pagein */
+               c_want:1,       /* wanted */
+               c_page:16,      /* virtual page number in segment */
+               c_hlink:13,     /* hash link for <blkno,mdev> */
+               c_intrans:1,    /* intransit bit */
+               c_free:1,       /* on the free list */
+               c_gone:1,       /* associated page has been released */
+               c_type:2,       /* type CSYS or CTEXT or CSTACK or CDATA */
+               c_blkno:20,     /* disk block this is a copy of */
+               c_ndx:10;       /* index of owner proc or text */
+};
+
+#define        CMHEAD  0
+
+/*
+ * Shared text pages are not totally abandoned when a process
+ * exits, but are remembered while in the free list hashed by <mdev,blkno>
+ * off the cmhash structure so that they can be reattached
+ * if another instance of the program runs again soon.
+ */
+#define        CMHSIZ  512             /* SHOULD BE DYNAMIC */
+#define        CMHASH(bn)      ((bn)&(CMHSIZ-1))
+
+#ifdef KERNEL
+extern struct cmap *cmap;
+extern struct cmap *ecmap;
+struct cmap *mfind();
+struct cmap zcmap;
+int    firstfree, maxfree;
+int    ecmx;                   /* cmap index of ecmap */
+short  cmhash[CMHSIZ];
+#endif
+
+/* bits defined in c_type */
+
+#define        CSYS            0               /* none of below */
+#define        CTEXT           1               /* belongs to shared text segment */
+#define        CDATA           2               /* belongs to data segment */
+#define        CSTACK          3               /* belongs to stack segment */
+
+#define        pgtocm(x)       ((((x)-firstfree) / CLSIZE) + 1)
+#define        cmtopg(x)       ((((x)-1) * CLSIZE) + firstfree)
diff --git a/usr/src/sys/h/cmap.m b/usr/src/sys/h/cmap.m
new file mode 100644 (file)
index 0000000..c05162a
--- /dev/null
@@ -0,0 +1,10 @@
+#
+#      cmap.m  4.1     11/9/80
+#
+       .set    CMSIZE,12
+       .globl  _cmap
+       .globl  _ecmap
+       .data
+_cmap: .long   0
+_ecmap:        .long   0
+       .text
diff --git a/usr/src/sys/h/conf.h b/usr/src/sys/h/conf.h
new file mode 100644 (file)
index 0000000..fef8c67
--- /dev/null
@@ -0,0 +1,59 @@
+/*     conf.h  4.1     11/9/80 */
+
+/*
+ * Declaration of block device
+ * switch. Each entry (row) is
+ * the only link between the
+ * main unix code and the driver.
+ * The initialization of the
+ * device switches is in the
+ * file conf.c.
+ */
+extern struct bdevsw
+{
+       int     (*d_open)();
+       int     (*d_close)();
+       int     (*d_strategy)();
+       struct buf *d_tab;
+} bdevsw[];
+
+/*
+ * Character device switch.
+ */
+extern struct cdevsw
+{
+       int     (*d_open)();
+       int     (*d_close)();
+       int     (*d_read)();
+       int     (*d_write)();
+       int     (*d_ioctl)();
+       int     (*d_stop)();
+       int     (*d_reset)();
+       struct tty *d_ttys;
+} cdevsw[];
+
+/*
+ * tty line control switch.
+ */
+extern struct linesw
+{
+       int     (*l_open)();
+       int     (*l_close)();
+       int     (*l_read)();
+       char    *(*l_write)();
+       int     (*l_ioctl)();
+       int     (*l_rint)();
+       int     (*l_rend)();
+       int     (*l_meta)();
+       int     (*l_start)();
+       int     (*l_modem)();
+} linesw[];
+
+/*
+ * Swap device information
+ */
+extern struct swdevt
+{
+       dev_t   sw_dev;
+       int     sw_freed;
+} swdevt[];
diff --git a/usr/src/sys/h/cons.h b/usr/src/sys/h/cons.h
new file mode 100644 (file)
index 0000000..c9ca739
--- /dev/null
@@ -0,0 +1,19 @@
+/*     cons.h  4.2     11/9/80 */
+
+/*
+ * VAX console interface registers
+ */
+
+#define        RXCS_IE         0x40            /* receiver interrupt enable */
+#define        RXCS_DONE       0x80            /* receiver done */
+#define        RXDB_DATA       0xff            /* received character */
+#define        RXDB_ID         0xf00           /* channel id */
+#define        RXDB_ERR        0x80000000      /* receiver error */
+
+#define        TXCS_IE         0x40            /* transmitter interrupt enable */
+#define        TXCS_RDY        0x80            /* transmitter ready for next char */
+#define        TXDB_DATA       0xff            /* transmitter byte */
+#define        TXDB_ID         0xf00           /* channel id */
+#define        TXDB_WSI        0xf02           /* set warm start inhibit */
+#define        TXDB_CWSI       0xf03           /* clear warm start inhibit */
+#define        TXDB_BOOT       0xf04           /* enable boot */
diff --git a/usr/src/sys/h/cons.m b/usr/src/sys/h/cons.m
new file mode 100644 (file)
index 0000000..2b02ecc
--- /dev/null
@@ -0,0 +1,20 @@
+#
+#      cons.m  4.1     11/9/80
+#
+#
+# VAX console interface registers
+#
+
+       .set    RXCS_IE,0x40            # receiver interrupt enable
+       .set    RXCS_DONE,0x80          # receiver done
+       .set    RXDB_DATA,0xff          # received character
+       .set    RXDB_ID,0xf00           # channel id
+       .set    RXDB_ERR,0x80000000     # receiver error
+
+       .set    TXCS_IE,0x40            # transmitter interrupt enable
+       .set    TXCS_RDY,0x80           # transmitter ready for next char
+       .set    TXCS_BRDY,7             # bit number of TXCS_RDY
+       .set    TXDB_DATA,0xff          # transmitter byte
+       .set    TXDB_ID,0xf00           # channel id
+       .set    TXDB_AUTOR,0xf03        # auto-restart command
+       .set    TXDB_BOOT,0xf04         # boot command
diff --git a/usr/src/sys/h/dir.h b/usr/src/sys/h/dir.h
new file mode 100644 (file)
index 0000000..92eb3db
--- /dev/null
@@ -0,0 +1,10 @@
+/*     dir.h   4.1     11/9/80 */
+
+#ifndef        DIRSIZ
+#define        DIRSIZ  14
+#endif
+struct direct
+{
+       ino_t   d_ino;
+       char    d_name[DIRSIZ];
+};
diff --git a/usr/src/sys/h/dk.h b/usr/src/sys/h/dk.h
new file mode 100644 (file)
index 0000000..25f5297
--- /dev/null
@@ -0,0 +1,26 @@
+/*     dk.h    4.1     11/9/80 */
+
+/*
+ * Instrumentation
+ */
+#define        CPUSTATES       4
+
+#define        CP_USER         0
+#define        CP_NICE         1
+#define        CP_SYS          2
+#define        CP_IDLE         3
+
+#define        DK_NDRIVE       4
+
+#ifdef KERNEL
+long   cp_time[CPUSTATES];
+int    dk_busy;
+long   dk_time[DK_NDRIVE];
+long   dk_seek[DK_NDRIVE];
+long   dk_xfer[DK_NDRIVE];
+long   dk_wds[DK_NDRIVE];
+float  dk_mspw[DK_NDRIVE];
+
+long   tk_nin;
+long   tk_nout;
+#endif
diff --git a/usr/src/sys/h/dmap.h b/usr/src/sys/h/dmap.h
new file mode 100644 (file)
index 0000000..11917c2
--- /dev/null
@@ -0,0 +1,31 @@
+/*     dmap.h  4.1     11/9/80 */
+
+/*
+ * Definitions for the mapping of vitual swap
+ * space to the physical swap area - the disk map.
+ */
+
+#define        NDMAP           16      /* size of the swap area map */
+#define        DMMIN           16      /* the initial block size in clicks */
+#define        DMMAX           1024    /* max block size alloc on drum = .5M byte */
+#define        DMTEXT          1024    /* size of blocks of pure text = .5M byte */
+
+struct dmap
+{
+       swblk_t dm_size;        /* current size used by process */
+       swblk_t dm_alloc;       /* amount of physical swap space allocated */
+       swblk_t dm_map[NDMAP];  /* first disk block number in each chunk */
+};
+#ifdef KERNEL
+struct dmap zdmap;
+#endif
+
+/*
+ * The following structure is that ``returned''
+ * from a call to vstodb().
+ */
+struct dblock
+{
+       swblk_t db_base;        /* base of physical contig drum block */
+       swblk_t db_size;        /* size of block */
+};
diff --git a/usr/src/sys/h/fblk.h b/usr/src/sys/h/fblk.h
new file mode 100644 (file)
index 0000000..cc4a9ea
--- /dev/null
@@ -0,0 +1,7 @@
+/*     fblk.h  4.1     11/9/80 */
+
+struct fblk
+{
+       int     df_nfree;
+       daddr_t df_free[NICFREE];
+};
diff --git a/usr/src/sys/h/file.h b/usr/src/sys/h/file.h
new file mode 100644 (file)
index 0000000..76675cd
--- /dev/null
@@ -0,0 +1,34 @@
+/*     file.h  4.1     11/9/80 */
+
+/*
+ * One file structure is allocated
+ * for each open/creat/pipe call.
+ * Main use is to hold the read/write
+ * pointer associated with each open
+ * file.
+ */
+struct file
+{
+       short   f_flag;
+       short   f_count;                /* reference count */
+       struct inode *f_inode;          /* pointer to inode structure */
+       union {
+               off_t   f_offset;       /* read/write character pointer */
+               struct chan *f_chan;    /* mpx channel pointer */
+       } f_un;
+};
+
+#ifdef KERNEL
+extern struct file file[];             /* the file table itself */
+
+struct file *getf();
+struct file *falloc();
+#endif
+
+/* flags */
+#define        FREAD   01
+#define        FWRITE  02
+#define        FPIPE   04
+#define        FMPX    010
+#define        FMPY    020
+#define        FMP     030
diff --git a/usr/src/sys/h/filsys.h b/usr/src/sys/h/filsys.h
new file mode 100644 (file)
index 0000000..2f323a3
--- /dev/null
@@ -0,0 +1,34 @@
+/*     filsys.h        4.1     11/9/80 */
+
+/*
+ * Structure of the super-block
+ */
+struct filsys
+{
+       unsigned short s_isize;         /* size in blocks of i-list */
+       daddr_t s_fsize;                /* size in blocks of entire volume */
+       short   s_nfree;                /* number of addresses in s_free */
+       daddr_t s_free[NICFREE];        /* free block list */
+       short   s_ninode;               /* number of i-nodes in s_inode */
+       ino_t   s_inode[NICINOD];       /* free i-node list */
+       char    s_flock;                /* lock during free list manipulation */
+       char    s_ilock;                /* lock during i-list manipulation */
+       char    s_fmod;                 /* super block modified flag */
+       char    s_ronly;                /* mounted read-only flag */
+       time_t  s_time;                 /* last super block update */
+       daddr_t s_tfree;                /* total free blocks*/
+       ino_t   s_tinode;               /* total free inodes */
+       /* begin not maintained by this version of the system */
+       short   s_dinfo[2];             /* interleave stuff */
+#define        s_m     s_dinfo[0]
+#define        s_n     s_dinfo[1]
+       char    s_fname[6];             /* file system name */
+       char    s_fpack[6];             /* file system pack name */
+       /* end not maintained */
+       ino_t   s_lasti;                /* start place for circular search */
+       ino_t   s_nbehind;              /* est # free inodes before s_lasti */
+};
+
+#ifdef KERNEL
+struct filsys *getfs();
+#endif
diff --git a/usr/src/sys/h/flp.h b/usr/src/sys/h/flp.h
new file mode 100644 (file)
index 0000000..02d0638
--- /dev/null
@@ -0,0 +1,43 @@
+/*     flp.h   4.1     11/9/80 */
+
+/*
+ * Console floppy command/status and sectoring information.
+ */
+#define        FL_FFC          0x200           /* floppy function complete */
+#define        FL_ERR          0x80            /* error bit in floppy status byte */
+#define        FL_PERR         0x905           /* floppy protocol error */
+#define        FL_DATA         0x100           /* floppy data select code */
+#define        FL_RS           0x900           /* floppy read sector command */
+#define        FL_WS           0x901           /* floppy write sector command*/
+#define        FL_STAT         0x902           /* floppy get status command*/
+#define        FL_CANCEL       0x904           /* cancel floppy function */
+
+#define        RXFTRK  77              /* tracks/floppy */
+#define        RXSTRK  26              /* sectors/track */
+#define        RXBYSEC 128             /* bytes/sector */
+#define        MAXSEC (RXFTRK*RXSTRK)  /* sectors/floppy */
+
+/*
+ * In the floppy driver routines, the device active byte is used
+ * not as a boolean, but as an indicator of the state we are in.
+ * That is, it contains what to do on the next interrupt.
+ */
+
+#define        FL_IDLE         0       /* floppy idle */
+#define        FL_MAND         1       /* about to send read/write command */
+#define        FL_SEC          2       /* about to send sector # to LSI */
+#define        FL_TRACK        3       /* about to send track # to LSI */
+#define        FL_DAX          4       /* transmitting data */
+#define        FL_DAR          5       /* receiving data */
+#define        FL_COM          6       /* completing transmission */
+#define        FL_CAN          7       /* give cancel order - we had an error,
+                                  and are to restart */
+
+#define        FLERRS          5       /* number of retries before quitting */
+
+/*
+ * The state byte is used to retain exclusivity,
+ * and contains the busy flag.
+ */
+#define        FL_OPEN         1
+#define        FL_BUSY         2
diff --git a/usr/src/sys/h/inline.h b/usr/src/sys/h/inline.h
new file mode 100644 (file)
index 0000000..6c4829a
--- /dev/null
@@ -0,0 +1,51 @@
+/*     inline.h        4.1     11/9/80 */
+/*
+ * Definitions of inlines for FASTVAX, and macro replacements
+ * for them if not FASTVAX (latter only scantily tested).
+ */
+
+#ifdef FASTVAX
+
+#define        plock(ip) \
+{ \
+       while ((ip)->i_flag & ILOCK) { \
+               (ip)->i_flag |= IWANT; \
+               sleep((caddr_t)(ip), PINOD); \
+       } \
+       (ip)->i_flag |= ILOCK; \
+}
+
+#define        prele(ip) \
+{ \
+       (ip)->i_flag &= ~ILOCK; \
+       if ((ip)->i_flag&IWANT) { \
+               (ip)->i_flag &= ~IWANT; \
+               wakeup((caddr_t)(ip)); \
+       } \
+}
+
+#define        GETF(fp, fd) { \
+       if ((unsigned)(fd) >= NOFILE || ((fp) = u.u_ofile[fd]) == NULL) { \
+               u.u_error = EBADF; \
+               return; \
+       } \
+}
+
+#define        IUPDAT(ip, t1, t2, waitfor) { \
+       if (ip->i_flag&(IUPD|IACC|ICHG)) \
+               iupdat(ip, t1, t2, waitfor); \
+}
+#define        ISSIG(p)        ((p)->p_sig && \
+       ((p)->p_flag&STRC || ((p)->p_sig &~ (p)->p_ignsig)) && issig())
+#else
+
+#define        GETF(fp, fd) { \
+       (fp) = getf(fd); \
+       if ((fp) == NULL) \
+               return; \
+}
+
+#define        IUPDAT(ip, t1, t2, waitfor)     iupdat(ip, t1, t2, waitfor)
+
+#define        ISSIG(p)        issig(p)
+#endif
diff --git a/usr/src/sys/h/ino.h b/usr/src/sys/h/ino.h
new file mode 100644 (file)
index 0000000..4ba4f4b
--- /dev/null
@@ -0,0 +1,23 @@
+/*     ino.h   4.1     11/9/80 */
+
+/*
+ * Inode structure as it appears on
+ * a disk block.
+ */
+struct dinode
+{
+       unsigned short di_mode; /* mode and type of file */
+       short   di_nlink;       /* number of links to file */
+       short   di_uid;         /* owner's user id */
+       short   di_gid;         /* owner's group id */
+       off_t   di_size;        /* number of bytes in file */
+       char    di_addr[40];    /* disk block addresses */
+       time_t  di_atime;       /* time last accessed */
+       time_t  di_mtime;       /* time last modified */
+       time_t  di_ctime;       /* time created */
+};
+/*
+ * the 40 address bytes:
+ *     39 used; 13 addresses
+ *     of 3 bytes each.
+ */
diff --git a/usr/src/sys/h/inode.h b/usr/src/sys/h/inode.h
new file mode 100644 (file)
index 0000000..6785e78
--- /dev/null
@@ -0,0 +1,95 @@
+/*     inode.h 4.1     11/9/80 */
+
+/*
+ * The I node is the focus of all
+ * file activity in unix. There is a unique
+ * inode allocated for each active file,
+ * each current directory, each mounted-on
+ * file, text file, and the root. An inode is 'named'
+ * by its dev/inumber pair. (iget/iget.c)
+ * Data, from mode on, is read in
+ * from permanent inode on volume.
+ */
+
+#define        NADDR   13
+
+#define        NINDEX          15
+struct group
+{
+       short   g_state;
+       char    g_index;
+       char    g_rot;
+       struct  group   *g_group;
+       struct  inode   *g_inode;
+       struct  file    *g_file;
+       short   g_rotmask;
+       short   g_datq;
+       struct  chan *g_chans[NINDEX];
+};
+struct inode
+{
+       char    i_flag;
+       char    i_count;        /* reference count */
+       dev_t   i_dev;          /* device where inode resides */
+       ino_t   i_number;       /* i number, 1-to-1 with device address */
+       unsigned short i_mode;
+       short   i_nlink;        /* directory entries */
+       short   i_uid;          /* owner */
+       short   i_gid;          /* group of owner */
+       off_t   i_size;         /* size of file */
+       union {
+               struct {
+                       daddr_t I_addr[NADDR];  /* if normal file/directory */
+                       daddr_t I_lastr;        /* last read (for read-ahead) */
+               } i_f;
+#define        i_addr  i_f.I_addr
+#define        i_lastr i_f.I_lastr
+               struct {
+                       daddr_t I_rdev;         /* i_addr[0] */
+                       struct  group I_group;  /* multiplexor group file */
+               } i_d;
+#define        i_rdev  i_d.I_rdev
+#define        i_group i_d.I_group
+       } i_un;
+       short   i_vfdcnt;       /* number of fd's vreading this inode */
+       short   i_hlink;        /* link in hash chain (iget/iput/ifind) */
+};
+
+#ifdef KERNEL
+extern struct inode inode[];   /* The inode table itself */
+
+struct inode *rootdir;         /* pointer to inode of root directory */
+struct inode *mpxip;           /* mpx virtual inode */
+
+struct inode *ialloc();
+struct inode *ifind();
+struct inode *iget();
+struct inode *owner();
+struct inode *maknode();
+struct inode *namei();
+#endif
+
+/* flags */
+#define        ILOCK   01              /* inode is locked */
+#define        IUPD    02              /* file has been modified */
+#define        IACC    04              /* inode access time to be updated */
+#define        IMOUNT  010             /* inode is mounted on */
+#define        IWANT   020             /* some process waiting on lock */
+#define        ITEXT   040             /* inode is pure text prototype */
+#define        ICHG    0100            /* inode has been changed */
+#define        IPIPE   0200            /* inode is a pipe */
+
+/* modes */
+#define        IFMT    0170000         /* type of file */
+#define                IFDIR   0040000 /* directory */
+#define                IFCHR   0020000 /* character special */
+#define                IFBLK   0060000 /* block special */
+#define                IFREG   0100000 /* regular */
+#define                IFMPC   0030000 /* multiplexed char special */
+#define                IFMPB   0070000 /* multiplexed block special */
+#define        ISUID   04000           /* set user id on execution */
+#define        ISGID   02000           /* set group id on execution */
+#define        ISVTX   01000           /* save swapped text even after use */
+#define        IREAD   0400            /* read, write, execute permissions */
+#define        IWRITE  0200
+#define        IEXEC   0100
diff --git a/usr/src/sys/h/ioctl.h b/usr/src/sys/h/ioctl.h
new file mode 100644 (file)
index 0000000..04c808c
--- /dev/null
@@ -0,0 +1,123 @@
+/*     ioctl.h 4.1     11/9/80 */
+/*
+ * ioctl definitions, and special character and local tty definitions
+ */
+#ifndef        _IOCTL_
+#define        _IOCTL_
+struct tchars {
+       char    t_intrc;        /* interrupt */
+       char    t_quitc;        /* quit */
+       char    t_startc;       /* start output */
+       char    t_stopc;        /* stop output */
+       char    t_eofc;         /* end-of-file */
+       char    t_brkc;         /* input delimiter (like nl) */
+};
+struct ltchars {
+       char    t_suspc;        /* stop process signal */
+       char    t_dsuspc;       /* delayed stop process signal */
+       char    t_rprntc;       /* reprint line */
+       char    t_flushc;       /* flush output (toggles) */
+       char    t_werasc;       /* word erase */
+       char    t_lnextc;       /* literal next character */
+};
+
+/*
+ * local mode settings
+ */
+#define        LCRTBS  01              /* correct backspacing for crt */
+#define        LPRTERA 02              /* printing terminal \ ... / erase */
+#define        LCRTERA 04              /* do " \b " to wipe out character */
+#define        LTILDE  010             /* IIASA - hazeltine tilde kludge */
+#define        LMDMBUF 020             /* IIASA - start/stop output on carrier intr */
+#define        LLITOUT 040             /* IIASA - suppress any output translations */
+#define        LTOSTOP 0100            /* send stop for any background tty output */
+#define        LFLUSHO 0200            /* flush output sent to terminal */
+#define        LNOHANG 0400            /* IIASA - don't send hangup on carrier drop */
+#define        LETXACK 01000           /* IIASA - diablo style buffer hacking */
+#define        LCRTKIL 02000           /* erase whole line on kill with " \b " */
+#define        LINTRUP 04000           /* interrupt on every input char - SIGTINT */
+#define        LCTLECH 010000          /* echo control characters as ^X */
+#define        LPENDIN 020000          /* tp->t_rawq is waiting to be reread */
+
+/* local state */
+#define        LSBKSL  01              /* state bit for lowercase backslash work */
+#define        LSQUOT  02              /* last character input was \ */
+#define        LSERASE 04              /* within a \.../ for LPRTRUB */
+#define        LSLNCH  010             /* next character is literal */
+#define        LSTYPEN 020             /* retyping suspended input (LPENDIN) */
+#define        LSCNTTB 040             /* counting width of tab; leave LFLUSHO alone */
+
+/*
+ * tty ioctl commands
+ */
+#define        TIOCGETD        (('t'<<8)|0)    /* get line discipline */
+#define        TIOCSETD        (('t'<<8)|1)    /* set line discipline */
+#define        TIOCHPCL        (('t'<<8)|2)    /* set hangup line on close bit */
+#define        TIOCMODG        (('t'<<8)|3)    /* modem bits get (???) */
+#define        TIOCMODS        (('t'<<8)|4)    /* modem bits set (???) */
+#define        TIOCGETP        (('t'<<8)|8)    /* get parameters - like old gtty */
+#define        TIOCSETP        (('t'<<8)|9)    /* set parameters - like old stty */
+#define        TIOCSETN        (('t'<<8)|10)   /* set params w/o flushing buffers */
+#define        TIOCEXCL        (('t'<<8)|13)   /* set exclusive use of tty */
+#define        TIOCNXCL        (('t'<<8)|14)   /* reset exclusive use of tty */
+#define        TIOCFLUSH       (('t'<<8)|16)   /* flush buffers */
+#define        TIOCSETC        (('t'<<8)|17)   /* set special characters */
+#define        TIOCGETC        (('t'<<8)|18)   /* get special characters */
+/* locals, from 127 down */
+#define        TIOCLBIS        (('t'<<8)|127)  /* bis local mode bits */
+#define        TIOCLBIC        (('t'<<8)|126)  /* bic local mode bits */
+#define        TIOCLSET        (('t'<<8)|125)  /* set entire local mode word */
+#define        TIOCLGET        (('t'<<8)|124)  /* get local modes */
+#define        TIOCSBRK        (('t'<<8)|123)  /* set break bit */
+#define        TIOCCBRK        (('t'<<8)|122)  /* clear break bit */
+#define        TIOCSDTR        (('t'<<8)|121)  /* set data terminal ready */
+#define        TIOCCDTR        (('t'<<8)|120)  /* clear data terminal ready */
+#define        TIOCGPGRP       (('t'<<8)|119)  /* get pgrp of tty */
+#define        TIOCSPGRP       (('t'<<8)|118)  /* set pgrp of tty */
+#define        TIOCSLTC        (('t'<<8)|117)  /* set local special characters */
+#define        TIOCGLTC        (('t'<<8)|116)  /* get local special characters */
+#define        TIOCOUTQ        (('t'<<8)|115)  /* number of chars in output queue */
+#define        TIOCSTI         (('t'<<8)|114)  /* simulate a terminal in character */
+
+#define        OTTYDISC        0
+#define        NETLDISC        1               /* line discip for berk net */
+#define        NTTYDISC        2
+
+#define        DIOCLSTN        (('d'<<8)|1)
+#define        DIOCNTRL        (('d'<<8)|2)
+#define        DIOCMPX         (('d'<<8)|3)
+#define        DIOCNMPX        (('d'<<8)|4)
+#define        DIOCSCALL       (('d'<<8)|5)
+#define        DIOCRCALL       (('d'<<8)|6)
+#define        DIOCPGRP        (('d'<<8)|7)
+#define        DIOCGETP        (('d'<<8)|8)
+#define        DIOCSETP        (('d'<<8)|9)
+#define        DIOCLOSE        (('d'<<8)|10)
+#define        DIOCTIME        (('d'<<8)|11)
+#define        DIOCRESET       (('d'<<8)|12)
+#define        DIOCSMETA       (('d'<<8)|13)
+#define        DIOCMERGE       (('d'<<8)|14)
+#define        DIOCICHAN       (('d'<<8)|15)
+#define        DIOCPAD         (('d'<<8)|16)
+#define        DIOCRMETA       (('d'<<8)|17)
+#define        DIOCXOUT        (('d'<<8)|18)
+#define        DIOCBMETA       (('d'<<8)|19)
+#define        DIOCAMETA       (('d'<<8)|20)
+#define        DIOCSBMETA      (('d'<<8)|21)
+
+#define        FIOCLEX         (('f'<<8)|1)
+#define        FIONCLEX        (('f'<<8)|2)
+/* another local */
+#define        FIONREAD        (('f'<<8)|127)  /* get # bytes to read */
+/* FIONREAD is not implemented on mpx channels yet */
+
+#define        MXLSTN          (('x'<<8)|1)
+#define        MXNBLK          (('x'<<8)|2)
+
+/*
+ * These are defined in sys/vcmd.h
+ *
+#define        VGETSTATE       (('v'<<8)|0)
+#define        VSETSTATE       (('v'<<8)|1)
+ */
+#endif
diff --git a/usr/src/sys/h/map.h b/usr/src/sys/h/map.h
new file mode 100644 (file)
index 0000000..1b12225
--- /dev/null
@@ -0,0 +1,18 @@
+/*     map.h   4.1     11/9/80 */
+
+/*
+ * Resource Allocation Maps
+ */
+struct map
+{
+       int     m_size;
+       int     m_addr;
+};
+
+#ifdef KERNEL
+struct map swapmap[SMAPSIZ];   /* space for swap allocation */
+#define        AMAPSIZ 25
+struct map argmap[AMAPSIZ];
+
+struct map kernelmap[NPROC];   /* space for kernel map for user page tables */
+#endif
diff --git a/usr/src/sys/h/mba.h b/usr/src/sys/h/mba.h
new file mode 100644 (file)
index 0000000..ca6ada9
--- /dev/null
@@ -0,0 +1,44 @@
+/*     mba.h   4.1     11/9/80 */
+
+/*
+ * VAX Massbus adapter registers
+ */
+
+struct mba_regs
+{
+       int     mba_csr;
+       int     mba_cr;
+       int     mba_sr;
+       int     mba_var;
+       int     mba_bcr;
+       int     mba_dr;
+       int     mba_pad1[250];
+       int     mba_erb[8][32];         /* external register base */
+       struct  pte mba_map[256];
+};
+
+#define        MBAINIT         0x1
+#define        MBAIE           0x4
+
+#define        MBAEBITS        0xe0770
+
+#define        PHYSMBA0        ((struct mba_regs *)0x20010000)
+#define        PHYSMBA1        ((struct mba_regs *)0x20012000)
+
+#define        mbadev(mba,unit)        ((struct device *)mba->mba_erb[unit])
+
+#ifdef KERNEL
+struct mba_info
+{
+       struct  mba_regs *mi_loc;       /* virtual mba */
+       struct  mba_regs *mi_phys;      /* physical mba */
+       struct  pte *mi_map;            /* page table base for nexus */
+};
+
+#define        MBA0            ((struct mba_regs *)0x80064000)
+#define        MBA1            ((struct mba_regs *)0x80066000)
+
+int    mbanum[];
+struct mba_info mbainfo[];
+int    mbaact;
+#endif
diff --git a/usr/src/sys/h/mba.m b/usr/src/sys/h/mba.m
new file mode 100644 (file)
index 0000000..8738c18
--- /dev/null
@@ -0,0 +1,18 @@
+#
+#      mba.m   4.1     11/9/80
+#
+#
+#      VAX massbus adapter registers
+#
+
+       .set    MBA0_CSR,0x80064000             # virtual address of mba0
+       .set    MBA1_CSR,0x80066000             # ditto mba1
+
+       .set    MBA_CSR,0       # configuration and status register
+       .set    MBA_CR,4        # control register
+       .set    MBA_SR,8        # status register
+       .set    MBA_VAR,12      # virtual address register
+       .set    MBA_BCR,16      # byte count register
+       .set    MBA_ERB,0x400   # external register base
+       .set    MBA_AS,0x410    # attention summary
+
diff --git a/usr/src/sys/h/mount.h b/usr/src/sys/h/mount.h
new file mode 100644 (file)
index 0000000..5c8f56d
--- /dev/null
@@ -0,0 +1,13 @@
+/*     mount.h 4.1     11/9/80 */
+
+/*
+ * Mount structure.
+ * One allocated on every mount.
+ * Used to find the super block.
+ */
+struct mount
+{
+       dev_t   m_dev;          /* device mounted */
+       struct  buf *m_bufp;    /* pointer to superblock */
+       struct  inode *m_inodp; /* pointer to mounted on inode */
+} mount[NMOUNT];
diff --git a/usr/src/sys/h/mtpr.h b/usr/src/sys/h/mtpr.h
new file mode 100644 (file)
index 0000000..62472bf
--- /dev/null
@@ -0,0 +1,52 @@
+/*     mtpr.h  4.1     11/9/80 */
+
+/*
+ * VAX processor register numbers
+ */
+
+#define        KSP     0               /* kernel stack pointer */
+#define        ESP     1               /* exec stack pointer */
+#define        SSP     2               /* supervisor stack pointer */
+#define        USP     3               /* user stack pointer */
+#define        ISP     4               /* interrupt stack pointer */
+#define        P0BR    8               /* p0 base register */
+#define        P0LR    9               /* p0 length register */
+#define        P1BR    10              /* p1 base register */
+#define        P1LR    11              /* p1 length register */
+#define        SBR     12              /* system segment base register */
+#define        SLR     13              /* system segment length register */
+#define        PCBB    16              /* process control block base */
+#define        SCBB    17              /* system control block base */
+#define        IPL     18              /* interrupt priority level */
+#define        ASTLVL  19              /* async. system trap level */
+#define        SIRR    20              /* software interrupt request */
+#define        SISR    21              /* software interrupt summary */
+#define        ICCS    24              /* interval clock control */
+#define        NICR    25              /* next interval count */
+#define        ICR     26              /* interval count */
+#define        TODR    27              /* time of year (day) */
+#define        RXCS    32              /* console receiver control and status */
+#define        RXDB    33              /* console receiver data buffer */
+#define        TXCS    34              /* console transmitter control and status */
+#define        TXDB    35              /* console transmitter data buffer */
+#define        MAPEN   56              /* memory management enable */
+#define        TBIA    57              /* translation buffer invalidate all */
+#define        TBIS    58              /* translation buffer invalidate single */
+#define        PMR     61              /* performance monitor enable */
+#define        SID     62              /* system identification */
+
+/*
+ * VAX-11/780 specific registers
+ */
+#define        ACCS    40              /* accelerator control and status */
+#define        ACCR    41              /* accelerator maintenance */
+#define        WCSA    44              /* WCS address */
+#define        WCSD    45              /* WCS data */
+#define        SBIFS   48              /* SBI fault and status */
+#define        SBIS    49              /* SBI silo */
+#define        SBISC   50              /* SBI silo comparator */
+#define        SBIMT   51              /* SBI maintenance */
+#define        SBIER   52              /* SBI error register */
+#define        SBITA   53              /* SBI timeout address */
+#define        SBIQC   54              /* SBI quadword clear */
+#define        MBRK    60              /* micro-program breakpoint */
diff --git a/usr/src/sys/h/mtpr.m b/usr/src/sys/h/mtpr.m
new file mode 100644 (file)
index 0000000..3659c06
--- /dev/null
@@ -0,0 +1,51 @@
+#
+#      mtpr.m  4.1     11/9/80
+#
+#
+#      VAX processor register numbers
+#
+       .set    KSP,0           # kernel stack pointer
+       .set    ESP,1           # exec stack pointer
+       .set    SSP,2           # supervisor stack pointer
+       .set    USP,3           # user stack pointer
+       .set    ISP,4           # interrupt stack pointer
+       .set    P0BR,8          # p0 base register
+       .set    P0LR,9          # p0 length register
+       .set    P1BR,10         # p1 base register
+       .set    P1LR,11         # p1 length register
+       .set    SBR,12          # system segment base register
+       .set    SLR,13          # system segment length register
+       .set    PCBB,16         # process control block base
+       .set    SCBB,17         # system control block base
+       .set    IPL,18          # interrupt priority level
+       .set    ASTLVL,19       # async. system trap level
+       .set    SIRR,20         # software interrupt request
+       .set    SISR,21         # software interrupt summary
+       .set    ICCS,24         # interval clock control
+       .set    NICR,25         # next interval count
+       .set    ICR,26          # interval count
+       .set    TODR,27         # time of year (day)
+       .set    RXCS,32         # console receiver control and status
+       .set    RXDB,33         # console receiver data buffer
+       .set    TXCS,34         # console transmitter control and status
+       .set    TXDB,35         # console transmitter data buffer
+       .set    MAPEN,56        # memory management enable
+       .set    TBIA,57         # translation buffer invalidate all
+       .set    TBIS,58         # translation buffer invalidate single
+       .set    PMR,61          # performance monitor enable
+       .set    SID,62          # system identification
+#
+#      VAX-11/780 specific registers
+#
+       .set    ACCS,40         # accelerator control and status
+       .set    ACCR,41         # accelerator maintenance
+       .set    WCSA,44         # WCS address
+       .set    WCSD,45         # WCS data
+       .set    SBIFS,48        # SBI fault and status
+       .set    SBIS,49         # SBI silo
+       .set    SBISC,50        # SBI silo comparator
+       .set    SBIMT,51        # SBI maintenance
+       .set    SBIER,52        # SBI error register
+       .set    SBITA,53        # SBI timeout address
+       .set    SBIQC,54        # SBI quadword clear
+       .set    MBRK,60         # micro-program breakpoint
diff --git a/usr/src/sys/h/mx.h b/usr/src/sys/h/mx.h
new file mode 100644 (file)
index 0000000..1265d81
--- /dev/null
@@ -0,0 +1,139 @@
+/*     mx.h    4.1     11/9/80 */
+
+#define        NGROUPS         10      /* number of mpx files permitted at one time */
+#define        NCHANS          20      /* number of channel structures */
+#define        NPORTS          30      /* number of channels to i/o ports */
+#define        CNTLSIZ         10
+#define        NLEVELS         4
+#define        NMSIZE          50      /* max size of mxlstn file name */
+
+/*
+ * header returned on read of mpx
+ */
+struct rh {
+       short   index;
+       short   count;
+       short   ccount;
+};
+
+/*
+ * head expected on write of mpx
+ */
+struct wh {
+       short   index;
+       short   count;
+       short   ccount;
+       char    *data;
+};
+
+struct mx_args {
+       char    *m_name;
+       int     m_cmd;
+       int     m_arg[3];
+};
+
+
+#ifdef KERNEL
+/*
+ * internal structure for channel
+ */
+
+struct chan {
+       short   c_flags;
+       char    c_index;
+       char    c_line;
+       struct  group   *c_group;
+       struct  file    *c_fy;
+       struct  tty     *c_ttyp;
+       struct  clist   c_ctlx;
+       int     c_pgrp;
+       struct  tty     *c_ottyp;
+       char    c_oline;
+       union {
+               struct  clist   datq;
+       } cx;
+       union {
+               struct  clist   datq;
+               struct  chan    *c_chan;
+       } cy;
+       struct  clist   c_ctly;
+};
+
+struct schan {
+       short   c_flags;
+       char    c_index;
+       char    c_line;
+       struct  group   *c_group;
+       struct  file    *c_fy;
+       struct  tty     *c_ttyp;
+       struct  clist   c_ctlx;
+       int     c_pgrp;
+};
+
+
+/*
+ * flags
+ */
+#define        INUSE   01
+#define        SIOCTL  02
+#define        XGRP    04
+#define        YGRP    010
+#define        WCLOSE  020
+#define        ISGRP   0100
+#define        BLOCK   0200
+#define        EOTMARK 0400
+#define        SIGBLK  01000
+#define        BLKMSG  01000
+#define        ENAMSG  02000
+#define        WFLUSH  04000
+#define        NMBUF   010000
+#define        PORT    020000
+#define        ALT     040000
+#define        FBLOCK  0100000
+
+#endif
+
+/*
+ * mpxchan command codes
+ */
+#define        MPX     5
+#define        MPXN    6
+#define        CHAN    1
+#define        JOIN    2
+#define        EXTR    3
+#define        ATTACH  4
+#define        CONNECT 7
+#define        DETACH  8
+#define        DISCON  9
+#define        DEBUG   10
+#define        NPGRP   11
+#define        CSIG    12
+#define        PACK    13
+
+#define        NDEBUGS 30
+/*
+ * control channel message codes
+ */
+#define        M_WATCH 1
+#define        M_CLOSE 2
+#define        M_EOT   3
+#define        M_OPEN  4
+#define        M_BLK   5
+#define        M_UBLK  6
+#define        DO_BLK  7
+#define        DO_UBLK 8
+#define        M_IOCTL 12
+#define        M_IOANS 13
+#define        M_SIG   14
+
+/*
+ * debug codes other than mpxchan cmds
+ */
+#define        MCCLOSE 29
+#define        MCOPEN  28
+#define        ALL     27
+#define        SCON    26
+#define        MSREAD  25
+#define        SDATA   24
+#define        MCREAD  23
+#define        MCWRITE 22
diff --git a/usr/src/sys/h/page.m b/usr/src/sys/h/page.m
new file mode 100644 (file)
index 0000000..31561a2
--- /dev/null
@@ -0,0 +1,18 @@
+#
+#      page.m  4.1     11/9/80
+#
+#
+# VAX page table entry
+#
+
+       .set    PG_PFNUM,0x1fffff
+       .set    PG_M,0x4000000
+       .set    PG_PROT,0x78000000
+       .set    PG_V,0x80000000
+
+       .set    PG_NOACC,0
+       .set    PG_KR,0x18000000
+       .set    PG_KW,0x10000000
+       .set    PG_UW,0x20000000
+       .set    PG_URKW,0x70000000
+       .set    PG_URKR,0x78000000
diff --git a/usr/src/sys/h/param.h b/usr/src/sys/h/param.h
new file mode 100644 (file)
index 0000000..9526fa2
--- /dev/null
@@ -0,0 +1,205 @@
+/*     param.h 4.1     11/9/80 */
+
+/*
+ * tunable variables
+ *
+ * NB: NBUF must be less than MAXNBUF in locore.s.
+ */
+
+#define        NBUF    128             /* size of buffer cache */
+#define        NINODE  400             /* number of in core inodes */
+#define        NFILE   350             /* number of in core file structures */
+#define        NMOUNT  15              /* number of mountable file systems */
+#define        MSWAPX  15              /* pseudo mount table index for swapdev */
+#define        MAXUPRC 25              /* max processes per user */
+#define        SSIZE   4               /* initial stack size (*512 bytes) */
+#define        SINCR   4               /* increment of stack (*512 bytes) */
+#define        NOFILE  20              /* max open files per process */
+#define        CANBSIZ 256             /* max size of typewriter line */
+#define        SMAPSIZ (4*NPROC)       /* size of swap allocation area */
+#define        NCALL   40              /* max simultaneous time callouts */
+#define        NPROC   250             /* max number of processes */
+#define        NTEXT   60              /* max number of pure texts */
+#define        NCLIST  500             /* max total clist size */
+#define        HZ      60              /* Ticks/second of the clock */
+#define        TIMEZONE (8*60)         /* Minutes westward from Greenwich */
+#define        DSTFLAG 1               /* Daylight Saving Time applies in this locality */
+#define        MSGBUFS 128             /* Characters saved from error messages */
+#define        NCARGS  10240           /* # characters in exec arglist */
+/*
+ * priorities
+ * probably should not be
+ * altered too much
+ */
+
+#define        PSWP    0
+#define        PINOD   10
+#define        PRIBIO  20
+#define        PRIUBA  24
+#define        PZERO   25
+#define        PPIPE   26
+#define        PWAIT   30
+#define        PSLEP   40
+#define        PUSER   50
+
+#define        NZERO   20
+
+/*
+ * signals
+ * dont change
+ */
+
+#ifndef        NSIG
+#include <signal.h>
+#endif
+
+/*
+ * Return values from tsleep().
+ */
+#define        TS_OK   0       /* normal wakeup */
+#define        TS_TIME 1       /* timed-out wakeup */
+#define        TS_SIG  2       /* asynchronous signal wakeup */
+
+/*
+ * fundamental constants of the implementation--
+ * cannot be changed easily.
+ * note: UPAGES is well known in locore.s
+ */
+
+#define        NBPW    sizeof(int)     /* number of bytes in an integer */
+
+#define        UPAGES  6               /* pages of u-area */
+#define        NULL    0
+#define        CMASK   0               /* default mask for file creation */
+#define        NODEV   (dev_t)(-1)
+#define        ROOTINO ((ino_t)2)      /* i number of all roots */
+#define        SUPERB  ((daddr_t)1)    /* block number of the super block */
+#define        DIRSIZ  14              /* max characters per directory */
+
+/*
+ * Clustering of hardware pages on machines with ridiculously small
+ * page sizes is done here.  The paging subsystem deals with units of
+ * CLSIZE pte's describing NBPG (from vm.h) pages each... BSIZE must
+ * be CLSIZE*NBPG in the current implementation, that is the paging subsystem
+ * deals with the same size blocks that the file system uses.
+ *
+ * NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE
+ *
+ * NB: CLSIZE is well known in locore.s.
+ */
+#define        CLSIZE  2
+
+/* give the base virtual address (first of CLSIZE) */
+#define        clbase(i)       ((i) &~ (CLSIZE-1))
+
+/* round a number of clicks up to a whole cluster */
+#define        clrnd(i)        (((i) + (CLSIZE-1)) &~ (CLSIZE-1))
+
+#if CLSIZE==1
+#define        BSIZE   512             /* size of secondary block (bytes) */
+#define        INOPB   8               /* 8 inodes per block */
+#define        BMASK   0777            /* BSIZE-1 */
+#define        BSHIFT  9               /* LOG2(BSIZE) */
+#define        NMASK   0177            /* NINDIR-1 */
+#define        NSHIFT  7               /* LOG2(NINDIR) */
+#define        NICINOD 100             /* number of superblock inodes */
+#define        NICFREE 50              /* number of superblock free blocks */
+
+#endif
+
+#if CLSIZE==2
+#define        BSIZE   1024
+#define        INOPB   16
+#define        BMASK   01777
+#define        BSHIFT  10
+#define        NMASK   0377
+#define        NSHIFT  8
+#define        NICINOD 100
+#define        NICFREE 178
+#endif
+
+#if CLSIZE==4
+#define        BSIZE   2048
+#define        INOPB   32
+#define        BMASK   03777
+#define        BSHIFT  11
+#define        NMASK   0777
+#define        NSHIFT  9
+#define        NICINOD 100
+#define        NICFREE 434
+#endif
+
+#ifndef INTRLVE
+/* macros replacing interleaving functions */
+#define        dkblock(bp)     ((bp)->b_blkno)
+#define        dkunit(bp)      (minor((bp)->b_dev) >> 3)
+#endif
+
+/* inumber to disk address and inumber to disk offset */
+#define        itod(x) ((daddr_t)((((unsigned)(x)+2*INOPB-1)/INOPB)))
+#define        itoo(x) ((int)(((x)+2*INOPB-1)%INOPB))
+
+/* file system blocks to disk blocks and back */
+#define        fsbtodb(b)      ((b)*CLSIZE)
+#define        dbtofsb(b)      ((b)/CLSIZE)
+
+#define        NINDIR  (BSIZE/sizeof(daddr_t))
+
+#define        CBSIZE  28              /* number of chars in a clist block */
+#define        CROUND  0x1F            /* clist rounding; sizeof(int *) + CBSIZE -1*/
+#define        CLKTICK (1000000/(HZ))  /* microseconds in a clock tick */
+
+/*
+ * Macros for fast min/max
+ */
+#define        MIN(a,b) (((a)<(b))?(a):(b))
+#define        MAX(a,b) (((a)>(b))?(a):(b))
+
+/*
+ * Some macros for units conversion
+ */
+/* Core clicks (512 bytes) to segments and vice versa */
+#define        ctos(x) (x)
+#define        stoc(x) (x)
+
+/* Core clicks (512 bytes) to disk blocks */
+#define        ctod(x) (x)
+
+/* clicks to bytes */
+#define        ctob(x) ((x)<<9)
+
+/* bytes to clicks */
+#define        btoc(x) ((((unsigned)(x)+511)>>9))
+
+/* major part of a device */
+#define        major(x)        ((int)(((unsigned)(x)>>8)&0377))
+
+/* minor part of a device */
+#define        minor(x)        ((int)((x)&0377))
+
+/* make a device number */
+#define        makedev(x,y)    ((dev_t)(((x)<<8) | (y)))
+
+typedef        struct { int r[1]; } *  physadr;
+typedef        int             daddr_t;
+typedef        char *          caddr_t;
+typedef        unsigned short  ino_t;
+typedef        int             swblk_t;
+typedef        int             size_t;
+typedef        int             time_t;
+typedef        int             label_t[14];
+typedef        short           dev_t;
+typedef        int             off_t;
+
+typedef        unsigned char   u_char;
+typedef        unsigned short  u_short;
+typedef        unsigned int    u_int;
+typedef        unsigned long   u_long;
+
+/*
+ * Machine-dependent bits and macros
+ */
+#define        UMODE   PSL_CURMOD              /* usermode bits */
+#define        USERMODE(ps)    (((ps) & UMODE) == UMODE)
+
+#define        BASEPRI(ps)     (((ps) & PSL_IPL) != 0)
diff --git a/usr/src/sys/h/pcb.h b/usr/src/sys/h/pcb.h
new file mode 100644 (file)
index 0000000..6cbbb4c
--- /dev/null
@@ -0,0 +1,44 @@
+/*     pcb.h   4.1     11/9/80 */
+
+/*
+ * VAX process control block
+ *
+ * THE SIZE OF THE pcb, AS INFLUENCED BY THE SIZE OF THE SOFTWARE
+ * EXTENSION, IS KNOWN IN THE #ifdef FASTVAX'ed DEFINITIONS OF THE
+ * OFFSETS OF U_ARG and U_QSAV IN THE FILE user.h.
+ */
+
+struct pcb
+{
+       int     pcb_ksp;        /* kernel stack pointer */
+       int     pcb_esp;        /* exec stack pointer */
+       int     pcb_ssp;        /* supervisor stack pointer */
+       int     pcb_usp;        /* user stack pointer */
+       int     pcb_r0; 
+       int     pcb_r1; 
+       int     pcb_r2; 
+       int     pcb_r3; 
+       int     pcb_r4; 
+       int     pcb_r5; 
+       int     pcb_r6; 
+       int     pcb_r7; 
+       int     pcb_r8; 
+       int     pcb_r9; 
+       int     pcb_r10; 
+       int     pcb_r11; 
+       int     pcb_r12; 
+       int     pcb_r13; 
+       int     pcb_pc;         /* program counter */
+       int     pcb_psl;        /* program status longword */
+       struct  pte *pcb_p0br;  /* seg 0 base register */
+       int     pcb_p0lr;       /* seg 0 length register and astlevel */
+       struct  pte *pcb_p1br;  /* seg 1 base register */
+       int     pcb_p1lr;       /* seg 1 length register and pme */
+/*
+ * Software pcb (extension)
+ */
+       int     pcb_szpt;       /* number of pages of user page table */
+       int     pcb_cmap2;
+       int     *pcb_sswap;
+       int     pcb_sigc[3];
+};
diff --git a/usr/src/sys/h/pcb.m b/usr/src/sys/h/pcb.m
new file mode 100644 (file)
index 0000000..b7f92a8
--- /dev/null
@@ -0,0 +1,40 @@
+#
+#      pcb.m   4.1     11/9/80
+#
+#
+#      VAX process control block
+#
+
+       .set    PCB_KSP,0       # kernel stack pointer
+       .set    PCB_ESP,4       # exec stack pointer
+       .set    PCB_SSP,8       # supervisor stack pointer
+       .set    PCB_USP,12      # user stack pointer
+       .set    PCB_R0,16
+       .set    PCB_R1,20
+       .set    PCB_R2,24
+       .set    PCB_R3,28
+       .set    PCB_R4,32
+       .set    PCB_R5,36
+       .set    PCB_R6,40
+       .set    PCB_R7,44
+       .set    PCB_R8,48
+       .set    PCB_R9,52
+       .set    PCB_R10,56
+       .set    PCB_R11,60
+       .set    PCB_R12,64
+       .set    PCB_R13,68
+       .set    PCB_PC,72       # program counter
+       .set    PCB_PSL,76      # program status longword
+       .set    PCB_P0BR,80     # seg 0 base register
+       .set    PCB_P0LR,84     # seg 0 length register and astlevel
+       .set    PCB_P1BR,88     # seg 1 base register
+       .set    PCB_P1LR,92     # seg 1 length register and pme
+
+#
+#      software pcb (extension)
+#
+
+       .set    PCB_SZPT,96     # number of pages of user page table
+       .set    PCB_CMAP2,100
+       .set    PCB_SSWAP,104
+       .set    PCB_SIGC,108
diff --git a/usr/src/sys/h/pdma.h b/usr/src/sys/h/pdma.h
new file mode 100644 (file)
index 0000000..6d73725
--- /dev/null
@@ -0,0 +1,10 @@
+/*     pdma.h  4.1     11/9/80 */
+
+struct pdma
+{
+       struct  device *p_addr;
+       char    *p_mem;
+       char    *p_end;
+       int     p_arg;
+       int     (*p_fcn)();
+};
diff --git a/usr/src/sys/h/proc.h b/usr/src/sys/h/proc.h
new file mode 100644 (file)
index 0000000..8a8a733
--- /dev/null
@@ -0,0 +1,141 @@
+/*     proc.h  4.1     11/9/80 */
+
+/*
+ * One structure allocated per active
+ * process. It contains all data needed
+ * about the process while the
+ * process may be swapped out.
+ * Other per process data (user.h)
+ * is swapped with the process.
+ *
+ * NB: OFFSETS HERE ARE ALSO DEFINED IN proc.m
+ */
+struct proc
+{
+       struct  proc *p_link;   /* linked list of running processes */
+       struct  proc *p_rlink;
+       struct  pte *p_addr;    /* u-area kernel map address */
+       char    p_usrpri;       /* user-priority based on p_cpu and p_nice */
+       char    p_pri;          /* priority, negative is high */
+       char    p_cpu;          /* cpu usage for scheduling */
+       char    p_stat;
+       char    p_time;         /* resident time for scheduling */
+       char    p_nice;         /* nice for cpu usage */
+       char    p_slptime;      /* time since last block */
+       char    p_cursig;
+       long    p_sig;          /* signals pending to this process */
+       long    p_siga0;        /* low bit of 2 bit signal action */
+       long    p_siga1;        /* high bit of 2 bit signal action */
+#define        p_ignsig p_siga0        /* ignored signal mask */
+       int     p_flag;
+       short   p_uid;          /* user id, used to direct tty signals */
+       short   p_pgrp;         /* name of process group leader */
+       short   p_pid;          /* unique process id */
+       short   p_ppid;         /* process id of parent */
+       short   p_poip;         /* count of page outs in progress */
+       short   p_szpt;         /* copy of page table size */
+       size_t  p_tsize;        /* size of text (clicks) */
+       size_t  p_dsize;        /* size of data space (clicks) */
+       size_t  p_ssize;        /* copy of stack size (clicks) */
+       size_t  p_rssize;       /* current resident set size in clicks */
+       size_t  p_swrss;        /* resident set size before last swap */
+       swblk_t p_swaddr;       /* disk address of u area when swapped */
+       caddr_t p_wchan;        /* event process is awaiting */
+       struct  text *p_textp;  /* pointer to text structure */
+       int     p_clktim;       /* time to alarm clock signal */
+       struct  pte *p_p0br;    /* page table base P0BR */
+       struct  proc *p_xlink;  /* linked list of procs sharing same text */
+       short   p_cpticks;      /* ticks of cpu time */
+       float   p_pctcpu;       /* %cpu for this process during p_time */
+       short   p_ndx;          /* proc index for memall (because of vfork) */
+       short   p_idhash;       /* hashed based on p_pid for kill+exit+... */
+       struct  proc *p_pptr;   /* pointer to process structure of parent */
+};
+
+#define        PIDHSZ          63
+#define        PIDHASH(pid)    ((pid) % PIDHSZ)
+
+#ifdef KERNEL
+short  pidhash[PIDHSZ];
+
+struct proc *pfind();
+#endif
+
+#ifdef KERNEL
+extern struct proc proc[];     /* the proc table itself */
+
+#ifdef FASTVAX
+#define        NQS     32              /* 32 run queues */
+struct prochd {
+       struct  proc *ph_link;  /* linked list of running processes */
+       struct  proc *ph_rlink;
+} qs[NQS];
+int    whichqs;                /* bit mask summarizing non-empty qs's */
+#else
+struct proc *runq;
+#endif
+#endif
+
+/* stat codes */
+#define        SSLEEP  1               /* awaiting an event */
+#define        SWAIT   2               /* (abandoned state) */
+#define        SRUN    3               /* running */
+#define        SIDL    4               /* intermediate state in process creation */
+#define        SZOMB   5               /* intermediate state in process termination */
+#define        SSTOP   6               /* process being traced */
+
+/* flag codes */
+#define        SLOAD   0x000001        /* in core */
+#define        SSYS    0x000002        /* swapper or pager process */
+#define        SLOCK   0x000004        /* process being swapped out */
+#define        SSWAP   0x000008        /* save area flag */
+#define        STRC    0x000010        /* process is being traced */
+#define        SWTED   0x000020        /* another tracing flag */
+#define        SULOCK  0x000040        /* user settable lock in core */
+#define        SPAGE   0x000080        /* process in page wait state */
+#define        SKEEP   0x000100        /* another flag to prevent swap out */
+#define        SDLYU   0x000200        /* delayed unlock of pages */
+#define        SWEXIT  0x000400        /* working on exiting */
+#define        SPHYSIO 0x000800        /* doing physical i/o (bio.c) */
+#define        SVFORK  0x001000        /* process resulted from vfork() */
+#define        SVFDONE 0x002000        /* another vfork flag */
+#define        SNOVM   0x004000        /* no vm, parent in a vfork() */
+#define        SPAGI   0x008000        /* init data space on demand, from inode */
+#define        SANOM   0x010000        /* system detected anomalous vm behavior */
+#define        SUANOM  0x020000        /* user warned of anomalous vm behavior */
+#define        STIMO   0x040000        /* timing out during sleep */
+#define        SDETACH 0x080000        /* detached inherited by init */
+#define        SNUSIG  0x100000        /* using new signal mechanism */
+
+/*
+ * parallel proc structure
+ * to replace part with times
+ * to be passed to parent process
+ * in ZOMBIE state.
+ *
+ * THIS SHOULD BE DONE WITH A union() CONSTRUCTION
+ */
+struct xproc
+{
+       struct  proc *xp_link;
+       struct  proc *xp_rlink;
+       struct  pte *xp_addr;
+       char    xp_usrpri;
+       char    xp_pri;         /* priority, negative is high */
+       char    xp_cpu;         /* cpu usage for scheduling */
+       char    xp_stat;
+       char    xp_time;        /* resident time for scheduling */
+       char    xp_nice;        /* nice for cpu usage */
+       char    xp_slptime;
+       char    p_cursig;
+       int     xp_sig;         /* signals pending to this process */
+       int     xp_siga0;
+       int     xp_siga1;
+       int     xp_flag;
+       short   xp_uid;         /* user id, used to direct tty signals */
+       short   xp_pgrp;        /* name of process group leader */
+       short   xp_pid;         /* unique process id */
+       short   xp_ppid;        /* process id of parent */
+       short   xp_xstat;       /* Exit status for wait */
+       struct  vtimes xp_vm;
+};
diff --git a/usr/src/sys/h/proc.m b/usr/src/sys/h/proc.m
new file mode 100644 (file)
index 0000000..b7e37df
--- /dev/null
@@ -0,0 +1,43 @@
+#
+#      proc.m  4.1     11/9/80
+#
+       .set    P_LINK,0
+       .set    P_RLINK,4
+       .set    P_ADDR,8
+       .set    P_USRPRI,12
+       .set    P_PRI,13
+       .set    P_CPU,14
+       .set    P_STAT,15
+       .set    P_TIME,16
+       .set    P_NICE,17
+       .set    P_SLPTIME,18
+       .set    P_CURSIG,19
+       .set    P_SIG,20
+       .set    P_SIGA0,24
+       .set    P_SIGA1,28
+       .set    P_FLAG,32
+       .set    P_UID,36
+       .set    P_PGRP,38
+       .set    P_PID,40
+       .set    P_PPID,42
+       .set    P_POIP,44
+       .set    P_SZPT,46
+       .set    P_TSIZE,48
+       .set    P_DSIZE,52
+       .set    P_SSIZE,56
+       .set    P_RSSIZE,60
+       .set    P_SWRSS,64
+       .set    P_SWADDR,68
+       .set    P_WCHAN,72
+       .set    P_TEXTP,76
+       .set    P_CLKTIM,80
+       .set    P_P0BR,84
+       .set    P_XLINK,88
+       .set    P_CPTICKS,92
+       .set    P_PCTCPU,96
+       .set    P_NDX,100
+       .set    P_IDHASH,102
+       .set    P_PPTR,104
+
+       .set    SSLEEP,1
+       .set    SRUN,3
diff --git a/usr/src/sys/h/psl.h b/usr/src/sys/h/psl.h
new file mode 100644 (file)
index 0000000..34f459f
--- /dev/null
@@ -0,0 +1,23 @@
+/*     psl.h   4.1     11/9/80 */
+
+/*
+ * VAX program status longword
+ */
+
+#define        PSL_C           0x1             /* carry bit */
+#define        PSL_V           0x2             /* overflow bit */
+#define        PSL_Z           0x4             /* zero bit */
+#define        PSL_N           0x8             /* negative bit */
+#define        PSL_ALLCC       0xf             /* all cc bits - unlikely */
+#define        PSL_T           0x10            /* trace enable bit */
+#define        PSL_IV          0x20            /* integer overflow enable bit */
+#define        PSL_FU          0x40            /* floating point underflow enable */
+#define        PSL_DV          0x80            /* decimal overflow enable bit */
+#define        PSL_IPL         0x1f0000        /* interrupt priority level */
+#define        PSL_PRVMOD      0xc00000        /* previous mode (all on is user) */
+#define        PSL_CURMOD      0x3000000       /* current mode (all on is user) */
+#define        PSL_IS          0x4000000       /* interrupt stack */
+#define        PSL_FPD         0x8000000       /* first part done */
+#define        PSL_TP          0x40000000      /* trace pending */
+#define        PSL_CM          0x80000000      /* compatibility mode */
+#define        PSL_USERCLR     0x3c20ff00      /* bits must be clear in user mode */
diff --git a/usr/src/sys/h/psl.m b/usr/src/sys/h/psl.m
new file mode 100644 (file)
index 0000000..f5a1e98
--- /dev/null
@@ -0,0 +1,23 @@
+#
+#      psl.m   4.1     11/9/80
+#
+#
+#      VAX program status longword
+#
+
+       .set    PSL_C,0x1               # carry bit
+       .set    PSL_V,0x2               # overflow bit
+       .set    PSL_Z,0x4               # zero bit
+       .set    PSL_N,0x8               # negative bit
+       .set    PSL_T,0x10              # trace enable bit
+       .set    PSL_IV,0x20             # integer overflow enable bit
+       .set    PSL_FU,0x40             # floating point underflow enable bit
+       .set    PSL_DV,0x80             # decimal overflow enable bit
+       .set    PSL_IPL,0x1f0000        # interrupt priority level
+       .set    PSL_PRVMOD,0xc00000     # previous mode
+       .set    PSL_CURMOD,0x3000000    # current mode
+       .set    PSL_IS,0x4000000        # interrupt stack
+       .set    PSL_FPD,0x8000000       # first part done
+       .set    PSL_TP,0x40000000       # trace pending
+       .set    PSL_CM,0x80000000       # compatibility mode
+
diff --git a/usr/src/sys/h/pte.h b/usr/src/sys/h/pte.h
new file mode 100644 (file)
index 0000000..409f1a6
--- /dev/null
@@ -0,0 +1,79 @@
+/*     pte.h   4.1     11/9/80 */
+
+/*
+ * VAX page table entry
+ *
+ * There are two major kinds of pte's: those which have ever existed (and are
+ * thus either now in core or on the swap device), and those which have
+ * never existed, but which will be filled on demand at first reference.
+ * There is a structure describing each.  There is also an ancillary
+ * structure used in page clustering.
+ */
+
+struct pte
+{
+unsigned int   pg_pfnum:21,            /* core page frame number or 0 */
+               :2,
+               pg_vreadm:1,            /* modified since vread (or with _m) */
+               pg_swapm:1,             /* have to write back to swap */
+               pg_fod:1,               /* is fill on demand (=0) */
+               pg_m:1,                 /* hardware maintained modified bit */
+               pg_prot:4,              /* access control */
+               pg_v:1;                 /* valid bit */
+};
+struct hpte
+{
+unsigned int   pg_pfnum:21,
+               :2,
+               pg_high:9;              /* special for clustering */
+};
+struct fpte
+{
+unsigned int   pg_blkno:20,            /* file system block number */
+               pg_fileno:5,            /* file mapped from or TEXT or ZERO */
+               pg_fod:1,               /* is fill on demand (=1) */
+               :1,
+               pg_prot:4,
+               pg_v:1;
+};
+
+#define        PG_V            0x80000000
+#define        PG_PROT         0x78000000
+#define        PG_M            0x04000000
+#define        PG_VREADM       0x00800000
+#define        PG_PFNUM        0x001fffff
+
+#define        PG_FZERO        (NOFILE)
+#define        PG_FTEXT        (NOFILE+1)
+#define        PG_FMAX         (PG_FTEXT)
+
+#define        PG_NOACC        0
+#define        PG_KW           0x10000000
+#define        PG_KR           0x18000000
+#define        PG_UW           0x20000000
+#define        PG_URKW         0x70000000
+#define        PG_URKR         0x78000000
+
+/*
+ * Pte related macros
+ */
+#define        dirty(pte)      ((pte)->pg_fod == 0 && (pte)->pg_pfnum && \
+                           ((pte)->pg_m || (pte)->pg_swapm))
+
+#ifdef KERNEL
+struct pte *vtopte();
+
+/* utilities defined in locore.s */
+extern struct pte Sysmap[];
+extern struct pte Usrptmap[];
+extern struct pte usrpt[];
+extern struct pte Swapmap[];
+extern struct pte Forkmap[];
+extern struct pte Xswapmap[];
+extern struct pte Xswap2map[];
+extern struct pte Pushmap[];
+extern struct pte Vfmap[];
+extern struct pte mmap[];
+extern struct pte mcrmap[];
+extern struct pte bufmap[];
+#endif
diff --git a/usr/src/sys/h/reboot.h b/usr/src/sys/h/reboot.h
new file mode 100644 (file)
index 0000000..6161604
--- /dev/null
@@ -0,0 +1,16 @@
+/*     reboot.h        4.1     11/9/80 */
+
+/*
+ * Arguments to reboot system call.
+ * These are passed to boot program in r11,
+ * and on to init.
+ */
+#define        RB_AUTOBOOT     0       /* flags for system auto-booting itself */
+
+#define        RB_ASKNAME      1       /* ask for file name to reboot from */
+#define        RB_SINGLE       2       /* reboot to single user only */
+#define        RB_NOSYNC       4       /* dont sync before reboot */
+#define        RB_HALT         8       /* don't reboot, just halt */
+
+#define        RB_PANIC        0       /* reboot due to panic */
+#define        RB_BOOT         1       /* reboot due to boot() */
diff --git a/usr/src/sys/h/reg.h b/usr/src/sys/h/reg.h
new file mode 100644 (file)
index 0000000..d3df37d
--- /dev/null
@@ -0,0 +1,26 @@
+/*     reg.h   4.1     11/9/80 */
+/*
+ * Location of the users' stored
+ * registers relative to R0.
+ * Usage is u.u_ar0[XX].
+ */
+#define        R0      (-18)
+#define        R1      (-17)
+#define        R2      (-16)
+#define        R3      (-15)
+#define        R4      (-14)
+#define        R5      (-13)
+#define        R6      (-12)
+#define        R7      (-11)
+#define        R8      (-10)
+#define        R9      (-9)
+#define        R10     (-8)
+#define        R11     (-7)
+#define        R12     (-21)
+#define        R13     (-20)
+
+#define AP     (-21)
+#define        FP      (-20)
+#define        SP      (-5)
+#define        PS      (-1)
+#define        PC      (-2)
diff --git a/usr/src/sys/h/seg.h b/usr/src/sys/h/seg.h
new file mode 100644 (file)
index 0000000..2b089f7
--- /dev/null
@@ -0,0 +1,8 @@
+/*     seg.h   4.1     11/9/80 */
+
+/*
+ * Mapper addresses and bits
+ */
+
+#define        RO      PG_URKR         /* access abilities */
+#define        RW      PG_UW
diff --git a/usr/src/sys/h/stat.h b/usr/src/sys/h/stat.h
new file mode 100644 (file)
index 0000000..0fdf869
--- /dev/null
@@ -0,0 +1,30 @@
+/*     stat.h  4.1     11/9/80 */
+
+struct stat
+{
+       dev_t   st_dev;
+       ino_t   st_ino;
+       unsigned short st_mode;
+       short   st_nlink;
+       short   st_uid;
+       short   st_gid;
+       dev_t   st_rdev;
+       off_t   st_size;
+       time_t  st_atime;
+       time_t  st_mtime;
+       time_t  st_ctime;
+};
+
+#define        S_IFMT  0170000         /* type of file */
+#define                S_IFDIR 0040000 /* directory */
+#define                S_IFCHR 0020000 /* character special */
+#define                S_IFBLK 0060000 /* block special */
+#define                S_IFREG 0100000 /* regular */
+#define                S_IFMPC 0030000 /* multiplexed char special */
+#define                S_IFMPB 0070000 /* multiplexed block special */
+#define        S_ISUID 0004000         /* set user id on execution */
+#define        S_ISGID 0002000         /* set group id on execution */
+#define        S_ISVTX 0001000         /* save swapped text even after use */
+#define        S_IREAD 0000400         /* read permission, owner */
+#define        S_IWRITE 0000200        /* write permission, owner */
+#define        S_IEXEC 0000100         /* execute/search permission, owner */
diff --git a/usr/src/sys/h/systm.h b/usr/src/sys/h/systm.h
new file mode 100644 (file)
index 0000000..a6302c4
--- /dev/null
@@ -0,0 +1,82 @@
+/*     systm.h 4.1     11/9/80 */
+
+/*
+ * Random set of variables
+ * used by more than one
+ * routine.
+ */
+char   canonb[CANBSIZ];        /* buffer for erase and kill (#@) */
+int    cpusid;                 /* cpu SID register */
+char   version[];              /* system version */
+int    lbolt;                  /* time of day in 60th not in time */
+time_t time;                   /* time in sec from 1970 */
+time_t bootime;                /* time at which booted */
+
+int    hand;                   /* current index into coremap used by daemon */
+
+/*
+ * Nblkdev is the number of entries
+ * (rows) in the block switch. It is
+ * set in binit/bio.c by making
+ * a pass over the switch.
+ * Used in bounds checking on major
+ * device numbers.
+ */
+int    nblkdev;
+
+/*
+ * Number of character switch entries.
+ * Set by cinit/prim.c
+ */
+int    nchrdev;
+
+int    nswdev;                 /* number of swap devices */
+int    mpid;                   /* generic for unique process id's */
+char   runin;                  /* scheduling flag */
+char   runout;                 /* scheduling flag */
+int    runrun;                 /* scheduling flag */
+char   kmapwnt;                /* kernel map want flag */
+char   curpri;                 /* more scheduling */
+
+int    maxmem;                 /* actual max memory per process */
+int    physmem;                /* physical memory on this CPU */
+
+int    nswap;                  /* size of swap space */
+int    updlock;                /* lock for sync */
+daddr_t        rablock;                /* block to be read ahead */
+char   msgbuf[MSGBUFS];        /* saved "printf" characters */
+int    intstack[512];          /* stack for interrupts */
+dev_t  rootdev;                /* device of the root */
+dev_t  swapdev;                /* swapping device */
+dev_t  argdev;
+dev_t  pipedev;                /* pipe device */
+
+extern int icode[];            /* user init code */
+extern int szicode;            /* its size */
+
+extern int printsw;            /* debug print switch */
+extern int coresw;             /* switch to force action on core dumps */
+
+dev_t  getmdev();
+daddr_t        bmap();
+unsigned max();
+unsigned min();
+int    memall();
+int    uchar();
+int    vmemall();
+swblk_t        vtod();
+
+/*
+ * Structure of the system-entry table
+ */
+extern struct sysent
+{
+       char    sy_narg;                /* total number of arguments */
+       char    sy_nrarg;               /* number of args in registers */
+       int     (*sy_call)();           /* handler */
+} sysent[];
+
+char   vmmap[];                /* poor name! */
+int    mcr[3];                 /* memory controller registers */
+int    umbabeg,umbaend;        /* where sensitive vm begins/ends */
+int    noproc;                 /* no one is running just now */
diff --git a/usr/src/sys/h/text.h b/usr/src/sys/h/text.h
new file mode 100644 (file)
index 0000000..eec6504
--- /dev/null
@@ -0,0 +1,36 @@
+/*     text.h  4.1     11/9/80 */
+
+/*
+ * Text structure.
+ * One allocated per pure
+ * procedure on swap device.
+ * Manipulated by text.c
+ */
+#define        NXDAD   12              /* param.h:MAXTSIZ / dmap.h:DMTEXT */
+
+struct text
+{
+       swblk_t x_daddr[NXDAD]; /* disk addresses of DMTEXT-page segments */
+       swblk_t x_ptdaddr;      /* disk address of page table */
+       size_t  x_size;         /* size (clicks) */
+       struct proc *x_caddr;   /* ptr to linked proc, if loaded */
+       struct inode *x_iptr;   /* inode of prototype */
+       short   x_rssize;
+       short   x_swrss;
+       char    x_count;        /* reference count */
+       char    x_ccount;       /* number of loaded references */
+       char    x_flag;         /* traced, written flags */
+       char    x_slptime;
+       short   x_poip;         /* page out in progress count */
+};
+
+#ifdef KERNEL
+extern struct text text[];
+#endif
+
+#define        XTRC    01              /* Text may be written, exclusive use */
+#define        XWRIT   02              /* Text written into, must swap out */
+#define        XLOAD   04              /* Currently being read from file */
+#define        XLOCK   010             /* Being swapped in or out */
+#define        XWANT   020             /* Wanted for swapping */
+#define        XPAGI   040             /* Page in on demand from inode */
diff --git a/usr/src/sys/h/timeb.h b/usr/src/sys/h/timeb.h
new file mode 100644 (file)
index 0000000..f49977e
--- /dev/null
@@ -0,0 +1,12 @@
+/*     timeb.h 4.1     11/9/80 */
+
+/*
+ * Structure returned by ftime system call
+ */
+struct timeb
+{
+       time_t  time;
+       unsigned short millitm;
+       short   timezone;
+       short   dstflag;
+};
diff --git a/usr/src/sys/h/times.h b/usr/src/sys/h/times.h
new file mode 100644 (file)
index 0000000..534e8ce
--- /dev/null
@@ -0,0 +1,11 @@
+/*     times.h 4.1     11/9/80 */
+
+/*
+ * Structure returned by times()
+ */
+struct tms {
+       time_t  tms_utime;              /* user time */
+       time_t  tms_stime;              /* system time */
+       time_t  tms_cutime;             /* user time, children */
+       time_t  tms_cstime;             /* system time, children */
+};
diff --git a/usr/src/sys/h/trap.h b/usr/src/sys/h/trap.h
new file mode 100644 (file)
index 0000000..1f3c413
--- /dev/null
@@ -0,0 +1,23 @@
+/*     trap.h  4.1     11/9/80 */
+
+/*
+ * Trap type values
+ *
+ * NB: OFFSETS HERE ARE ALSO DEFINED IN trap.m
+ */
+
+#define        RESADFLT        0               /* reserved addressing fault */
+#define        PRIVINFLT       1               /* privileged instruction fault */
+#define        BPTFLT          2               /* bpt instruction fault */
+#define        XFCFLT          3               /* xfc instruction fault */
+#define        RESOPFLT        4               /* reserved operand fault */
+#define        SYSCALL         5               /* chmk instruction (syscall trap) */
+#define        ARITHTRAP       6               /* arithmetic trap */
+#define        RESCHED         7               /* software level 1 trap
+                                          (reschedule trap) */
+#define        SEGFLT          8               /* segmentation fault */
+#define        PROTFLT         9               /* protection fault */
+#define        TRCTRAP         10              /* trace trap */
+#define        COMPATFLT       11              /* compatibility mode fault */
+#define        PAGEFLT         12              /* page fault */
+#define        TABLEFLT        13              /* page table fault */
diff --git a/usr/src/sys/h/trap.m b/usr/src/sys/h/trap.m
new file mode 100644 (file)
index 0000000..f146da0
--- /dev/null
@@ -0,0 +1,22 @@
+#
+#      trap.m  4.1     11/9/80
+#
+#
+#      Trap,type values
+#
+
+       .set    RESADFLT,0              # reserved addressing fault
+       .set    PRIVINFLT,1             # privileged instruction fault
+       .set    BPTFLT,2                # bpt instruction fault
+       .set    XFCFLT,3                # xfc instruction fault
+       .set    RESOPFLT,4              # reserved operand fault
+       .set    SYSCALL,5               # chmk instruction (syscall trap)
+       .set    ARITHTRAP,6             # arithmetic trap
+       .set    RESCHED,7               # software level 1 trap (reschedule trap)
+       .set    SEGFLT,8                # segmentation fault
+       .set    PROTFLT,9               # protection fault
+
+       .set    TRCTRAP,10              # trace trap
+       .set    COMPATFLT,11            # compatibility mode fault
+       .set    PAGEFLT,12              # page fault
+       .set    TABLEFLT,13             # page table fault
diff --git a/usr/src/sys/h/tty.h b/usr/src/sys/h/tty.h
new file mode 100644 (file)
index 0000000..34db51a
--- /dev/null
@@ -0,0 +1,144 @@
+/*     tty.h   4.1     11/9/80 */
+
+#include <sgtty.h>
+#include <sys/ioctl.h>
+
+/*
+ * A clist structure is the head
+ * of a linked list queue of characters.
+ * The characters are stored in
+ * blocks containing a link and CBSIZE (param.h)
+ * characters.  The routines getc, putc, ... in prim.c
+ * manipulate these structures.
+ */
+struct clist
+{
+       int     c_cc;           /* character count */
+       char    *c_cf;          /* pointer to first char */
+       char    *c_cl;          /* pointer to last char */
+};
+
+/*
+ * A tty structure is needed for
+ * each UNIX character device that
+ * is used for normal terminal IO.
+ * The routines in tty.c handle the
+ * common code associated with
+ * these structures.  The definition
+ * and device dependent code is in
+ * each driver. (cons.c, dh.c, dz.c, kl.c)
+ */
+struct tty
+{
+       union {
+               struct {
+                       struct  clist T_rawq;
+                       struct  clist T_canq;
+               } t_t;
+#define        t_rawq  t_nu.t_t.T_rawq         /* raw characters or partial line */
+#define        t_canq  t_nu.t_t.T_canq         /* complete input lines */
+               struct {
+                       struct  buf *T_bufp;
+                       char    *T_cp;
+                       int     T_inbuf;
+                       int     T_rec;
+               } t_n;
+#define        t_bufp  t_nu.t_n.T_bufp         /* buffer allocated to protocol */
+#define        t_cp    t_nu.t_n.T_cp           /* pointer into the ripped off buffer */
+#define        t_inbuf t_nu.t_n.T_inbuf        /* number chars in the buffer */
+#define        t_rec   t_nu.t_n.T_rec          /* have a complete record */
+       } t_nu;
+       struct  clist t_outq;   /* output list to device */
+       int     (*t_oproc)();   /* routine to start output */
+       int     (*t_iproc)();   /* routine to start input */
+       struct chan *t_chan;    /* destination channel */
+       caddr_t t_linep;        /* aux line discipline pointer */
+       caddr_t t_addr;         /* device address */
+       dev_t   t_dev;          /* device number */
+       short   t_flags;        /* mode, settable by ioctl call */
+       short   t_state;        /* internal state, not visible externally */
+       short   t_pgrp;         /* process group name */
+       char    t_delct;        /* number of delimiters in raw q */
+       char    t_line;         /* line discipline */
+       char    t_col;          /* printing column of device */
+       char    t_erase;        /* erase character */
+       char    t_kill;         /* kill character */
+       char    t_char;         /* character temporary */
+       char    t_ispeed;       /* input speed */
+       char    t_ospeed;       /* output speed */
+/* begin local */
+       char    t_rocount;      /* chars input since a ttwrite() */
+       char    t_rocol;        /* t_col when first input this line */
+       struct  ltchars t_lchr; /* local special characters */
+       short   t_local;        /* local mode word */
+       short   t_lstate;       /* local state bits */
+/* end local */
+       union {
+               struct tchars t_chr;
+               struct clist t_ctlq;
+       } t_un;
+};
+
+#define        tun     tp->t_un.t_chr
+#define        tlun    tp->t_lchr
+
+#define        TTIPRI  28
+#define        TTOPRI  29
+
+#define        CTRL(c) ('c'&037)
+
+/* default special characters */
+#define        CERASE  '#'
+#define        CEOT    CTRL(d)
+#define        CKILL   '@'
+#define        CQUIT   034             /* FS, cntl shift L */
+#define        CINTR   0177            /* DEL */
+#define        CSTOP   CTRL(s)
+#define        CSTART  CTRL(q)
+#define        CBRK    0377
+
+/* limits */
+#define        NSPEEDS 16
+#define        TTMASK  15
+#ifdef KERNEL
+short  tthiwat[NSPEEDS], ttlowat[NSPEEDS];
+#define        TTHIWAT(tp)     tthiwat[(tp)->t_ospeed&TTMASK]
+#define        TTLOWAT(tp)     ttlowat[(tp)->t_ospeed&TTMASK]
+#endif
+#define        TTYHOG  256
+
+/* hardware bits */
+#define        DONE    0200
+#define        IENABLE 0100
+
+/* internal state bits */
+#define        TIMEOUT 01              /* delay timeout in progress */
+#define        WOPEN   02              /* waiting for open to complete */
+#define        ISOPEN  04              /* device is open */
+#define        FLUSH   010             /* outq has been flushed during DMA */
+#define        CARR_ON 020             /* software copy of carrier-present */
+#define        BUSY    040             /* output in progress */
+#define        ASLEEP  0100            /* wakeup when output done */
+#define        XCLUDE  0200            /* exclusive-use flag against open */
+#define        TTSTOP  0400            /* output stopped by ctl-s */
+#define        HUPCLS  01000           /* hang up upon last close */
+#define        TBLOCK  02000           /* tandem queue blocked */
+#define        SPEEDS  04000           /* t_ispeed and t_ospeed used by driver */
+#define        PROTO1  010000          /* reserved for line discipline */
+#define        EXTPROC 020000          /* external processor (kmc) */
+#define        FSLEEP  040000          /* Wakeup on input framing */
+#define        CNTLQ   0100000         /* interpret t_un as clist */
+
+/* define partab character types */
+#define        ORDINARY        0
+#define        CONTROL         1
+#define        BACKSPACE       2
+#define        NEWLINE         3
+#define        TAB             4
+#define        VTAB            5
+#define        RETURN          6
+
+/* define dmctl actions */
+#define        DMSET           0
+#define        DMBIS           1
+#define        DMBIC           2
diff --git a/usr/src/sys/h/uba.h b/usr/src/sys/h/uba.h
new file mode 100644 (file)
index 0000000..76d664d
--- /dev/null
@@ -0,0 +1,126 @@
+/*     uba.h   4.1     11/9/80 */
+
+/*
+ * Unibus adapter
+ */
+
+#define        UBA0            0x80060000      /* sys virt i/o for UBA 0 */
+#define        UBA0_DEV (UBA0+0x2000-0160000)  /* sys virt of device regs */
+
+#define        UNIBASE 0760000                 /* UNIBUS phys base of i/o reg's */
+
+/* UBA Configuration Register, CNFGR */
+#define        PARFLT          0x80000000      /* SBI Parity Fault */
+#define        WSQFLT          0x40000000      /* SBI Write Sequence Fault */
+#define        URDFLT          0x20000000      /* SBI Unexpected Read Fault */
+#define        ISQFLT          0x10000000      /* SBI Interlock Sequence Fault */
+#define        MXTFLT          0x8000000       /* SBI Multiple Transmitter Fault */
+#define        XMTFLT          0x4000000       /* UBA is transmit faulter */
+#define        ADPDN           0x800000        /* Adapter Power Down */
+#define        ADPUP           0x400000        /* Adapter Power Up */
+#define        UBINIT          0x40000         /* UNIBUS INIT is asserted */
+#define        UBPDN           0x20000         /* UNIBUS Power Down */
+#define        UBIC            0x10000         /* UNIBUS Initialization */
+                                       /* UNIBUS Ready */
+#define        UBACOD          0xff            /* UBA Code bits */
+/* UBA Control Register, UBACR */
+#define        MRD16           0x40000000      /* Map Reg Disable Bit 4 */
+#define        MRD8            0x20000000      /* Map Reg Disable Bit 3 */
+#define        MRD4            0x10000000      /* Map Reg Disable Bit 2 */
+#define        MRD2            0x8000000       /* Map Reg Disable Bit 1 */
+#define        MRD1            0x4000000       /* Map Reg Disable Bit 0 */
+#define        IFS             0x40            /* Interrupt Field Switch */
+#define        BRIE            0x20            /* BR Interrupt Enable */
+#define        USEFIE          0x10            /* UNIBUS to SBI Error Field IE */
+#define        SUEFIE          0x8             /* SBI to UNIBUS Error Field IE */
+#define        CNFIE           0x4             /* Configuration IE */
+#define        UPF             0x2             /* UNIBUS Power Fail */
+#define        ADINIT          0x1             /* Adapter Init */
+/* UBA Status Register, UASR */
+#define        BR7FULL         0x8000000       /* BR7 Receive Vector Rg Full */
+#define        BR6FULL         0x4000000       /* BR6 Receive Vector Reg Full */
+#define        BR5FULL         0x2000000       /* BR5 Receive Vector Reg Full */
+#define        BR4FULL         0x1000000       /* BR4 Receive Vector Reg Full */
+#define        RDTO            0x400           /* UNIBUS to SBI Read Data Timeout */
+#define        RDS             0x200           /* Read Data Substitute */
+#define        CRD             0x100           /* Corrected Read Data */
+#define        CXTER           0x80            /* Command Transmit Error */
+#define        CXTMO           0x40            /* Command Transmit Timeout */
+#define        DPPE            0x20            /* Data Path Parity Error */
+#define        IVMR            0x10            /* Invalid Map Register */
+#define        MRPF            0x8             /* Map Register Parity Failure */
+#define        LEB             0x4             /* Lost Error */
+#define        UBSTO           0x2             /* UNIBUS Select Timeout */
+#define        UBSSTO          0x1             /* UNIBUS Slave Sync Timeout */
+/* Failed Map Entry Register, FMER */
+#define        FMRN            0x1ff           /* Failed Map Reg. No. Field */
+/* Failed UNIBUS Address Register, FUBAR */
+#define        FUA             0xffff          /* Failed UNIBUS Address Field */
+/* BR Receive Vector register, BRRVR */
+#define        AIRI            0x80000000      /* Adapter Interrupt Request */
+#define        DIV             0xffff          /* Device Interrupt Vector Field */
+/* Data Path Register, DPR */
+#define        BNE             0x80000000      /* Buffer Not Empty - Purge */
+#define        BTE             0x40000000      /* Buffer Transfer Error */
+#define        DPF             0x20000000      /* DP Function (RO) */
+#define        BS              0x7f0000        /* Buffer State Field */
+#define        BUBA            0xffff          /* Buffered UNIBUS Address */
+/* Map Register, MR */
+#define        MRV             0x80000000      /* Map Register Valid */
+#define        BO              0x2000000       /* Byte Offset Bit */
+#define        DPDB            0x1e00000       /* Data Path Designator Field */
+#define        SBIPFN          0xfffff         /* SBI Page Address Field */
+
+/*
+ * Unibus maps
+ */
+#ifdef KERNEL
+#define        UAMSIZ 50
+
+struct map ubamap[UAMSIZ];
+char   bdpwant;                /* someone is waiting for buffered data path */ 
+struct map bdpmap[15];
+char   umrwant;                /* ... for unibus map registers */
+#endif
+
+/*
+ * UBA registers
+ */
+
+struct uba_regs
+{
+       int     uba_cnfgr;
+       int     uba_cr;
+       int     uba_sr;
+       int     uba_dcr;
+       int     uba_fmer;
+       int     uba_fubar;
+       int     pad1[2];
+       int     uba_brsvr[4];
+       int     uba_brrvr[4];
+       int     uba_dpr[16];
+       int     pad2[480];
+       struct  pte uba_map[496];
+};
+
+union  ub_info {
+       struct ub_Info {
+       unsigned int    Ub_off:18,
+                       Ub_npf:10,
+                       Ub_bdp:4;
+       } ub_I;
+       int     ub_word;
+};
+
+#define        ub_off  ub_I.Ub_off
+#define        ub_npf  ub_I.Ub_npf
+#define        ub_bdp  ub_I.Ub_bdp
diff --git a/usr/src/sys/h/uba.m b/usr/src/sys/h/uba.m
new file mode 100644 (file)
index 0000000..f9fd4e8
--- /dev/null
@@ -0,0 +1,19 @@
+#
+#      uba.m   4.1     11/9/80
+#
+#
+#      VAX unibus adapter registers
+#
+
+       .set    UBA,0x80060000          # virtual address of unibus registers
+       .set    UBA0,0x80060000
+       .set    UBR_OFF,0x30            # UBA offset to BRRVR regs
+       .set    CFGFLT,0xfc000000       # SBI fault bits in UBA config reg
+       .set    UCN_OFF,0               # UBA offset to config reg
+       .set    UST_OFF,8               # UBA offset to status reg
+       .set    UFMER_OFF,0x10          # UBA offset to failed map register
+       .set    UFUBAR_OFF,0x14         # UBA offset to failed UB addr reg
+
+       .set    UBA_SR,UBA + 0x8
+       .set    UBA_BR4,UBA + 0x30      # virtual address of intr vect registers
+
diff --git a/usr/src/sys/h/user.h b/usr/src/sys/h/user.h
new file mode 100644 (file)
index 0000000..8e34f95
--- /dev/null
@@ -0,0 +1,133 @@
+/*     user.h  4.1     11/9/80 */
+
+#ifdef KERNEL
+#include "../h/pcb.h"
+#include "../h/dmap.h"
+#include "../h/vtimes.h"
+#ifdef FASTVAX
+asm(".set U_ARG,120");
+asm(".set U_QSAV,140");
+#endif
+#else
+#include <sys/pcb.h>
+#include <sys/dmap.h>
+#include <sys/vtimes.h>
+#endif
+/*
+ * The user structure.
+ * One allocated per process.
+ * Contains all per process data
+ * that doesn't need to be referenced
+ * while the process is swapped.
+ * The user block is UPAGES*NBPG bytes
+ * long; resides at virtual user
+ * loc 0x80000000-UPAGES*NBPG; contains the system
+ * stack per user; is cross referenced
+ * with the proc structure for the
+ * same process.
+ */
+#define        EXCLOSE 01
+struct user
+{
+       struct  pcb u_pcb;
+       int     u_arg[5];               /* arguments to current system call */
+       label_t u_qsav;                 /* for non-local gotos on interrupts */
+       char    u_segflg;               /* 0:user D; 1:system; 2:user I */
+       char    u_error;                /* return error code */
+       short   u_uid;                  /* effective user id */
+       short   u_gid;                  /* effective group id */
+       short   u_ruid;                 /* real user id */
+       short   u_rgid;                 /* real group id */
+       struct  proc *u_procp;          /* pointer to proc structure */
+       int     *u_ap;                  /* pointer to arglist */
+       union {                         /* syscall return values */
+               struct  {
+                       int     R_val1;
+                       int     R_val2;
+               } u_rv;
+#define        r_val1  u_rv.R_val1
+#define        r_val2  u_rv.R_val2
+               off_t   r_off;
+               time_t  r_time;
+       } u_r;
+       caddr_t u_base;                 /* base address for IO */
+       unsigned int u_count;           /* bytes remaining for IO */
+       off_t   u_offset;               /* offset in file for IO */
+       struct  inode *u_cdir;          /* pointer to inode of current directory */
+       struct  inode *u_rdir;          /* root directory of current process */
+       char    u_dbuf[DIRSIZ];         /* current pathname component */
+       caddr_t u_dirp;                 /* pathname pointer */
+       struct  direct u_dent;          /* current directory entry */
+       struct  inode *u_pdir;          /* inode of parent directory of dirp */
+       struct  file *u_ofile[NOFILE];  /* pointers to file structures of open files */
+       char    u_pofile[NOFILE];       /* per-process flags of open files */
+       label_t u_ssav;                 /* label variable for swapping */
+       int     (*u_signal[NSIG])();    /* disposition of signals */
+       int     u_cfcode;               /* ``code'' to trap when CM faulted */
+       int     *u_ar0;                 /* address of users saved R0 */
+       struct uprof {                  /* profile arguments */
+               short   *pr_base;       /* buffer base */
+               unsigned pr_size;       /* buffer size */
+               unsigned pr_off;        /* pc offset */
+               unsigned pr_scale;      /* pc scaling */
+       } u_prof;
+       char    u_eosys;                /* special action on end of syscall */
+       char    u_sep;                  /* flag for I and D separation */
+       struct  tty *u_ttyp;            /* controlling tty pointer */
+       dev_t   u_ttyd;                 /* controlling tty dev */
+       struct {                        /* header of executable file */
+               int     ux_mag;         /* magic number */
+               unsigned ux_tsize;      /* text size */
+               unsigned ux_dsize;      /* data size */
+               unsigned ux_bsize;      /* bss size */
+               unsigned ux_ssize;      /* symbol table size */
+               unsigned ux_entloc;     /* entry location */
+               unsigned ux_unused;
+               unsigned ux_relflg;
+       } u_exdata;
+       char    u_comm[DIRSIZ];
+       time_t  u_start;
+       char    u_acflag;
+       short   u_fpflag;               /* unused now, will be later */
+       short   u_cmask;                /* mask for file creation */
+       size_t  u_tsize;                /* text size (clicks) */
+       size_t  u_dsize;                /* data size (clicks) */
+       size_t  u_ssize;                /* stack size (clicks) */
+       struct  vtimes u_vm;            /* stats for this proc */
+       struct  vtimes u_cvm;           /* sum of stats for reaped children */
+       struct  dmap u_dmap;            /* disk map for data segment */
+       struct  dmap u_smap;            /* disk map for stack segment */
+       struct  dmap u_cdmap, u_csmap;  /* shadows of u_dmap, u_smap, for
+                                          use of parent during fork */
+       time_t  u_outime;               /* user time at last sample */
+       size_t  u_odsize, u_ossize;     /* for (clumsy) expansion swaps */
+       size_t  u_vrpages[NOFILE];      /* number vread pages hanging on fd */
+       int     u_limit[8];             /* see <sys/limit.h> */
+       int     u_stack[1];
+
+                                       /*
+                                        * kernel stack per user
+                                        * extends from u + UPAGES*512
+                                        * backward not to reach here
+                                        */
+};
+
+/* u_eosys values */
+#define        JUSTRETURN      0
+#define        RESTARTSYS      1
+#define        SIMULATERTI     2
+
+/* u_error codes */
+#include <errno.h>
+
+#ifdef KERNEL
+extern struct user u;
+extern struct user swaputl;
+extern struct user forkutl;
+extern struct user xswaputl;
+extern struct user xswap2utl;
+extern struct user pushutl;
+extern struct user vfutl;
+#endif
diff --git a/usr/src/sys/h/vcmd.h b/usr/src/sys/h/vcmd.h
new file mode 100644 (file)
index 0000000..5de46fc
--- /dev/null
@@ -0,0 +1,8 @@
+/*     vcmd.h  4.1     11/9/80 */
+
+#define        VPRINT          0100
+#define        VPLOT           0200
+#define        VPRINTPLOT      0400
+
+#define        VGETSTATE       (('v'<<8)|0)
+#define        VSETSTATE       (('v'<<8)|1)
diff --git a/usr/src/sys/h/vlimit.h b/usr/src/sys/h/vlimit.h
new file mode 100644 (file)
index 0000000..906ad01
--- /dev/null
@@ -0,0 +1,15 @@
+/*     vlimit.h        4.1     11/9/80 */
+
+/*
+ * Limits for u.u_limit[i], per process, inherited.
+ */
+#define        LIM_NORAISE     0       /* if <> 0, can't raise limits */
+#define        LIM_CPU         1       /* max secs cpu time */
+#define        LIM_FSIZE       2       /* max size of file created */
+#define        LIM_DATA        3       /* max growth of data space */
+#define        LIM_STACK       4       /* max growth of stack */
+#define        LIM_CORE        5       /* max size of ``core'' file */
+
+#define        NLIMITS         5
+
+#define        INFINITY        0x7fffffff
diff --git a/usr/src/sys/h/vm.h b/usr/src/sys/h/vm.h
new file mode 100644 (file)
index 0000000..dfefc37
--- /dev/null
@@ -0,0 +1,26 @@
+/*     vm.h    4.1     11/9/80 */
+
+/*
+ *     #include "../h/vm.h"
+ * or  #include <vm.h>          in a user program
+ * is a quick way to include all the vm header files.
+ */
+#ifdef KERNEL
+#include "../h/vmparam.h"
+#include "../h/vmclust.h"
+#include "../h/vmtune.h"
+#include "../h/vmmac.h"
+#include "../h/vmmeter.h"
+#include "../h/vmtotal.h"
+#include "../h/vmsystm.h"
+#include "../h/vmklust.h"
+#else
+#include <sys/vmparam.h>
+#include <sys/vmclust.h>
+#include <sys/vmtune.h>
+#include <sys/vmmac.h>
+#include <sys/vmmeter.h>
+#include <sys/vmtotal.h>
+#include <sys/vmsystm.h>
+#include <sys/vmklust.h>
+#endif
diff --git a/usr/src/sys/h/vm.m b/usr/src/sys/h/vm.m
new file mode 100644 (file)
index 0000000..76e2f38
--- /dev/null
@@ -0,0 +1,8 @@
+#
+#      vm.m    4.1     11/9/80
+#
+       .set    V_SWTCH,0
+       .set    V_TRAP,4
+       .set    V_SYSCALL,8
+       .set    V_INTR,12
+       .set    V_PDMA,16
diff --git a/usr/src/sys/h/vmclust.h b/usr/src/sys/h/vmclust.h
new file mode 100644 (file)
index 0000000..7f37f25
--- /dev/null
@@ -0,0 +1,42 @@
+/*     vmclust.h       4.1     11/9/80 */
+
+/*
+ * Page clustering macros.
+ * 
+ * dirtycl(pte)                        is the page cluster dirty?
+ * anycl(pte,fld)              does any pte in the cluster has fld set?
+ * zapcl(pte,fld) = val                set all fields fld in the cluster to val
+ * distcl(pte)                 distribute high bits to cluster; note that
+ *                             distcl copies everything but pg_pfnum,
+ *                             INCLUDING pg_m!!!
+ *
+ * In all cases, pte must be the low pte in the cluster, even if
+ * the segment grows backwards (e.g. the stack).
+ */
+#define        H(pte)  ((struct hpte *)(pte))
+
+#if CLSIZE==1
+#define        dirtycl(pte)    dirty(pte)
+#define        anycl(pte,fld)  ((pte)->fld)
+#define        zapcl(pte,fld)  (pte)->fld
+#define        distcl(pte)
+#endif
+
+#if CLSIZE==2
+#define        dirtycl(pte)    (dirty(pte) || dirty((pte)+1))
+#define        anycl(pte,fld)  ((pte)->fld || (((pte)+1)->fld))
+#define        zapcl(pte,fld)  (pte)[1].fld = (pte)[0].fld
+#endif
+
+#if CLSIZE==4
+#define        dirtycl(pte) \
+    (dirty(pte) || dirty((pte)+1) || dirty((pte)+2) || dirty((pte)+3))
+#define        anycl(pte,fld) \
+    ((pte)->fld || (((pte)+1)->fld) || (((pte)+2)->fld) || (((pte)+3)->fld))
+#define        zapcl(pte,fld) \
+    (pte)[3].fld = (pte)[2].fld = (pte)[1].fld = (pte)[0].fld
+#endif
+
+#ifndef distcl
+#define        distcl(pte)     zapcl(H(pte),pg_high)
+#endif
diff --git a/usr/src/sys/h/vmklust.h b/usr/src/sys/h/vmklust.h
new file mode 100644 (file)
index 0000000..c0da909
--- /dev/null
@@ -0,0 +1,20 @@
+/*     vmklust.h       4.1     11/9/80 */
+
+/*
+ * Klustering constants.  Klustering is the gathering
+ * of pages together for pagein/pageout, while clustering
+ * is the treatment of hardware page size as though it were
+ * larger than it really is.
+ *
+ * KLMAX gives maximum cluster size in CLSIZE page (cluster-page)
+ * units.  Note that KLMAX*CLSIZE must be <= DMMIN in dmap.h.
+ */
+
+#define        KLMAX   (16/CLSIZE)
+#define        KLIN    (4/CLSIZE)              /* Read up to 4 pages */
+#define        KLOUT   (16/CLSIZE)             /* Write up to 16 pages */
+
+#ifdef KERNEL
+int    klin;
+int    klout;
+#endif
diff --git a/usr/src/sys/h/vmmac.h b/usr/src/sys/h/vmmac.h
new file mode 100644 (file)
index 0000000..66a6a42
--- /dev/null
@@ -0,0 +1,53 @@
+/*     vmmac.h 4.1     11/9/80 */
+
+/*
+ * Virtual memory related conversion macros
+ */
+
+/* Core clicks to number of pages of page tables needed to map that much */
+#define        ctopt(x)        (((x)+NPTEPG-1)/NPTEPG)
+
+/* Virtual page numbers to text|data|stack segment page numbers and back */
+#define        vtotp(p, v)     ((int)(v))
+#define        vtodp(p, v)     ((int)((v) - (p)->p_tsize))
+#define        vtosp(p, v)     ((int)(btop(USRSTACK) - 1 - (v)))
+#define        tptov(p, i)     ((unsigned)(i))
+#define        dptov(p, i)     ((unsigned)((p)->p_tsize + (i)))
+#define        sptov(p, i)     ((unsigned)(btop(USRSTACK) - 1 - (i)))
+
+/* Tell whether virtual page numbers are in text|data|stack segment */
+#define        isassv(p, v)    ((v) & P1TOP)
+#define        isatsv(p, v)    ((v) < (p)->p_tsize)
+#define        isadsv(p, v)    ((v) >= (p)->p_tsize && !isassv(p, v))
+
+/* Tell whether pte's are text|data|stack */
+#define        isaspte(p, pte)         ((pte) > sptopte(p, (p)->p_ssize))
+#define        isatpte(p, pte)         ((pte) < dptopte(p, 0))
+#define        isadpte(p, pte)         (!isaspte(p, pte) && !isatpte(p, pte))
+
+/* Text|data|stack pte's to segment page numbers and back */
+#define        ptetotp(p, pte)         ((pte) - (p)->p_p0br)
+#define        ptetodp(p, pte)         ((pte) - ((p)->p_p0br + (p)->p_tsize))
+#define        ptetosp(p, pte) \
+       (((p)->p_p0br + (p)->p_szpt*NPTEPG - UPAGES - 1) - (pte))
+
+#define        tptopte(p, i)           ((p)->p_p0br + (i))
+#define        dptopte(p, i)           ((p)->p_p0br + (p)->p_tsize + (i))
+#define        sptopte(p, i) \
+       (((p)->p_p0br + (p)->p_szpt*NPTEPG - UPAGES - 1) - (i))
+
+/* Bytes to pages without rounding, and back */
+#define        btop(x)         (((unsigned)(x)) >> PGSHIFT)
+#define        ptob(x)         ((caddr_t)((x) << PGSHIFT))
+
+/* Turn virtual addresses into kernel map indices */
+#define        kmxtob(a)       (usrpt + (a) * NPTEPG)
+#define        btokmx(b)       (((b) - usrpt) / NPTEPG)
+
+/* User area address and pcb bases */
+#define        uaddr(p)        (&((p)->p_p0br[(p)->p_szpt * NPTEPG - UPAGES]))
+#define        pcbb(p)         ((p)->p_addr[0].pg_pfnum)
+
+/* Average new into old with aging factor time */
+#define        ave(smooth, cnt, time) \
+       smooth = ((time - 1) * (smooth) + (cnt)) / (time)
diff --git a/usr/src/sys/h/vmmeter.h b/usr/src/sys/h/vmmeter.h
new file mode 100644 (file)
index 0000000..61bb399
--- /dev/null
@@ -0,0 +1,42 @@
+
+/*     vmmeter.h       4.1     11/9/80 */
+
+/*
+ * Virtual memory related instrumentation
+ *
+ * NB: THE OFFSETS IN THE vmmeter STRUCTURE ARE KNOWN IN vm.m.
+ */
+struct vmmeter
+{
+#define        v_first v_swtch
+       unsigned v_swtch;       /* context switches */
+       unsigned v_trap;        /* calls to trap */
+       unsigned v_syscall;     /* calls to syscall() */
+       unsigned v_intr;        /* device interrupts */
+       unsigned v_pdma;        /* pseudo-dma interrupts */
+       unsigned v_pswpin;      /* pages swapped in */
+       unsigned v_pswpout;     /* pages swapped out */
+       unsigned v_pgin;        /* pageins */
+       unsigned v_pgout;       /* pageouts */
+       unsigned v_intrans;     /* intransit blocking page faults */
+       unsigned v_pgrec;       /* total page reclaims */
+       unsigned v_xsfrec;      /* found in free list rather than on swapdev */
+       unsigned v_xifrec;      /* found in free list rather than in filsys */
+       unsigned v_exfod;       /* pages filled on demand from executables */
+       unsigned v_zfod;        /* pages zero filled on demand */
+       unsigned v_vrfod;       /* fills of pages mapped by vread() */
+       unsigned v_nexfod;      /* number of exfod's created */
+       unsigned v_nzfod;       /* number of zfod's created */
+       unsigned v_nvrfod;      /* number of vrfod's created */
+       unsigned v_pgfrec;      /* page reclaims from free list */
+       unsigned v_faults;      /* total faults taken */
+       unsigned v_scan;        /* scans in page out daemon */
+       unsigned v_rev;         /* revolutions of the hand */
+       unsigned v_dfree;       /* pages freed by daemon */
+#define        v_last v_dfree
+       unsigned v_swpin;       /* swapins */
+       unsigned v_swpout;      /* swapouts */
+};
+#ifdef KERNEL
+struct vmmeter cnt, rate, sum;
+#endif
diff --git a/usr/src/sys/h/vmmon.h b/usr/src/sys/h/vmmon.h
new file mode 100644 (file)
index 0000000..0c9660f
--- /dev/null
@@ -0,0 +1,36 @@
+/*     vmmon.h 4.1     11/9/80 */
+
+#ifdef PGINPROF
+
+#define        NDMON   128
+#define        NSMON   128
+
+#define        DRES    20
+#define        SRES    5
+
+#define        PMONMIN 20
+#define        PRES    50
+#define        NPMON   64
+
+#define        RMONMIN 130
+#define        RRES    5
+#define        NRMON   64
+
+/* data and stack size distribution counters */
+unsigned int   dmon[NDMON+1];
+unsigned int   smon[NSMON+1];
+
+/* page in time distribution counters */
+unsigned int   pmon[NPMON+2];
+
+/* reclaim time distribution counters */
+unsigned int   rmon[NRMON+2];
+
+int    pmonmin;
+int    pres;
+int    rmonmin;
+int    rres;
+
+unsigned rectime;              /* accumulator for reclaim times */
+unsigned pgintime;             /* accumulator for page in times */
+#endif
diff --git a/usr/src/sys/h/vmparam.h b/usr/src/sys/h/vmparam.h
new file mode 100644 (file)
index 0000000..ffa84c5
--- /dev/null
@@ -0,0 +1,29 @@
+/*     vmparam.h       4.1     11/9/80 */
+
+/*
+ * Machine dependent constants
+ */
+#define        NBBY            8               /* number of bits in a byte */
+#define        NBPG            512             /* number of bytes per page */
+#define        PGSHIFT         9               /* LOG2(NBPG) */
+#define        NPTEPG          (NBPG/(sizeof (struct pte)))
+                                       /* number of ptes per page */
+#define        PGOFSET         (NBPG-1)        /* byte offset into page */
+#define        CLOFSET         (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */
+#define        USRSTACK        (0x80000000-UPAGES*NBPG)
+                                       /* Start of user stack */
+#define        P1TOP           0x200000        /* boundary between P0 and P1 regions */
+#define        AST             0x04000000      /* ast level */
+
+/*
+ * Virtual memory related constants
+ *
+ * note: USRPTSIZE is well known in locore.s
+ */
+#define        SLOP    16
+#define        MAXTSIZ         (6*2048-SLOP)           /* max text size (clicks) */
+#define        MAXDSIZ         (11*1024-16-SLOP)       /* max data size (clicks) */
+#define        MAXSSIZ         (11*1024-16-SLOP)       /* max stack size (clicks) */
+#define        USRPTSIZE       (8*NPTEPG)      /* max number of pages of page tables
+                                          for resident processes, this is
+                                          known in locore.s */
diff --git a/usr/src/sys/h/vmsysent.h b/usr/src/sys/h/vmsysent.h
new file mode 100644 (file)
index 0000000..cefa06b
--- /dev/null
@@ -0,0 +1,22 @@
+/*     vmsysent.h      4.1     11/9/80 */
+
+/*
+ * Externals for functions defined in vmsys.c.
+ */
+
+int    nosys();
+int    nullsys();
+
+int    vfork();                /* later, just fork? */
+int    vread();                /* deprecated */
+int    vwrite();               /* deprecated */
+int    vadvise();              /* later, segadvise */
+
+int    vhangup();              /* should just do in exit() */
+int    vlimit();
+int    vswapon();
+int    vtimes();
+
+int    segalloc();             /* not in yet */
+int    segfree();              /* not in yet */
+int    segsync();              /* not in yet */
diff --git a/usr/src/sys/h/vmsystm.h b/usr/src/sys/h/vmsystm.h
new file mode 100644 (file)
index 0000000..a8a6125
--- /dev/null
@@ -0,0 +1,51 @@
+/*     vmsystm.h       4.1     11/9/80 */
+
+/*
+ * Miscellaneous virtual memory subsystem variables and structures.
+ */
+
+
+#ifdef KERNEL
+int    freemem;                /* remaining blocks of free memory */
+int    avefree;                /* moving average of remaining free blocks */
+int    deficit;                /* estimate of needs of new swapped in procs */
+int    nscan;                  /* number of scans in last second */
+int    multprog;               /* current multiprogramming degree */
+int    desscan;                /* desired pages scanned per second */
+
+/* writable copies of tunables */
+int    maxpgio;                /* max paging i/o per sec before start swaps */
+int    maxslp;                 /* max sleep time before very swappable */
+int    lotsfree;               /* max free before clock freezes */
+int    minfree;                /* minimum free pages before swapping begins */
+int    desfree;                /* no of pages to try to keep free via daemon */
+int    saferss;                /* no pages not to steal; decays with slptime */
+#endif
+
+/*
+ * Fork/vfork accounting.
+ */
+struct forkstat
+{
+       int     cntfork;
+       int     cntvfork;
+       int     sizfork;
+       int     sizvfork;
+};
+#ifdef KERNEL
+struct forkstat forkstat;
+#endif
+
+/*
+ * Swap kind accounting.
+ */
+struct swptstat
+{
+       int     pteasy;         /* easy pt swaps */
+       int     ptexpand;       /* pt expansion swaps */
+       int     ptshrink;       /* pt shrinking swaps */
+       int     ptpack;         /* pt swaps involving spte copying */
+};
+#ifdef KERNEL
+struct swptstat swptstat;
+#endif
diff --git a/usr/src/sys/h/vmtotal.h b/usr/src/sys/h/vmtotal.h
new file mode 100644 (file)
index 0000000..ae59d99
--- /dev/null
@@ -0,0 +1,23 @@
+/*     vmtotal.h       4.1     11/9/80 */
+
+/* systemwide totals computed every five seconds */
+struct vmtotal
+{
+       short   t_rq;           /* length of the run queue */
+       short   t_dw;           /* jobs in ``disk wait'' (neg priority) */
+       short   t_pw;           /* jobs in page wait */
+       short   t_sl;           /* jobs sleeping in core */
+       short   t_sw;           /* swapped out runnable/short block jobs */
+       int     t_vm;           /* total virtual memory */
+       int     t_avm;          /* active virtual memory */
+       short   t_rm;           /* total real memory in use */
+       short   t_arm;          /* active real memory */
+       int     t_vmtxt;        /* virtual memory used by text */
+       int     t_avmtxt;       /* active virtual memory used by text */
+       short   t_rmtxt;        /* real memory used by text */
+       short   t_armtxt;       /* active real memory used by text */
+       short   t_free;         /* free memory pages */
+};
+#ifdef KERNEL
+struct vmtotal total;
+#endif
diff --git a/usr/src/sys/h/vmtune.h b/usr/src/sys/h/vmtune.h
new file mode 100644 (file)
index 0000000..bcbea43
--- /dev/null
@@ -0,0 +1,25 @@
+/*     vmtune.h        4.1     11/9/80 */
+
+/*
+ * Tunable performance parameters
+ *
+ * These may vary per-cpu due to configuration as well as the flavor of
+ * the local job mix.  MAXPGIO in multiplied by the number of swap devices
+ * available (nswdev) at boot time.
+ */
+#define        LOOPSIZ         ((maxfree - firstfree) / CLSIZE)
+                                       /* loop circumference */
+#define        LOTSFREE        ((maxfree - firstfree) / 4)
+                                       /* very high mark to freeze scans */
+#define        DESFREE         200             /* minimum desirable free memory */
+#define        MINFREE         64              /* water mark to run swap daemon */
+#define        MAXSLP          20              /* max blocked time (in seconds) allowed
+                                          before being very swappable */
+#define        SLOWSCAN        25              /* seconds per loop when memory easy */
+#define        FASTSCAN        15              /* seconds per loop when memory tight */
+#define        SAFERSS         32              /* nominal ``small'' resident set size
+                                          protected against replacement */
+#define        MAXPGIO         50              /* max desired paging i/o per second
+                                          per paging device, controls max
+                                          paging ops per second */
+/* WITH MAXPGIO SET TO 50, IT RARELY TAKES OVER */
diff --git a/usr/src/sys/h/vtimes.h b/usr/src/sys/h/vtimes.h
new file mode 100644 (file)
index 0000000..e5b77c5
--- /dev/null
@@ -0,0 +1,24 @@
+/*     vtimes.h        4.1     11/9/80 */
+/*
+ * Structure returned by vtimes() and in vwait().
+ * In vtimes() two of these are returned, one for the process itself
+ * and one for all its children.  In vwait() these are combined
+ * by adding componentwise (except for maxrss, which is max'ed).
+ */
+struct vtimes {
+       int     vm_utime;               /* user time (60'ths) */
+       int     vm_stime;               /* system time (60'ths) */
+       /* divide next two by utime+stime to get averages */
+       unsigned vm_idsrss;             /* integral of d+s rss */
+       unsigned vm_ixrss;              /* integral of text rss */
+       int     vm_maxrss;              /* maximum rss */
+       int     vm_majflt;              /* major page faults */
+       int     vm_minflt;              /* minor page faults */
+       int     vm_nswap;               /* number of swaps */
+       int     vm_inblk;               /* block reads */
+       int     vm_oublk;               /* block writes */
+};
+
+#ifdef KERNEL
+struct vtimes zvms;            /* an empty (componentwise 0) structure */
+#endif