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

1992/1105/power/faultmips.c (diff list | history)

power/faultmips.c on 1990/1212
1990/1212    
#include	"u.h" 
1992/0321    
#include	"../port/lib.h" 
1990/1212    
#include	"mem.h" 
#include	"dat.h" 
#include	"fns.h" 
#include	"ureg.h" 
1992/0111    
#include	"../port/error.h" 
1992/0508    
#include	"io.h" 
1990/1212    
 
/* 
 *  find out fault address and type of access. 
 *  Call common fault handler. 
 */ 
void 
faultmips(Ureg *ur, int user, int code) 
{ 
	ulong addr; 
	extern char *excname[]; 
1991/0705    
	char buf[ERRLEN]; 
1990/1212    
	int read; 
 
1992/0508    
	LEDON(LEDfault); 
1990/1212    
	addr = ur->badvaddr; 
1992/0609    
	if(addr & KZERO) 
		LEDON(LEDkfault); 
1990/1212    
	addr &= ~(BY2PG-1); 
	read = !(code==CTLBM || code==CTLBS); 
1991/0926    
 
1990/1212    
	if(fault(addr, read) < 0){ 
		if(user){ 
1991/1218    
			sprint(buf, "sys: trap: fault %s addr=0x%lux", 
				read? "read" : "write", ur->badvaddr); 
1991/0705    
			postnote(u->p, 1, buf, NDebug); 
1992/0508    
			LEDOFF(LEDfault); 
1991/0705    
			return; 
1990/1212    
		} 
1992/1105    
		iprint("kernel %s badvaddr=0x%lux\n", excname[code], ur->badvaddr); 
		iprint("status=0x%lux pc=0x%lux sp=0x%lux\n", ur->status, ur->pc, ur->sp); 
1990/1212    
		dumpregs(ur); 
		panic("fault"); 
	} 
1992/0508    
	LEDOFF(LEDfault); 
1990/1212    
} 
 
/* 
 * called in sysfile.c 
 */ 
void 
evenaddr(ulong addr) 
{ 
	if(addr & 3){ 
		postnote(u->p, 1, "sys: odd address", NDebug); 
		error(Ebadarg); 
	} 
} 


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