~kris/9p

9hist

4c74c8e3b69dbdee009d03d6c0dc8f98fb0bdfe0 — David du Colombier 28 years ago 20938cf
Plan 9 from Bell Labs 1997-12-08
6 files changed, 61 insertions(+), 4 deletions(-)

M carrera/mem.h
M port/alloc.c
M port/chan.c
M port/devproc.c
M port/netif.c
M port/sysfile.c
M carrera/mem.h => carrera/mem.h +1 -1
@@ 213,7 213,7 @@
#define	TSTKSIZ 100
#define	KZERO	KSEG0			/* base of kernel address space */
#define	KTZERO	(KZERO+0x12000)		/* first address in kernel text */
#define	USTKSIZE	(4*1024*1024)	/* size of user stack */
#define	USTKSIZE	(8*1024*1024)	/* size of user stack */
#define globalmem(x)	(((ulong)x)&KZERO)	/* addresses valid in all contexts */
/*
 * Exception codes

M port/alloc.c => port/alloc.c +4 -2
@@ 617,7 617,9 @@ recur(Bhdr *t)
}

int
poolok(void)
poolok(int x)
{
	return recur(mainmem->root);
	if(x & 1)
		return recur(mainmem->root);
	return recur(imagmem->root);
}

M port/chan.c => port/chan.c +41 -0
@@ 104,6 104,47 @@ newchan(void)
	return c;
}

int
okchan1(Chan *c)
{
	if(c->type > 64)
		return 0;
	if((ulong)(c->next) & 3)
		return 0;
	if((ulong)(c->link) & 3)
		return 0;
	if((ulong)(c->path) & 3)
		return 0;
	if((ulong)(c->mnt) & 3)
		return 0;
	if((ulong)(c->xmnt) & 3)
		return 0;
	if((ulong)(c->mcp) & 3)
		return 0;
	if((ulong)(c->mchan) & 3)
		return 0;
	if((ulong)(c->session) & 3)
		return 0;
	return 1;
}

void
okchan(char *msg, int n)
{
	int s;
	Chan *c;

	return;
	s = splhi();
	for(c = chanalloc.list; c; c = c->link)
		if(!okchan1(c)){
			spllo();
			print("okchan: %s (%d=#%.8lux)\n", msg, n, n);
			panic("okchan");
		}
	splx(s);
}

void
chanfree(Chan *c)
{

M port/devproc.c => port/devproc.c +7 -1
@@ 882,13 882,19 @@ procctlmemio(Proc *p, ulong offset, int n, void *va, int read)
		n = l;

	k = kmap(pg);
	if(waserror()) {
		s->steal--;
		kunmap(k);
		nexterror();
	}
	b = (char*)VA(k);
	b += offset&(BY2PG-1);
	if(read == 1)
		memmove(a, b, n);
		memmove(a, b, n);	/* This can fault */
	else
		memmove(b, a, n);
	kunmap(k);
	poperror();

	/* Ensure the process sees text page changes */
	if(s->flushme)

M port/netif.c => port/netif.c +4 -0
@@ 171,6 171,10 @@ netifread(Netif *nif, Chan *c, void *a, long n, ulong offset)
	switch(NETTYPE(c->qid.path)){
	case Ndataqid:
		f = nif->f[NETID(c->qid.path)];
okchan("before qread", 0);
j = qread(f->in, a, n);
okchan("after qread", j);
return j;
		return qread(f->in, a, n);
	case Nctlqid:
		return readnum(offset, a, n, NETID(c->qid.path), NUMSIZE);

M port/sysfile.c => port/sysfile.c +4 -0
@@ 230,7 230,9 @@ sysopen(ulong *arg)
		nexterror();
	}
	validaddr(arg[0], 1, 0);
okchan("before open namec", 0);
	c = namec((char*)arg[0], Aopen, arg[1], 0);
okchan("after open namec", 0);
	fd = newfd(c);
	poperror();
	return fd;


@@ 515,7 517,9 @@ sysfstat(ulong *arg)
		cclose(c);
		nexterror();
	}
okchan("before stat routine", c->type);
	devtab[c->type]->stat(c, (char*)arg[1]);
okchan("after stat routine", c->type);
	poperror();
	cclose(c);
	return 0;