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

1991/1112/pc/trap.c (diff list | history)

1991/1005/sys/src/9/pc/trap.c:68,731991/1112/sys/src/9/pc/trap.c:68,86 (short | long | prev | next)
1991/0709    
	} 
1991/0703    
} 
 
1991/1112    
void 
debugbpt(Ureg *ur) 
{ 
	char buf[ERRLEN]; 
 
	if(u == 0) 
		panic("kernel bpt"); 
	/* restore pc to instruction that caused the trap */ 
	ur->pc--; 
	sprint(buf, "sys: breakpoint pc=0x%lux", ur->pc); 
	postnote(u->p, 1, buf, NDebug); 
} 
 
1991/0614    
/* 
1991/0703    
 *  set up the interrupt/trap gates 
1991/0614    
 */ 
1991/1005/sys/src/9/pc/trap.c:88,941991/1112/sys/src/9/pc/trap.c:101,106
1991/0823    
	sethvec(0, intr0, SEGTG, 0); 
	sethvec(1, intr1, SEGTG, 0); 
	sethvec(2, intr2, SEGTG, 0); 
	sethvec(3, intr3, SEGTG, 0); 
	sethvec(4, intr4, SEGTG, 0); 
	sethvec(5, intr5, SEGTG, 0); 
	sethvec(6, intr6, SEGTG, 0); 
1991/1005/sys/src/9/pc/trap.c:128,1331991/1112/sys/src/9/pc/trap.c:140,147
1991/0710    
	 */ 
1991/0910    
	sethvec(Syscallvec, intr64, SEGTG, 3); 
	setvec(Syscallvec, (void (*)(Ureg*))syscall); 
1991/1112    
	sethvec(Bptvec, intr3, SEGTG, 3); 
	setvec(Bptvec, debugbpt); 
1991/0710    
 
	/* 
1991/0703    
	 *  tell the hardware where the table is (and how long) 
1991/1005/sys/src/9/pc/trap.c:171,1891991/1112/sys/src/9/pc/trap.c:185,203
1991/0710    
void 
1991/0703    
trap(Ureg *ur) 
1991/0614    
{ 
1991/0731    
	int v; 
1991/1112    
	int v, user; 
1991/0731    
	int c; 
1991/1005    
	static int spuriousfloppy; 
1991/0703    
 
1991/0731    
	v = ur->trap; 
1991/0807    
	if(v>=256 || ivec[v] == 0){ 
1991/1005    
		if(v == 10 && spuriousfloppy == 0){ 
			v = Floppyvec; 
			spuriousfloppy = 1; 
		}else 
			panic("bad trap type %d %lux %lux %lux\n", v, ur->pc, int0mask, int1mask); 
1991/0807    
	} 
1991/0731    
 
1991/1112    
	user = ((ur->cs)&0xffff)!=KESEL && v!=Syscallvec; 
	if(user) 
		u->dbgreg = ur; 
 
	if(v>=256 || ivec[v] == 0) 
		panic("bad trap type %d %lux %lux %lux\n", v, ur->pc, int0mask, int1mask); 
 
1991/0709    
	/* 
	 *  tell the 8259 that we're done with the 
1991/0801    
	 *  highest level interrupt (interrupts are still 
1991/1005/sys/src/9/pc/trap.c:203,2091991/1112/sys/src/9/pc/trap.c:217,223
1991/0913    
	/* 
	 *  syscall does it's own notifying 
	 */ 
1991/0910    
	if(((ur->cs)&0xffff)!=KESEL && u->nnote && v!=Syscallvec) 
1991/1112    
	if(user) 
1991/0910    
		notify(ur); 
1991/0806    
} 
 
1991/1005/sys/src/9/pc/trap.c:273,2781991/1112/sys/src/9/pc/trap.c:287,293
1991/0720    
 
1991/0718    
	u->p->insyscall = 1; 
	u->p->pc = ur->pc; 
1991/1112    
	u->dbgreg = ur; 
1991/0720    
	if((ur->cs)&0xffff == KESEL) 
		panic("recursive system call"); 
1991/0718    
 
1991/1005/sys/src/9/pc/trap.c:307,3131991/1112/sys/src/9/pc/trap.c:322,328
1991/0801    
	ur->ax = ret; 
1991/0802    
	if(ax == NOTED){ 
1991/0720    
		noted(ur, *(ulong*)(sp+BY2WD)); 
1991/0802    
	} else if(u->nnote && ax!=FORK){ 
1991/1112    
	} else if(u->p->procctl || (u->nnote && ax!=FORK)){ 
1991/0720    
		notify(ur); 
	} 
	return ret; 
1991/1005/sys/src/9/pc/trap.c:322,3321991/1112/sys/src/9/pc/trap.c:337,347
1991/0710    
{ 
1991/0720    
	ulong sp; 
 
	lock(&u->p->debug); 
	if(u->nnote==0){ 
		unlock(&u->p->debug); 
1991/1112    
	if(u->p->procctl) 
		procctl(u->p); 
	if(u->nnote==0) 
1991/0720    
		return; 
	} 
1991/1112    
	lock(&u->p->debug); 
1991/0727    
	u->p->notepending = 0; 
1991/0720    
	if(u->note[0].flag!=NUser && (u->notified || u->notify==0)){ 
		if(u->note[0].flag == NDebug) 
1991/1005/sys/src/9/pc/trap.c:420,4231991/1112/sys/src/9/pc/trap.c:435,457
1991/0720    
		unlock(&u->p->debug); 
		pexit(u->lastnote.msg, u->lastnote.flag!=NDebug); 
	} 
1991/1112    
} 
 
/* This routine must save the values of registers the user is not permitted to write 
 * from devproc and the restore the saved values before returning 
 */ 
void 
setregisters(Ureg *xp, char *pureg, char *uva, int n) 
{ 
	ulong flags; 
	ulong cs; 
	ulong ss; 
 
	flags = xp->flags; 
	cs = xp->cs; 
	ss = xp->ss; 
	memmove(pureg, uva, n); 
	xp->flags = (xp->flags & 0xff) | (flags & 0xff00); 
	xp->cs = cs; 
	xp->ss = ss; 
1991/0614    
} 


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