plan 9 kernel history: overview | file list | diff list

1993/0217/pc/trap.c (diff list | history)

1993/0216/sys/src/9/pc/trap.c:32,371993/0217/sys/src/9/pc/trap.c:32,39 (short | long | prev | next)
1991/0709    
	Int1aux=	0xA1,		/* everything else (ICW2, ICW3, ICW4, OCW1) */ 
 
	EOI=		0x20,		/* non-specific end of interrupt */ 
1993/0217    
 
	Maxhandler=	128,		/* max number of interrupt handlers */ 
1991/0709    
}; 
 
1991/1001    
int	int0mask = 0xff;	/* interrupts enabled for first 8259 */ 
1993/0216/sys/src/9/pc/trap.c:41,481993/0217/sys/src/9/pc/trap.c:43,64
1991/0614    
 *  trap/interrupt gates 
1991/0613    
 */ 
1991/0703    
Segdesc ilt[256]; 
void	(*ivec[256])(void*); 
 
1993/0217    
typedef struct Handler	Handler; 
struct Handler 
{ 
	void	(*r)(void*); 
	Handler	*next; 
}; 
 
struct 
{ 
	Lock; 
	Handler	*ivec[256]; 
	Handler	h[Maxhandler]; 
	int	free; 
} halloc; 
 
1991/0703    
void 
1991/0710    
sethvec(int v, void (*r)(void), int type, int pri) 
1991/0613    
{ 
1993/0216/sys/src/9/pc/trap.c:53,601993/0217/sys/src/9/pc/trap.c:69,85
1991/0703    
void 
1991/0716    
setvec(int v, void (*r)(Ureg*)) 
1991/0703    
{ 
	ivec[v] = r; 
1993/0217    
	Handler *h; 
1991/0709    
 
1993/0217    
	lock(&halloc); 
	if(halloc.free >= Maxhandler) 
		panic("out of interrupt handlers"); 
	h = &halloc.h[halloc.free++]; 
	h->next = halloc.ivec[v]; 
	h->r = r; 
	halloc.ivec[v] = h; 
	unlock(&halloc); 
 
1991/0709    
	/* 
	 *  enable corresponding interrupt in 8259 
	 */ 
1993/0216/sys/src/9/pc/trap.c:201,2061993/0217/sys/src/9/pc/trap.c:226,232
1991/1112    
	int v, user; 
1991/0731    
	int c; 
1991/1113    
	char buf[ERRLEN]; 
1993/0217    
	Handler *h; 
1991/0703    
 
1991/0731    
	v = ur->trap; 
 
1993/0216/sys/src/9/pc/trap.c:222,2281993/0217/sys/src/9/pc/trap.c:248,254
1991/0823    
			uartintr0(ur); 
1991/1113    
	} 
 
	if(v>=256 || ivec[v] == 0){ 
1993/0217    
	if(v>=256 || (h = halloc.ivec[v]) == 0){ 
1991/1214    
		if(v == 13) 
			return; 
1991/1113    
		if(v <= 16){ 
1993/0216/sys/src/9/pc/trap.c:239,2451993/0217/sys/src/9/pc/trap.c:265,274
1992/0918    
		return; 
1991/0731    
	} 
1991/0801    
 
	(*ivec[v])(ur); 
1993/0217    
	do { 
		(*h->r)(ur); 
		h = h->next; 
	} while(h); 
1991/0910    
 
1991/0913    
	/* 
1992/0108    
	 *  check user since syscall does its own notifying 


source code copyright © 1990-2005 Lucent Technologies; see license
Plan 9 distribution
comments to russ cox (rsc@swtch.com)