Plan 9 from Bell Labs’s /usr/web/sources/extra/9hist/gnot/fault68020.c

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


## diffname gnot/fault68020.c 1990/1212
## diff -e /dev/null /n/bootesdump/1990/1212/sys/src/9/68020/fault68020.c
0a
#include	"u.h"
#include	"lib.h"
#include	"mem.h"
#include	"dat.h"
#include	"fns.h"
#include	"ureg.h"
#include	"errno.h"

#define	FORMAT(ur)	((((ur)->vo)>>12)&0xF)
#define	OFFSET(ur)	(((ur)->vo)&0xFFF)


struct FFrame
{
	ushort	ireg0;			/* internal register */
	ushort	ssw;			/* special status word */
	ushort	ipsc;			/* instr. pipe stage c */
	ushort	ipsb;			/* instr. pipe stage b */
	ulong	addr;			/* data cycle fault address */
	ushort	ireg1;			/* internal register */
	ushort	ireg2;			/* internal register */
	ulong	dob;			/* data output buffer */
	ushort	ireg3[4];		/* more stuff */
	ulong	baddr;			/* stage b address */
	ushort	ireg4[26];		/* more more stuff */
};

/*
 * SSW bits
 */
#define	RW	0x0040		/* read/write for data cycle */
#define	FC	0x8000		/* fault on stage C of instruction pipe */
#define	FB	0x4000		/* fault on stage B of instruction pipe */
#define	RC	0x2000		/* rerun flag for stage C of instruction pipe */
#define	RB	0x1000		/* rerun flag for stage B of instruction pipe */
#define	DF	0x0100		/* fault/rerun flag for data cycle */
#define	RM	0x0080		/* read-modify-write on data cycle */
#define	READ	0x0040
#define	WRITE	0x0000
#define	SIZ	0x0030		/* size code for data cycle */
#define	FC2	0x0004		/* address space for data cycle */
#define	FC1	0x0002
#define	FC0	0x0001

void
fault68020(Ureg *ur, FFrame *f)
{
	ulong addr, mmuvirt, mmuphys, n, badvaddr;
	Seg *s;
	PTE *opte, *pte, *npte;
	Orig *o;
	char *l;
	Page *pg;
	KMap *k, *k1;
	int zeroed = 0, head = 1;
	int i, user, read, insyscall;

	if(u == 0){
		dumpregs(ur);
		panic("fault u==0 pc=%lux", ur->pc);
	}
	insyscall = u->p->insyscall;
	u->p->insyscall = 1;
	addr = 0;	/* set */
	if(f->ssw & DF)
		addr = f->addr;
	else if(FORMAT(ur) == 0xA){
		if(f->ssw & FC)
			addr = ur->pc+2;
		else if(f->ssw & FB)
			addr = ur->pc+4;
		else
			panic("prefetch pagefault");
	}else if(FORMAT(ur) == 0xB){
		if(f->ssw & FC)
			addr = f->baddr-2;
		else if(f->ssw & FB)
			addr = f->baddr;
		else
			panic("prefetch pagefault");
	}else
		panic("prefetch format");
	addr &= VAMASK;
	badvaddr = addr;
	addr &= ~(BY2PG-1);
	user = !(ur->sr&SUPER);
	if(f->ssw & DF)
		read = (f->ssw&READ) && !(f->ssw&RM);
	else
		read = f->ssw&(FB|FC);
/* print("fault pc=%lux addr=%lux read %d\n", ur->pc, badvaddr, read); /**/

	if(fault(addr, read) < 0){
		if(user){
			pprint("user %s error addr=0x%lux\n", read? "read" : "write", badvaddr);
			pprint("status=0x%lux pc=0x%lux sp=0x%lux\n", ur->sr, ur->pc, ur->sp);
			pexit("Suicide", 0);
		}
		u->p->state = MMUing;
		dumpregs(ur);
		panic("fault: 0x%lux", badvaddr);
		exit();
	}
	u->p->insyscall = insyscall;
}
.
## diffname gnot/fault68020.c 1990/1214
## diff -e /n/bootesdump/1990/1212/sys/src/9/68020/fault68020.c /n/bootesdump/1990/1214/sys/src/9/68020/fault68020.c
48,56c
	ulong addr, badvaddr;
	int user, read, insyscall;
