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

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

1993/1116/sys/src/9/pc/trap.c:48,541993/1124/sys/src/9/pc/trap.c:48,55 (short | long | prev | next)
1993/0217    
typedef struct Handler	Handler; 
struct Handler 
{ 
	void	(*r)(void*); 
1993/1124    
	void	(*r)(Ureg*, void*); 
	void	*arg; 
1993/0217    
	Handler	*next; 
}; 
 
1993/1116/sys/src/9/pc/trap.c:68,741993/1124/sys/src/9/pc/trap.c:69,75
1991/0703    
} 
1991/0614    
 
1991/0703    
void 
1991/0716    
setvec(int v, void (*r)(Ureg*)) 
1993/1124    
setvec(int v, void (*r)(Ureg*, void*), void *arg) 
1991/0703    
{ 
1993/0217    
	Handler *h; 
1991/0709    
 
1993/1116/sys/src/9/pc/trap.c:78,831993/1124/sys/src/9/pc/trap.c:79,85
1993/0217    
	h = &halloc.h[halloc.free++]; 
	h->next = halloc.ivec[v]; 
	h->r = r; 
1993/1124    
	h->arg = arg; 
1993/0217    
	halloc.ivec[v] = h; 
	unlock(&halloc); 
 
1993/1116/sys/src/9/pc/trap.c:94,1031993/1124/sys/src/9/pc/trap.c:96,107
1991/0703    
} 
 
1991/1112    
void 
debugbpt(Ureg *ur) 
1993/1124    
debugbpt(Ureg *ur, void *arg) 
1991/1112    
{ 
	char buf[ERRLEN]; 
 
1993/1124    
	USED(arg); 
 
1993/0915    
	if(up == 0) 
1991/1112    
		panic("kernel bpt"); 
	/* restore pc to instruction that caused the trap */ 
1993/1116/sys/src/9/pc/trap.c:164,1721993/1124/sys/src/9/pc/trap.c:168,176
1991/1214    
	 *  system calls and break points 
1991/0710    
	 */ 
1993/1114    
	sethvec(Syscallvec, intr64, SEGIG, 3); 
1991/0910    
	setvec(Syscallvec, (void (*)(Ureg*))syscall); 
1993/1124    
	setvec(Syscallvec, syscall, 0); 
1993/1114    
	sethvec(Bptvec, intr3, SEGIG, 3); 
1991/1112    
	setvec(Bptvec, debugbpt); 
1993/1124    
	setvec(Bptvec, debugbpt, 0); 
1991/0710    
 
	/* 
1991/0703    
	 *  tell the hardware where the table is (and how long) 
1993/1116/sys/src/9/pc/trap.c:223,2291993/1124/sys/src/9/pc/trap.c:227,233
1993/0915    
 
 
1991/0614    
/* 
1993/1115    
 *  All trapscome here.  It is slower to have all traps call trap() rather than 
1993/1124    
 *  All traps come here.  It is slower to have all traps call trap() rather than 
1993/1115    
 *  directly vectoring the handler.  However, this avoids a lot of code duplication 
 *  and possible bugs. 
1991/0614    
 */ 
1993/1116/sys/src/9/pc/trap.c:295,3011993/1124/sys/src/9/pc/trap.c:299,305
1991/0801    
 
1993/0224    
	/* there may be multiple handlers on one interrupt level */ 
1993/0217    
	do { 
		(*h->r)(ur); 
1993/1124    
		(*h->r)(ur, h->arg); 
1993/0217    
		h = h->next; 
	} while(h); 
1991/0910    
 
1993/1116/sys/src/9/pc/trap.c:387,3991993/1124/sys/src/9/pc/trap.c:391,405
1992/0103    
/* 
 *  syscall is called spllo() 
 */ 
1991/0710    
long 
syscall(Ureg *ur) 
1993/1124    
void 
syscall(Ureg *ur, void *arg) 
1991/0710    
{ 
1991/0720    
	ulong	sp; 
	long	ret; 
	int	i; 
 
1993/1124    
	USED(arg); 
 
1993/0915    
	up->insyscall = 1; 
	up->pc = ur->pc; 
1991/0720    
	if((ur->cs)&0xffff == KESEL) 
1993/1116/sys/src/9/pc/trap.c:455,4621993/1124/sys/src/9/pc/trap.c:461,466
1992/0103    
	splhi(); /* avoid interrupts during the iret */ 
1993/0915    
	if(up->scallnr!=RFORK && (up->procctl || up->nnote)) 
1991/0720    
		notify(ur); 
1992/0804    
                 
1991/0720    
	return ret; 
1991/0710    
} 
 
1991/0720    
/* 


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