BSD 4_3_Reno release
[unix-history] / usr / src / usr.sbin / config / mkubglue.c
index a5a5d88..b551e39 100644 (file)
@@ -1,4 +1,12 @@
-/*     mkubglue.c      1.9     83/06/16        */
+/*
+ * Copyright (c) 1980 Regents of the University of California.
+ * All rights reserved.  The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ */
+
+#ifndef lint
+static char sccsid[] = "@(#)mkubglue.c 5.1 (Berkeley) 5/8/85";
+#endif not lint
 
 /*
  * Make the uba interrupt file ubglue.s
 
 /*
  * Make the uba interrupt file ubglue.s
@@ -35,9 +43,32 @@ ubglue()
                        }
                }
        }
                        }
                }
        }
+       dump_std(fp);
+       for (dp = dtab; dp != 0; dp = dp->d_next) {
+               mp = dp->d_conn;
+               if (mp != 0 && mp != (struct device *)-1 &&
+                   !eq(mp->d_name, "mba")) {
+                       struct idlst *id, *id2;
+
+                       for (id = dp->d_vec; id; id = id->id_next) {
+                               for (id2 = dp->d_vec; id2; id2 = id2->id_next) {
+                                       if (id2 == id) {
+                                               dump_intname(fp, id->id,
+                                                       dp->d_unit);
+                                               break;
+                                       }
+                                       if (!strcmp(id->id, id2->id))
+                                               break;
+                               }
+                       }
+               }
+       }
+       dump_ctrs(fp);
        (void) fclose(fp);
 }
 
        (void) fclose(fp);
 }
 
+static int cntcnt = 0;         /* number of interrupt counters allocated */
+
 /*
  * print an interrupt vector
  */
 /*
  * print an interrupt vector
  */
@@ -52,6 +83,7 @@ dump_vec(fp, vector, number)
        (void) sprintf(v, "%s%d", vector, number);
        fprintf(fp, "\t.globl\t_X%s\n\t.align\t2\n_X%s:\n\tpushr\t$0x3f\n",
            v, v);
        (void) sprintf(v, "%s%d", vector, number);
        fprintf(fp, "\t.globl\t_X%s\n\t.align\t2\n_X%s:\n\tpushr\t$0x3f\n",
            v, v);
+       fprintf(fp, "\tincl\t_fltintrcnt+(4*%d)\n", cntcnt++);
        if (strncmp(vector, "dzx", 3) == 0)
                fprintf(fp, "\tmovl\t$%d,r0\n\tjmp\tdzdma\n\n", number);
        else {
        if (strncmp(vector, "dzx", 3) == 0)
                fprintf(fp, "\tmovl\t$%d,r0\n\tjmp\tdzdma\n\n", number);
        else {
@@ -61,7 +93,73 @@ dump_vec(fp, vector, number)
                        fprintf(fp, "#endif\n");
                }
                fprintf(fp, "\tpushl\t$%d\n", number);
                        fprintf(fp, "#endif\n");
                }
                fprintf(fp, "\tpushl\t$%d\n", number);
-               fprintf(fp, "\tcalls\t$1,_%s\n\tpopr\t$0x3f\n\trei\n\n",
-                   vector);
+               fprintf(fp, "\tcalls\t$1,_%s\n\tpopr\t$0x3f\n", vector);
+               fprintf(fp, "\tincl\t_cnt+V_INTR\n\trei\n\n");
        }
 }
        }
 }
+
+/*
+ * Start the interrupt name table with the names
+ * of the standard vectors not on the unibus.
+ * The number and order of these names should correspond
+ * with the definitions in scb.s.
+ */
+dump_std(fp)
+       register FILE *fp;
+{
+       fprintf(fp, "\n\t.globl\t_intrnames\n");
+       fprintf(fp, "\n\t.globl\t_eintrnames\n");
+       fprintf(fp, "\t.data\n");
+       fprintf(fp, "_intrnames:\n");
+       fprintf(fp, "\t.asciz\t\"clock\"\n");
+       fprintf(fp, "\t.asciz\t\"cnr\"\n");
+       fprintf(fp, "\t.asciz\t\"cnx\"\n");
+       fprintf(fp, "\t.asciz\t\"tur\"\n");
+       fprintf(fp, "\t.asciz\t\"tux\"\n");
+       fprintf(fp, "\t.asciz\t\"mba0\"\n");
+       fprintf(fp, "\t.asciz\t\"mba1\"\n");
+       fprintf(fp, "\t.asciz\t\"mba2\"\n");
+       fprintf(fp, "\t.asciz\t\"mba3\"\n");
+       fprintf(fp, "\t.asciz\t\"uba0\"\n");
+       fprintf(fp, "\t.asciz\t\"uba1\"\n");
+       fprintf(fp, "\t.asciz\t\"uba2\"\n");
+       fprintf(fp, "\t.asciz\t\"uba3\"\n");
+#define        I_FIXED         13                      /* number of names above */
+}
+
+dump_intname(fp, vector, number)
+       register FILE *fp;
+       char *vector;
+       int number;
+{
+       register char *cp = vector;
+
+       fprintf(fp, "\t.asciz\t\"");
+       /*
+        * Skip any "int" or "intr" in the name.
+        */
+       while (*cp)
+               if (cp[0] == 'i' && cp[1] == 'n' &&  cp[2] == 't') {
+                       cp += 3;
+                       if (*cp == 'r')
+                               cp++;
+               } else {
+                       putc(*cp, fp);
+                       cp++;
+               }
+       fprintf(fp, "%d\"\n", number);
+}
+
+dump_ctrs(fp)
+       register FILE *fp;
+{
+       fprintf(fp, "_eintrnames:\n");
+       fprintf(fp, "\n\t.globl\t_intrcnt\n");
+       fprintf(fp, "\n\t.globl\t_eintrcnt\n");
+       fprintf(fp, "_intrcnt:\n", I_FIXED);
+       fprintf(fp, "\t.space\t4 * %d\n", I_FIXED);
+       fprintf(fp, "_fltintrcnt:\n", cntcnt);
+       fprintf(fp, "\t.space\t4 * %d\n", cntcnt);
+       fprintf(fp, "_eintrcnt:\n\n");
+       fprintf(fp, "\t.text\n");
+}