~kris/9p

9hist

7c848aca21eee26d8d5d56454d724caab03a0d0a — David du Colombier 27 years ago 8026984
Plan 9 from Bell Labs 1999-05-01
M alphapc/arch164.c => alphapc/arch164.c +8 -2
@@ 42,7 42,7 @@ sginit(void)
	for(pa = 0; pa < 8*1024*1024; pa += BY2PG)
		*pte++ = ((pa>>PGSHIFT)<<1)|1;

	wind[0x400/4] = ISAWINDOW|2;
	wind[0x400/4] = ISAWINDOW|4|2|1;
	wind[0x440/4] = 0x00700000;
	wind[0x480/4] = PADDR(sgmap);
}


@@ 91,7 91,7 @@ sginit();
	core[0x8200/4] = 0x7ff;

	/* set config: byte/word enable, no monster window, etc. */
	core[0x140/4] = 1;
	core[0x140/4] = 0x21;

	/* turn off mcheck on master abort.  now we can probe PCI space. */
	core[0x8280/4] &= ~(1<<7);


@@ 101,6 101,12 @@ sginit();
	cserve(52, 4);		/* enable SIO interrupt */
}

void
ciaerror(void)
{
	print("cia error 0x%luX\n", core[0x8200/4]);
}

static void
corehello(void)
{

M alphapc/clock.c => alphapc/clock.c +2 -2
@@ 91,8 91,8 @@ microdelay(int us)
{
	uvlong eot;

	eot = cycletimer() + (m->cpuhz/1000000)*us;
	while(cycletimer() < eot)
	eot = fastticks(nil) + (m->cpuhz/1000000)*us;
	while(fastticks(nil) < eot)
		;
}


M alphapc/devfloppy.c => alphapc/devfloppy.c +25 -3
@@ 39,7 39,7 @@ enum {
};

#define DPRINT if(floppydebug)print
int floppydebug = 0;
int floppydebug = 1;

/*
 *  types of drive (from PC equipment byte)


@@ 56,12 56,14 @@ enum
FType floppytype[] =
{
 { "3½HD",	T1440kb, 512, 18, 2, 1, 80, 0x1B, 0x54,	0, },
/*
 { "3½DD",	T1440kb, 512,  9, 2, 1, 80, 0x1B, 0x54, 2, },
 { "3½DD",	T720kb,  512,  9, 2, 1, 80, 0x1B, 0x54, 2, },
 { "5¼HD",	T1200kb, 512, 15, 2, 1, 80, 0x2A, 0x50, 0, },
 { "5¼DD",	T1200kb, 512,  9, 2, 2, 40, 0x2A, 0x50, 1, },
 { "ATT3B1",	T1200kb, 512,  8, 2, 2, 48, 0x2A, 0x50, 1, },
 { "5¼DD",	T360kb,  512,  9, 2, 1, 40, 0x2A, 0x50, 2, },
 */
};

/*


@@ 533,6 535,7 @@ floppycmd(void)
			microdelay(8);	/* for machine independence */
		}
		outb(Pfdata, fl.cmd[i]);
microdelay(8);	/* for machine independence */
	}
	return 0;
}


