~kris/9p

9hist

aeb605a91c8a01a448497929f7176a0d2a06b257 — David du Colombier 25 years ago d4fb276
Plan 9 from Bell Labs 2001-04-24
13 files changed, 40 insertions(+), 85 deletions(-)

D alphapc/segment.h
D bitsy/segment.h
M carrera/main.c
D carrera/segment.h
D mpc/segment.h
M pc/ether82557.c
D pc/segment.h
M port/chan.c
M port/devproc.c
M port/fault.c
M port/portdat.h
M port/segment.c
M port/swap.c
D alphapc/segment.h => alphapc/segment.h +0 -9
@@ 1,9 0,0 @@
/*
 * Attach segment types
 */

Physseg physseg[10] = {
	{ SG_SHARED,	"shared",	0,	SEGMAXSIZE,	0, 	0 },
	{ SG_BSS,	"memory",	0,	SEGMAXSIZE,	0,	0 },
	{ 0,		0,		0,	0,		0,	0 },
};

D bitsy/segment.h => bitsy/segment.h +0 -8
@@ 1,8 0,0 @@
/*
 * Attach segment types
 */
static Physseg physseg[10] = {
	{ SG_SHARED,	"shared",	0,	SEGMAXSIZE,	0, 	0 },
	{ SG_BSS,	"memory",	0,	SEGMAXSIZE,	0,	0 },
	{ 0,		0,		0,	0,		0,	0 },
};

M carrera/main.c => carrera/main.c +24 -0
@@ 40,6 40,8 @@ extern	uchar rdbgcode[];
extern	ulong	rdbglen;
extern	int	noprint;

static void	addps(void);

void
main(void)
{


@@ 63,6 65,7 @@ main(void)
	procinit0();
	initseg();
	links();
	addps();
	chandevreset();
	swapinit();
	userinit();


@@ 590,3 593,24 @@ return;/**/
	/* Install the debugger code in a known place */
	memmove((void*)0xA001C000, rdbgcode, rdbglen);
}

/*
 *  physical segs unique to the carrera
 */
static Physseg myphyssegs[] =
{
	{ SG_PHYSICAL,	"eisaio",	Eisaphys,	64*1024,	0, 0 },
	{ SG_PHYSICAL,	"eisavga",	Eisavgaphys,	128*1024,	0, 0 },
	{ SG_PHYSICAL,	"bootrom",	0x1fc00000,	256*1024,	0, 0 },
	{ SG_PHYSICAL,	"nvram",	0xe0009000,	12*1024,	0, 0 },
	{ SG_PHYSICAL,	"fb",		0x40000000,	4*1024*1024,	0, 0 },
};

static void
addps(void)
{
	int i;

	for(i = 0; i < nelem(myphyssegs); i++)
		addphysseg(&myphyssegs[i]);
}

D carrera/segment.h => carrera/segment.h +0 -16
@@ 1,16 0,0 @@
/*
 * Attach segment types
 */

Physseg physseg[] =
{
	{ SG_SHARED,	"shared",	0,		SEGMAXSIZE,	0, 0 },
	{ SG_BSS,	"memory",	0,		SEGMAXSIZE,	0, 0 },
	{ SG_MAP,	"map",		0,		SEGMAXSIZE,	0, 0 },
	{ SG_PHYSICAL,	"eisaio",	Eisaphys,	64*1024,	0, 0 },
	{ SG_PHYSICAL,	"eisavga",	Eisavgaphys,	128*1024,	0, 0 },
	{ SG_PHYSICAL,	"bootrom",	0x1fc00000,	256*1024,	0, 0 },
	{ SG_PHYSICAL,	"nvram",	0xe0009000,	12*1024,	0, 0 },
	{ SG_PHYSICAL,	"fb",		0x40000000,	4*1024*1024,	0, 0 },
	{ 0,		0,		0,		0,		0, 0 },
};

D mpc/segment.h => mpc/segment.h +0 -8
@@ 1,8 0,0 @@
/*
 * Attach segment types
 */
static Physseg physseg[10] = {
	{ SG_SHARED,	"shared",	0,	SEGMAXSIZE,	0, 	0 },
	{ SG_BSS,	"memory",	0,	SEGMAXSIZE,	0,	0 },
	{ 0,		0,		0,	0,		0,	0 },
};

M pc/ether82557.c => pc/ether82557.c +7 -6
@@ 225,7 225,6 @@ typedef struct Ctlr {
} Ctlr;

static Ctlr* ctlrhead;
static Ctlr* ctlrtail;

static uchar configdata[24] = {
	0x16,				/* byte count */


@@ 914,11 913,13 @@ i82557pci(void)
		ctlr->port = port;
		ctlr->pcidev = p;

		if(ctlrhead != nil)
			ctlrtail->next = ctlr;
		else
			ctlrhead = ctlr;
		ctlrtail = ctlr;
		/*
		 *  this is backwards from what we really wanted to do
		 *  but this keeps the numbering of ethernet cards
		 *  consistent with 9load.
		 */
		ctlr->next = ctlrhead;
		ctlrhead = ctlr;

		pcisetbme(p);
	}

