~kris/9p

9hist

eaa55ec8f618c965c894d6a5f4123e388ec5978d — David du Colombier 23 years ago 762fe08
Plan 9 from Bell Labs 2003-02-04
1 files changed, 15 insertions(+), 6 deletions(-)

M pc/devarch.c
M pc/devarch.c => pc/devarch.c +15 -6
@@ 108,8 108,11 @@ ioinit(void)

	// a dummy entry at 2^16
	ioalloc(0x10000, 1, 0, "dummy");
	/*
	 * Someone needs to explain why this was here...
	ioalloc(0x0fff, 1, 0, "dummy");	// i82557 is at 0x1000, the dummy
					// entry is needed for swappable devs.
	 */

	if ((excluded = getconf("ioexclude")) != nil) {
		char *s;


@@ 341,7 344,7 @@ enum
static long
archread(Chan *c, void *a, long n, vlong offset)
{
	char buf[Linelen+1], *p;
	char *buf, *p;
	int port;
	ushort *sp;
	ulong *lp;


@@ 388,23 391,29 @@ archread(Chan *c, void *a, long n, vlong offset)
		break;
	}

	offset = offset/Linelen;
	if((buf = malloc(n)) == nil)
		error(Enomem);
	p = buf;
	n = n/Linelen;
	p = a;
	offset = offset/Linelen;

	lock(&iomap);
	for(m = iomap.m; n > 0 && m != nil; m = m->next){
		if(offset-- > 0)
			continue;
		if(strcmp(m->tag, "dummy") == 0)
			break;
		sprint(buf, "%8lux %8lux %-12.12s\n", m->start, m->end-1, m->tag);
		memmove(p, buf, Linelen);
		sprint(p, "%8lux %8lux %-12.12s\n", m->start, m->end-1, m->tag);
		p += Linelen;
		n--;
	}
	unlock(&iomap);

	return p - (char*)a;
	n = p - buf;
	memmove(a, buf, n);
	free(buf);

	return n;
}

static long