~kris/9p

9hist

82a008e85162e5080b3b87ee59fa829c7d1bd375 — David du Colombier 33 years ago dbced7d
Plan 9 from Bell Labs 1992-11-30
3 files changed, 14 insertions(+), 26 deletions(-)

M power/dat.h
M power/mmu.c
M power/trap.c
M power/dat.h => power/dat.h +0 -4
@@ 109,10 109,6 @@ struct Mach
	int	load;
	int	intr;
	int	ledval;			/* value last written to LED */
ulong cause;
ulong status;
ulong ur;
ulong sp;

	int	stack[1];
};

M power/mmu.c => power/mmu.c +6 -10
@@ 14,7 14,6 @@ mapstack(Proc *p)
	ulong tlbvirt, tlbphys;

	if(p->newtlb) {
		/* see flushmmu. */
		memset(p->pidonmach, 0, sizeof p->pidonmach);
		p->newtlb = 0;
	}


@@ 22,12 21,9 @@ mapstack(Proc *p)
	tp = p->pidonmach[m->machno];
	if(tp == 0)
		tp = newtlbpid(p);
/*	if(p->upage->va != (USERADDR|(p->pid&0xFFFF)) && p->pid != 0)
		panic("mapstack %d 0x%lux 0x%lux", p->pid, p->upage->pa, p->upage->va);
*/
	/* don't set m->pidhere[tp] because we're only writing entry 0 */

	tlbvirt = USERADDR | PTEPID(tp);
	tlbphys = p->upage->pa | PTEWRITE | PTEVALID | PTEGLOBL;
	tlbphys = p->upage->pa | PTEWRITE|PTEVALID|PTEGLOBL;
	puttlbx(0, tlbvirt, tlbphys);
	u = (User*)USERADDR;
}


@@ 66,6 62,7 @@ newtlbpid(Proc *p)
	}
	if(h[i])
		purgetlb(i);

	sp = m->pidproc[i];
	if(sp && sp->pidonmach[m->machno] == i)
		sp->pidonmach[m->machno] = 0;


@@ 92,12 89,10 @@ putmmu(ulong tlbvirt, ulong tlbphys, Page *pg)
	}

	p = u->p;
/*	if(p->state != Running)
		panic("putmmu state %lux %lux %s\n", u, p, statename[p->state]);
*/
	tp = p->pidonmach[m->machno];
	if(tp == 0)
		tp = newtlbpid(p);

	tlbvirt |= PTEPID(tp);
	putstlb(tlbvirt, tlbphys);
	puttlb(tlbvirt, tlbphys);


@@ 131,7 126,7 @@ purgetlb(int pid)
	dead[pid] = 1;
	/*
	 * clean out all dead pids from the stlb;
	 * garbage collect any pids with no entries
	 * garbage collect pids with no entries
	 */
	memset(m->pidhere, 0, sizeof m->pidhere);
	pidhere = m->pidhere;


@@ 178,6 173,7 @@ putstlb(ulong tlbvirt, ulong tlbphys)
{
	Softtlb *entry;

	/* This hash function is also coded into utlbmiss in l.s */
	entry = &m->stb[((tlbvirt<<1) ^ (tlbvirt>>12)) & (STLBSIZE-1)];
	entry->phys = tlbphys;
	entry->virt = tlbvirt;

M power/trap.c => power/trap.c +8 -12
@@ 103,9 103,10 @@ trap(Ureg *ur)
		if(u == 0)
			panic("fault u==0 pc %lux addr %lux", ur->pc, ur->badvaddr);

		spllo();
		x = u->p->insyscall;
		u->p->insyscall = 1;

		spllo();
		faultmips(ur, user, ecode);
		u->p->insyscall = x;
		break;


@@ 165,12 166,11 @@ trap(Ureg *ur)
void
intr(Ureg *ur)
{
	int i, any;
	uchar xxx;
	uchar pend, npend;
	long v;
	int i, any;
	ulong cause;
	static int bogies;
	uchar pend, npend, xxx;

	m->intr++;
	cause = ur->cause&(INTR5|INTR4|INTR3|INTR2|INTR1);


@@ 450,7 450,7 @@ noted(Ureg **urp, ulong arg0)
	Ureg *nur;

	nur = u->ureg;
	if(nur->status!=u->svstatus) {
	if(nur->status != u->svstatus) {
		pprint("bad noted ureg status %lux\n", nur->status);
		pexit("Suicide", 0);
	}


@@ 505,12 505,8 @@ syscall(Ureg *aur)
	ur = aur;
	p->pc = ur->pc;
	u->dbgreg = aur;
	ur->cause = 15<<2;		/* for debugging: system call is undef 15;
	/*
	 * since the system call interface does not
	 * guarantee anything about registers, we can
	 * smash them.  but we must save fpstatus.
	 */
	ur->cause = 15<<2;		/* for debugging: system call is undef 15; */

	if(p->fpstate == FPactive) {
		if((ur->status&CU1) == 0)
			panic("syscall: FPactive but no CU1");


@@ 525,8 521,8 @@ syscall(Ureg *aur)
		procctl(p);

	u->scallnr = ur->r1;
	sp = ur->sp;
	u->nerrlab = 0;
	sp = ur->sp;
	ret = -1;
	if(!waserror()){
		if(u->scallnr >= sizeof systab/sizeof systab[0]) {