BSD 4_1_snap development
authorCSRG <csrg@ucbvax.Berkeley.EDU>
Sat, 21 Mar 1981 02:18:13 +0000 (18:18 -0800)
committerCSRG <csrg@ucbvax.Berkeley.EDU>
Sat, 21 Mar 1981 02:18:13 +0000 (18:18 -0800)
Work on file sys/stand/conf.c.ancient
Work on file sys/stand/cat.c
Work on file sys/stand/mba.c
Work on file sys/stand/machdep.c
Work on file sys/stand/ls.c
Work on file sys/stand/saio.h
Work on file sys/stand/savax.h

Synthesized-from: CSRG/cd1/4.1.snap

sys/stand/cat.c [new file with mode: 0644]
sys/stand/conf.c.ancient [new file with mode: 0644]
sys/stand/ls.c [new file with mode: 0644]
sys/stand/machdep.c [new file with mode: 0644]
sys/stand/mba.c [new file with mode: 0644]
sys/stand/saio.h [new file with mode: 0644]
sys/stand/savax.h [new file with mode: 0644]

diff --git a/sys/stand/cat.c b/sys/stand/cat.c
new file mode 100644 (file)
index 0000000..1c5384c
--- /dev/null
@@ -0,0 +1,17 @@
+/*     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);
+}
diff --git a/sys/stand/conf.c.ancient b/sys/stand/conf.c.ancient
new file mode 100644 (file)
index 0000000..efc9631
--- /dev/null
@@ -0,0 +1,59 @@
+/*     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
+};
diff --git a/sys/stand/ls.c b/sys/stand/ls.c
new file mode 100644 (file)
index 0000000..8797aa4
--- /dev/null
@@ -0,0 +1,41 @@
+/*     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");
+       }
+}
diff --git a/sys/stand/machdep.c b/sys/stand/machdep.c
new file mode 100644 (file)
index 0000000..cd80405
--- /dev/null
@@ -0,0 +1,34 @@
+/*     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)");
+}
diff --git a/sys/stand/mba.c b/sys/stand/mba.c
new file mode 100644 (file)
index 0000000..9347f54
--- /dev/null
@@ -0,0 +1,49 @@
+/*     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;
+}
diff --git a/sys/stand/saio.h b/sys/stand/saio.h
new file mode 100644 (file)
index 0000000..2595fc7
--- /dev/null
@@ -0,0 +1,54 @@
+/*     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];
diff --git a/sys/stand/savax.h b/sys/stand/savax.h
new file mode 100644 (file)
index 0000000..0ba32dc
--- /dev/null
@@ -0,0 +1,35 @@
+/*     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)))