date and time created 81/02/24 21:11:42 by toy
[unix-history] / usr / src / usr.sbin / config / mkubglue.c
CommitLineData
e1f7f2fb
MT
1/*
2 * Make the uba interrupt file ubglue.s
3 */
4#include <stdio.h>
5#include "config.h"
6#include "y.tab.h"
7
8ubglue()
9{
10 register FILE *fp;
11 register struct device *dp, *mp;
12
13 fp = fopen(path(ubglue.c), "w");
14 for (dp = dtab ; dp != NULL; dp = dp->d_next)
15 {
16 mp = dp->d_conn;
17 if (mp != NULL && mp != -1 && !eq(mp->d_name, "mba"))
18 {
19 if (dp->d_vec1 != NULL)
20 dump_vec(fp, dp->d_vec1, dp->d_unit);
21 if (dp->d_vec2 != NULL)
22 dump_vec(fp, dp->d_vec2, dp->d_unit);
23 }
24 }
25 fclose(fp);
26}
27
28/*
29 * dump_vec
30 * Print an interrupt vector
31 */
32
33dump_vec(fp, vector, number)
34register FILE *fp;
35char *vector;
36int number;
37{
38 char nbuf[80];
39 register char *v = nbuf;
40
41 sprintf(v, "%s%d", vector, number);
42 fprintf(fp, "\t.globl\t_X%s\n\t.align\t2\n_X%s:\n\tpushr\t$0x3f\n", v, v);
43 if (strncmp(vector, "dzx", 3) == 0)
44 fprintf(fp, "\tmovl\t$%d,r0\n\tjbr\t_dzdma\n\n", number);
45 else
46 {
47 fprintf(fp, "\tpushl\t$%d\n", number);
48 fprintf(fp, "\tcalls\t$1,_%s\n\tpopr\t$0x3f\n\trei\n\n", vector);
49 }
50}