~kris/9p

9hist

dff8b736bdd75399fb285d430f5900d775bb18e1 — David du Colombier 33 years ago 79df10c
Plan 9 from Bell Labs 1993-02-24
3 files changed, 23 insertions(+), 11 deletions(-)

M pc/devlpt.c
M pc/l.s
M pc/trap.c
M pc/devlpt.c => pc/devlpt.c +5 -1
@@ 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);

M pc/l.s => pc/l.s +1 -1
@@ 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

M pc/trap.c => pc/trap.c +17 -9
@@ 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);
}