From 6bafdb92368bd22292888729e62109ebdf6dc2c9 Mon Sep 17 00:00:00 2001 From: CSRG Date: Fri, 20 Mar 1981 17:03:45 -0800 Subject: [PATCH] BSD 4_1_snap development Work on file sys/h/cons.h Work on file sys/h/pcb.m Work on file sys/h/clock.h Work on file sys/h/bk.h Work on file sys/h/acct.h Work on file sys/h/cmap.h Work on file sys/h/dir.h Work on file sys/h/fblk.h Work on file sys/h/flp.h Work on file sys/h/inline.h Work on file sys/h/filsys.h Work on file sys/h/ino.h Work on file sys/h/inode.h Work on file sys/h/map.h Work on file sys/h/mount.h Work on file sys/h/mtpr.h Work on file sys/h/vcmd.h Work on file sys/h/mx.h Work on file sys/h/pdma.h Work on file sys/h/reg.h Work on file sys/h/stat.h Work on file sys/h/seg.h Work on file sys/h/text.h Work on file sys/h/timeb.h Work on file sys/h/times.h Work on file sys/h/trap.h Work on file sys/h/clist.h Work on file sys/h/dk.h Work on file sys/h/vtimes.h Work on file sys/h/reboot.h Work on file sys/h/scb.h Synthesized-from: CSRG/cd1/4.1.snap --- sys/h/acct.h | 26 +++++++++ sys/h/bk.h | 22 ++++++++ sys/h/clist.h | 15 ++++++ sys/h/clock.h | 39 ++++++++++++++ sys/h/cmap.h | 52 ++++++++++++++++++ sys/h/cons.h | 22 ++++++++ sys/h/dir.h | 10 ++++ sys/h/dk.h | 26 +++++++++ sys/h/fblk.h | 7 +++ sys/h/filsys.h | 32 +++++++++++ sys/h/flp.h | 45 ++++++++++++++++ sys/h/inline.h | 51 ++++++++++++++++++ sys/h/ino.h | 23 ++++++++ sys/h/inode.h | 96 +++++++++++++++++++++++++++++++++ sys/h/map.h | 43 +++++++++++++++ sys/h/mount.h | 16 ++++++ sys/h/mtpr.h | 65 ++++++++++++++++++++++ sys/h/mx.h | 142 +++++++++++++++++++++++++++++++++++++++++++++++++ sys/h/pcb.m | 36 +++++++++++++ sys/h/pdma.h | 10 ++++ sys/h/reboot.h | 16 ++++++ sys/h/reg.h | 26 +++++++++ sys/h/scb.h | 59 ++++++++++++++++++++ sys/h/seg.h | 8 +++ sys/h/stat.h | 30 +++++++++++ sys/h/text.h | 37 +++++++++++++ sys/h/timeb.h | 12 +++++ sys/h/times.h | 11 ++++ sys/h/trap.h | 22 ++++++++ sys/h/vcmd.h | 8 +++ sys/h/vtimes.h | 24 +++++++++ 31 files changed, 1031 insertions(+) create mode 100644 sys/h/acct.h create mode 100644 sys/h/bk.h create mode 100644 sys/h/clist.h create mode 100644 sys/h/clock.h create mode 100644 sys/h/cmap.h create mode 100644 sys/h/cons.h create mode 100644 sys/h/dir.h create mode 100644 sys/h/dk.h create mode 100644 sys/h/fblk.h create mode 100644 sys/h/filsys.h create mode 100644 sys/h/flp.h create mode 100644 sys/h/inline.h create mode 100644 sys/h/ino.h create mode 100644 sys/h/inode.h create mode 100644 sys/h/map.h create mode 100644 sys/h/mount.h create mode 100644 sys/h/mtpr.h create mode 100644 sys/h/mx.h create mode 100644 sys/h/pcb.m create mode 100644 sys/h/pdma.h create mode 100644 sys/h/reboot.h create mode 100644 sys/h/reg.h create mode 100644 sys/h/scb.h create mode 100644 sys/h/seg.h create mode 100644 sys/h/stat.h create mode 100644 sys/h/text.h create mode 100644 sys/h/timeb.h create mode 100644 sys/h/times.h create mode 100644 sys/h/trap.h create mode 100644 sys/h/vcmd.h create mode 100644 sys/h/vtimes.h diff --git a/sys/h/acct.h b/sys/h/acct.h new file mode 100644 index 0000000000..694906db8c --- /dev/null +++ b/sys/h/acct.h @@ -0,0 +1,26 @@ +/* acct.h 4.3 81/03/09 */ + +/* + * Accounting structures; + * these use a comp_t type which is a 3 bits base 8 + * exponent, 13 bit fraction ``floating point'' number. + */ +typedef u_short comp_t; + +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 */ +}; + +#define AFORK 01 /* has executed fork, but no exec */ +#define ASU 02 /* used super-user privileges */ diff --git a/sys/h/bk.h b/sys/h/bk.h new file mode 100644 index 0000000000..c2e281e58c --- /dev/null +++ b/sys/h/bk.h @@ -0,0 +1,22 @@ +/* bk.h 4.2 81/02/19 */ + +/* + * 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/sys/h/clist.h b/sys/h/clist.h new file mode 100644 index 0000000000..21d98bdde4 --- /dev/null +++ b/sys/h/clist.h @@ -0,0 +1,15 @@ +/* clist.h 4.4 81/03/09 */ + +/* + * Raw structures for the character list routines. + */ +struct cblock { + struct cblock *c_next; + char c_info[CBSIZE]; +}; +#ifdef KERNEL +struct cblock *cfree; +int nclist; +struct cblock *cfreelist; +int cfreecount; +#endif diff --git a/sys/h/clock.h b/sys/h/clock.h new file mode 100644 index 0000000000..f734d0c6b6 --- /dev/null +++ b/sys/h/clock.h @@ -0,0 +1,39 @@ +/* clock.h 4.5 81/02/23 */ + +/* + * VAX clock registers + */ + +#define ICCS_RUN 0x00000001 +#define ICCS_TRANS 0x00000010 +#define ICCS_SS 0x00000020 +#define ICCS_IE 0x00000040 +#define ICCS_INT 0x00000080 +#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) /* good till time becomes negative */ + +/* + * 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) + +/* + * Software clock is software interrupt level 8 + */ +#define setsoftclock() mtpr(SIRR, 0x8) diff --git a/sys/h/cmap.h b/sys/h/cmap.h new file mode 100644 index 0000000000..ae2b305655 --- /dev/null +++ b/sys/h/cmap.h @@ -0,0 +1,52 @@ +/* cmap.h 4.5 81/03/09 */ + +/* + * core map entry + */ +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 */ + 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 + * 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 +struct cmap *cmap; +struct cmap *ecmap; +int ncmap; +struct cmap *mfind(); +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/sys/h/cons.h b/sys/h/cons.h new file mode 100644 index 0000000000..169469eb13 --- /dev/null +++ b/sys/h/cons.h @@ -0,0 +1,22 @@ +/* cons.h 4.6 81/02/23 */ + +/* + * VAX console interface registers + */ + +#define RXCS_IE 0x00000040 /* receiver interrupt enable */ +#define RXCS_DONE 0x00000080 /* receiver done */ + +#define RXDB_DATA 0x000000ff /* received character */ +#define RXDB_ID 0x00000f00 /* channel id */ +#define RXDB_ERR 0x80000000 /* receiver error */ + +#define TXCS_IE 0x00000040 /* transmitter interrupt enable */ +#define TXCS_RDY 0x00000080 /* transmitter ready for next char */ +#define TXDB_DATA 0x000000ff /* transmitter byte */ +#define TXDB_ID 0x00000f00 /* channel id */ + +#define TXDB_DONE 0xf01 /* software done */ +#define TXDB_BOOT 0xf02 /* reboot */ +#define TXDB_CWSI 0xf03 /* clear warm start inhibit */ +#define TXDB_CCSI 0xf04 /* clear cold-start inhibit */ diff --git a/sys/h/dir.h b/sys/h/dir.h new file mode 100644 index 0000000000..c978a72252 --- /dev/null +++ b/sys/h/dir.h @@ -0,0 +1,10 @@ +/* dir.h 4.2 81/02/19 */ + +#ifndef DIRSIZ +#define DIRSIZ 14 +#endif +struct direct +{ + ino_t d_ino; + char d_name[DIRSIZ]; +}; diff --git a/sys/h/dk.h b/sys/h/dk.h new file mode 100644 index 0000000000..9c45f68850 --- /dev/null +++ b/sys/h/dk.h @@ -0,0 +1,26 @@ +/* dk.h 4.2 81/02/19 */ + +/* + * 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/sys/h/fblk.h b/sys/h/fblk.h new file mode 100644 index 0000000000..64aadbe3b8 --- /dev/null +++ b/sys/h/fblk.h @@ -0,0 +1,7 @@ +/* fblk.h 4.2 81/02/19 */ + +struct fblk +{ + int df_nfree; + daddr_t df_free[NICFREE]; +}; diff --git a/sys/h/filsys.h b/sys/h/filsys.h new file mode 100644 index 0000000000..93632d1688 --- /dev/null +++ b/sys/h/filsys.h @@ -0,0 +1,32 @@ +/* filsys.h 4.3 81/03/03 */ + +/* + * 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 */ + short s_dinfo[2]; /* interleave stuff */ +#define s_m s_dinfo[0] +#define s_n s_dinfo[1] + char s_fsmnt[12]; /* ordinary file mounted on */ + /* 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/sys/h/flp.h b/sys/h/flp.h new file mode 100644 index 0000000000..ce811a9b17 --- /dev/null +++ b/sys/h/flp.h @@ -0,0 +1,45 @@ +/* flp.h 4.4 81/02/25 */ + +#if VAX780 +/* + * 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 +#endif diff --git a/sys/h/inline.h b/sys/h/inline.h new file mode 100644 index 0000000000..174d692f02 --- /dev/null +++ b/sys/h/inline.h @@ -0,0 +1,51 @@ +/* inline.h 4.3 81/02/26 */ +/* + * Definitions of inlines, and macro replacements + * for them if UNFAST (latter only scantily tested). + */ + +#ifndef UNFAST + +#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/sys/h/ino.h b/sys/h/ino.h new file mode 100644 index 0000000000..408c79f515 --- /dev/null +++ b/sys/h/ino.h @@ -0,0 +1,23 @@ +/* ino.h 4.2 81/02/19 */ + +/* + * 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/sys/h/inode.h b/sys/h/inode.h new file mode 100644 index 0000000000..fd2163fe73 --- /dev/null +++ b/sys/h/inode.h @@ -0,0 +1,96 @@ +/* inode.h 4.5 81/03/09 */ + +/* + * 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 6 +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 +struct inode *inode, *inodeNINODE; +int ninode; + +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/sys/h/map.h b/sys/h/map.h new file mode 100644 index 0000000000..dffed9feff --- /dev/null +++ b/sys/h/map.h @@ -0,0 +1,43 @@ +/* map.h 4.5 81/02/28 */ + +/* + * Resource Allocation Maps. + * + * Associated routines manage sub-allocation of an address space using + * an array of segment descriptors. The first element of this array + * is a map structure, describing the arrays extent and the name + * of the controlled object. Each additional structure represents + * a free segment of the address space. + * + * A call to rminit initializes a resource map and may also be used + * to free some address space for the map. Subsequent calls to rmalloc + * and rmfree allocate and free space in the resource map. If the resource + * map becomes too fragmented to be described in the available space, + * then some of the resource is discarded. This may lead to critical + * shortages, but is better than not checking (as the previous versions + * of these routines did) or giving up and calling panic(). The routines + * could use linked lists and call a memory allocator when they run + * out of space, but that would not solve the out of space problem when + * called at interrupt time. + * + * N.B.: The address 0 in the resource address space is not available + * as it is used internally by the resource map routines. + */ +struct map { + struct mapent *m_limit; /* address of last slot in map */ + char *m_name; /* name of resource */ +/* we use m_name when the map overflows, in warning messages */ +}; +struct mapent +{ + int m_size; /* size of this segment of the map */ + int m_addr; /* resource-space addr of start of segment */ +}; + +#ifdef KERNEL +struct map *swapmap; +int nswapmap; +struct map *argmap; +#define ARGMAPSIZE 16 +struct map *kernelmap; +#endif diff --git a/sys/h/mount.h b/sys/h/mount.h new file mode 100644 index 0000000000..864a581923 --- /dev/null +++ b/sys/h/mount.h @@ -0,0 +1,16 @@ +/* mount.h 4.3 81/02/26 */ + +/* + * 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 */ +}; +#ifdef KERNEL +struct mount mount[NMOUNT]; +#endif diff --git a/sys/h/mtpr.h b/sys/h/mtpr.h new file mode 100644 index 0000000000..2497200f10 --- /dev/null +++ b/sys/h/mtpr.h @@ -0,0 +1,65 @@ +/* mtpr.h 4.5 81/02/25 */ + +/* + * VAX processor register numbers + */ + +#define KSP 0x0 /* kernel stack pointer */ +#define ESP 0x1 /* exec stack pointer */ +#define SSP 0x2 /* supervisor stack pointer */ +#define USP 0x3 /* user stack pointer */ +#define ISP 0x4 /* interrupt stack pointer */ +#define P0BR 0x8 /* p0 base register */ +#define P0LR 0x9 /* p0 length register */ +#define P1BR 0xa /* p1 base register */ +#define P1LR 0xb /* p1 length register */ +#define SBR 0xc /* system segment base register */ +#define SLR 0xd /* system segment length register */ +#define PCBB 0x10 /* process control block base */ +#define SCBB 0x11 /* system control block base */ +#define IPL 0x12 /* interrupt priority level */ +#define ASTLVL 0x13 /* async. system trap level */ +#define SIRR 0x14 /* software interrupt request */ +#define SISR 0x15 /* software interrupt summary */ +#define ICCS 0x18 /* interval clock control */ +#define NICR 0x19 /* next interval count */ +#define ICR 0x1a /* interval count */ +#define TODR 0x1b /* time of year (day) */ +#define RXCS 0x20 /* console receiver control and status */ +#define RXDB 0x21 /* console receiver data buffer */ +#define TXCS 0x22 /* console transmitter control and status */ +#define TXDB 0x23 /* console transmitter data buffer */ +#define MAPEN 0x38 /* memory management enable */ +#define TBIA 0x39 /* translation buffer invalidate all */ +#define TBIS 0x3a /* translation buffer invalidate single */ +#define PMR 0x3d /* performance monitor enable */ +#define SID 0x3e /* system identification */ + +#if VAX780 +#define ACCS 0x28 /* accelerator control and status */ +#define ACCR 0x29 /* accelerator maintenance */ +#define WCSA 0x2c /* WCS address */ +#define WCSD 0x2d /* WCS data */ +#define SBIFS 0x30 /* SBI fault and status */ +#define SBIS 0x31 /* SBI silo */ +#define SBISC 0x32 /* SBI silo comparator */ +#define SBIMT 0x33 /* SBI maintenance */ +#define SBIER 0x34 /* SBI error register */ +#define SBITA 0x35 /* SBI timeout address */ +#define SBIQC 0x36 /* SBI quadword clear */ +#define MBRK 0x3c /* micro-program breakpoint */ +#endif + +#if VAX750 +#define MCSR 0x17 /* machine check status register */ +#define CSRS 0x1c /* console storage receive status register */ +#define CSRD 0x1d /* console storage receive data register */ +#define CSTS 0x1e /* console storage transmit status register */ +#define CSTD 0x1f /* console storage transmit data register */ +#define TBDR 0x24 /* translation buffer disable register */ +#define CADR 0x25 /* cache disable register */ +#define MCESR 0x26 /* machine check error summary register */ +#define CAER 0x27 /* cache error */ +#define IUR 0x37 /* init unibus register */ +#define TB 0x3b /* translation buffer */ +#endif diff --git a/sys/h/mx.h b/sys/h/mx.h new file mode 100644 index 0000000000..784b162700 --- /dev/null +++ b/sys/h/mx.h @@ -0,0 +1,142 @@ +/* mx.h 4.3 81/02/25 */ + +#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 +/* mux io controls */ +#define MXLSTN (('x'<<8)|1) +#define MXNBLK (('x'<<8)|2) diff --git a/sys/h/pcb.m b/sys/h/pcb.m new file mode 100644 index 0000000000..cb17ce26c9 --- /dev/null +++ b/sys/h/pcb.m @@ -0,0 +1,36 @@ +/* pcb.m 4.3 81/02/23 */ + +/* + * VAX process control block + */ + .set PCB_KSP, 0 + .set PCB_ESP, 4 + .set PCB_SSP, 8 + .set PCB_USP, 12 + .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 + .set PCB_PSL, 76 + .set PCB_P0BR, 80 + .set PCB_P0LR, 84 + .set PCB_P1BR, 88 + .set PCB_P1LR, 92 +/* + * Software pcb extension + */ + .set PCB_SZPT, 96 /* number of user page table pages */ + .set PCB_CMAP2, 100 /* saved cmap2 across cswitch (ick) */ + .set PCB_SSWAP, 104 /* flag for non-local goto */ + .set PCB_SIGC, 108 /* signal trampoline code */ diff --git a/sys/h/pdma.h b/sys/h/pdma.h new file mode 100644 index 0000000000..7a3ce367c9 --- /dev/null +++ b/sys/h/pdma.h @@ -0,0 +1,10 @@ +/* pdma.h 4.2 81/02/19 */ + +struct pdma +{ + struct device *p_addr; + char *p_mem; + char *p_end; + int p_arg; + int (*p_fcn)(); +}; diff --git a/sys/h/reboot.h b/sys/h/reboot.h new file mode 100644 index 0000000000..7cd7059b1c --- /dev/null +++ b/sys/h/reboot.h @@ -0,0 +1,16 @@ +/* reboot.h 4.2 81/02/19 */ + +/* + * 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/sys/h/reg.h b/sys/h/reg.h new file mode 100644 index 0000000000..2648bca6ad --- /dev/null +++ b/sys/h/reg.h @@ -0,0 +1,26 @@ +/* reg.h 4.2 81/02/19 */ +/* + * 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/sys/h/scb.h b/sys/h/scb.h new file mode 100644 index 0000000000..27e2cf26bc --- /dev/null +++ b/sys/h/scb.h @@ -0,0 +1,59 @@ +/* scb.h 4.3 81/02/21 */ + +/* + * VAX System control block layout + */ + +struct scb { + int (*scb_stray)(); /* reserved */ + int (*scb_machchk)(); /* machine chack */ + int (*scb_kspinval)(); /* KSP invalid */ + int (*scb_powfail)(); /* power fail */ + int (*scb_resinstr)(); /* reserved instruction */ + int (*scb_custinst)(); /* XFC instr */ + int (*scb_resopnd)(); /* reserved operand */ + int (*scb_resaddr)(); /* reserved addr mode */ + int (*scb_acv)(); /* access control violation */ + int (*scb_tnv)(); /* translation not valid */ + int (*scb_tracep)(); /* trace pending */ + int (*scb_bpt)(); /* breakpoint instr */ + int (*scb_compat)(); /* compatibility mode fault */ + int (*scb_arith)(); /* arithmetic fault */ + int (*scb_stray2)(); + int (*scb_stray3)(); + int (*scb_chmk)(); /* CHMK instr */ + int (*scb_chme)(); /* CHME instr */ + int (*scb_chms)(); /* CHMS instr */ + int (*scb_chmu)(); /* CHMU instr */ + int (*scb_sbisilo)(); /* SBI silo compare */ + int (*scb_cmrd)(); /* corrected mem read data */ + int (*scb_sbialert)(); /* SBI alert */ + int (*scb_sbiflt)(); /* SBI fault */ + int (*scb_wtime)(); /* memory write timeout */ + int (*scb_stray4[8])(); + int (*scb_soft[15])(); /* software interrupt */ + int (*scb_timer)(); /* interval timer interrupt */ + int (*scb_stray5[7])(); + int (*scb_stray6[4])(); + int (*scb_csdr)(); /* console storage receive */ + int (*scb_csdx)(); /* console storage transmit */ + int (*scb_ctr)(); /* console terminal receive */ + int (*scb_ctx)(); /* console terminal transmit */ + int (*scb_ipl14[16])(); /* device interrupts IPL 14 */ + int (*scb_ipl15[16])(); /* " " IPL 15 */ + int (*scb_ipl16[16])(); /* " " IPL 16 */ + int (*scb_ipl17[16])(); /* " " IPL 17 */ + int (*scb_ubaint[128])(); /* Unibus device intr */ +}; + +#ifdef KERNEL +extern struct scb scb; +/* scb.scb_ubaint is the same as UNIvec */ +#endif + +#define scbentry(f, how) ((int (*)())(((int)f)+how)) + +#define SCB_KSTACK 0 +#define SCB_ISTACK 1 +#define SCB_WCS 2 +#define SCB_HALT 3 diff --git a/sys/h/seg.h b/sys/h/seg.h new file mode 100644 index 0000000000..aaaddaa57d --- /dev/null +++ b/sys/h/seg.h @@ -0,0 +1,8 @@ +/* seg.h 4.2 81/02/19 */ + +/* + * Mapper addresses and bits + */ + +#define RO PG_URKR /* access abilities */ +#define RW PG_UW diff --git a/sys/h/stat.h b/sys/h/stat.h new file mode 100644 index 0000000000..46f388ec4f --- /dev/null +++ b/sys/h/stat.h @@ -0,0 +1,30 @@ +/* stat.h 4.2 81/02/19 */ + +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/sys/h/text.h b/sys/h/text.h new file mode 100644 index 0000000000..7501d0c0b7 --- /dev/null +++ b/sys/h/text.h @@ -0,0 +1,37 @@ +/* text.h 4.4 81/03/09 */ + +/* + * 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 +struct text *text, *textNTEXT; +int ntext; +#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/sys/h/timeb.h b/sys/h/timeb.h new file mode 100644 index 0000000000..4d65f377ff --- /dev/null +++ b/sys/h/timeb.h @@ -0,0 +1,12 @@ +/* timeb.h 4.2 81/02/19 */ + +/* + * Structure returned by ftime system call + */ +struct timeb +{ + time_t time; + unsigned short millitm; + short timezone; + short dstflag; +}; diff --git a/sys/h/times.h b/sys/h/times.h new file mode 100644 index 0000000000..3e58a99413 --- /dev/null +++ b/sys/h/times.h @@ -0,0 +1,11 @@ +/* times.h 4.2 81/02/19 */ + +/* + * 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/sys/h/trap.h b/sys/h/trap.h new file mode 100644 index 0000000000..885bca0aeb --- /dev/null +++ b/sys/h/trap.h @@ -0,0 +1,22 @@ +/* trap.h 4.6 81/03/03 */ + +/* + * Trap type values + */ + +/* The first three constant values are known to the real world */ +#define RESADFLT 0 /* reserved addressing fault */ +#define PRIVINFLT 1 /* privileged instruction fault */ +#define RESOPFLT 2 /* reserved operand fault */ +/* End of known constants */ +#define BPTFLT 3 /* bpt instruction fault */ +#define XFCFLT 4 /* xfc instruction fault */ +#define SYSCALL 5 /* chmk instruction (syscall trap) */ +#define ARITHTRAP 6 /* arithmetic trap */ +#define ASTFLT 7 /* software level 2 trap (ast deliv) */ +#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/sys/h/vcmd.h b/sys/h/vcmd.h new file mode 100644 index 0000000000..60ce7e2172 --- /dev/null +++ b/sys/h/vcmd.h @@ -0,0 +1,8 @@ +/* vcmd.h 4.3 81/02/25 */ + +#define VPRINT 0100 +#define VPLOT 0200 +#define VPRINTPLOT 0400 + +#define VGETSTATE (('v'<<8)|0) +#define VSETSTATE (('v'<<8)|1) diff --git a/sys/h/vtimes.h b/sys/h/vtimes.h new file mode 100644 index 0000000000..40eba533c1 --- /dev/null +++ b/sys/h/vtimes.h @@ -0,0 +1,24 @@ +/* vtimes.h 4.2 81/02/19 */ +/* + * 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 -- 2.20.1