@@ 636,7 639,11 @@ cmddone(void *)
static void
floppywait(void)
{
vlong t0, t1;
t0 = fastticks(nil);
	tsleep(&fl.r, cmddone, 0, 5000);
t1 = fastticks(nil);
print("wait %lld ticks\n", t1-t0);
	if(!cmddone(0)){
		floppyintr(0);
		fl.confused = 1;


@@ 680,9 687,22 @@ floppyrecal(FDrive *dp)
	return 0;
}

static void
specify(void)
{
	fl.ncmd = 0;
	fl.cmd[fl.ncmd++] = Fspec;
	fl.cmd[fl.ncmd++] = 0;
	fl.cmd[fl.ncmd++] = 1;
	if(floppycmd() < 0)
		return;
	floppywait();
	fldump();
}

/*
 *  if the controller or a specific drive is in a confused state,
 *  reset it and get back to a kown state
 *  reset it and get back to a known state
 */
static void
floppyrevive(void)


@@ 774,7 794,7 @@ floppyxfer(FDrive *dp, int cmd, void *a, long off, long n)
	/* retry on error (until it gets ridiculous) */
	tries = 0;
	while(waserror()){
		if(tries++ > 20)
		if(tries++ > 2/*0*/)
			nexterror();
		DPRINT("floppyxfer: retrying\n");
		/*floppyon(dp);*/


@@ 820,6 840,8 @@ floppyxfer(FDrive *dp, int cmd, void *a, long off, long n)
	/*
	 *  give bus to DMA, floppyintr() will read result
	 */
delay(10);
print("msr 0x%2.2uX\n", inb(Pmsr));
	floppywait();
	dmaend(DMAchan);
	poperror();

M alphapc/dma.c => alphapc/dma.c +15 -7
@@ 85,6 85,7 @@ dmainit(int chan, int maxtransfer)
			return 1;
		return 0;
	}
outb(dp->mc, 0);

	xp->bva = xspanalloc(maxtransfer, BY2PG, 64*1024);
	if(xp->bva == nil)


@@ 126,14 127,15 @@ dmasetup(int chan, void *va, long len, int isread)

	dp = &dma[(chan>>2)&1];
	chan = chan & 3;
//print("va%lux+", va);
#define tryPCI
#ifdef notdef
	xp = &dp->x[chan];

	/*
	 *  if this isn't kernel memory or crossing 64k boundary or above 16 meg
	 *  use the bounce buffer.
	 */
print("va%lux+", va);
#ifdef notdef
	pa = PADDR(va);
	if((((ulong)va)&0xF0000000) != KZERO
	|| (pa&0xFFFF0000) != ((pa+len)&0xFFFF0000)


@@ 151,9 153,13 @@ print("va%lux+", va);
	}
	else
		xp->len = 0;
#else
	pa = ISAWADDR(va);
#endif /* notdef */
#ifdef tryISA
	pa = ISAWADDR(va);
#endif /* tryISA */
#ifdef tryPCI
	pa = PCIWADDR(va);
#endif /* tryPCI */

	/*
	 * this setup must be atomic


@@ 165,12 171,14 @@ print("va%lux+", va);
	outb(dp->addr[chan], pa>>dp->shift);		/* set address */
	outb(dp->addr[chan], pa>>(8+dp->shift));
	outb(dp->page[chan], pa>>16);
//outb(0x400|dp->page[chan], pa>>24);
#ifdef tryPCI
	outb(0x400|dp->page[chan], pa>>24);
#endif /* tryPCI */
	outb(dp->count[chan], (len>>dp->shift)-1);		/* set count */
	outb(dp->count[chan], ((len>>dp->shift)-1)>>8);
	outb(dp->sbm, chan);		/* enable the channel */
	iunlock(dp);
print("pa%lux+", pa);
//print("pa%lux+", pa);

	return len;
}


@@ 215,7 223,7 @@ i = inb(dp->addr[chan]);
i |= inb(dp->addr[chan])<<8;
i |= inb(dp->page[chan])<<16;
i |= inb(0x400|dp->page[chan])<<24;
print("X%uX+", i);
//print("X%uX+", i);
}

	xp = &dp->x[chan];

M boot/local.c => boot/local.c +5 -5
@@ 62,7 62,7 @@ connectlocal(void)
	char *dev;
	char *args[16], **argp;

	if(stat("/fs", d) < 0)
	if(stat("/kfs", d) < 0)
		return -1;

	dev = disk ? disk : bootdisk;


@@ 73,7 73,7 @@ connectlocal(void)
			return -1;
	}

	print("fs...");
	print("kfs...");
	if(bind("#c", "/dev", MREPL) < 0)
		fatal("bind #c");
	if(bind("#p", "/proc", MREPL) < 0)


@@ 89,13 89,13 @@ connectlocal(void)
		close(p[0]);
		close(p[1]);
		argp = args;
		*argp++ = "fs";
		*argp++ = "kfs";
		*argp++ = "-f";
		*argp++ = partition;
		*argp++ = "-s";
		*argp = 0;
		exec("/fs", args);
		fatal("can't exec fs");
		exec("/kfs", args);
		fatal("can't exec kfs");
	default:
		break;
	}