D pc/segment.h => pc/segment.h +0 -8
@@ 1,8 0,0 @@
/*
 * Attach segment types
 */
static Physseg physseg[10] = {
	{ SG_SHARED,	"shared",	0,	SEGMAXSIZE,	0, 	0 },
	{ SG_BSS,	"memory",	0,	SEGMAXSIZE,	0,	0 },
	{ 0,		0,		0,	0,		0,	0 },
};

M port/chan.c => port/chan.c +2 -0
@@ 664,6 664,8 @@ namec(char *name, int amode, int omode, ulong perm)
		cname = newcname(name);	/* save this before advancing */
		name = skipslash(name);
		c = cclone(up->slash, 0);
		if(*name == 0)
			isdot = 1;
		break;
	case '#':
		cname = newcname(name);	/* save this before advancing */

M port/devproc.c => port/devproc.c +1 -1
@@ 49,7 49,7 @@ Dirtab procdir[] =
};

/* Segment type from portdat.h */
char *sname[]={ "Text", "Data", "Bss", "Stack", "Shared", "Phys", "Shdata", "Map" };
char *sname[]={ "Text", "Data", "Bss", "Stack", "Shared", "Phys", "Shdata" };

/*
 * Qids are, in path:

M port/fault.c => port/fault.c +1 -8
@@ 53,12 53,10 @@ fixfault(Segment *s, ulong addr, int read, int doputmmu)
	int type;
	int ref;
	Pte **p, *etp;
	char buf[ERRLEN];
	ulong va, mmuphys=0, soff;
	ulong mmuphys=0, soff;
	Page **pg, *lkp, *new;
	Page *(*fn)(Segment*, ulong);

	va = addr;
	addr &= ~(BY2PG-1);
	soff = addr-s->base;
	p = &s->map[soff/PTEMAPMEM];


@@ 90,12 88,7 @@ fixfault(Segment *s, ulong addr, int read, int doputmmu)
	case SG_BSS:
	case SG_SHARED:			/* Zero fill on demand */
	case SG_STACK:
	case SG_MAP:
		if(*pg == 0) {
			if(type == SG_MAP) {
				sprint(buf, "map 0x%lux %c", va, read ? 'r' : 'w');
				postnote(up, 1, buf, NDebug);
			}
			new = newpage(1, &s, addr);
			if(s == 0)
				return -1;

M port/portdat.h => port/portdat.h +0 -1
@@ 343,7 343,6 @@ enum
	SG_SHARED	= 04,
	SG_PHYSICAL	= 05,
	SG_SHDATA	= 06,
	SG_MAP		= 07,

	SG_RONLY	= 0040,		/* Segment is read only */
	SG_CEXEC	= 0100,		/* Detach at exec */

M port/segment.c => port/segment.c +5 -18
@@ 158,7 158,6 @@ dupseg(Segment **seg, int segno, int share)
	case SG_TEXT:		/* New segment shares pte set */
	case SG_SHARED:
	case SG_PHYSICAL:
	case SG_SHDATA:
		goto sameseg;

	case SG_STACK:


@@ 166,13 165,8 @@ dupseg(Segment **seg, int segno, int share)
		break;

	case SG_BSS:		/* Just copy on write */
	case SG_MAP:
		if(share) {
			if(s->ref != 1)
				print("Fuckin A cap'n!\n");
			s->type = (s->type&~SG_TYPE)|SG_SHARED;
		if(share)
			goto sameseg;
		}
		n = newseg(s->type, s->base, s->size);
		break;



@@ 183,12 177,8 @@ dupseg(Segment **seg, int segno, int share)
			return data2txt(s);
		}

		if(share) {
			if(s->ref != 1)
				print("Fuckin A again cap'n!\n");
			s->type = (s->type&~SG_TYPE)|SG_SHDATA;
		if(share)
			goto sameseg;
		}
		n = newseg(s->type, s->base, s->size);

		incref(s->image);


@@ 203,6 193,8 @@ dupseg(Segment **seg, int segno, int share)
			n->map[i] = ptecpy(pte);

	n->flushme = s->flushme;
	if(s->ref > 1)
		procflushseg(s);
	poperror();
	qunlock(&s->lk);
	return n;


@@ 531,13 523,8 @@ mfreeseg(Segment *s, ulong start, int pages)
	}
out:
	/* flush this seg in all other processes */
	i = s->type&SG_TYPE;
	switch(i){
	case SG_SHARED:
	case SG_SHDATA:
	if(s->ref > 1)
		procflushseg(s);
		break;
	}

	/* free the pages */
	for(pg = list; pg != nil; pg = list){

M port/swap.c => port/swap.c +0 -2
@@ 148,7 148,6 @@ loop:
					case SG_STACK:
					case SG_SHARED:
					case SG_SHDATA:
					case SG_MAP:
						up->psstate = "Pageout";
						pageout(p, s);
						if(ioptr != 0) {


@@ 282,7 281,6 @@ pagepte(int type, Page **pg)
	case SG_STACK:
	case SG_SHARED:
	case SG_SHDATA:
	case SG_MAP:
		/*
		 *  get a new swap address and clear any pages
		 *  referring to it from the cache