--- /dev/null
+/*
+ * 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 */
--- /dev/null
+/*
+ * 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 */
+ unsigned int b_resid; /* words not transferred after error */
+};
+
+extern struct buf buf[]; /* The buffer pool itself */
+extern struct buf bfreelist; /* head of available list */
+
+/*
+ * These flags are kept in b_flags.
+ */
+#define B_WRITE 0 /* non-read pseudo-flag */
+#define B_READ 01 /* read when I/O occurs */
+#define B_DONE 02 /* transaction finished */
+#define B_ERROR 04 /* transaction aborted */
+#define B_BUSY 010 /* not on av_forw/back list */
+#define B_PHYS 020 /* Physical IO potentially using UNIBUS map */
+#define B_MAP 040 /* This block has the UNIBUS map allocated */
+#define B_WANTED 0100 /* issue wakeup when BUSY goes off */
+#define B_AGE 0200 /* delayed write for correct aging */
+#define B_ASYNC 0400 /* don't wait for I/O completion */
+#define B_DELWRI 01000 /* don't write till block leaves available list */
+#define B_TAPE 02000 /* this is a magtape (no bdwrite) */
+
+/*
+ * 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
--- /dev/null
+/*
+ * 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];
--- /dev/null
+#define NGROUPS 10
+#define NCHANS 20
+
+
+struct chan {
+ int c_flags;
+ char c_index;
+ char c_msg;
+ struct group *c_group;
+ struct tty *c_ttyp;
+ int c_pgrp;
+ union {
+ struct clist datq;
+ } cx;
+ union {
+ struct clist datq;
+ struct chan *c_chan;
+ } cy;
+ struct clist c_ctlx;
+ struct clist c_ctly;
+};
+
+
+struct group {
+ char g_state;
+ char g_mindex;
+ short g_index;
+ short g_count;
+ struct inode *g_inode;
+ struct group *g_master;
+ struct clist g_cntl;
+ struct clist g_datq;
+};
+
+/*
+ * flags
+ */
+#define INUSE 01
+#define XGRP 04
+#define YGRP 010
+#define WCLOSE 020
+#define TTYO 040
+#define SUBGRP 0100
+#define BLOCK 0200
+#define BLOCK1 0400
+#define SIGBLK 01000
+#define BLKMSG 01000
+#define ENAMSG 02000
+#define WFLUSH 04000
+
+
+/*
+ * mpxchan command codes
+ */
+#define GROUP 5
+#define GROUPN 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 NDEBUGS 30
+/*
+ * control channel message codes
+ */
+#define WATTCH 1
+#define SCLOSE 2
+#define UID 3
+#define M_BLK 4
+#define M_UBLK 5
+#define DO_BLK 6
+#define DO_UBLK 7
+
+
+/*
+ * 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
+
+union u_index {
+ short val;
+ struct {
+ char byte0;
+ char byte1;
+ };
+};
+typedef union u_index index_t;
--- /dev/null
+/*
+ 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 YRCURR 1979 /* current year */
+# define YRREF 1970 /* reference year for time */
+# define SECHR (60*60) /* seconds/hr */
+# define SECDAY (24*SECHR) /* seconds/day */
+# define SECYR (365*SECDAY) /* seconds/common year */
--- /dev/null
+#
+# 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
--- /dev/null
+/*
+ * 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)();
+ struct tty *d_ttys;
+} cdevsw[];
+
+/*
+ * tty line control switch.
+ */
+extern struct linesw
+{
+ int (*l_open)();
+ int (*l_close)();
+ int (*l_read)();
+ int (*l_write)();
+ int (*l_ioctl)();
+ int (*l_rint)();
+ int (*l_start)();
+} linesw[];
--- /dev/null
+/*
+ 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 */
--- /dev/null
+#
+# 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 i"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
--- /dev/null
+#ifndef DIRSIZ
+#define DIRSIZ 14
+#endif
+struct direct
+{
+ ino_t d_ino;
+ char d_name[DIRSIZ];
+};
--- /dev/null
+struct fblk
+{
+ int df_nfree;
+ daddr_t df_free[NICFREE];
+};
--- /dev/null
+/*
+ * 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
+{
+ char f_flag;
+ char 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;
+};
+
+extern struct file file[]; /* The file table itself */
+
+/* flags */
+#define FREAD 01
+#define FWRITE 02
+#define FPIPE 04
+#define FMPX 010
+#define FMPY 020
+#define FMP 030
--- /dev/null
+/*
+ * 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 */
+ /* remainder not maintained by this version of the system */
+ daddr_t s_tfree; /* total free blocks*/
+ ino_t s_tinode; /* total free inodes */
+ short s_m; /* interleave factor */
+ short s_n; /* " " */
+ char s_fname[6]; /* file system name */
+ char s_fpack[6]; /* file system pack name */
+};
--- /dev/null
+/*
+ * 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 */
+};
+#define INOPB 8 /* 8 inodes per block */
+/*
+ * the 40 address bytes:
+ * 39 used; 13 addresses
+ * of 3 bytes each.
+ */
--- /dev/null
+/*
+ * 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 16
+
+struct group {
+ short g_state;
+ char g_index;
+ char g_rot;
+ struct group *g_group;
+ struct inode *g_inode;
+ 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 logical block read (for read-ahead) */
+ };
+ struct {
+ daddr_t i_rdev; /* i_addr[0] */
+ struct group i_group; /* multiplexor group file */
+ };
+ } i_un;
+};
+
+
+extern struct inode inode[]; /* The inode table itself */
+
+/* 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 */
+
+/* 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
--- /dev/null
+struct map
+{
+ short m_size;
+ unsigned short m_addr;
+};
+
+struct map coremap[CMAPSIZ]; /* space for core allocation */
+struct map swapmap[SMAPSIZ]; /* space for swap allocation */
+/*
+ uba
+*/
+char bdpwant , umrwant ;
+struct map ubamap[UAMSIZ];
+struct map bdpmap[15];
--- /dev/null
+/* VAX Massbus adapter registers
+ */
+
+struct mba_regs {
+ int mba_csr,
+ mba_cr,
+ mba_sr,
+ mba_var,
+ mba_bcr;
+};
+
+/* NOTE:
+ mba_erb at displacement 0x400
+ mba_as at displacement 0x410
+ mba_map at displacement 0x800
+ */
+
+#define MBA0 0x80028000
+#define MBA1 0x8002a000
+
+#define MBA_ERB 0x400
+#define MBA_MAP 0x800
+
+#define MBA0_MAP MBA0 + 0x800
+#define MBA1_MAP MBA1 + 0x800
+
+#define MBAEBITS 0xe0770
+
+
+#define MBAIE 0x4
+
--- /dev/null
+#
+# VAX massbus adapter registers
+#
+
+ .set MBA0_CSR,0x80028000 # virtual address of mba0
+ .set MBA1_CSR,0x8002a000 # 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 # ???
+ .set MBA_AS,0x410 # attention summary
+
--- /dev/null
+/*
+ * 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];
--- /dev/null
+#define M 3
+#define C 100
+
+/*
+ * character Q structure
+ */
+struct clist
+{
+ int c_cc;
+ int c_cf;
+ int c_cl;
+};
+
+struct chan
+{
+ char cflag;
+ char m, c;
+ struct chan *dest;
+ struct clist ioq;
+};
+
+/* c flags */
+#define BLOCK 01
+
+struct line
+{
+ char xbuf[24+2];
+ char rbuf[100+2];
+ char rseq;
+ char xseq;
+ char ackf;
+ char xflag;
+ char state;
+ char time;
+ int sum;
+ char *ip;
+ char *ep;
+};
+#define WWAIT 02
+#define CRUN 04
+#define RWAIT 010
+#define ALLOC 020
+#define DIS 040
+#define DLY 0100
+
+/*
+ * machine structure
+ */
+struct mach
+{
+ char mflag;
+ char rchan;
+ char rcount;
+ char xchan;
+ char xcount;
+ struct clist ackq;
+ struct clist datq;
+ struct clist disq;
+ struct chan *chanp[128];
+};
+
+/* m flags */
+#define RNEXT 01
+#define MRUN 04
+#define XNEXT 010
+
+/*
+ * trace buffer
+ */
+#define TBSIZ 100
--- /dev/null
+/*
+ VAX processor register numbers
+ */
+
+#define KSP 0 /* kernal 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 */
--- /dev/null
+#
+# VAX processor register numbers
+#
+ .set KSP,0 # kernal 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
--- /dev/null
+#define NGROUPS 10
+#define NCHANS 20
+
+
+struct chan {
+ short c_flags;
+ char c_index;
+ char c_iline;
+ struct group *c_group;
+ struct tty *c_ittyp;
+ struct tty *c_ottyp;
+ struct file *c_fy;
+ int c_pgrp;
+ char c_oline;
+ union {
+ struct clist datq;
+ } cx;
+ union {
+ struct clist datq;
+ struct chan *c_chan;
+ } cy;
+ struct clist c_ctlx;
+ struct clist c_ctly;
+};
+
+
+
+
+struct header {
+ short index;
+ short count;
+ short ccount;
+ caddr_t addr;
+};
+
+
+
+
+/*
+ * flags
+ */
+#define INUSE 01
+#define COPEN 02
+#define XGRP 04
+#define YGRP 010
+#define WCLOSE 020
+#define TTYO 040
+#define ISGRP 0100
+#define BLOCK 0200
+#define BLOCK1 0400
+#define SIGBLK 01000
+#define BLKMSG 01000
+#define ENAMSG 02000
+#define WFLUSH 04000
+#define RZERO 010000
+
+
+/*
+ * 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_ATTACH 3
+#define M_BLK 4
+#define M_UBLK 5
+#define DO_BLK 6
+#define DO_UBLK 7
+#define M_XINT 8
+#define M_RINT 9
+#define M_ACK 10
+#define M_NAK\e 11
+
+
+/*
+ * 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
+
+#define HDRSIZE 4
+#define CNTLSIZ 10
+#define NLEVELS 4
--- /dev/null
+/*
+ VAX page table entry
+ */
+
+struct pt_entry {
+ int pg_pfnum:21,
+ :2,
+ pg_type:2,
+ :1,
+ pg_m:1,
+ pg_prot:4,
+ pg_v:1;
+};
+
+#define PG_PFNUM 0x1fffff
+#define PG_M 0x4000000
+#define PG_PROT 0x78000000
+#define PG_V 0x80000000
+
+#define PG_NOACC 0
+#define PG_KR 0x18000000
+#define PG_KW 0x10000000
+#define PG_UW 0x20000000
+#define PGURKW 0x60000000
+#define PG_URKR 0x78000000
+
+#define PG_TXT 0x01800000
--- /dev/null
+#
+# 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 PGURKW,0x60000000
+ .set PG_URKR,0x78000000
--- /dev/null
+/*
+ * tunable variables
+ */
+
+#define NBUF 32 /* size of buffer cache */
+#define NINODE 125 /* number of in core inodes */
+#define NFILE 125 /* number of in core file structures */
+#define NMOUNT 8 /* number of mountable file systems */
+#define MAXMEM 1024 /* max core in 512-byte clicks */
+#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 CMAPSIZ 50 /* size of core allocation area */
+#define SMAPSIZ 50 /* size of swap allocation area */
+#define NCALL 20 /* max simultaneous time callouts */
+#define NPROC 65 /* max number of processes */
+#define NTEXT 40 /* max number of pure texts */
+#define NCLIST 150 /* max total clist size */
+#define HZ 60 /* Ticks/second of the clock */
+#define TIMEZONE (5*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 5120 /* # characters in exec arglist */
+#define USRSTACK 0x80000000 /* Start of user stack */
+#define PHYSPAGES 1024 /* number of real memory pages */
+
+/*
+ * priorities
+ * probably should not be
+ * altered too much
+ */
+
+#define PSWP 0
+#define PINOD 10
+#define PRIBIO 20
+#define PZERO 25
+#define NZERO 20
+#define PPIPE 26
+#define PWAIT 30
+#define PSLEP 40
+#define PUSER 50
+
+/*
+ * signals
+ * dont change
+ */
+
+#define NSIG 17
+/*
+ * No more than 16 signals (1-16) because they are
+ * stored in bits in a word.
+ */
+#define SIGHUP 1 /* hangup */
+#define SIGINT 2 /* interrupt (rubout) */
+#define SIGQUIT 3 /* quit (FS) */
+#define SIGINS 4 /* illegal instruction */
+#define SIGTRC 5 /* trace or breakpoint */
+#define SIGIOT 6 /* iot */
+#define SIGEMT 7 /* emt */
+#define SIGFPT 8 /* floating exception */
+#define SIGKIL 9 /* kill, uncatchable termination */
+#define SIGBUS 10 /* bus error */
+#define SIGSEG 11 /* segmentation violation */
+#define SIGSYS 12 /* bad system call */
+#define SIGPIPE 13 /* end of pipe */
+#define SIGCLK 14 /* alarm clock */
+#define SIGTRM 15 /* Catchable termination */
+
+/*
+ * fundamental constants of the implementation--
+ * cannot be changed easily
+ */
+
+#define NBPW sizeof(int) /* number of bytes in an integer */
+#define BSIZE 512 /* size of secondary block (bytes) */
+/* BSLOP can be 0 unless you have a TIU/Spider */
+# define BSLOP 0 /* In case some device needs bigger buffers */
+#define NINDIR (BSIZE/sizeof(daddr_t))
+#define BMASK 0777 /* BSIZE-1 */
+#define BSHIFT 9 /* LOG2(BSIZE) */
+#define NMASK 0177 /* NINDIR-1 */
+#define NSHIFT 7 /* LOG2(NINDIR) */
+#define USIZE (4 + u.u_pcb.pcb_szpt) /* size of user block (*512) */
+#define UBASE (0x80000000 + PHYSPAGES*512) /* abs. addr of user block */
+#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 */
+#define NICINOD 100 /* number of superblock inodes */
+#define NICFREE 50 /* number of superblock free blocks */
+#define CBSIZE 12 /* number of chars in a clist block */
+#define CROUND 0xF /* clist rounding; sizeof(int *) + CBSIZE -1*/
+#define CLKTICK 16667 /* microseconds in a clock tick */
+
+/*
+ * 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)
+
+/* inumber to disk address */
+#define itod(x) (daddr_t)((((unsigned)x+15)>>3))
+
+/* inumber to disk offset */
+#define itoo(x) (int)((x+15)&07)
+
+/* 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 time_t;
+typedef int label_t[10];
+typedef short dev_t;
+typedef int off_t;
+
+/*
+ * Machine-dependent bits and macros
+ */
+#define UMODE PSL_CURMOD /* usermode bits */
+#define USERMODE(ps) ((ps & UMODE) == UMODE)
+
+#define BASEPRI(ps) ((ps & PSL_IPL) != 0)
--- /dev/null
+/*
+ VAX process control block
+ */
+
+struct pcb {
+ int
+ pcb_ksp, /* kernal stack pointer */
+ pcb_esp, /* exec stack pointer */
+ pcb_ssp, /* supervisor stack pointer */
+ pcb_usp, /* user stack pointer */
+ pcb_r0,
+ pcb_r1,
+ pcb_r2,
+ pcb_r3,
+ pcb_r4,
+ pcb_r5,
+ pcb_r6,
+ pcb_r7,
+ pcb_r8,
+ pcb_r9,
+ pcb_r10,
+ pcb_r11,
+ pcb_r12,
+ pcb_r13,
+ pcb_pc, /* program counter */
+ pcb_psl, /* program status longword */
+ pcb_p0br, /* seg 0 base register */
+ pcb_p0lr, /* seg 0 length register and astlevel */
+ pcb_p1br, /* seg 1 base register */
+ pcb_p1lr, /* seg 1 length register and pme */
+
+/*
+ Software pcb (extension)
+ */
+
+ pcb_szpt; /* number of pages of user page table */
+
+};
--- /dev/null
+#
+# VAX process control block
+#
+
+ .set PCB_KSP,0 # kernal 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
+
--- /dev/null
+/*
+ * 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.
+ */
+struct proc {
+ char p_stat;
+ char p_flag;
+ char p_pri; /* priority, negative is high */
+ char p_time; /* resident time for scheduling */
+ char p_cpu; /* cpu usage for scheduling */
+ char p_nice; /* nice for cpu usage */
+ short p_sig; /* signals pending to this process */
+ 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_addr; /* address of swappable image */
+ short p_size; /* size of swappable image (clicks) */
+ caddr_t p_wchan; /* event process is awaiting */
+ struct text *p_textp; /* pointer to text structure */
+ struct proc *p_link; /* linked list of running processes */
+ int p_clktim; /* time to alarm clock signal */
+};
+
+extern struct proc proc[]; /* the proc table itself */
+
+/* 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 01 /* in core */
+#define SSYS 02 /* scheduling process */
+#define SLOCK 04 /* process cannot be swapped */
+#define SSWAP 010 /* process is being swapped out */
+#define STRC 020 /* process is being traced */
+#define SWTED 040 /* another tracing flag */
+#define SULOCK 0100 /* user settable lock in core */
+
+/*
+ * parallel proc structure
+ * to replace part with times
+ * to be passed to parent process
+ * in ZOMBIE state.
+ */
+struct xproc {
+ char xp_stat;
+ char xp_flag;
+ char xp_pri; /* priority, negative is high */
+ char xp_time; /* resident time for scheduling */
+ char xp_cpu; /* cpu usage for scheduling */
+ char xp_nice; /* nice for cpu usage */
+ short xp_sig; /* signals pending to this process */
+ 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 */
+ time_t xp_utime; /* user time, this proc */
+ time_t xp_stime; /* system time, this proc */
+};
--- /dev/null
+/*
+ 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_T 0x10 /* trace enable bit */
+#define PSL_IV 0x20 /* integer overflow enable bit */
+#define PSL_FU 0x40 /* floating point underflow enable bit */
+#define PSL_DV 0x80 /* decimal overflow enable bit */
+#define PSL_IPL 0x1f0000 /* interrupt priority level */
+#define PSL_PRVMOD 0xc00000 /* previous mode */
+#define PSL_CURMOD 0x3000000 /* current mode */
+#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 */
+
--- /dev/null
+#
+# 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
+
--- /dev/null
+/*
+ * Location of the users' stored
+ * registers relative to R0.
+ * Usage is u.u_ar0[XX].
+ */
+#define R0 0
+#define R1 1
+#define R2 2
+#define R3 3
+#define R4 4
+#define R5 5
+#define R6 6
+#define R7 7
+#define R8 8
+#define R9 9
+#define R10 10
+#define R11 11
+#define R12 12
+#define R13 13
+
+#define AP 12
+#define FP 13
+#define SP 14
+#define PS 18
+#define PC 17
--- /dev/null
+/*
+ * Mapper addresses and bits
+ */
+
+#define RO PG_URKR /* access abilities */
+#define RW PG_UW
--- /dev/null
+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 */
--- /dev/null
+/*
+ * Random set of variables
+ * used by more than one
+ * routine.
+ */
+char canonb[CANBSIZ]; /* buffer for erase and kill (#@) */
+struct inode *rootdir; /* pointer to inode of root directory */
+struct proc *runq; /* head of linked list of running processes */
+int cputype; /* type of cpu =40, 45, or 70 */
+int lbolt; /* time of day in 60th not in time */
+time_t time; /* time in sec from 1970 */
+int time64[2]; /* microseconds since system was booted */
+
+/*
+ * 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/tty.c
+ */
+int nchrdev;
+
+int mpid; /* generic for unique process id's */
+char runin; /* scheduling flag */
+char runout; /* scheduling flag */
+char runrun; /* scheduling flag */
+char curpri; /* more scheduling */
+int maxmem; /* actual max memory per process */
+daddr_t swplo; /* block number of swap space */
+int nswap; /* size of swap space */
+int updlock; /* lock for sync */
+daddr_t rablock; /* block to be read ahead */
+extern char regloc[]; /* locs. of saved user registers (trap.c) */
+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 pipedev; /* pipe device */
+extern int icode[]; /* user init code */
+extern int szicode; /* its size */
+
+dev_t getmdev();
+daddr_t bmap();
+struct inode *ialloc();
+struct inode *iget();
+struct inode *owner();
+struct inode *maknode();
+struct inode *namei();
+struct buf *alloc();
+struct buf *getblk();
+struct buf *geteblk();
+struct buf *bread();
+struct buf *breada();
+struct filsys *getfs();
+struct file *getf();
+struct file *falloc();
+int uchar();
+caddr_t realaddr();
+caddr_t checkio();
+/*
+ * Instrumentation
+ */
+int dk_busy;
+long dk_time[32];
+long dk_numb[3];
+long dk_wds[3];
+long tk_nin;
+long tk_nout;
+
+/*
+ * 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[];
--- /dev/null
+/*
+ * Text structure.
+ * One allocated per pure
+ * procedure on swap device.
+ * Manipulated by text.c
+ */
+struct text
+{
+ short x_daddr; /* disk address of segment (relative to swplo) */
+ short x_caddr; /* core address, if loaded */
+ short x_size; /* size (clicks) */
+ struct inode *x_iptr; /* inode of prototype */
+ char x_count; /* reference count */
+ char x_ccount; /* number of loaded references */
+ char x_flag; /* traced, written flags */
+};
+
+extern struct text text[];
+
+#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 */
--- /dev/null
+/*
+ * Structure returned by ftime system call
+ */
+struct timeb {
+ time_t time;
+ unsigned short millitm;
+ short timezone;
+ short dstflag;
+};
--- /dev/null
+/*
+ Trap type values
+ */
+
+#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 */
+
--- /dev/null
+#
+# 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
--- /dev/null
+/*
+ * A clist structure is the head
+ * of a linked list queue of characters.
+ * The characters are stored in 4-word
+ * blocks containing a link and several characters.
+ * The routines getc and putc
+ * 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. (kl.c dc.c dh.c)
+ */
+struct tty
+{
+ struct clist t_rawq; /* input chars right off device */
+ struct clist t_canq; /* input chars after erase and kill */
+ 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 */
+ 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 */
+};
+
+/*
+ * structure of arg for ioctl
+ */
+struct ttiocb {
+ char ioc_ispeed;
+ char ioc_ospeed;
+ char ioc_erase;
+ char ioc_kill;
+ int ioc_flags;
+};
+
+#define TTIPRI 28
+#define TTOPRI 29
+
+#define CERASE '#' /* default special characters */
+#define CEOT 004
+#define CKILL '@'
+#define CQUIT 034 /* FS, cntl shift L */
+#define CINTR 0177 /* DEL */
+#define CSTOP 023 /* Stop output: ctl-s */
+#define CSTART 021 /* Start output: ctl-q */
+
+/* limits */
+#define TTHIWAT 100
+#define TTLOWAT 50
+#define TTYHOG 256
+
+/* modes */
+#define TANDEM 01
+#define CBREAK 02
+#define LCASE 04
+#define ECHO 010
+#define CRMOD 020
+#define RAW 040
+#define ODDP 0100
+#define EVENP 0200
+#define NLDELAY 001400
+#define TBDELAY 006000
+#define XTABS 006000
+#define CRDELAY 030000
+#define VTDELAY 040000
+
+/* 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 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 */
+
+/*
+ * tty ioctl commands
+ */
+#define TIOCGETD (('t'<<8)|0)
+#define TIOCSETD (('t'<<8)|1)
+#define TIOCHPCL (('t'<<8)|2)
+#define TIOCMODG (('t'<<8)|3)
+#define TIOCMODS (('t'<<8)|4)
+#define TIOCGETP (('t'<<8)|8)
+#define TIOCSETP (('t'<<8)|9)
+#define TIOCSETN (('t'<<8)|10)
+#define TIOCEXCL (('t'<<8)|13)
+#define TIOCNXCL (('t'<<8)|14)
+#define TIOCTSTP (('t'<<8)|16)
+#define DIOCLSTN (('d'<<8)|1)
+#define DIOCGETP (('d'<<8)|8)
+#define DIOCSETP (('d'<<8)|9)
+#define FIOCLEX (('f'<<8)|1)
+#define FIONCLEX (('f'<<8)|2)
--- /dev/null
+# define UBA0 0x80024000 /* 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 Rg 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 */
+# define UAMSIZ 50
+/*
+* UBA registers
+*/
+
+struct uba_regs {
+ int uba_cnfgr,
+ uba_cr,
+ uba_sr,
+ uba_dcr,
+ uba_fmer,
+ uba_fubar,
+ pad1[2],
+ uba_brsvr[4],
+ uba_brrvr[4],
+ uba_dpr[16],
+ pad2[480],
+ uba_map[496];
+ };
+
--- /dev/null
+#
+# VAX unibus adapter registers
+#
+
+ .set UBA,0x80024000 # virtual address of unibus registers
+ .set UBA0,0x80024000
+ .set UBR_OFF,0x30 # UBA offset to BRRVR regs
+ .set CFGFLT,0xfc000000 # SBI fault bits in UBA config reg
+ .set UCN_OFF,4 # UBA offset to config reg
+ .set UST_OFF,8 # UBA offset to status reg
+
+ .set UBA_SR,UBA + 0x8
+ .set UBA_BR4,UBA + 0x30 # virtual address of interrupt vector registers
+
--- /dev/null
+#include "../h/pcb.h"
+/*
+ * 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 USIZE*512 bytes
+ * long; resides at virtual kernel
+ * loc 140000; 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; /* pcb, save area when exchanging stacks */
+ label_t u_rsav;
+ char u_segflg; /* IO flag: 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;
+ };
+ 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 */
+ int u_arg[5]; /* arguments to current system call */
+ unsigned u_tsize; /* text size (clicks) */
+ unsigned u_dsize; /* data size (clicks) */
+ unsigned u_ssize; /* stack size (clicks) */
+ label_t u_qsav; /* label variable for quits and interrupts */
+ label_t u_ssav; /* label variable for swapping */
+ int u_signal[NSIG]; /* disposition of signals */
+ time_t u_utime; /* this process user time */
+ time_t u_stime; /* this process system time */
+ time_t u_cutime; /* sum of childs' utimes */
+ time_t u_cstime; /* sum of childs' stimes */
+ int *u_ar0; /* address of users saved R0 */
+ struct { /* 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_intflg; /* catch intr from sys */
+ 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 */
+ int u_stack[1];
+ /* kernel stack per user
+ * extends from u + USIZE*64
+ * backward not to reah here
+ */
+};
+
+extern struct user u;
+
+/* u_error codes */
+#define EPERM 1
+#define ENOENT 2
+#define ESRCH 3
+#define EINTR 4
+#define EIO 5
+#define ENXIO 6
+#define E2BIG 7
+#define ENOEXEC 8
+#define EBADF 9
+#define ECHILD 10
+#define EAGAIN 11
+#define ENOMEM 12
+#define EACCES 13
+#define EFAULT 14
+#define ENOTBLK 15
+#define EBUSY 16
+#define EEXIST 17
+#define EXDEV 18
+#define ENODEV 19
+#define ENOTDIR 20
+#define EISDIR 21
+#define EINVAL 22
+#define ENFILE 23
+#define EMFILE 24
+#define ENOTTY 25
+#define ETXTBSY 26
+#define EFBIG 27
+#define ENOSPC 28
+#define ESPIPE 29
+#define EROFS 30
+#define EMLINK 31
+#define EPIPE 32
+#define EDOM 33
+#define ERANGE 34