M ip/il.c => ip/il.c +1 -0
@@ 190,6 190,7 @@ void	iliput(Proto*, uchar*, Block*);
void	iladvise(Proto*, Block*, char*);
int	ilnextqt(Ilcb*);
void	ilcbinit(Ilcb*);
int	later(ulong, ulong, char*);

	int 	ilcksum = 1;
static 	int 	initseq = 25001;

M pc/devastar.c => pc/devastar.c +1 -1
@@ 322,7 322,7 @@ setpage(Astar *a, ulong offset)
	int i;

	if(a->pci){
		print("#G%d: setpage caller pc %luX\n", a->id, getcallerpc(a));
		print("#G%d: setpage caller pc %luX\n", a->id, getcallerpc(&a));
		return;
	}


M pc/fns.h => pc/fns.h +1 -1
@@ 115,7 115,7 @@ int	xchgw(ushort*, int);
ulong	TK2MS(ulong);				/* ticks to milliseconds */

#define	waserror()	(up->nerrlab++, setlabel(&up->errlab[up->nerrlab-1]))
#define getcallerpc(x)	(((ulong*)(&x))[-1])
#define getcallerpc(x)	(((ulong*)(x))[-1])
#define KADDR(a)	((void*)((ulong)(a)|KZERO))
#define PADDR(a)	((ulong)(a)&~KZERO)


M port/alloc.c => port/alloc.c +20 -0
@@ 368,6 368,11 @@ malloc(ulong size)
	v = poolalloc(mainmem, size);
	if(v != nil)
		memset(v, 0, size);
{
Bhdr *h;
D2B(h, v);
B2T(h)->pad = getcallerpc(&size);
}
	return v;
}



@@ 383,6 388,11 @@ smalloc(ulong size)
		tsleep(&up->sleep, return0, 0, 100);
	}
	memset(v, 0, size);
{
Bhdr *h;
D2B(h, v);
B2T(h)->pad = getcallerpc(&size);
}
	return v;
}



@@ 394,6 404,11 @@ mallocz(ulong size, int clr)
	v = poolalloc(mainmem, size);
	if(clr && v != nil)
		memset(v, 0, size);
{
Bhdr *h;
D2B(h, v);
B2T(h)->pad = getcallerpc(&size);
}
	return v;
}



@@ 429,6 444,11 @@ realloc(void *v, ulong size)
		memmove(nv, v, osize);
		free(v);
	}
{
Bhdr *h;
D2B(h, nv);
B2T(h)->pad = getcallerpc(&size);
}
	return nv;
}


