From dff8b736bdd75399fb285d430f5900d775bb18e1 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Wed, 24 Feb 1993 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1993-02-24 --- pc/devlpt.c | 6 +++++- pc/l.s | 2 +- pc/trap.c | 26 +++++++++++++++++--------- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/pc/devlpt.c b/pc/devlpt.c index 8e152ac8faaf9bea5f108ef3b7e3e01f4f4ceb4d..ae23bbb3feb2461f87becb41bcd51c8d5d7165b9 100644 --- a/pc/devlpt.c +++ b/pc/devlpt.c @@ -74,7 +74,6 @@ lptgen(Chan *c, Dirtab *tab, int ntab, int i, Dir *dp) void lptreset(void) { - setvec(Parallelvec, lptintr); } void @@ -86,7 +85,12 @@ lptattach(char *spec) { Chan *c; int i = (spec && *spec) ? strtol(spec, 0, 0) : 1; + static int set; + if(!set){ + set = 1; + setvec(Parallelvec, lptintr); + } if(i < 1 || i > NDEV) error(Ebadarg); c = devattach('L', spec); diff --git a/pc/l.s b/pc/l.s index 48bb6b7ed75f04798a44640ab90ab32959a6887b..754e1cd3b2695e9e15a5c79a82e69573f9e1a0bc 100644 --- a/pc/l.s +++ b/pc/l.s @@ -500,7 +500,7 @@ TEXT intr31(SB),$0 JMP intrcommon TEXT intr32(SB),$0 PUSHL $0 - PUSHL $16 + PUSHL $32 JMP intrcommon TEXT intr33(SB),$0 PUSHL $0 diff --git a/pc/trap.c b/pc/trap.c index 91f961724ab1b7c6c4d9c28189ea213af3fa0c56..0ab10cec82f870caf41130f5633c93eb9314fa45 100644 --- a/pc/trap.c +++ b/pc/trap.c @@ -43,7 +43,7 @@ int int1mask = 0xff; /* interrupts enabled for second 8259 */ * trap/interrupt gates */ Segdesc ilt[256]; -int badtrap[256]; +int badintr[16]; typedef struct Handler Handler; struct Handler @@ -245,13 +245,14 @@ trap(Ureg *ur) if(c == Int1vec) outb(Int1ctl, EOI); outb(Int0ctl, EOI); - if(v != Uart0vec) - uartintr0(ur); } if(v>=256 || (h = halloc.ivec[v]) == 0){ + /* an old 386 generates these fairly often, no idea why */ if(v == 13) return; + + /* a processor or coprocessor error */ if(v <= 16){ if(user){ sprint(buf, "sys: trap: %s", excname[v]); @@ -262,20 +263,27 @@ trap(Ureg *ur) panic("%s pc=0x%lux", excname[v], ur->pc); } } - if(badtrap[v]++ < 10 || (badtrap[v]%1000) == 0) - print("bad trap type %d pc=0x%lux: total %d\n", v, ur->pc, - badtrap[v]); + + if(v >= Int0vec || v < Int0vec+16){ + /* an unknown interrupts */ + v -= Int0vec; + if(badintr[v]++ == 0 || (badintr[v]%1000) == 0) + print("unknown interrupt %d pc=0x%lux: total %d\n", v, + ur->pc, badintr[v]); + } else { + /* unimplemented traps */ + print("illegal trap %d pc=0x%lux\n", v, ur->pc); + } return; } + /* there may be multiple handlers on one interrupt level */ do { (*h->r)(ur); h = h->next; } while(h); - /* - * check user since syscall does its own notifying - */ + /* check user since syscall does its own notifying */ if(user && (u->p->procctl || u->nnote)) notify(ur); }