.
## diffname gnot/fault68020.c 1991/0705
## diff -e /n/bootesdump/1991/0201/sys/src/9/68020/fault68020.c /n/bootesdump/1991/0705/sys/src/9/gnot/fault68020.c
83a

.
79a

.
75a

.
## diffname gnot/fault68020.c 1991/0710
## diff -e /n/bootesdump/1991/0705/sys/src/9/gnot/fault68020.c /n/bootesdump/1991/0710/sys/src/9/gnot/fault68020.c
92c
			pprint("status=0x%lux pc=0x%lux sp=0x%lux\n", ur->sr, ur->pc, ur->usp);
.
## diffname gnot/fault68020.c 1991/0719
## diff -e /n/bootesdump/1991/0710/sys/src/9/gnot/fault68020.c /n/bootesdump/1991/0719/sys/src/9/gnot/fault68020.c
91,93c
			sprint(buf, "sys: fault %s pc=0x%lux addr=0x%lux",
				read? "read" : "write", ur->pc, badvaddr);
			postnote(u->p, 1, buf, NDebug);
			notify(ur);
			return;
.
49a
	char buf[ERRLEN];
.
## diffname gnot/fault68020.c 1991/0926
## diff -e /n/bootesdump/1991/0719/sys/src/9/gnot/fault68020.c /n/bootesdump/1991/0926/sys/src/9/gnot/fault68020.c
98d
## diffname gnot/fault68020.c 1991/1108
## diff -e /n/bootesdump/1991/0926/sys/src/9/gnot/fault68020.c /n/bootesdump/1991/1108/sys/src/9/gnot/fault68020.c
94a
			if(u->p->procctl)
				procctl(u->p);
.
## diffname gnot/fault68020.c 1991/1112
## diff -e /n/bootesdump/1991/1108/sys/src/9/gnot/fault68020.c /n/bootesdump/1991/1112/sys/src/9/gnot/fault68020.c
95,96d
57a
	u->dbgreg = ur;
.
## diffname gnot/fault68020.c 1991/1218
## diff -e /n/bootesdump/1991/1112/sys/src/9/gnot/fault68020.c /n/bootesdump/1991/1218/sys/src/9/gnot/fault68020.c
93,94c
			sprint(buf, "sys: trap: fault %s addr=0x%lux",
				read? "read" : "write", badvaddr);
.
## diffname gnot/fault68020.c 1992/0111
## diff -e /n/bootesdump/1991/1218/sys/src/9/gnot/fault68020.c /n/bootesdump/1992/0111/sys/src/9/gnot/fault68020.c
7c
#include	"../port/error.h"
.
## diffname gnot/fault68020.c 1992/0201
## diff -e /n/bootesdump/1992/0111/sys/src/9/gnot/fault68020.c /n/bootesdump/1992/0201/sys/src/9/gnot/fault68020.c
82a
	if(user)
		u->dbgreg = ur;
.
58d
## diffname gnot/fault68020.c 1992/0321
## diff -e /n/bootesdump/1992/0201/sys/src/9/gnot/fault68020.c /n/bootesdump/1992/0321/sys/src/9/gnot/fault68020.c
2c
#include	"../port/lib.h"
.
## diffname gnot/fault68020.c 1992/0812
## diff -e /n/bootesdump/1992/0321/sys/src/9/gnot/fault68020.c /n/bootesdump/1992/0812/sys/src/9/gnot/fault68020.c
102d
## diffname gnot/fault68020.c 1993/0501 # deleted
## diff -e /n/bootesdump/1992/0812/sys/src/9/gnot/fault68020.c /n/fornaxdump/1993/0501/sys/src/brazil/gnot/fault68020.c
1,104d

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.