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

1991/0717/ss/trap.c (diff list | history)

1991/0713/sys/src/9/ss/trap.c:8,141991/0717/sys/src/9/ss/trap.c:8,14 (short | long | prev | next)
1990/1223    
#include	"errno.h" 
 
void	notify(Ureg*); 
void	noted(Ureg**); 
1991/0717    
void	noted(Ureg**, ulong); 
1990/1223    
void	rfnote(Ureg**); 
 
1990/1226    
extern	void traplink(void); 
1991/0713/sys/src/9/ss/trap.c:232,2371991/0717/sys/src/9/ss/trap.c:232,238
1990/1223    
	if(!u->notified){ 
		if(!u->notify) 
			goto Die; 
1991/0717    
		u->svpsr = ur->psr; 
1990/1223    
		sp = ur->usp; 
		sp -= sizeof(Ureg); 
		u->ureg = (void*)sp; 
1991/0713/sys/src/9/ss/trap.c:247,2521991/0717/sys/src/9/ss/trap.c:248,254
1991/0112    
		ur->npc = (ulong)u->notify+4; 
1990/1223    
		u->notified = 1; 
		u->nnote--; 
1991/0717    
		memmove(&u->lastnote, &u->note[0], sizeof(Note)); 
1991/0318    
		memmove(&u->note[0], &u->note[1], u->nnote*sizeof(Note)); 
1990/1223    
	} 
	unlock(&u->p->debug); 
1991/0713/sys/src/9/ss/trap.c:256,2631991/0717/sys/src/9/ss/trap.c:258,274
1990/1223    
 * Return user to state before notify() 
 */ 
void 
noted(Ureg **urp) 
1991/0717    
noted(Ureg **urp, ulong arg0) 
1990/1223    
{ 
1991/0717    
	Ureg *nur; 
 
	nur = u->ureg; 
	validaddr(nur->pc, 1, 0); 
	validaddr(nur->usp, BY2WD, 0); 
	if(nur->psr!=u->svpsr){ 
		pprint("bad noted ureg psr %lux\n", nur->psr); 
		pexit("Suicide", 0); 
	} 
1990/1223    
	lock(&u->p->debug); 
	if(!u->notified){ 
		unlock(&u->p->debug); 
1991/0713/sys/src/9/ss/trap.c:266,2741991/0717/sys/src/9/ss/trap.c:277,301
1990/1223    
	u->notified = 0; 
1991/0318    
	memmove(*urp, u->ureg, sizeof(Ureg)); 
1991/0112    
	(*urp)->r7 = -1;	/* return error from the interrupted call */ 
1990/1223    
	unlock(&u->p->debug); 
	splhi(); 
	rfnote(urp); 
1991/0717    
	switch(arg0){ 
	case NCONT: 
		splhi(); 
		unlock(&u->p->debug); 
		rfnote(urp); 
		break; 
		/* never returns */ 
 
	default: 
		pprint("unknown noted arg 0x%lux\n", arg0); 
		u->lastnote.flag = NDebug; 
		/* fall through */ 
		 
	case NTERM: 
		if(u->lastnote.flag == NDebug) 
			pprint("suicide: %s\n", u->lastnote.msg); 
		unlock(&u->p->debug); 
		pexit(u->lastnote.msg, u->lastnote.flag!=NDebug); 
	} 
1990/1223    
} 
 
#undef	CHDIR	/* BUG */ 
1991/0713/sys/src/9/ss/trap.c:376,3821991/0717/sys/src/9/ss/trap.c:403,409
1991/0614    
	} 
1990/1223    
	u->p->insyscall = 0; 
1990/1226    
	if(r7 == NOTED)	/* ugly hack */ 
1990/1223    
		noted(&aur);	/* doesn't return */ 
1991/0717    
		noted(&aur, *(ulong*)(sp+1*BY2WD));	/* doesn't return */ 
1990/1223    
	if(u->nnote){ 
1990/1226    
		ur->r7 = ret; 
1990/1223    
		notify(ur); 


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