|
|
1.1 root 1: /*
2: * read template for trap and interrupt vectors
3: * offset type name
4: */
5:
6: #include <fio.h>
7: #include <libc.h>
8: #include <ctype.h>
9: #include "mkconf.h"
10:
11: readlow(f)
12: char *f;
13: {
14: int fd;
15: register char *p;
16: char *args[4];
17: int off;
18:
19: if ((fd = open(f, 0)) < 0) {
20: perror(f);
21: exit(1);
22: }
23: while ((p = Frdline(fd)) != NULL) {
24: while (isspace(*p))
25: p++;
26: if (*p == 0 || *p == '#')
27: continue;
28: if (crack(p, args, 4) != 3) {
29: fprint(STDERR, "bad scb line: %s\n", p);
30: errs++;
31: continue;
32: }
33: off = nconv(args[0]);
34: switch (args[1][0]) {
35: case 't':
36: newvec(off, STRAP, args[2]);
37: break;
38:
39: case 'i':
40: newvec(off, SINTR, args[2]);
41: break;
42:
43: default:
44: fprint(STDERR, "scb offset %s: unknown flag %s\n",
45: args[0], args[1]);
46: errs++;
47: break;
48: }
49: }
50: close(fd);
51: }
52:
53: /*
54: * new interrupt vector into scb list
55: * the hard part is keeping the list ordered
56: */
57: newvec(off, typ, name)
58: int off;
59: int typ;
60: char *name;
61: {
62: register Scb *sp;
63: register Scb *tp, *bp;
64:
65: sp = (Scb *)ealloc(sizeof(Scb));
66: sp->name = estrdup(name);
67: sp->type = typ;
68: sp->offset = off;
69: bp = NULL;
70: for (tp = llist; tp; bp = tp, tp = tp->next) {
71: if (tp->offset == sp->offset) {
72: fprint(STDERR, "duplicate scb vector 0x%x %s %s\n",
73: sp->offset, sp->name, tp->name);
74: errs++;
75: return;
76: }
77: if (tp->offset > sp->offset)
78: break;
79: }
80: if (bp == NULL) {
81: sp->next = llist;
82: llist = sp;
83: }
84: else {
85: sp->next = bp->next;
86: bp->next = sp;
87: }
88: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.