--- /dev/null
+/* cat.c 4.2 81/03/15 */
+
+main()
+{
+ int c, i;
+ char buf[50];
+
+ do {
+ printf("File: ");
+ gets(buf);
+ i = open(buf, 0);
+ } while (i <= 0);
+
+ while ((c = getc(i)) > 0)
+ putchar(c);
+ exit(0);
+}
--- /dev/null
+/* conf.c 4.7 81/03/15 */
+
+#include "../h/param.h"
+#include "../h/inode.h"
+#include "../h/pte.h"
+#include "../h/mbareg.h"
+#include "saio.h"
+
+devread(io)
+ register struct iob *io;
+{
+
+ return( (*devsw[io->i_ino.i_dev].dv_strategy)(io, READ) );
+}
+
+devwrite(io)
+ register struct iob *io;
+{
+
+ return( (*devsw[io->i_ino.i_dev].dv_strategy)(io, WRITE) );
+}
+
+devopen(io)
+ register struct iob *io;
+{
+
+ (*devsw[io->i_ino.i_dev].dv_open)(io);
+}
+
+devclose(io)
+ register struct iob *io;
+{
+
+ (*devsw[io->i_ino.i_dev].dv_close)(io);
+}
+
+nullsys()
+{
+
+ ;
+}
+
+int nullsys();
+int hpstrategy(), hpopen();
+int htstrategy(), htopen(), htclose();
+int upstrategy(), upopen();
+int tmstrategy(), tmopen(), tmclose();
+int tsstrategy(), tsopen(), tsclose();
+int rkopen(),rkstrategy();
+
+struct devsw devsw[] = {
+ "hp", hpstrategy, hpopen, nullsys,
+ "ht", htstrategy, htopen, htclose,
+ "up", upstrategy, upopen, nullsys,
+ "tm", tmstrategy, tmopen, tmclose,
+ "hk", rkstrategy, rkopen, nullsys,
+ "ts", tsstrategy, tsopen, tsclose,
+ 0,0,0,0
+};
--- /dev/null
+/* ls.c 4.2 81/03/15 */
+
+#include "../h/param.h"
+#include "../h/inode.h"
+#include "../h/ino.h"
+#include "../h/dir.h"
+#include "saio.h"
+
+char line[100];
+
+main()
+{
+ int i;
+
+ printf("ls\n");
+ do {
+ printf(": "); gets(line);
+ i = open(line, 0);
+ } while (i < 0);
+
+ ls(i);
+}
+
+ls(io)
+register io;
+{
+ struct direct d;
+ register i;
+
+ while (read(io, (char *)&d, sizeof d) == sizeof d) {
+ if (d.d_ino == 0)
+ continue;
+ printf("%d\t", d.d_ino);
+ for (i=0; i<DIRSIZ; i++) {
+ if (d.d_name[i] == 0)
+ break;
+ printf("%c", d.d_name[i]);
+ }
+ printf("\n");
+ }
+}
--- /dev/null
+/* machdep.c 4.2 81/03/15 */
+
+#include "../h/param.h"
+#include "../h/mtpr.h"
+
+/*ARGSUSED*/
+/*VARARGS1*/
+mtpr(regno, value)
+{
+
+ asm(" mtpr 8(ap),4(ap)");
+}
+
+/*ARGSUSED*/
+mfpr(regno)
+{
+
+ asm(" mfpr 4(ap),r0");
+#ifdef lint
+ return (0);
+#endif
+}
+
+/*
+ * Copy bytes within kernel
+ */
+/*ARGSUSED*/
+bcopy(from, to, count)
+ caddr_t from, to;
+ unsigned count;
+{
+
+ asm(" movc3 12(ap),*4(ap),*8(ap)");
+}
--- /dev/null
+/* mba.c 4.3 81/03/15 */
+
+#include "../h/param.h"
+#include "../h/inode.h"
+#include "../h/pte.h"
+#include "../h/mbareg.h"
+#include "../h/mtpr.h"
+#include "../h/vm.h"
+#include "saio.h"
+#include "savax.h"
+
+mbastart(io, func)
+ register struct iob *io;
+ int func;
+{
+ struct mba_regs *mba = mbamba(io->i_unit);
+ struct mba_drv *drv = mbadrv(io->i_unit);
+ register struct pte *pte = mba->mba_map;
+ int npf;
+ unsigned v;
+ int o;
+ int vaddr;
+
+ v = btop(io->i_ma);
+ o = (int)io->i_ma & PGOFSET;
+ npf = btoc(io->i_cc + o);
+ vaddr = o;
+ while (--npf >= 0)
+ *(int *)pte++ = v++ | PG_V;
+ mba->mba_sr = -1;
+ mba->mba_bcr = -io->i_cc;
+ mba->mba_var = vaddr;
+ if (func == WRITE)
+ drv->mbd_cs1 = MB_WCOM | MB_GO;
+ else
+ drv->mbd_cs1 = MB_RCOM | MB_GO;
+}
+
+mbainit(mbanum)
+ int mbanum;
+{
+ register struct mba_regs *mba = mbaddr[mbanum];
+
+ /* SHOULD BADADDR IT */
+ if (mbaact & (1<<mbanum))
+ return;
+ mba->mba_cr = MBCR_INIT;
+ mbaact |= 1<<mbanum;
+}
--- /dev/null
+/* saio.h 4.4 3/15/81 */
+
+/*
+ * header file for standalone package
+ */
+
+/*
+ * io block: includes an
+ * inode, cells for the use of seek, etc,
+ * and a buffer.
+ */
+struct iob {
+ char i_flgs;
+ struct inode i_ino;
+ int i_unit;
+ daddr_t i_boff;
+ daddr_t i_cyloff;
+ off_t i_offset;
+ daddr_t i_bn;
+ char *i_ma;
+ int i_cc;
+ char i_buf[BSIZE];
+};
+
+#define F_READ 01
+#define F_WRITE 02
+#define F_ALLOC 04
+#define F_FILE 010
+
+/*
+ * dev switch
+ */
+struct devsw {
+ char *dv_name;
+ int (*dv_strategy)();
+ int (*dv_open)();
+ int (*dv_close)();
+};
+
+struct devsw devsw[];
+
+/*
+ * request codes. Must be the same a F_XXX above
+ */
+#define READ 1
+#define WRITE 2
+
+#define NBUFS 4
+
+char b[NBUFS][BSIZE];
+daddr_t blknos[NBUFS];
+
+#define NFILES 4
+struct iob iob[NFILES];
--- /dev/null
+/* savax.h 4.2 81/03/15 */
+
+/*
+ * Standalone definitions peculiar to vaxen
+ * The mba devices in the standalone system are addressed as
+ * xx(unit,section)
+ * where unit is
+ * 8*mbanum+drive
+ * The mbadrv macro gives the address of the device registers
+ * for the specified unit; the mbamba macro gives the address of the
+ * mba registers themselves.
+ *
+ * The uba devices are also addressed by giving, as unit,
+ * 8*ubanum+drive
+ * The ubamem macro converts a specified unibus address (ala pdp-11)
+ * into a unibus memory address space address.
+ */
+
+int cpu; /* see <sys/cpu.h> */
+
+#define MAXNMBA 4
+struct mba_regs **mbaddr;
+int mbaact;
+caddr_t *umaddr;
+struct uba_regs **ubaddr;
+
+#define UNITTOMBA(unit) ((unit)>>3)
+#define UNITTODRIVE(unit) ((unit)&07)
+
+#define mbamba(unit) (mbaddr[UNITTOMBA(unit)])
+#define mbadrv(unit) (&mbamba(unit)->mba_drv[UNITTODRIVE(unit)])
+
+#define UNITTOUBA(unit) ((unit)>>3)
+#define ubauba(unit) (ubaddr[UNITTOUBA(unit)])
+#define ubamem(unit, off) ((umaddr[UNITTOUBA(unit)]+(off&017777)))