386BSD 0.1 development
[unix-history] / usr / src / usr.sbin / config / mkglue.c
index 8f57056..ebc3e82 100644 (file)
@@ -2,21 +2,37 @@
  * Copyright (c) 1980 Regents of the University of California.
  * All rights reserved.
  *
  * Copyright (c) 1980 Regents of the University of California.
  * All rights reserved.
  *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of California, Berkeley.  The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)mkglue.c   5.7 (Berkeley) %G%";
+static char sccsid[] = "@(#)mkglue.c   5.10 (Berkeley) 1/15/91";
 #endif /* not lint */
 
 /*
 #endif /* not lint */
 
 /*
@@ -108,6 +124,10 @@ dump_ubavec(fp, vector, number)
        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);
        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, "dpx", 3) == 0)
+               fprintf(fp, "\tmovl\t$%d,r0\n\tjmp\tdpxdma\n\n", number);
+       else if (strncmp(vector, "dpr", 3) == 0)
+               fprintf(fp, "\tmovl\t$%d,r0\n\tjmp\tdprdma\n\n", number);
        else {
                if (strncmp(vector, "uur", 3) == 0) {
                        fprintf(fp, "#ifdef UUDMA\n");
        else {
                if (strncmp(vector, "uur", 3) == 0) {
                        fprintf(fp, "#ifdef UUDMA\n");
@@ -309,3 +329,71 @@ dump_ctrs(fp)
        fprintf(fp, "_eintrcnt:\n\n");
        fprintf(fp, "\t.text\n");
 }
        fprintf(fp, "_eintrcnt:\n\n");
        fprintf(fp, "\t.text\n");
 }
+
+/*
+ * Create the ISA interrupt vector glue file.
+ */
+vector() {
+       register FILE *fp, *gp;
+       register struct device *dp, *mp;
+       int count;
+
+       fp = fopen(path("vector.s"), "w");
+       if (fp == 0) {
+               perror(path("vector.s"));
+               exit(1);
+       }
+       fprintf(fp,"\
+/*\n\
+ * AT/386\n\
+ * Interrupt vector routines\n\
+ * Generated by config program\n\
+ */ \n\
+\n\
+#include       \"i386/isa/isa.h\"\n\
+#include       \"i386/isa/icu.h\"\n\
+\n\
+#define        VEC(name)       .align 4; .globl _V/**/name; _V/**/name:\n\n");
+
+       fprintf(fp,"\
+       .globl  _hardclock\n\
+VEC(clk)\n\
+       INTR(0, _highmask, 0)\n\
+       call    _hardclock \n\
+       INTREXIT1\n\n\n");
+
+       count=0;
+       for (dp = dtab; dp != 0; dp = dp->d_next) {
+               mp = dp->d_conn;
+               if (mp != 0 && /* mp != (struct device *)-1 &&*/
+                   eq(mp->d_name, "isa")) {
+                       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) {
+                                               if(dp->d_irq == -1) continue;
+                       fprintf(fp,"\t.globl _%s, _%s%dmask\n\t.data\n",
+                               id->id, dp->d_name, dp->d_unit);
+                       fprintf(fp,"_%s%dmask:\t.long 0\n\t.text\n",
+                               dp->d_name, dp->d_unit);
+                       fprintf(fp,"VEC(%s%d)\n\tINTR(%d, ",
+                               dp->d_name, dp->d_unit, dp->d_unit);
+                                       if(eq(dp->d_mask,"null"))
+                                               fprintf(fp,"_%s%dmask, ",
+                                                       dp->d_name, dp->d_unit);
+                                       else
+                                               fprintf(fp,"_%smask, ",
+                                                       dp->d_mask);
+                       fprintf(fp,"%d)\n\tcall\t_%s\n\tINTREXIT%d\n\n\n",
+                               ++count, id->id, (dp->d_irq > 7)?2:1); 
+                                               break;
+                                       }
+                                       if (!strcmp(id->id, id2->id))
+                                               break;
+                               }
+                       }
+               }
+       }
+       (void) fclose(fp);
+}