date and time created 92/12/13 03:50:33 by akito
authorAkito Fujita <akito@ucbvax.Berkeley.EDU>
Sun, 13 Dec 1992 19:50:33 +0000 (11:50 -0800)
committerAkito Fujita <akito@ucbvax.Berkeley.EDU>
Sun, 13 Dec 1992 19:50:33 +0000 (11:50 -0800)
SCCS-vsn: sys/luna68k/stand/tape.c 7.1
SCCS-vsn: sys/luna68k/stand/trap.c 7.1

usr/src/sys/luna68k/stand/tape.c [new file with mode: 0644]
usr/src/sys/luna68k/stand/trap.c [new file with mode: 0644]

diff --git a/usr/src/sys/luna68k/stand/tape.c b/usr/src/sys/luna68k/stand/tape.c
new file mode 100644 (file)
index 0000000..ce419be
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 1992 OMRON Corporation.
+ * Copyright (c) 1992 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * OMRON Corporation.
+ *
+ * %sccs.include.redist.c%
+ *
+ *     @(#)tape.c      7.1 (Berkeley) %G%
+ */
+
+/*
+ * tape.c -- operation commands for TAPE unit.
+ * by A.Fujita, APR-14-1992
+ */
+
+#include <sys/param.h>
+#include <luna68k/stand/status.h>
+
+dev_t  rst0 = 0x0000;
+dev_t nrst0 = 0x0004;
+
+u_char buff[512];
+
+int
+tape(argc, argv)
+       int   argc;
+       char *argv[];
+{
+       int size, count;
+       u_long *p = (u_long *) buff;
+
+       if (!strcmp(argv[1], "read")) {
+               count = 0;
+               while ((size = stread(rst0, buff, 512)) == 512)
+                       count++;
+               printf("tape: size  = %d\n", size);
+               printf("tape: count = %d\n", count);
+       } else if (!strcmp(argv[1], "write")) {
+               for (count = 0; count < 500; count++) {
+                       if ((size = stwrite(rst0, buff, 512)) != 512)
+                               break;
+               }
+               printf("tape: size  = %d\n", size);
+               printf("tape: count = %d\n", count);
+       } else if (!strcmp(argv[1], "rewind")) {
+               st_rewind(rst0);
+       } else if (!strcmp(argv[1], "weof")) {
+               st_write_EOF(rst0);
+       } else if (!strcmp(argv[1], "skip")) {
+               st_skip(rst0);
+       } else {
+               return(ST_ERROR);
+       }
+
+       return(ST_NORMAL);
+}
diff --git a/usr/src/sys/luna68k/stand/trap.c b/usr/src/sys/luna68k/stand/trap.c
new file mode 100644 (file)
index 0000000..c81a094
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 1992 OMRON Corporation.
+ * Copyright (c) 1992 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * OMRON Corporation.
+ *
+ * %sccs.include.redist.c%
+ *
+ *     @(#)trap.c      7.1 (Berkeley) %G%
+ */
+
+#include <sys/param.h>
+#include <machine/frame.h>
+#include <luna68k/stand/romvec.h>
+
+#define        USER    040             /* user-mode flag added to type */
+
+char   *trap_type[] = {
+       "Bus error",
+       "Address error",
+       "Illegal instruction",
+       "Zero divide",
+       "CHK instruction",
+       "TRAPV instruction",
+       "Privilege violation",
+       "Trace trap",
+       "MMU fault",
+       "SSIR trap",
+       "Format error",
+       "68881 exception",
+       "Coprocessor violation",
+       "Async system trap"
+};
+#define        TRAP_TYPES      (sizeof trap_type / sizeof trap_type[0])
+
+/*
+ * Called from the trap handler when a processor trap occurs.
+ */
+/*ARGSUSED*/
+trap(type, code, v, frame)
+       int type;
+       unsigned code;
+       register unsigned v;
+       struct frame frame;
+{
+       switch (type) {
+
+       default:
+dopanic:
+               printf("trap type %d, code = %x, v = %x\n", type, code, v);
+               regdump(frame.f_regs, 128);
+               type &= ~USER;
+               if ((unsigned)type < TRAP_TYPES)
+                       panic(trap_type[type]);
+               panic("trap");
+       }
+}