M port/chan.c => port/chan.c +1 -1
@@ 144,7 144,7 @@ void
cclose(Chan *c)
{
	if(c->flag&CFREE)
		panic("cclose %lux", getcallerpc(c));
		panic("cclose %lux", getcallerpc(&c));
	if(decref(c))
		return;


M port/debugalloc.c => port/debugalloc.c +4 -4
@@ 414,7 414,7 @@ malloc(ulong size)
	void *v;

	v = poolalloc(mainmem, size);
remember(getcallerpc(size), v);
remember(getcallerpc(&size), v);
	if(v != nil)
		memset(v, 0, size);
	return v;


@@ 427,7 427,7 @@ smalloc(ulong size)

	for(;;) {
		v = poolalloc(mainmem, size);
remember(getcallerpc(size), v);
remember(getcallerpc(&size), v);
		if(v != nil)
			break;
		tsleep(&up->sleep, return0, 0, 100);


@@ 442,7 442,7 @@ mallocz(ulong size, int clr)
	void *v;

	v = poolalloc(mainmem, size);
remember(getcallerpc(size), v);
remember(getcallerpc(&size), v);
	if(clr && v != nil)
		memset(v, 0, size);
	return v;


@@ 477,7 477,7 @@ realloc(void *v, ulong size)
		return v;

	nv = poolalloc(mainmem, size);
remember(getcallerpc(v), nv);
remember(getcallerpc(&v), nv);
	if(nv != nil) {
		memmove(nv, v, osize);
		free(v);

M port/devdraw.c => port/devdraw.c +1 -1
@@ 1787,7 1787,7 @@ Dev drawdevtab = {
 * On 8 bit displays, load the default color map
 */
void
drawcmap(invert){
drawcmap(int invert){
	int r, g, b, cr, cg, cb, v;
	int num, den;
	int i, j;

M port/devpipe.c => port/devpipe.c +1 -1
@@ 289,7 289,7 @@ pipewrite(Chan *c, void *va, long n, vlong)
	Pipe *p;

	if(!islo())
		print("pipewrite hi %lux\n", getcallerpc(c));
		print("pipewrite hi %lux\n", getcallerpc(&c));
	if(waserror()) {
		/* avoid notes when pipe is a mounted queue */
		if((c->flag & CMSG) == 0)

M port/qio.c => port/qio.c +3 -3
@@ 242,7 242,7 @@ padblock(Block *bp, int size)
		}

		if(bp->next)
			panic("padblock 0x%uX", getcallerpc(bp));
			panic("padblock 0x%uX", getcallerpc(&bp));
		n = BLEN(bp);
		padblockcnt++;
		nbp = allocb(size+n);


@@ 256,7 256,7 @@ padblock(Block *bp, int size)
		size = -size;

		if(bp->next)
			panic("padblock 0x%uX", getcallerpc(bp));
			panic("padblock 0x%uX", getcallerpc(&bp));

		if(bp->lim - bp->wp >= size)
			return bp;


@@ 1105,7 1105,7 @@ qwrite(Queue *q, void *vp, int len)
	uchar *p = vp;

	QDEBUG if(islo() == 0)
		print("qwrite hi %lux\n", getcallerpc(q));
		print("qwrite hi %lux\n", getcallerpc(&q));

	sofar = 0;
	do {

M port/qlock.c => port/qlock.c +1 -1
@@ 37,7 37,7 @@ rwstats.qlockq++;
	q->tail = mp;
	mp->qnext = 0;
	mp->state = Queueing;
	up->qpc = getcallerpc(q);
	up->qpc = getcallerpc(&q);
	unlock(&q->use);
	sched();
}

M port/taslock.c => port/taslock.c +8 -8
@@ 33,7 33,7 @@ lock(Lock *l)
	int i, cansched;
	ulong pc, oldpri;

	pc = getcallerpc(l);
	pc = getcallerpc(&l);

lockstats.locks++;
	if(tas(&l->key) == 0){


@@ 89,7 89,7 @@ ilock(Lock *l)
	ulong pc, oldpri;
	int cansched;

	pc = getcallerpc(l);
	pc = getcallerpc(&l);
lockstats.locks++;

	x = splhi();


@@ 138,7 138,7 @@ canlock(Lock *l)
	if(tas(&l->key))
		return 0;

	l->pc = getcallerpc(l);
	l->pc = getcallerpc(&l);
	l->p = up;
	l->isilock = 0;
	return 1;


@@ 149,9 149,9 @@ unlock(Lock *l)
{

	if(l->key == 0)
		print("unlock: not locked: pc %luX\n", getcallerpc(l));
		print("unlock: not locked: pc %luX\n", getcallerpc(&l));
	if(l->isilock)
		print("iunlock of lock: pc %lux, held by %lux\n", getcallerpc(l), l->pc);
		print("iunlock of lock: pc %lux, held by %lux\n", getcallerpc(&l), l->pc);
	l->pc = 0;
	l->key = 0;
	coherence();


@@ 163,15 163,15 @@ iunlock(Lock *l)
	ulong sr;

	if(l->key == 0)
		print("iunlock: not locked: pc %luX\n", getcallerpc(l));
		print("iunlock: not locked: pc %luX\n", getcallerpc(&l));
	if(!l->isilock)
		print("unlock of ilock: pc %lux, held by %lux\n", getcallerpc(l), l->pc);
		print("unlock of ilock: pc %lux, held by %lux\n", getcallerpc(&l), l->pc);

	sr = l->sr;
	l->pc = 0;
	l->key = 0;
	coherence();

	m->splpc = getcallerpc(l);
	m->splpc = getcallerpc(&l);
	splxpc(sr);
}