~kris/9p

9hist

06c52a46da3eb340be1f2494bd93364861efdca0 — David du Colombier 35 years ago 23672e4
Plan 9 from Bell Labs 1991-09-26
M gnot/boot.c => gnot/boot.c +254 -149
@@ 47,82 47,87 @@ int	authenticate(int);
void	termtype(char*);
void	setuser(char*);
int	fileserver(void);
int	inconctl(void);
int	asyncctl(char*);
int	inconfs(void);
int	asyncfs(char*);
int	localfs(int);
void	dkconfig(int);
void	boot(int);
void	srvcreate(char*, int);
void	settime(int);

/*
 * Ethernet type stations boot over ether or use dk via RS232.
 */
main(int argc, char *argv[])
{
	int cfd;
	int fd;

	int fromserver;

	open("#c/cons", OREAD);
	open("#c/cons", OWRITE);
	open("#c/cons", OWRITE);
	sleep(1000);
	termtype("at&t gnot 1");

	/*
	 *  get parameters passed by boot rom to kernel
	 */
	bootparams();
	termtype("at&t gnot 1");

	/*
	 *  user/passwd pair if the boot rom didn't
	 *  authenticate
	 *  prompt for user if the boot rom didn't authenticate
	 */
	if(!authenticated){
		strcpy(username, "none");
		outin("user", username, sizeof(username));
		passwd();
	} else {
		strcpy(username, bootuser);
	}
	setuser(username);

	/*
	 *  get the control channel for the network
	 *  device
	 *  make the root a union
	 */
	if(bind("/", "/", MREPL) < 0)
		error("bind");

	/*
	 *  connect to file systems
	 */
	switch(fileserver()){
	case 'a':
		cfd = asyncctl("B19200");
		asyncfs("B19200");
		localfs(0);
		fromserver = 1;
		break;
	case 'A':
		cfd = asyncctl("B9600");
		asyncfs("B9600");
		localfs(0);
		fromserver = 1;
		break;
	case 'i':
		inconfs();
		localfs(0);
		fromserver = 1;
		break;
	default:
		cfd = inconctl();
		localfs(1);
		fromserver = 0;
		break;
	}
	settime(fromserver);

	/*
	 *  start up the datakit and connect to
	 *  file server
	 *  put a default net into the name space
	 */
	dkconfig(cfd);
	for(;;){
		fd = dkdial(sys);
		if(fd >= 0)
			break;
		print("can't connect, retrying...\n");
		sleep(1000);
	if(netdev){
		sprint(buf, "/net/%s", net);
		bind(netdev, buf, MREPL);
		bind(netdev, "/net/net", MREPL);
	}
	if(net){
		sprint(buf, "/lib/netaddr.%s", net);
		bind(buf, "/lib/netaddr.net", MREPL);
	}

	/*
	 *  set up the file system connection
	 */
	boot(fd);

	/*
	 *  go to init
	 */
	if(manual)
		execl("/68020/init", "init", "-m", 0);
	else


@@ 132,7 137,7 @@ main(int argc, char *argv[])

/*
 *  read arguments passed by kernel as
 *  environment variables - YECH!
 *  environment variables
 */
void
bootparams(void)


@@ 168,20 173,16 @@ bootparams(void)
	}
	f = open("#e/bootuser", OREAD);
	if(f >= 0){
		read(f, &bootuser, sizeof(bootuser)-1);
		read(f, &bootuser, sizeof(bootuser));
		close(f);
	}
	f = open("#e/bootserver", OREAD);
	if(f >= 0){
		read(f, sys, sizeof(sys)-1);
		read(f, sys, sizeof(sys));
		close(f);
	} else
		strcpy(sys, DEFSYS);

	/*
	 *  perhaps a stupid assumption
	 */
	if(bootdevice == 'i')
	if(bootdevice != 's')
		authenticated = 1;
}



@@ 215,13 216,12 @@ setuser(char *name)
	 */
	fd = open("#c/user", OWRITE|OTRUNC);
	if(fd >= 0){
		if(write(fd, username, strlen(username)) <= 0)
			print("error writing %s to /dev/user\n", username);
		write(fd, username, strlen(username));
		close(fd);
	}
}

#define FS "(9)600 serial, (1)9200 serial, (i)incon"
#define FS "remote fs is (9)600 serial, (1)9200 serial, (n)ot used"
/*
 *  if we've booted off the disk, figure out where to get the
 *  file service from


@@ 235,67 235,23 @@ fileserver(void)
		return bootdevice;

	for(;;){
		strcpy(reply, "9");
		strcpy(reply, "n");
		strcpy(sys, DEFSYS);
		outin(FS, reply, sizeof(reply));
		switch(reply[0]){
		case 'i':
			outin("server", sys, sizeof(sys));
			return 'i';
		case 'l':
			return 'l';
		case 'n':
			return 'n';
		case '1':
			outin("server", sys, sizeof(sys));
			return 'a';
		case '9':
			outin("server", sys, sizeof(sys));
			return 'A';
		}
	}
}

/*
 *  get the incon control channel
 */
int
inconctl(void)
{
	int cfd;

	cfd = open("#i/ctl", ORDWR);
	if(cfd < 0)
		error("opening #i/ctl");

	return cfd;
}

/*
 *  get the serial control channel and let the
 *  user connect to the TSM8
 */
int
asyncctl(char *baud)
{
	int cfd, dfd;
	char reply[4];

	cfd = open("#t/tty0ctl", ORDWR);
	if(cfd < 0)
		error("opening #t/tty0ctl");

	sendmsg(cfd, baud);

	dfd = open("#t/tty0", ORDWR);
	if(dfd < 0)
		error("opening #t/tty0");

	connect(dfd);
	close(dfd);
	sendmsg(cfd, "push async");
	return cfd;
}

/*
 *  configure the datakit
 */
void


@@ 350,7 306,6 @@ dkdial(char *arg)
		close(cfd);
		sleep(500);
	}
	print("connected to %s\n", arg);
	sendmsg(cfd, "init");
	close(cfd);
	net = "dk";


@@ 358,28 313,166 @@ dkdial(char *arg)
	return fd;	
}

void
boot(int fd)
/*
 *  connect to a file system over the serial line
 */
int
asyncfs(char *baud)
{
	int n, f;
	char *srvname;
	Dir dir;
	char dirbuf[DIRLEN];
	int fd, cfd, dfd;
	char reply[4];

	if(!authenticated){
		passwd();
		outin("server", sys, sizeof(sys));
	}

	cfd = open("#t/tty0ctl", ORDWR);
	if(cfd < 0)
		error("opening #t/tty0ctl");
	sendmsg(cfd, baud);

	dfd = open("#t/tty0", ORDWR);
	if(dfd < 0)
		error("opening #t/tty0");
	connect(dfd);
	close(dfd);
	sendmsg(cfd, "push async");

	dkconfig(cfd);
	for(;;){
		fd = dkdial(sys);
		if(fd >= 0)
			break;
		print("can't connect, retrying...\n");
		sleep(1000);
	}

	nop(fd);
	session(fd);
	fd = cache(fd);
	srvcreate(sys, fd);
	srvcreate("boot", fd);
	if(mount(fd, "/", MAFTER|MCREATE, "", "") < 0)
		error("mount");
	close(fd);

	return 0;
}

/*
 *  connect to a file system over the incon
 */
int
inconfs(void)
{
	int fd, cfd, dfd;
	char reply[4];

	if(!authenticated){
		passwd();
		outin("server", sys, sizeof(sys));
	}
	cfd = open("#i/ctl", ORDWR);
	if(cfd < 0)
		error("opening #i/ctl");

	dkconfig(cfd);
	for(;;){
		fd = dkdial(sys);
		if(fd >= 0)
			break;
		print("can't connect, retrying...\n");
		sleep(1000);
	}

	srvname = strrchr(sys, '/');
	if(srvname)
		srvname++;
	else
		srvname = sys;
	nop(fd);
	session(fd);
	fd = cache(fd);
	srvcreate(sys, fd);
	srvcreate("boot", fd);
	if(mount(fd, "/", MAFTER|MCREATE, "", "") < 0)
		error("mount");
	close(fd);

	return 0;
}

/*
 *  plug the local file system into the name space
 */
int
localfs(int bootfs)
{
	ulong i;
	int p[2];
	Dir d;
	char sbuf[32];
	char rbuf[32];
	char *mtpt;

	if(dirstat("/kfs", &d) < 0)
		return -1;
	if(dirstat("#w/hd0fs", &d) < 0)
		return -1;

	print("local\n");

	/*
	 *  stick handles to the file system
	 *  into /srv
	 *  because kfs uses /dev/time, /dev/pid, and /proc/#
	 */
	print("post...");
	if(bind("#c", "/dev", MREPL) < 0)
		error("bind #c");
	if(bind("#p", "/proc", MREPL) < 0)
		error("bind #p");

	if(pipe(p)<0)
		error("pipe");
	switch(fork()){
	case -1:
		error("fork");
	case 0:
		sprint(sbuf, "%d", p[0]);
		sprint(rbuf, "%d", p[1]);
		execl("/kfs", "kfs", "-f", "#w/hd0fs", "-s", sbuf, rbuf, 0);
		error("can't exec kfs");
	default:
		break;
	}

	close(p[1]);

/*
 *  NEW KERNEL - these can both be MAFTER
 */
	if(bootfs){
		mtpt = "/";
		if(mount(p[0], mtpt, MAFTER|MCREATE, "", "") < 0)
			error("mount");
		srvcreate("boot", p[0]);
	} else {
		mtpt = "/n/kfs";
		if(mount(p[0], mtpt, MREPL|MCREATE, "", "") < 0)
			error("mount");
	}
	
	close(p[0]);

	return 0;
}

void
srvcreate(char *name, int fd)
{
	char *srvname;
	int f;

	srvname = strrchr(name, '/');
	if(srvname)
		srvname++;
	else
		srvname = name;

	sprint(buf, "#s/%s", srvname);
	f = create(buf, 1, 0666);
	if(f < 0)


@@ 388,53 481,65 @@ boot(int fd)
	if(write(f, buf, strlen(buf)) != strlen(buf))
		error("write");
	close(f);
	f = create("#s/boot", 1, 0666);
	if(f < 0)
		error("create");
	sprint(buf, "%d", fd);
	if(write(f, buf, strlen(buf)) != strlen(buf))
		error("write");
	close(f);
}

	/*
	 *  make the root a union
	 */
	print("mount...");
	if(bind("/", "/", MREPL) < 0)
		error("bind");
	if(mount(fd, "/", MAFTER|MCREATE, "", "") < 0)
		error("mount");
/*
 *  set the system time
 */
void
settime(int fromserver)
{
	int n, f;
	Dir dir;
	char dirbuf[DIRLEN];
	char *srvname;

	/*
	 *  set the time from the access time of the root
	 *  of the file server, accessible as /..
	 */
	print("time...");
	if(stat("/..", dirbuf) < 0)
		error("stat");
	convM2D(dirbuf, &dir);
	if(!fromserver){
		/*
		 *  set the time from the real time clock or file system
		 */
		f = open("#r/rtc", ORDWR);
		if(f > 0){
			if((n = read(f, dirbuf, sizeof(dirbuf)-1)) < 0)
				error("reading rtc");
			dirbuf[n] = 0;
			close(f);
		} else
			fromserver = 1;
	}
	if(fromserver){
		/*
		 *  set the time from the access time of the root
		 *  of the file server
		 */
		f = open("#s/boot", ORDWR);
		if(f < 0)
			return;
		if(mount(f, "/n/boot", MREPL, "", "") < 0){
			close(f);
			return;
		}
		close(f);
		if(stat("/n/boot", dirbuf) < 0)
			error("stat");
		convM2D(dirbuf, &dir);
		sprint(dirbuf, "%ld", dir.atime);
/*		unmount(0, "/n/boot"); /**/
		/*
		 *  set real time clock if there is one
		 */
		f = open("#r/rtc", ORDWR);
		if(f > 0){
			if(write(f, dirbuf, strlen(dirbuf)) < 0)
				error("writing rtc");
			close(f);
		}
		close(f);
	}
	f = open("#c/time", OWRITE);
	sprint(dirbuf, "%ld", dir.atime);
	write(f, dirbuf, strlen(dirbuf));
	close(f);

	print("success\n");

	/*
	 *  put a generic network device into the namespace
	 */
	if(netdev){
		char buf[64];
		sprint(buf, "/net/%s", net);
		bind(netdev, buf, MREPL);
		bind(netdev, "/net/net", MREPL);
	}
	if(net){
		char buf[64];
		sprint(buf, "/lib/netaddr.%s", net);
		print("binding %s onto /lib/netaddr.net\n", buf);
		bind(buf, "/lib/netaddr.net", MREPL);
	}
}

/*


@@ 537,7 642,7 @@ cache(int fd)
	 */
	if(dirstat("/cfs", &d) < 0)
		return fd;
	if(dirstat("#r/hd0cache", &d) < 0)
	if(dirstat("#w/hd0cache", &d) < 0)
		return fd;
	print("cfs...");



@@ 557,9 662,9 @@ cache(int fd)
		dup(p[0], 1);
		close(p[0]);
		if(format)
			execl("/cfs", "bootcfs", "-fs", "-p", "#r/hd0cache", 0);
			execl("/cfs", "bootcfs", "-fs", "-p", "#w/hd0cache", 0);
		else
			execl("/cfs", "bootcfs", "-s", "-p", "#r/hd0cache", 0);
			execl("/cfs", "bootcfs", "-s", "-p", "#w/hd0cache", 0);
		break;
	default:
		close(p[0]);

M gnot/boot.h => gnot/boot.h +1039 -841
@@ 1,7 1,7 @@
ulong bootcode[]={
	0x000000107,
	0x0000031a6,
	0x000000700,
	0x000003446,
	0x000000778,
	0x0000012b0,
	0x000000000,
	0x000002020,


@@ 14,199 14,222 @@ ulong bootcode[]={
	0x000142f2f,
	0x00014610c,
	0x02f006100,
	0x00f424fef,
	0x011e24fef,
	0x0001c4e75,
	0x0518f42a7,
	0x0486e8122,
	0x06100117c,
	0x06100141c,
	0x048780001,
	0x0486e812a,
	0x061001170,
	0x061001410,
	0x048780001,
	0x0486e8132,
	0x061001164,
	0x0487803e8,
	0x061001168,
	0x0610000f6,
	0x061001404,
	0x0486e813a,
	0x06100021e,
	0x061000298,
	0x061000164,
	0x04aae8006,
	0x0660000d2,
	0x066000148,
	0x0486e8146,
	0x0486e9916,
	0x06100109a,
	0x0486e998e,
	0x061001342,
	0x04878001c,
	0x0486e9916,
	0x0486e998e,
	0x0486e814b,
	0x061000be2,
	0x061000da6,
	0x0486e9916,
	0x06100024a,
	0x06100029c,
	0x04fef0038,
	0x061000e8a,
	0x0486e998e,
	0x0610002c4,
	0x042a7486e,
	0x08152486e,
	0x081506100,
	0x013884a80,
	0x06c0a486e,
	0x081546100,
	0x00e3e588f,
	0x0610002e8,
	0x04fef0040,
	0x07241b280,
	0x06700008a,
	0x0670000e2,
	0x07261b280,
	0x067747269,
	0x0b280676c,
	0x06100032e,
	0x024002f02,
	0x0610003cc,
	0x0486e977e,
	0x061000420,
	0x04a806d3e,
	0x02f006100,
	0x0050e4aae,
	0x0802e6720,
	0x042a7486e,
	0x0818a486e,
	0x08185486e,
	0x081796100,
	0x00fd0486e,
	0x0819e6100,
	0x00b524fef,
	0x000284e75,
	0x0670000c4,
	0x07269b280,
	0x0670000aa,
	0x048780001,
	0x06100067c,
	0x04282588f,
	0x02f026100,
	0x008984aae,
	0x080326730,
	0x02f2e800a,
	0x0486e8166,
	0x0486e877a,
	0x06100123a,
	0x042a7486e,
	0x08199486e,
	0x0818d6100,
	0x00fb4598f,
	0x060e0486e,
	0x0815d6100,
	0x00ea84878,
	0x003e86100,
	0x010aa4fef,
	0x0000c60a0,
	0x06092486e,
	0x081506100,
	0x002ec2400,
	0x0588f608a,
	0x0486e8157,
	0x0610002de,
	0x02400588f,
	0x06000ff7c,
	0x0486e98de,
	0x0486e9916,
	0x061000fca,
	0x04feffff4,
	0x0877a2f2e,
	0x080326100,
	0x0132442a7,
	0x0486e816e,
	0x02f2e8032,
	0x061001316,
	0x04fef0024,
	0x04aae800a,
	0x067222f2e,
	0x0800a486e,
	0x08177486e,
	0x0877a6100,
	0x0120442a7,
	0x0486e8187,
	0x0486e877a,
	0x0610012ee,
	0x04fef0018,
	0x04aae802e,
	0x0672042a7,
	0x0486e81a9,
	0x0486e81a4,
	0x0486e8198,
	0x06100120a,
	0x0486e81bd,
	0x061000d8c,
	0x04fef0020,
	0x04e7542a7,
	0x0486e81b8,
	0x0486e81ac,
	0x0610011ee,
	0x0598f60e0,
	0x061000500,
	0x042a76100,
	0x005d27401,
	0x0588f6000,
	0x0ff54486e,
	0x081596100,
	0x003ca42a7,
	0x0610005bc,
	0x07401508f,
	0x06000ff3e,
	0x0518f42ae,
	0x0802a42ae,
	0x0802e42a7,
	0x0486e81aa,
	0x061001050,
	0x04a806d74,
	0x04878003f,
	0x0486e989e,
	0x02f002f40,
	0x000186100,
	0x010402f2f,
	0x000186100,
	0x0100e207c,
	0x00000789c,
	0x048780020,
	0x02f086100,
	0x00f382040,
	0x04a804fef,
	0x000186740,
	0x052880c10,
	0x0002d4fef,
	0x0fff066e0,
	0x04a1067dc,
	0x00c100020,
	0x067d61018,
	0x049c04fef,
	0x000187266,
	0x0b2006714,
	0x0726db200,
	0x067064fef,
	0x0ffe860dc,
	0x070012d40,
	0x0802e60f2,
	0x070012d40,
	0x0802a60ea,
	0x042a7486e,
	0x081b66100,
	0x00fce4a80,
	0x06d1e4878,
	0x00001486e,
	0x080362f00,
	0x02f400020,
	0x061000fbe,
	0x02f2f0020,
	0x061000f8c,
	0x04fef0010,
	0x042a7486e,
	0x081c46100,
	0x00fa24a80,
	0x06d1e4878,
	0x0001b486e,
	0x098de2f00,
	0x02f400028,
	0x061000f92,
	0x02f2f0028,
	0x061000f60,
	0x04fef0010,
	0x0486e8160,
	0x0610003b4,
	0x042a76100,
	0x005a67401,
	0x0508f6000,
	0x0ff28486e,
	0x09956486e,
	0x0998e6100,
	0x011fc4fef,
	0x0fff46000,
	0x0fec4518f,
	0x042ae802a,
	0x042ae802e,
	0x042a7486e,
	0x081d06100,
	0x00f764a80,
	0x06d2e4878,
	0x0001b486e,
	0x0977e2f00,
	0x02f400030,
	0x061000f66,
	0x02f2f0030,
	0x061000f34,
	0x00c2e0069,
	0x080366606,
	0x070012d40,
	0x080064fef,
	0x000384e75,
	0x0486e81de,
	0x0486e977e,
	0x061000e96,
	0x0518f60dc,
	0x0598f4878,
	0x001b64878,
	0x00001486e,
	0x081e26100,
	0x00f044a80,
	0x042e72f40,
	0x0000e44df,
	0x06c0a486e,
	0x081ee6100,
	0x0099a588f,
	0x02f2f0014,
	0x061000e74,
	0x0588f2f00,
	0x081c96100,
	0x012824a80,
	0x06d744878,
	0x0003f486e,
	0x099162f00,
	0x02f400018,
	0x061001272,
	0x02f2f0018,
	0x02f2f0014,
	0x061000f0c,
	0x04a806c0a,
	0x0486e81f7,
	0x061000974,
	0x061001240,
	0x0207c0000,
	0x079144878,
	0x000202f08,
	0x06100116a,
	0x020404a80,
	0x04fef0018,
	0x067405288,
	0x00c10002d,
	0x04feffff0,
	0x066e04a10,
	0x067dc0c10,
	0x0002067d6,
	0x0101849c0,
	0x04fef0018,
	0x07266b200,
	0x06714726d,
	0x0b2006706,
	0x04fefffe8,
	0x060dc7001,
	0x02d40802e,
	0x060f27001,
	0x02d40802a,
	0x060ea42a7,
	0x0486e81d5,
	0x061001200,
	0x04a806d1e,
	0x048780001,
	0x0486e8036,
	0x02f002f40,
	0x000206100,
	0x011f02f2f,
	0x000206100,
	0x011be4fef,
	0x0001042a7,
	0x0486e81e3,
	0x0610011d4,
	0x04a806d1e,
	0x04878001c,
	0x0486e9956,
	0x02f002f40,
	0x000286100,
	0x011c42f2f,
	0x000286100,
	0x011924fef,
	0x0001042a7,
	0x0486e81ef,
	0x0610011a8,
	0x04a806d2e,
	0x04878001c,
	0x0486e97f6,
	0x02f002f40,
	0x000306100,
	0x011982f2f,
	0x000306100,
	0x011660c2e,
	0x000738036,
	0x067067001,
	0x02d408006,
	0x04fef0038,
	0x04e75486e,
	0x081fd486e,
	0x097f66100,
	0x010c8518f,
	0x060dc598f,
	0x0487801b6,
	0x048780001,
	0x0486e8201,
	0x061001136,
	0x04a8042e7,
	0x02f40000e,
	0x044df6c0a,
	0x0486e820d,
	0x061000bcc,
	0x0588f2f2f,
	0x000186100,
	0x00eba4fef,
	0x000204e75,
	0x0598f4878,
	0x00011486e,
	0x082006100,
	0x00eca4a80,
	0x042e72f40,
	0x0000a44df,
	0x06d36486e,
	0x099166100,
	0x00e26588f,
	0x02f00486e,
	0x099162f2f,
	0x000106100,
	0x00ebe4a80,
	0x06e0e486e,
	0x09916486e,
	0x082086100,
	0x00c98508f,
	0x000146100,
	0x010a6588f,
	0x02f002f2f,
	0x000182f2f,
	0x000146100,
	0x0113e4a80,
	0x06c0a486e,
	0x082166100,
	0x00ba6588f,
	0x02f2f0018,
	0x0610010ec,
	0x04fef0020,
	0x04e75598f,
	0x048780011,
	0x0486e821f,
	0x0610010fc,
	0x04a8042e7,
	0x02f40000a,
	0x044df6d24,
	0x0486e998e,
	0x061001058,
	0x0588f2f00,
	0x0486e998e,
	0x02f2f0010,
	0x0610010f0,
	0x02f2f0014,
	0x061000e68,
	0x0610010ac,
	0x04fef0010,
	0x04fef000c,
	0x04e75598f,


@@ 217,327 240,472 @@ ulong bootcode[]={
	0x04e75486e,
	0x08227486f,
	0x000046100,
	0x00dc0486e,
	0x01004486e,
	0x08229486e,
	0x0977e6100,
	0x00db44878,
	0x097f66100,
	0x00ff84878,
	0x00004486f,
	0x00014486e,
	0x0822d6100,
	0x008fc102f,
	0x00b40102f,
	0x0001c49c0,
	0x04fef001c,
	0x07231b200,
	0x0674a7239,
	0x0b200672c,
	0x067267239,
	0x0b200671a,
	0x07269b200,
	0x0670e726c,
	0x0670e726e,
	0x0b2006702,
	0x060b4706c,
	0x060b4706e,
	0x0588f4e75,
	0x04878001c,
	0x0486e977e,
	0x0486e8255,
	0x0610008c2,
	0x070694fef,
	0x000104e75,
	0x04878001c,
	0x0486e977e,
	0x0486e8263,
	0x0610008aa,
	0x070414fef,
	0x000104e75,
	0x04878001c,
	0x0486e977e,
	0x0486e825c,
	0x061000892,
	0x070614fef,
	0x000104e75,
	0x0598f4878,
	0x00002486e,
	0x0826a6100,
	0x00dc62200,
	0x042e72f40,
	0x0000a44df,
	0x06c0e486e,
	0x082716100,
	0x0083e222f,
	0x0000c588f,
	0x020014fef,
	0x0000c4e75,
	0x04feffff4,
	0x048780002,
	0x0486e8280,
	0x061000d94,
	0x02f400010,
	0x04aaf0010,
	0x06c0a486e,
	0x0828b6100,
	0x0080e588f,
	0x02f2f0018,
	0x02f2f0014,
	0x0610007ac,
	0x048780002,
	0x0486e829e,
	0x061000d68,
	0x02f40001c,
	0x04aaf001c,
	0x06c0a486e,
	0x082a66100,
	0x007e2588f,
	0x02f2f001c,
	0x061000866,
	0x02f2f0020,
	0x061000d20,
	0x0486e82b6,
	0x02f2f002c,
	0x061000770,
	0x0202f0030,
	0x04fef0034,
	0x07069588f,
	0x04e757041,
	0x0588f4e75,
	0x07061588f,
	0x04e75486e,
	0x082c12f2f,
	0x082642f2f,
	0x000086100,
	0x0075a206f,
	0x00a7a206f,
	0x0000c4aae,
	0x08006673a,
	0x0486e82cc,
	0x0486e826f,
	0x02f086100,
	0x007466100,
	0x00cfe4fef,
	0x00a666100,
	0x0101e4fef,
	0x0001072ff,
	0x0b2806720,
	0x04281b280,
	0x0670c2f2f,
	0x000046100,
	0x00cce588f,
	0x00fee588f,
	0x04e754879,
	0x00000ea60,
	0x061000cf0,
	0x061001010,
	0x0588f60f2,
	0x060ee486e,
	0x082e22f08,
	0x06100070c,
	0x082852f08,
	0x061000a2c,
	0x060c44fef,
	0x0fff02f2f,
	0x00014486e,
	0x082f6486e,
	0x087026100,
	0x00b90486e,
	0x087026100,
	0x00c262f40,
	0x08299486e,
	0x0877a6100,
	0x00eb0486e,
	0x0877a6100,
	0x00f462f40,
	0x0001042af,
	0x000144878,
	0x00002486e,
	0x083016100,
	0x00ca24a80,
	0x082a46100,
	0x00fc24a80,
	0x042e72f40,
	0x0002644df,
	0x06c0a486e,
	0x0830b6100,
	0x0071a588f,
	0x082ae6100,
	0x00a3a588f,
	0x048780002,
	0x0486e831d,
	0x061000c80,
	0x0486e82c0,
	0x061000fa0,
	0x02f400028,
	0x04aaf0028,
	0x06c0a486e,
	0x083266100,
	0x006fa588f,
	0x082c96100,
	0x00a1a588f,
	0x02f2f0020,
	0x0486e8702,
	0x0486e877a,
	0x02f2f0030,
	0x061000c74,
	0x061000f94,
	0x0b0af002c,
	0x0660e2f2f,
	0x000386100,
	0x002e6588f,
	0x00606588f,
	0x04a806734,
	0x07005b0af,
	0x000306608,
	0x070ff4fef,
	0x0003c4e75,
	0x02f2f0038,
	0x061000c0c,
	0x061000f2c,
	0x02f2f0038,
	0x061000c04,
	0x061000f24,
	0x0487801f4,
	0x061000c2c,
	0x061000f4c,
	0x052af003c,
	0x04fef0028,
	0x06000ff68,
	0x02f2f0040,
	0x0486e8337,
	0x061000a0a,
	0x0486e8348,
	0x02f2f0040,
	0x061000634,
	0x02f2f0044,
	0x061000bd0,
	0x0486e82da,
	0x02f2f0038,
	0x061000960,
	0x02f2f003c,
	0x061000efc,
	0x02d7c0000,
	0x0634b800a,
	0x062dd800a,
	0x02d7c0000,
	0x0634e8032,
	0x0202f004c,
	0x04fef0050,
	0x062e08032,
	0x0202f0044,
	0x04fef0048,
	0x04e754fef,
	0x0fecc4878,
	0x0002f486e,
	0x0977e6100,
	0x00b522400,
	0x067000250,
	0x052822f42,
	0x001302f2f,
	0x001406100,
	0x003222f2f,
	0x001446100,
	0x0041e2f2f,
	0x001486100,
	0x004d42f40,
	0x0014c486e,
	0x083536100,
	0x0099c2f2f,
	0x00140486e,
	0x0835b486e,
	0x087026100,
	0x00a5c4878,
	0x001b64878,
	0x00001486e,
	0x087026100,
	0x00b5c4a80,
	0x042e72f40,
	0x0015e44df,
	0x0fff04aae,
	0x080066618,
	0x061000b76,
	0x04878001c,
	0x0486e97f6,
	0x0486e82e5,
	0x06100099e,
	0x04fef000c,
	0x048780002,
	0x0486e82ec,
	0x061000ed8,
	0x02f400010,
	0x04aaf0010,
	0x06c0a486e,
	0x083616100,
	0x005f2588f,
	0x02f2f0168,
	0x0486e8368,
	0x0486e8702,
	0x061000a26,
	0x0486e8702,
	0x061000abc,
	0x0588f2f00,
	0x0486e8702,
	0x02f2f0170,
	0x061000b54,
	0x02f00486e,
	0x087026100,
	0x00aa2588f,
	0x0221fb280,
	0x0670a486e,
	0x0836b6100,
	0x005ae588f,
	0x02f2f0174,
	0x061000af4,
	0x082f76100,
	0x00952588f,
	0x02f2f001c,
	0x02f2f0014,
	0x0610008f0,
	0x048780002,
	0x0486e830a,
	0x061000eac,
	0x02f40001c,
	0x04aaf001c,
	0x06c0a486e,
	0x083126100,
	0x00926588f,
	0x02f2f001c,
	0x0610009aa,
	0x02f2f0020,
	0x061000e64,
	0x0486e8322,
	0x02f2f002c,
	0x0610008b4,
	0x02f2f0030,
	0x06100fe28,
	0x0486e97f6,
	0x06100fe7c,
	0x04a806d6a,
	0x02f002f40,
	0x000406100,
	0x005ca2f2f,
	0x000406100,
	0x006c62f2f,
	0x000446100,
	0x0077c2f00,
	0x02f40004c,
	0x0486e97f6,
	0x0610002b6,
	0x02f2f0050,
	0x0486e8349,
	0x0610002aa,
	0x0486e8351,
	0x0486e8350,
	0x048780006,
	0x0486e834e,
	0x02f2f0068,
	0x061000e16,
	0x04a806c0a,
	0x0486e8352,
	0x06100089c,
	0x0588f2f2f,
	0x0006c6100,
	0x00de24280,
	0x04fef0074,
	0x04e75486e,
	0x0832d6100,
	0x00bf84878,
	0x003e86100,
	0x00dfa4fef,
	0x0000c6000,
	0x0ff744fef,
	0x0fff04aae,
	0x080066618,
	0x061000a56,
	0x04878001c,
	0x0486e97f6,
	0x0486e8358,
	0x06100087e,
	0x04fef000c,
	0x048780002,
	0x0486e835f,
	0x061000db8,
	0x02f400010,
	0x04aaf0010,
	0x06c0a486e,
	0x083666100,
	0x00832588f,
	0x02f2f0010,
	0x06100fd50,
	0x0486e97f6,
	0x06100fda4,
	0x04a806d6a,
	0x02f002f40,
	0x000206100,
	0x004f22f2f,
	0x000206100,
	0x005ee2f2f,
	0x000246100,
	0x006a42f00,
	0x02f40002c,
	0x0486e97f6,
	0x0610001de,
	0x02f2f0030,
	0x0486e8391,
	0x0610001d2,
	0x0486e8399,
	0x0486e8398,
	0x048780006,
	0x0486e8396,
	0x02f2f0048,
	0x061000d3e,
	0x04a806c0a,
	0x0486e839a,
	0x0610007c4,
	0x0588f2f2f,
	0x0004c6100,
	0x00d0a4280,
	0x04fef0054,
	0x04e75486e,
	0x083756100,
	0x00b204878,
	0x003e86100,
	0x00d224fef,
	0x0000c6000,
	0x0ff744fef,
	0x0ff3c486f,
	0x00044486e,
	0x083a06100,
	0x01c544a80,
	0x06c0870ff,
	0x04fef00cc,
	0x04e75486f,
	0x0004c486e,
	0x083a56100,
	0x01c3c4a80,
	0x06c0870ff,
	0x04fef00d4,
	0x04e75486e,
	0x083ae6100,
	0x00ad442a7,
	0x0486e83b8,
	0x0486e83b5,
	0x061000c8e,
	0x04a806c0a,
	0x0486e83bd,
	0x061000744,
	0x0588f42a7,
	0x0486e83c8,
	0x0486e83c5,
	0x061000c72,
	0x04a806c0a,
	0x0486e83ce,
	0x061000728,
	0x0588f486f,
	0x000e46100,
	0x00c624a80,
	0x06c0a486e,
	0x083d66100,
	0x00712588f,
	0x061000c74,
	0x04fef0030,
	0x072ffb280,
	0x0670000de,
	0x04281b280,
	0x067000084,
	0x02f2f00bc,
	0x061000c40,
	0x04aaf00cc,
	0x06746207c,
	0x00000640b,
	0x0486e8410,
	0x0486e840f,
	0x048780006,
	0x02f082f2f,
	0x000cc6100,
	0x00c3c4a80,
	0x06c0a486e,
	0x084116100,
	0x006c2588f,
	0x02f2f00d0,
	0x0486e8417,
	0x06100009e,
	0x02f2f00d8,
	0x061000bfc,
	0x042804fef,
	0x000e84e75,
	0x0207c0000,
	0x0641a486e,
	0x08424486e,
	0x084234878,
	0x000042f08,
	0x02f2f00cc,
	0x061000bf6,
	0x04a80518f,
	0x06cce486e,
	0x084256100,
	0x0067a588f,
	0x060c22f2f,
	0x000b8486e,
	0x083e0486f,
	0x0002c6100,
	0x00aac2f2f,
	0x000c8486e,
	0x083e3486f,
	0x000186100,
	0x00a9c42a7,
	0x0486f0020,
	0x0486f0044,
	0x0486e83fb,
	0x0486e83f2,
	0x0486e83ef,
	0x0486e83eb,
	0x0486e83e6,
	0x061000aaa,
	0x0486e83fe,
	0x06100062c,
	0x04fef003c,
	0x06000ff2e,
	0x0486e83db,
	0x06100061c,
	0x0588f60a2,
	0x0518f4878,
	0x0002f2f2f,
	0x000106100,
	0x00b062400,
	0x06700008a,
	0x052822f02,
	0x0486e842b,
	0x0486e877a,
	0x061000a3a,
	0x0487801b6,
	0x048780001,
	0x0486e8371,
	0x061000aea,
	0x0486e877a,
	0x061000b3a,
	0x04a8042e7,
	0x02f400186,
	0x02f400022,
	0x044df6c0a,
	0x0486e8379,
	0x061000580,
	0x0486e8431,
	0x0610005d0,
	0x0588f2f2f,
	0x00190486e,
	0x08380486e,
	0x087026100,
	0x009b4486e,
	0x087026100,
	0x00a4a588f,
	0x00030486e,
	0x08438486e,
	0x0877a6100,
	0x00a04486e,
	0x0877a6100,
	0x00a9a588f,
	0x02f00486e,
	0x087022f2f,
	0x001986100,
	0x00ae22f00,
	0x0486e8702,
	0x061000a30,
	0x0877a2f2f,
	0x000346100,
	0x00b322f00,
	0x0486e877a,
	0x061000a80,
	0x0588f221f,
	0x0b280670a,
	0x0486e8383,
	0x06100053c,
	0x0486e843b,
	0x06100058c,
	0x0588f2f2f,
	0x0019c6100,
	0x00a82486e,
	0x083896100,
	0x008a042a7,
	0x0486e8394,
	0x0486e8392,
	0x061000a5a,
	0x04a806c0a,
	0x0486e8396,
	0x061000510,
	0x0588f486e,
	0x0839e486e,
	0x0839d4878,
	0x00006486e,
	0x0839b2f2f,
	0x001cc6100,
	0x00a644a80,
	0x000386100,
	0x00ad24fef,
	0x000444e75,
	0x0242f0014,
	0x06000ff74,
	0x04fefff0c,
	0x0486e8441,
	0x0610008de,
	0x04aaf00fc,
	0x066504878,
	0x00002486e,
	0x084496100,
	0x00aca4a80,
	0x06f000150,
	0x048780073,
	0x0486f0014,
	0x02f002f40,
	0x001046100,
	0x00ab82200,
	0x042e72f40,
	0x0010a44df,
	0x06c0e486e,
	0x084506100,
	0x0052a222f,
	0x0010c588f,
	0x042371920,
	0x0001c2f2f,
	0x001046100,
	0x00a664fef,
	0x000184aaf,
	0x000fc6700,
	0x000d44878,
	0x00002486e,
	0x0845c6100,
	0x00a724a80,
	0x06c064fef,
	0x001004e75,
	0x0486e846d,
	0x0486e846c,
	0x042a7486e,
	0x084642f00,
	0x02f40010c,
	0x061000a4a,
	0x0206f010c,
	0x04a806c0c,
	0x02f086100,
	0x00a1e4fef,
	0x001184e75,
	0x02f086100,
	0x00a12486f,
	0x00028486e,
	0x0846e6100,
	0x00a3c4a80,
	0x06c0a486e,
	0x0839f6100,
	0x004ea588f,
	0x0486e83a5,
	0x061000856,
	0x0486f00dc,
	0x0486e83ad,
	0x061000a5a,
	0x04a806c0a,
	0x0486e83b1,
	0x0610004c8,
	0x0588f486f,
	0x00158486f,
	0x000e86100,
	0x00a524878,
	0x00001486e,
	0x083b66100,
	0x00a222f40,
	0x001e02f2f,
	0x001c8486e,
	0x083be486f,
	0x000fc6100,
	0x008e0486f,
	0x001006100,
	0x00976588f,
	0x084766100,
	0x004aa588f,
	0x0486f00a4,
	0x0486f0034,
	0x061000a34,
	0x02f2f010c,
	0x0486e847b,
	0x0486f0040,
	0x0610008d2,
	0x048780002,
	0x0486e847f,
	0x0610009f4,
	0x02f400134,
	0x04aaf0134,
	0x06f32486f,
	0x0004c6100,
	0x00952588f,
	0x02f00486f,
	0x001042f2f,
	0x001f46100,
	0x00a0e2f2f,
	0x001f86100,
	0x009ca486e,
	0x083c26100,
	0x007e84aae,
	0x080326730,
	0x02f2e800a,
	0x0486e83cb,
	0x0486f00dc,
	0x0610008a2,
	0x042a7486f,
	0x000e42f2e,
	0x080326100,
	0x0098c42a7,
	0x0486e83d3,
	0x02f2e8032,
	0x06100097e,
	0x04fef0024,
	0x04aae800a,
	0x0672e2f2e,
	0x0800a486e,
	0x083dc486f,
	0x000dc6100,
	0x0086c486f,
	0x000e0486e,
	0x083ec6100,
	0x0079042a7,
	0x0486e840e,
	0x0486f00f0,
	0x06100094a,
	0x04fef0020,
	0x04fef0208,
	0x04e752f7c,
	0x00000777c,
	0x001306000,
	0x0fdae598f,
	0x000502f2f,
	0x0013c6100,
	0x009ea4a80,
	0x06c0a486e,
	0x084866100,
	0x00452588f,
	0x02f2f0140,
	0x061000998,
	0x04fef0010,
	0x02f2f0134,
	0x06100098c,
	0x04fef0048,
	0x048780001,
	0x0486e8492,
	0x0610009a0,
	0x02f4000f8,
	0x0486f0010,
	0x061000904,
	0x0588f2f00,
	0x0486f0014,
	0x02f2f0100,
	0x06100099c,
	0x02f2f0104,
	0x061000958,
	0x04fef0110,
	0x04e757001,
	0x02f400104,
	0x0508f6000,
	0x0fee6598f,
	0x048781000,
	0x0486e8702,
	0x0486e877a,
	0x02f2f0010,
	0x06100095e,
	0x022007002,


@@ 545,182 713,182 @@ ulong bootcode[]={
	0x0610005ca,
	0x070ff4fef,
	0x000104e75,
	0x0422e8704,
	0x0486e841f,
	0x0486e8702,
	0x0422e877c,
	0x0486e849a,
	0x0486e877a,
	0x061000870,
	0x04a806608,
	0x042804fef,
	0x000184e75,
	0x0486e8422,
	0x0486e8702,
	0x0486e849d,
	0x0486e877a,
	0x061000858,
	0x04a806634,
	0x0486e98fa,
	0x0486e9916,
	0x0486e8425,
	0x0486e8702,
	0x0486e9972,
	0x0486e998e,
	0x0486e84a0,
	0x0486e877a,
	0x0610007d6,
	0x0486e8702,
	0x0486e877a,
	0x06100086c,
	0x0588f2f00,
	0x0486e8702,
	0x0486e877a,
	0x02f2f003c,
	0x061000904,
	0x04fef0038,
	0x06000ff7e,
	0x0486e842c,
	0x0486e8702,
	0x0486e84a7,
	0x0486e877a,
	0x061000814,
	0x04a804fef,
	0x000246600,
	0x0ff686100,
	0x00548486e,
	0x098fa486e,
	0x09916486e,
	0x0842f486e,
	0x087026100,
	0x09972486e,
	0x0998e486e,
	0x084aa486e,
	0x0877a6100,
	0x00788486e,
	0x087026100,
	0x0877a6100,
	0x0081e588f,
	0x02f00486e,
	0x087022f2f,
	0x0877a2f2f,
	0x000206100,
	0x008b64fef,
	0x0001c6000,
	0x0ff30598f,
	0x0486e8436,
	0x0486e84b1,
	0x06100068e,
	0x01d7c0032,
	0x097023d7c,
	0x0ffff9706,
	0x0486e8702,
	0x0486e9702,
	0x0977a3d7c,
	0x0ffff977e,
	0x0486e877a,
	0x0486e977a,
	0x0610010e8,
	0x02f002f40,
	0x00010486e,
	0x087022f2f,
	0x0877a2f2f,
	0x0001c6100,
	0x0087ab0af,
	0x00018670a,
	0x0486e843d,
	0x0486e84b8,
	0x0610002e0,
	0x0588f4878,
	0x01000486e,
	0x087022f2f,
	0x0877a2f2f,
	0x000286100,
	0x008482200,
	0x07002b081,
	0x066080c2e,
	0x0004f8702,
	0x0004f877a,
	0x0677c4a81,
	0x042e72f41,
	0x0002644df,
	0x06e0e486e,
	0x084476100,
	0x084c26100,
	0x002aa222f,
	0x00028588f,
	0x02f01486e,
	0x09702486e,
	0x087026100,
	0x0977a486e,
	0x0877a6100,
	0x009c24a80,
	0x06638102e,
	0x0870549c0,
	0x0877d49c0,
	0x02f00102e,
	0x0870449c0,
	0x0877c49c0,
	0x02f00102e,
	0x0870349c0,
	0x0877b49c0,
	0x02f00102e,
	0x0870249c0,
	0x0877a49c0,
	0x02f002f2f,
	0x00040486e,
	0x084506100,
	0x084cb6100,
	0x005dc486e,
	0x084776100,
	0x084f26100,
	0x0025e4fef,
	0x0001c0c2e,
	0x000339702,
	0x00033977a,
	0x0670a486e,
	0x084826100,
	0x084fd6100,
	0x0024a588f,
	0x04fef0034,
	0x04e750c2e,
	0x0004b8703,
	0x0004b877b,
	0x06600ff7c,
	0x048781000,
	0x0486e8702,
	0x0486e877a,
	0x02f2f0034,
	0x0610007a2,
	0x022004fef,
	0x0000c6000,
	0x0ff62598f,
	0x0486e848b,
	0x0486e8506,
	0x06100058a,
	0x01d7c0034,
	0x097023d7c,
	0x0ffff9706,
	0x0486e8702,
	0x0486e9702,
	0x0977a3d7c,
	0x0ffff977e,
	0x0486e877a,
	0x0486e977a,
	0x061000fe4,
	0x02f002f40,
	0x00010486e,
	0x087022f2f,
	0x0877a2f2f,
	0x0001c6100,
	0x00776b0af,
	0x00018670a,
	0x0486e8496,
	0x0486e8511,
	0x0610001dc,
	0x0588f4878,
	0x01000486e,
	0x087022f2f,
	0x0877a2f2f,
	0x000286100,
	0x007442f40,
	0x000244aaf,
	0x000246e0a,
	0x0486e84a4,
	0x0486e851f,
	0x0610001b8,
	0x0588f2f2f,
	0x00024486e,
	0x09702486e,
	0x087026100,
	0x0977a486e,
	0x0877a6100,
	0x008d24a80,
	0x0660a486e,
	0x084b16100,
	0x0852c6100,
	0x0019a588f,
	0x00c2e0037,
	0x097026618,
	0x0486e9708,
	0x0486e84c0,
	0x0977a6618,
	0x0486e9780,
	0x0486e853b,
	0x0610004fa,
	0x0486e9708,
	0x0486e9780,
	0x06100017c,
	0x04fef000c,
	0x00c2e0035,
	0x09702670a,
	0x0486e84ca,
	0x0977a670a,
	0x0486e8545,
	0x061000168,
	0x0588f4fef,
	0x000344e75,
	0x04fefff80,
	0x04857486e,
	0x084d76100,
	0x085526100,
	0x0161c4a80,
	0x06c0a202f,
	0x0008c4fef,
	0x000884e75,
	0x0486f0008,
	0x0486e84dc,
	0x0486e8557,
	0x061001602,
	0x04a806c0a,
	0x0202f0094,
	0x04fef0090,
	0x04e75486e,
	0x084e86100,
	0x085636100,
	0x00498486f,
	0x000886100,
	0x0065e4a80,
	0x06c0a486e,
	0x084ef6100,
	0x0856a6100,
	0x0010e588f,
	0x061000670,
	0x04fef0018,


@@ 750,22 918,22 @@ ulong bootcode[]={
	0x005f64aae,
	0x0802a6720,
	0x042a7486e,
	0x0850d486e,
	0x0850a486e,
	0x08506486e,
	0x084fe486e,
	0x084f96100,
	0x08588486e,
	0x08585486e,
	0x08581486e,
	0x08579486e,
	0x085746100,
	0x004fc4fef,
	0x0003460a2,
	0x042a7486e,
	0x0852c486e,
	0x08529486e,
	0x08526486e,
	0x0851e486e,
	0x085196100,
	0x085a7486e,
	0x085a4486e,
	0x085a1486e,
	0x08599486e,
	0x085946100,
	0x004dc4fef,
	0x000346082,
	0x0486e84f4,
	0x0486e856f,
	0x06158588f,
	0x06082598f,
	0x02f2f000c,


@@ 784,7 952,7 @@ ulong bootcode[]={
	0x0610005ae,
	0x0486f0004,
	0x02f2f004c,
	0x0486e8538,
	0x0486e85b3,
	0x048780002,
	0x0610003e6,
	0x04fef0054,


@@ 793,7 961,7 @@ ulong bootcode[]={
	0x06100058a,
	0x0486f0004,
	0x02f2f004c,
	0x0486e8546,
	0x0486e85c1,
	0x048780002,
	0x0610003c2,
	0x042a76100,


@@ 802,7 970,7 @@ ulong bootcode[]={
	0x04feffefc,
	0x02f2f010c,
	0x02f2f010c,
	0x0486e8554,
	0x0486e85cf,
	0x06100033a,
	0x02f2f011c,
	0x0486f0010,


@@ 812,7 980,7 @@ ulong bootcode[]={
	0x067da42e7,
	0x02f400102,
	0x044df6c0c,
	0x0486e855d,
	0x0486e85d8,
	0x0619c222f,
	0x00104588f,
	0x07001b081,


@@ 825,7 993,7 @@ ulong bootcode[]={
	0x020014fef,
	0x001044e75,
	0x04fefff70,
	0x0486e857f,
	0x0486e85fa,
	0x0610002de,
	0x0610004cc,
	0x02f40000c,


@@ 834,12 1002,12 @@ ulong bootcode[]={
	0x000fc4281,
	0x0b2806700,
	0x0009842a7,
	0x0486e85bc,
	0x0486e8637,
	0x0610004b8,
	0x02f400008,
	0x04aaf0008,
	0x06c0a486e,
	0x085c56100,
	0x086406100,
	0x0ff32588f,
	0x048780001,
	0x0486f001c,


@@ 862,7 1030,7 @@ ulong bootcode[]={
	0x02f2f0008,
	0x061000430,
	0x0486f001c,
	0x0486e85d3,
	0x0486e864e,
	0x06100024a,
	0x04fef0014,
	0x0518f609c,


@@ 879,7 1047,7 @@ ulong bootcode[]={
	0x0486f001c,
	0x06100042e,
	0x0486f0020,
	0x0486e85a2,
	0x0486e861d,
	0x061000206,
	0x060fe4282,
	0x0b4836c18,


@@ 894,19 1062,19 @@ ulong bootcode[]={
	0x000016100,
	0x003ee4fef,
	0x0001860a4,
	0x0486e8596,
	0x0486e8611,
	0x06100fe54,
	0x0588f6098,
	0x04fefffdc,
	0x02f2f0028,
	0x0486e85ee,
	0x0486e8669,
	0x0486f000c,
	0x061000282,
	0x048780001,
	0x0486f0014,
	0x0610003a4,
	0x048780003,
	0x0486e85fc,
	0x0486e8677,
	0x02f002f40,
	0x000206100,
	0x003aa2f2f,


@@ 915,14 1083,14 @@ ulong bootcode[]={
	0x000484e75,
	0x04fefff74,
	0x042a7486e,
	0x086006100,
	0x0867b6100,
	0x003764a80,
	0x042e72f40,
	0x0001244df,
	0x06c0a486e,
	0x086096100,
	0x086846100,
	0x0fdee588f,
	0x0486e862c,
	0x0486e86a7,
	0x06100015a,
	0x042af0018,
	0x048780001,


@@ 932,7 1100,7 @@ ulong bootcode[]={
	0x02f400028,
	0x04aaf0028,
	0x06c0a486e,
	0x086376100,
	0x086b26100,
	0x0fdbe588f,
	0x04aaf0028,
	0x04fef000c,


@@ 946,7 1114,7 @@ ulong bootcode[]={
	0x06748202f,
	0x0000c1daf,
	0x000140920,
	0x098fa52af,
	0x0997252af,
	0x0000c0c2f,
	0x0000a0014,
	0x06710701c,


@@ 955,14 1123,14 @@ ulong bootcode[]={
	0x06e924fef,
	0x0000c202f,
	0x0000c4236,
	0x0092098fa,
	0x009209972,
	0x02f2f0008,
	0x0610002ac,
	0x0486e865c,
	0x0486e86d7,
	0x0610000ca,
	0x04fef0094,
	0x04e75486e,
	0x0865a6100,
	0x086d56100,
	0x000bc598f,
	0x06000ff56,
	0x060b84aaf,


@@ 972,9 1140,9 @@ ulong bootcode[]={
	0x042817021,
	0x0b0816f1e,
	0x04ab61d20,
	0x0981a660e,
	0x09892660e,
	0x02daf0008,
	0x01d20981a,
	0x01d209892,
	0x07001588f,
	0x04e755281,
	0x07021b081,


@@ 984,10 1152,10 @@ ulong bootcode[]={
	0x000084282,
	0x07021b082,
	0x06f182036,
	0x02d20981a,
	0x02d209892,
	0x0b0886606,
	0x042b62d20,
	0x0981a5282,
	0x098925282,
	0x07021b082,
	0x06ee8588f,
	0x04e754aaf,


@@ 999,10 1167,10 @@ ulong bootcode[]={
	0x0518f7220,
	0x04a816d22,
	0x02eb61d20,
	0x0981a4a97,
	0x098924a97,
	0x067122f41,
	0x0000442b6,
	0x01d20981a,
	0x01d209892,
	0x04eb70151,
	0x0222f0004,
	0x053814a81,


@@ 2132,54 2300,54 @@ ulong bootcode[]={
	0x042804fef,
	0x000844e75,
	0x02d7c0000,
	0x047f48666,
	0x04a9486de,
	0x01d7c0001,
	0x0995d1d7c,
	0x00001995f,
	0x099d51d7c,
	0x0000199d7,
	0x01d7c0001,
	0x099551d7c,
	0x00001999a,
	0x099cd1d7c,
	0x000019a12,
	0x01d7c0001,
	0x0999e1d7c,
	0x0000199a7,
	0x09a161d7c,
	0x000019a1f,
	0x02d7c0000,
	0x04464866a,
	0x0470486e2,
	0x01d7c0002,
	0x099961d7c,
	0x0000299a1,
	0x09a0e1d7c,
	0x000029a19,
	0x01d7c0002,
	0x099aa1d7c,
	0x00002998a,
	0x09a221d7c,
	0x000029a02,
	0x02d7c0000,
	0x04846866e,
	0x04ae686e6,
	0x01d7c0003,
	0x099971d7c,
	0x000039998,
	0x09a0f1d7c,
	0x000039a10,
	0x01d7c0003,
	0x099991d7c,
	0x000039977,
	0x09a111d7c,
	0x0000399ef,
	0x01d7c0003,
	0x099792d7c,
	0x000004796,
	0x086721d7c,
	0x000049995,
	0x099f12d7c,
	0x000004a36,
	0x086ea1d7c,
	0x000049a0d,
	0x02d7c0000,
	0x047bc8676,
	0x04a5c86ee,
	0x01d7c0005,
	0x099a52d7c,
	0x0000047da,
	0x0867a1d7c,
	0x000069957,
	0x09a1d2d7c,
	0x000004a7a,
	0x086f21d7c,
	0x0000699cf,
	0x070072d40,
	0x080164878,
	0x000804878,
	0x00001486e,
	0x0979a6100,
	0x098126100,
	0x00eba422e,
	0x0979a422e,
	0x097a3422e,
	0x097a4422e,
	0x097bf4fef,
	0x09812422e,
	0x0981b422e,
	0x0981c422e,
	0x098374fef,
	0x0000c4e75,
	0x04aae8016,
	0x066046100,


@@ 2191,14 2359,14 @@ ulong bootcode[]={
	0x0202e8016,
	0x0122f0007,
	0x049c11d80,
	0x019209932,
	0x0192099aa,
	0x052ae8016,
	0x0122f0007,
	0x049c11036,
	0x019209932,
	0x0192099aa,
	0x049c02daf,
	0x000080d20,
	0x086624280,
	0x086da4280,
	0x04e754fef,
	0x0ffe42a2f,
	0x0002c226f,


@@ 2216,7 2384,7 @@ ulong bootcode[]={
	0x049c02600,
	0x0707fc083,
	0x04a360920,
	0x0979a6600,
	0x098126600,
	0x00186d3c2,
	0x0d7c22d4b,
	0x080122002,


@@ 2300,9 2468,9 @@ ulong bootcode[]={
	0x02f4a0028,
	0x02f052f45,
	0x000401036,
	0x029209932,
	0x0292099aa,
	0x049c02076,
	0x00d208662,
	0x00d2086da,
	0x04e902a2f,
	0x00040266e,
	0x08012246f,


@@ 2517,9 2685,9 @@ ulong bootcode[]={
	0x02f2f0018,
	0x02f2f0018,
	0x012363920,
	0x0993249c1,
	0x099aa49c1,
	0x020761d20,
	0x086624e90,
	0x086da4e90,
	0x04fef0018,
	0x04e751ebc,
	0x0002a202f,


@@ 3268,82 3436,109 @@ ulong bootcode[]={
	0x031006e6f,
	0x06e650075,
	0x073657200,
	0x042313932,
	0x030300042,
	0x039363030,
	0x00063616e,
	0x027742063,
	0x06f6e6e65,
	0x063742c20,
	0x072657472,
	0x079696e67,
	0x02e2e2e0a,
	0x0002f3638,
	0x03032302f,
	0x02f002f00,
	0x062696e64,
	0x000423139,
	0x032303000,
	0x042393630,
	0x030002f6e,
	0x065742f25,
	0x073002f6e,
	0x065742f6e,
	0x06574002f,
	0x06c69622f,
	0x06e657461,
	0x06464722e,
	0x02573002f,
	0x06c69622f,
	0x06e657461,
	0x06464722e,
	0x06e657400,
	0x02f363830,
	0x032302f69,
	0x06e697400,
	0x0696e6974,
	0x0002d6d00,
	0x02f363830,
	0x032302f69,
	0x06e697400,
	0x0696e6974,
	0x000696e69,
	0x074002d6d,
	0x0002f3638,
	0x03032302f,
	0x0696e6974,
	0x000696e69,
	0x074002f36,
	0x038303230,
	0x02f696e69,
	0x074002365,
	0x02f626f6f,
	0x0746c696e,
	0x065002365,
	0x02f626f6f,
	0x074646576,
	0x069636500,
	0x023652f62,
	0x06f6f7475,
	0x073657200,
	0x023652f62,
	0x06f6f7473,
	0x065727665,
	0x072004e66,
	0x073002365,
	0x02f746572,
	0x00023652f,
	0x0626f6f74,
	0x06c696e65,
	0x00023652f,
	0x0626f6f74,
	0x064657669,
	0x063650023,
	0x0652f626f,
	0x06f747573,
	0x065720023,
	0x0652f626f,
	0x06f747365,
	0x072766572,
	0x0004e6673,
	0x00023652f,
	0x07465726d,
	0x0696e616c,
	0x000746572,
	0x06d696e61,
	0x06c007465,
	0x0726d696e,
	0x0616c0074,
	0x065726d69,
	0x06e616c00,
	0x023632f75,
	0x073657200,
	0x06572726f,
	0x072207772,
	0x06974696e,
	0x067202573,
	0x020746f20,
	0x02f646576,
	0x02f757365,
	0x0720a0039,
	0x0616c0023,
	0x0632f7573,
	0x06572006e,
	0x0004e6673,
	0x000283929,
	0x036303020,
	0x073657269,
	0x0616c2c20,
	0x028312939,
	0x032303020,
	0x073657269,
	0x0616c2c20,
	0x028692969,
	0x06e636f6e,
	0x000736572,
	0x076657200,
	0x073657276,
	0x065720073,
	0x065727665,
	0x072002369,
	0x00072656d,
	0x06f746520,
	0x066732069,
	0x073202839,
	0x029363030,
	0x020736572,
	0x069616c2c,
	0x020283129,
	0x039323030,
	0x020736572,
	0x069616c2c,
	0x020286e29,
	0x06f742075,
	0x073656400,
	0x070757368,
	0x020646b6d,
	0x075780063,
	0x06f6e6669,
	0x067203120,
	0x03136206e,
	0x06f726573,
	0x074617274,
	0x000636f6e,
	0x066696720,
	0x031203136,
	0x020726573,
	0x074617274,
	0x000636f6e,
	0x06e656374,
	0x020257300,
	0x0236b2f32,
	0x02f646174,
	0x061006f70,
	0x0656e696e,
	0x06720236b,
	0x02f322f64,
	0x061746100,
	0x0236b2f32,
	0x02f63746c,
	0x0006f7065,
	0x06e696e67,
	0x02023692f,
	0x063746c00,
	0x020236b2f,
	0x0322f6374,
	0x06c00696e,
	0x069740064,
	0x06b00236b,
	0x000736572,
	0x076657200,
	0x023742f74,
	0x074793063,
	0x0746c006f,


@@ 3360,240 3555,243 @@ ulong bootcode[]={
	0x030007075,
	0x073682061,
	0x073796e63,
	0x000707573,
	0x06820646b,
	0x06d757800,
	0x0636f6e66,
	0x069672031,
	0x020313620,
	0x06e6f7265,
	0x073746172,
	0x07400636f,
	0x06e666967,
	0x020312031,
	0x036207265,
	0x073746172,
	0x07400636f,
	0x06e6e6563,
	0x074202573,
	0x000236b2f,
	0x0322f6461,
	0x07461006f,
	0x070656e69,
	0x06e672023,
	0x06b2f322f,
	0x064617461,
	0x000236b2f,
	0x0322f6374,
	0x00063616e,
	0x027742063,
	0x06f6e6e65,
	0x063742c20,
	0x072657472,
	0x079696e67,
	0x02e2e2e0a,
	0x000626f6f,
	0x074002f00,
	0x000006d6f,
	0x0756e7400,
	0x073657276,
	0x065720023,
	0x0692f6374,
	0x06c006f70,
	0x0656e696e,
	0x06720236b,
	0x02f322f63,
	0x0746c0063,
	0x067202369,
	0x02f63746c,
	0x00063616e,
	0x027742063,
	0x06f6e6e65,
	0x063746564,
	0x020746f20,
	0x025730a00,
	0x0696e6974,
	0x000646b00,
	0x0236b0070,
	0x06f73742e,
	0x02e2e0023,
	0x063742c20,
	0x072657472,
	0x079696e67,
	0x02e2e2e0a,
	0x000626f6f,
	0x074002f00,
	0x000006d6f,
	0x0756e7400,
	0x02f6b6673,
	0x00023772f,
	0x068643066,
	0x073006c6f,
	0x063616c0a,
	0x000236300,
	0x02f646576,
	0x00062696e,
	0x064202363,
	0x000237000,
	0x02f70726f,
	0x063006269,
	0x06e642023,
	0x070007069,
	0x070650066,
	0x06f726b00,
	0x025640025,
	0x064002f6b,
	0x06673006b,
	0x06673002d,
	0x066002377,
	0x02f686430,
	0x06673002d,
	0x073006361,
	0x06e277420,
	0x065786563,
	0x0206b6673,
	0x0002f0000,
	0x0006d6f75,
	0x06e740062,
	0x06f6f7400,
	0x02f6e2f6b,
	0x066730000,
	0x0006d6f75,
	0x06e740023,
	0x0732f2573,
	0x000637265,
	0x061746500,
	0x025640077,
	0x072697465,
	0x00023732f,
	0x0626f6f74,
	0x000637265,
	0x061746500,
	0x025640077,
	0x072697465,
	0x0006d6f75,
	0x06e742e2e,
	0x02e002f00,
	0x02f006269,
	0x06e64002f,
	0x00000006d,
	0x06f756e74,
	0x00074696d,
	0x0652e2e2e,
	0x0002f2e2e,
	0x000737461,
	0x074002363,
	0x02f74696d,
	0x06500256c,
	0x064007375,
	0x063636573,
	0x0730a002f,
	0x06e65742f,
	0x02573002f,
	0x06e65742f,
	0x06e657400,
	0x02f6c6962,
	0x02f6e6574,
	0x061646472,
	0x02e257300,
	0x062696e64,
	0x00023722f,
	0x072746300,
	0x072656164,
	0x0696e6720,
	0x02573206f,
	0x06e746f20,
	0x02f6c6962,
	0x02f6e6574,
	0x061646472,
	0x02e6e6574,
	0x00a002f6c,
	0x069622f6e,
	0x065746164,
	0x064722e6e,
	0x06574004f,
	0x04b004348,
	0x00025730a,
	0x025730a00,
	0x04e4f0025,
	0x0730a2573,
	0x00a006e6f,
	0x0702e2e2e,
	0x072746300,
	0x023732f62,
	0x06f6f7400,
	0x02f6e2f62,
	0x06f6f7400,
	0x000002f6e,
	0x02f626f6f,
	0x074007374,
	0x061740025,
	0x06c640023,
	0x0722f7274,
	0x063007772,
	0x06974696e,
	0x067207274,
	0x063002363,
	0x02f74696d,
	0x065004f4b,
	0x000434800,
	0x025730a25,
	0x0730a004e,
	0x04f002573,
	0x00a25730a,
	0x0006e6f70,
	0x02e2e2e00,
	0x077726974,
	0x065206e6f,
	0x070007265,
	0x06164206e,
	0x06f70006e,
	0x0203d2025,
	0x0643b2062,
	0x07566203d,
	0x02025232e,
	0x032782025,
	0x0232e3278,
	0x02025232e,
	0x032782025,
	0x0232e3278,
	0x00a00666f,
	0x0726d6174,
	0x0206e6f70,
	0x0006e6f74,
	0x020526e6f,
	0x070007365,
	0x07373696f,
	0x06e2e2e2e,
	0x000777269,
	0x07465206e,
	0x06f700072,
	0x065616420,
	0x06e6f7000,
	0x06e203d20,
	0x025643b20,
	0x062756620,
	0x03d202523,
	0x02e327820,
	0x025232e32,
	0x078202523,
	0x02e327820,
	0x025232e32,
	0x0780a0066,
	0x06f726d61,
	0x074206e6f,
	0x070006e6f,
	0x07420526e,
	0x06f700073,
	0x074652073,
	0x065737369,
	0x06f6e2e2e,
	0x02e007772,
	0x069746520,
	0x073657373,
	0x0696f6e00,
	0x072656164,
	0x020736573,
	0x073696f6e,
	0x000666f72,
	0x06d617420,
	0x06f6e0072,
	0x065616420,
	0x073657373,
	0x0696f6e00,
	0x06572726f,
	0x072202573,
	0x03b006e6f,
	0x074205273,
	0x0666f726d,
	0x061742073,
	0x065737369,
	0x06f6e002f,
	0x063667300,
	0x023722f68,
	0x064306361,
	0x063686500,
	0x06366732e,
	0x02e2e0070,
	0x069706500,
	0x0666f726b,
	0x0002f6366,
	0x07300626f,
	0x06f746366,
	0x073002d66,
	0x073002d70,
	0x00023722f,
	0x068643063,
	0x061636865,
	0x0002f6366,
	0x07300626f,
	0x06f746366,
	0x073002d73,
	0x06f6e0065,
	0x072726f72,
	0x02025733b,
	0x0006e6f74,
	0x020527365,
	0x07373696f,
	0x06e002f63,
	0x066730023,
	0x0772f6864,
	0x030636163,
	0x068650063,
	0x066732e2e,
	0x02e007069,
	0x070650066,
	0x06f726b00,
	0x02f636673,
	0x000626f6f,
	0x074636673,
	0x0002d6673,
	0x0002d7000,
	0x023722f68,
	0x023772f68,
	0x064306361,
	0x063686500,
	0x0626f6f74,
	0x03a202573,
	0x03a202573,
	0x00a00626f,
	0x06f743a20,
	0x025733a20,
	0x025730a00,
	0x025735b25,
	0x0735d3a20,
	0x00063616e,
	0x027742072,
	0x065616420,
	0x023632f63,
	0x02f636673,
	0x000626f6f,
	0x074636673,
	0x0002d7300,
	0x02d700023,
	0x0772f6864,
	0x030636163,
	0x068650062,
	0x06f6f743a,
	0x02025733a,
	0x02025730a,
	0x000626f6f,
	0x0743a2025,
	0x0733a2025,
	0x0730a0025,
	0x0735b2573,
	0x05d3a2000,
	0x063616e27,
	0x074207265,
	0x061642023,
	0x0632f636f,
	0x06e733b20,
	0x0706c6561,
	0x073652072,
	0x065626f6f,
	0x074005b63,
	0x074726c2d,
	0x06420746f,
	0x020617474,
	0x061636820,
	0x066735d0a,
	0x000666f72,
	0x06b206661,
	0x0696c6564,
	0x0005b7265,
	0x06d6f7465,
	0x020726561,
	0x064206572,
	0x0726f7220,
	0x028257329,
	0x05d0a0023,
	0x0632f7263,
	0x06f6e7300,
	0x06f70656e,
	0x0696e6720,
	0x072636f6e,
	0x073005b72,
	0x0656d6f74,
	0x065207772,
	0x069746520,
	0x06572726f,
	0x072202825,
	0x073295d0a,
	0x0002f7072,
	0x06f632f25,
	0x0642f6e6f,
	0x074650064,
	0x069650023,
	0x0632f7263,
	0x06f6e7300,
	0x063616e27,
	0x074206f70,
	0x0656e2023,
	0x0632f7263,
	0x06f6e733b,
	0x020706c65,
	0x061736520,
	0x07265626f,
	0x06f74005b,
	0x06374726c,
	0x02d642074,
	0x06f206174,
	0x074616368,
	0x02066735d,
	0x00a00666f,
	0x0726b2066,
	0x061696c65,
	0x064005b72,
	0x0656d6f74,
	0x06f740070,
	0x061737377,
	0x06f72643a,
	0x020006361,
	0x06e277420,
	0x072656164,
	0x02023632f,
	0x072636f6e,
	0x0733b2070,
	0x06c656173,
	0x065207265,
	0x061642065,
	0x072726f72,
	0x020282573,
	0x0295d0a00,
	0x023632f72,
	0x0636f6e73,
	0x0006f7065,
	0x06e696e67,
	0x02072636f,
	0x06e73005b,
	0x072656d6f,
	0x074652077,
	0x072697465,
	0x020657272,
	0x06f722028,
	0x02573295d,
	0x00a002f70,
	0x0726f632f,
	0x025642f6e,
	0x06f746500,
	0x064696500,
	0x023632f72,
	0x0636f6e73,
	0x00063616e,
	0x02774206f,
	0x070656e20,
	0x023632f72,
	0x0636f6e73,
	0x03b20706c,
	0x065617365,
	0x020726562,
	0x06f6f7400,
	0x070617373,
	0x0776f7264,
	0x03a200063,
	0x0616e2774,
	0x020726561,
	0x064202363,
	0x02f72636f,
	0x06e733b20,
	0x0706c6561,
	0x073652072,
	0x065626f6f,
	0x074000a00,
	0x00a000000,
	0x0626f6f74,
	0x0000a000a,
	0x000000000,
	0x047320000,
	0x049d20000,
	0x000000000,
	0x000000000,
	0x000000000,


@@ 3633,6 3831,6 @@ ulong bootcode[]={
	0x000000000,
	0x000000000,
	0x000000000,
	0x000038c6,
	0x00003bde,
	0x0,
};

M gnot/disk.c => gnot/disk.c +2 -3
@@ 41,7 41,7 @@ Dev	devtab[]={
	{ duartreset, duartinit, duartattach, duartclone, duartwalk, duartstat, duartopen, duartcreate,
	  duartclose, duartread, duartwrite, duartremove, duartwstat, },
};
char devchar[]="/ce|psMikdbxSrt";
char devchar[]="/ce|psMikdbxSwt";
extern Qinfo	urpinfo;
extern Qinfo	asyncinfo;
extern Qinfo	fcallinfo;


@@ 50,6 50,5 @@ void streaminit0(void){
	newqinfo(&asyncinfo);
	newqinfo(&fcallinfo);
}
	long kfslen = 0; ulong kfscode[1];
	long cryptfslen = 0; ulong cryptfscode[1];
	#include "cfs.h"
	#include "kfs.h"

M gnot/fault68020.c => gnot/fault68020.c +0 -1
@@ 95,7 95,6 @@ fault68020(Ureg *ur, FFrame *f)
			notify(ur);
			return;
		}
		u->p->state = MMUing;
		dumpregs(ur);
		panic("fault: 0x%lux", badvaddr);
		exit();

M gnot/main.c => gnot/main.c +7 -1
@@ 121,6 121,12 @@ init0(void)
	u->slash = (*devtab[0].attach)(0);
	u->dot = clone(u->slash, 0);
	if(!waserror()){
		c = namec("#e/terminal", Acreate, OWRITE, 0600);
		(*devtab[c->type].write)(c, "at&t gnot 1", strlen("at&t gnot 1"), 0);
		close(c);
		c = namec("#e/cputype", Acreate, OWRITE, 0600);
		(*devtab[c->type].write)(c, "68020", strlen("68020"), 0);
		close(c);
		c = namec("#e/bootuser", Acreate, OWRITE, 0600);
		(*devtab[c->type].write)(c, bootuser, strlen(bootuser), 0);
		close(c);


@@ 133,8 139,8 @@ init0(void)
		c = namec("#e/bootdevice", Acreate, OWRITE, 0600);
		(*devtab[c->type].write)(c, bootdevice, strlen(bootdevice), 0);
		close(c);
		poperror();
	}
	poperror();

	touser();
}

M gnot/mmu.c => gnot/mmu.c +0 -8
@@ 143,12 143,6 @@ KMap*
kmap(Page *pg)
{
	KMap *k;
	int s = 0;

	if(u) {
		s = u->p->state;
		u->p->state = MMUing;
	}
	
	lock(&kmapalloc);
	k = kmapalloc.free;


@@ 161,8 155,6 @@ kmap(Page *pg)

	k->pa = pg->pa;
	putkmmu(k->va, PPN(k->pa) | PTEVALID | PTEKERNEL);
	if(s)
		u->p->state = s;

	return k;
}

M gnot/trap.c => gnot/trap.c +2 -0
@@ 292,6 292,7 @@ syscall(Ureg *aur)
		}
		if(sp<(USTKTOP-BY2PG) || sp>(USTKTOP-(1+MAXSYSARG)*BY2WD))
			validaddr(sp, (1+MAXSYSARG)*BY2WD, 0);
		u->p->psstate = sysctab[r0];
		ret = (*systab[r0])((ulong*)(sp+BY2WD));
		poperror();
	}


@@ 304,6 305,7 @@ syscall(Ureg *aur)
	}

	u->p->insyscall = 0;
	u->p->psstate = 0;

	if(r0 == NOTED)		/* ugly hack */
		noted(aur, *(ulong*)(sp+BY2WD));	/* doesn't return */

M pc/fault386.c => pc/fault386.c +0 -1
@@ 30,7 30,6 @@ fault386(Ureg *ur)
				ur->pc, ur->usp);
			pexit("Suicide", 0);
		}
		u->p->state = MMUing;
		dumpregs(ur);
		panic("fault: 0x%lux", addr);
	}

M pc/main.c => pc/main.c +9 -0
@@ 78,6 78,15 @@ init0(void)

	chandevinit();

	if(!waserror()){
		c = namec("#e/terminal", Acreate, OWRITE, 0600);
		(*devtab[c->type].write)(c, "safari", strlen("next station 68040"), 0);
		close(c);
		c = namec("#e/cputype", Acreate, OWRITE, 0600);
		(*devtab[c->type].write)(c, "386", strlen("68020"), 0);
		close(c);
		poperror();
	}
	touser();
}


M pc/trap.c => pc/trap.c +2 -0
@@ 288,6 288,7 @@ syscall(Ureg *ur)
		}
		if(sp<(USTKTOP-BY2PG) || sp>(USTKTOP-(1+MAXSYSARG)*BY2WD))
			validaddr(sp, (1+MAXSYSARG)*BY2WD, 0);
		u->p->psstate = sysctab[ax];
		ret = (*systab[ax])((ulong*)(sp+BY2WD));
		poperror();
	}


@@ 298,6 299,7 @@ syscall(Ureg *ur)
		panic("error stack");
	}
	u->p->insyscall = 0;
	u->p->psstate = 0;
	ur->ax = ret;
	if(ax == NOTED){
		noted(ur, *(ulong*)(sp+BY2WD));

M port/devlance.c => port/devlance.c +1 -1
@@ 682,7 682,7 @@ lanceup(Ethertype *e, Etherpkt *p, int len)
	 *  only a trace channel gets packets destined for other machines
	 */
	if(e->type != -1){
		if(!(p->d[0]&0x80) && memcmp(p->d, l.ea, sizeof(p->d))!=0)
		if(p->d[0]!=0xff && memcmp(p->d, l.ea, sizeof(p->d))!=0)
			return;
	}
	if(e->q && e->q->next->len<=Streamhi && !waserror()){

M port/devmnt.c => port/devmnt.c +3 -1
@@ 35,6 35,7 @@ struct Mnt
	int	id;		/* Multiplexor id for channel check */
	Mnt	*list;		/* Free list */
	char	mux;		/* Set if the device aleady does the multiplexing */
	int	blocksize;	/* read/write block size */
};

struct Mntalloc


@@ 152,6 153,7 @@ mntattach(char *muxattach)
	m->queue = 0;
	m->rip = 0;
	m->c = bogus.chan;
	m->blocksize = MAXFDATA;

	switch(devchar[m->c->type]) {
	case 'H':			/* Hotrod */


@@ 447,7 449,7 @@ mntrdwr(int type, Chan *c, void *buf, long n, ulong offset)
		r->request.fid = c->fid;
		r->request.offset = offset;
		r->request.data = uba;
		r->request.count = limit(n, MAXFDATA);
		r->request.count = limit(n, m->blocksize);
		mountrpc(m, r);
		nr = r->reply.count;
		if(type == Tread)

M port/devnonet.c => port/devnonet.c +57 -49
@@ 564,7 564,8 @@ nooput(Queue *q, Block *bp)
	Noconv *cp;
	int next;
	Nomsg *mp;
	int retries;
	Block *first, *last;
	int len;

	cp = (Noconv *)(q->ptr);



@@ 586,12 587,24 @@ nooput(Queue *q, Block *bp)
	}

	/*
	 *  take the collected message out of the queue
	 */
	first = q->first;
	last = q->last;
	len = q->len;
	q->len = q->nb = 0;
	q->first = q->last = 0;
	if(len == 0){
		freeb(first);
		qunlock(&cp->mlock);
		return;
	}

	/*
	 *  block till we get an output buffer
	 */
	if(waserror()){
		/* throw out the message */
		while(bp = getb(q))
			freeb(bp);
		freeb(first);
		qunlock(&cp->mlock);
		nexterror();
	}


@@ 607,17 620,12 @@ nooput(Queue *q, Block *bp)
	 *  point the output buffer to the message
	 */
	mp->time = NOW + MSrexmit;
	mp->first = q->first;
	mp->last = q->last;
	mp->len = q->len;
	mp->first = first;
	mp->last = last;
	mp->len = len;
	mp->mid ^= Nnomsg;
	mp->acked = 0;

	/*
	 *  take the message out of the queue
	 */
	q->len = q->nb = 0;
	q->first = q->last = 0;
	cp->sent++;

	/*


@@ 1427,51 1435,51 @@ nokproc(void *arg)
			qunlock(cp);
	}

loop:
	/*
	 *  loop through all active interfaces
	 */
	for(ifc = noifc; ifc < &noifc[conf.nnoifc]; ifc++){
		if(ifc->wq==0 || !canlock(ifc))
			continue;

	for(;;){
		/*
		 *  loop through all active conversations
		 *  loop through all active interfaces
		 */
		ep = ifc->conv + conf.nnoconv;
		for(cp = ifc->conv; cp < ep; cp++){
			if(cp->state<=Copen || !canqlock(cp))
		for(ifc = noifc; ifc < &noifc[conf.nnoifc]; ifc++){
			if(ifc->wq==0 || !canlock(ifc))
				continue;
			if(cp->state <= Copen){
				qunlock(cp);
				continue;
			}

			/*
			 *  resend the first message
			 */
			if(cp->first!=cp->next && NOW>=cp->out[cp->first].time){
				mp = &(cp->out[cp->first]);
				if(cp->rexmit++ > 15){
					norack(cp, mp->mid);
					noreset(cp);
				} else
					nosend(cp, mp);
			}

	
			/*
			 *  get the acknowledges out
			 *  loop through all active conversations
			 */
			while(cp->afirst!=cp->anext && cp->rq->next->len<16*1024){
				DPRINT("sending ack %d\n", cp->ack[cp->afirst]);
				nosendctl(cp, /*NO_NULL*/0, 0);
			ep = ifc->conv + conf.nnoconv;
			for(cp = ifc->conv; cp < ep; cp++){
				if(cp->state<=Copen || !canqlock(cp))
					continue;
				if(cp->state <= Copen){
					qunlock(cp);
					continue;
				}
	
				/*
				 *  resend the first message
				 */
				if(cp->first!=cp->next && NOW>=cp->out[cp->first].time){
					mp = &(cp->out[cp->first]);
					if(cp->rexmit++ > 15){
						norack(cp, mp->mid);
						noreset(cp);
					} else
						nosend(cp, mp);
				}
	
				/*
				 *  get the acknowledges out
				 */
				while(cp->afirst!=cp->anext && cp->rq->next->len<16*1024){
					DPRINT("sending ack %d\n", cp->ack[cp->afirst]);
					nosendctl(cp, /*NO_NULL*/0, 0);
				}
				qunlock(cp);
			}
			qunlock(cp);
			unlock(ifc);
		}
		unlock(ifc);
		tsleep(&nonetkr, return0, 0, MSrexmit/2);
	}
	tsleep(&nonetkr, return0, 0, MSrexmit/2);
	goto loop;
}

void

M port/devproc.c => port/devproc.c +1 -1
@@ 354,7 354,7 @@ procread(Chan *c, void *va, long n, ulong offset)
		if(offset+n > STATSIZE)
			n = STATSIZE - offset;
		j = sprint(statbuf, "%-27s %-27s %-11s ",
			p->text, p->pgrp->user, statename[p->state]);
			p->text, p->pgrp->user, p->psstate ? p->psstate : statename[p->state]);
		for(i=0; i<6; i++){
			l = p->time[i];
			if(i == TReal)

M port/fault.c => port/fault.c +9 -1
@@ 16,15 16,22 @@ fault(ulong addr, int read)
	Pte **p;
	Page **pg, *lkp, *new = 0;
	int type;
	char *sps;

	sps = u->p->psstate;
	u->p->psstate = "Fault";

	m->pfault++;
again:
	s = seg(u->p, addr, 1);
	if(s == 0)
	if(s == 0) {
		u->p->psstate = sps;
		return -1;
	}

	if(!read && (s->type&SG_RONLY)) {
		qunlock(&s->lk);
		u->p->psstate = sps;
		return -1;
	}



@@ 112,6 119,7 @@ again:
		putpage(new);

	putmmu(addr, mmuphys, *pg);
	u->p->psstate = sps;
	return 0;
}


M port/portdat.h => port/portdat.h +14 -10
@@ 30,6 30,7 @@ typedef struct Ref	Ref;
typedef struct Rendez	Rendez;
typedef struct Segment	Segment;
typedef struct Stream	Stream;
typedef struct Waitq	Waitq;

typedef int Devgen(Chan*, Dirtab*, int, int, Dir*);



@@ 410,6 411,12 @@ struct Palloc
	int	wanted;			/* Do the wakeup at free */
};

struct Waitq
{
	Waitmsg	w;
	Waitq	*next;
};

enum					/* Argument to forkpgrp call */
{
	FPall 	  = 0,			/* Concession to back portablility */


@@ 441,14 448,10 @@ enum
{
	Dead = 0,
	Moribund,
	Zombie,
	Ready,
	Scheding,
	Running,
	Queueing,
	MMUing,
	Exiting,
	Inwait,
	Wakeme,
	Broken,
	Stopped,


@@ 487,13 490,16 @@ struct Proc
	QLock	*qlock;			/* address of qlock being queued for DEBUG */
	ulong	qlockpc;		/* pc of last call to qlock */
	int	state;
	char	*psstate;		/* What /proc/???/status reports */
	Page	*upage;			/* BUG: should be unlinked from page list */
	Segment	*seg[NSEG];
	ulong	pid;
	int	nchild;
	QLock	wait;			/* exiting children to be waited for */
	Waitmsg	waitmsg;		/* this is large but must be addressable */
	Proc	*child;

	Lock	exl;			/* Lock count and waitq */
	Waitq	*waitq;			/* Exited processes wait children */
	int	nchild;			/* Number of living children */
	int	nwait;			/* Number of uncollected wait records */
	Rendez	waitr;			/* Place to hang out in wait */
	Proc	*parent;

	Pgrp	*pgrp;			/* Process group for notes and namespace */


@@ 502,7 508,6 @@ struct Proc

	ulong	parentpid;
	ulong	time[6];		/* User, Sys, Real; child U, S, R */
	short	exiting;
	short	insyscall;
	int	fpstate;
	Lock	debug;			/* to access debugging elements of User */


@@ 573,7 578,6 @@ struct Stream {
	Queue	*procq;			/* write queue at process end */
	Queue	*devq;			/* read queue at device end */
	Block	*err;			/* error message from down stream */
	int	forcedelim;		/* force a delimiter before the next message */
	int	flushmsg;		/* flush up till the next delimiter */
};


M port/portfns.h => port/portfns.h +2 -0
@@ 223,3 223,5 @@ void	validaddr(ulong, ulong, int);
void*	vmemchr(void*, int, int);
void	wakeme(Alarm*);
void	wakeup(Rendez*);
void	freewaitq(Waitq*);
Waitq	*newwaitq(void);

M port/proc.c => port/proc.c +129 -127
@@ 18,6 18,12 @@ struct
	Proc	*free;
}procalloc;

struct
{
	Lock;
	Waitq	*free;
}waitqalloc;

typedef struct
{
	Lock;


@@ 30,14 36,10 @@ Schedq runhiq, runloq;
char *statename[]={	/* BUG: generate automatically */
	"Dead",
	"Moribund",
	"Zombie",
	"Ready",
	"Scheding",
	"Running",
	"Queueing",
	"MMUing",
	"Exiting",
	"Inwait",
	"Wakeme",
	"Broken",
	"Stopped",


@@ 227,13 229,14 @@ loop:
	lock(&procalloc);
	if(p = procalloc.free){		/* assign = */
		procalloc.free = p->qnext;
		p->state = Zombie;
		p->state = Scheding;
		p->psstate = "New";
		unlock(&procalloc);
		p->mach = 0;
		p->qnext = 0;
		p->nchild = 0;
		p->child = 0;
		p->exiting = 0;
		p->nwait = 0;
		p->waitq = 0;
		p->pgrp = 0;
		p->egrp = 0;
		p->fgrp = 0;


@@ 492,6 495,7 @@ addbroken(Proc *c)
	broken.p[broken.n++] = c;
	unlock(&broken);
	c->state = Broken;
	c->psstate = 0;
	sched();		/* until someone lets us go */
	lock(&broken);
	for(b=0; b<NBROKEN; b++)


@@ 520,99 524,72 @@ freebroken(void)
void
pexit(char *exitstr, int freemem)
{
	ulong mypid;
	Proc *p, *c, *k, *l;
	int n, i;
	Chan *ch;
	char msg[ERRLEN];
	ulong *up, *ucp, *wp;
	Proc *p, *c;
	Segment **s, **es, *os;
	Waitq *wq, *f, *next;

	if(exitstr) 			/* squirrel away before we lose our address space */
		strcpy(msg, exitstr);
	else
		msg[0] = 0;
	
	c = u->p;
	c->alarm = 0;
	mypid = c->pid;

	if(c->fgrp)
		closefgrp(c->fgrp);

	if(freemem){
		flushvirt();
		es = &c->seg[NSEG];
		for(s = c->seg; s < es; s++)
			if(os = *s) {
				*s = 0;
				putseg(os);
			}
		closepgrp(c->pgrp);
		if(c->egrp)
			closeegrp(c->egrp);
		close(u->dot);
	}
	/*
	 * Any of my children exiting?
	 */
	while(c->nchild){
		lock(&c->wait.queue);
		if(canlock(&c->wait.use)){	/* no child is exiting */
			c->exiting = 1;
			unlock(&c->wait.use);
			unlock(&c->wait.queue);
			break;
		}else{				/* must wait for child */
			unlock(&c->wait.queue);
			pwait(0);
		}
	}
	wq = newwaitq();
	wq->w.pid = c->pid;
	wq->w.time[TUser] = TK2MS(c->time[TUser]);
	wq->w.time[TCUser] = TK2MS(c->time[TCUser]);
	wq->w.time[TSys] = TK2MS(c->time[TSys]);
	wq->w.time[TCSys] = TK2MS(c->time[TCSys]);
	wq->w.time[TReal] = TK2MS(MACHP(0)->ticks - c->time[TReal]);
	if(exitstr)
		strncpy(wq->w.msg, exitstr, ERRLEN);
	else
		wq->w.msg[0] = '\0';

	c->time[TReal] = MACHP(0)->ticks - c->time[TReal];
	/*
	 * Tell my parent
	 */
	/* Find my parent */
	p = c->parent;
	if(p == 0)
		goto out;
	qlock(&p->wait);
	lock(&p->wait.queue);
	if(p->pid==c->parentpid && !p->exiting){
		memmove(p->waitmsg.msg, msg, ERRLEN);
		p->waitmsg.pid = mypid;
		wp = &p->waitmsg.time[TUser];
		up = &c->time[TUser];
		ucp = &c->time[TCUser];
		*wp++ = TK2MS(*up++ + *ucp++);
		*wp++ = TK2MS(*up++ + *ucp  );
		*wp   = TK2MS(*up           );
		p->child = c;
		c->state = Exiting;
		if(p->state == Inwait)
			ready(p);
		unlock(&p->wait.queue);
		sched();
	}else{
		unlock(&p->wait.queue);
		qunlock(&p->wait);

	lock(&p->exl);
	/* My parent still alive */
	if(p->pid == c->parentpid && p->state != Broken && p->nwait < 128) {	
		p->nchild--;
		p->time[TCUser] += c->time[TUser] + c->time[TCUser];
		p->time[TCSys] += c->time[TSys] + c->time[TCSys];

		wq->next = p->waitq;
		p->waitq = wq;
		p->nwait++;
		unlock(&p->exl);

		wakeup(&p->waitr);
	}
   out:
	if(!freemem){
		addbroken(c);
		flushvirt();
		es = &c->seg[NSEG];
		for(s = c->seg; s < es; s++)
			if(os = *s) {
				*s = 0;
				putseg(os);
			}
		closepgrp(c->pgrp);
		closeegrp(c->egrp);
		close(u->dot);
	else {
		unlock(&p->exl);
		freewaitq(wq);
	}

    done:
	if(!freemem)
		addbroken(c);

	flushvirt();
	es = &c->seg[NSEG];
	for(s = c->seg; s < es; s++)
		if(os = *s) {
			*s = 0;
			putseg(os);
		}
	closepgrp(c->pgrp);
	closeegrp(c->egrp);
	close(u->dot);

	lock(&c->exl);		/* Prevent my children from leaving waits */
	c->pid = 0;
	unlock(&c->exl);

	for(f = c->waitq; f; f = next) {
		next = f->next;
		freewaitq(f);
	}

	/*
	 * sched() cannot wait on these locks


@@ 626,46 603,46 @@ pexit(char *exitstr, int freemem)
	panic("pexit");
}

int
haswaitq(void *x)
{
	Proc *p;

	p = (Proc *)x;
	return p->waitq != 0;
}

ulong
pwait(Waitmsg *w)
{
	Proc *c, *p;
	Proc *p;
	ulong cpid;
	Waitq *wq;

	p = u->p;
again:
	while(canlock(&p->wait.use)){
		if(p->nchild == 0){
			qunlock(&p->wait);
			error(Enochild);
		}
		p->state = Inwait;
		qunlock(&p->wait);
		sched();
	}
	lock(&p->wait.queue);	/* wait until child is finished */
	c = p->child;
	if(c == 0){
		p->state = Inwait;
		unlock(&p->wait.queue);
		sched();
		goto again;

	lock(&p->exl);
	if(p->nchild == 0 && p->waitq == 0) {
		unlock(&p->exl);
		error(Enochild);
	}
	p->child = 0;
	unlock(&p->exl);

	sleep(&p->waitr, haswaitq, u->p);

	lock(&p->exl);
	wq = p->waitq;
	p->waitq = wq->next;
	p->nwait--;
	unlock(&p->exl);

	if(w)
		*w = p->waitmsg;
	cpid = p->waitmsg.pid;
	p->time[TCUser] += c->time[TUser] + c->time[TCUser];
	p->time[TCSys] += c->time[TSys] + c->time[TCSys];
	p->time[TCReal] += c->time[TReal];
	p->nchild--;
	unlock(&p->wait.queue);
	qunlock(&p->wait);
	ready(c);
		memmove(w, &wq->w, sizeof(Waitmsg));
	cpid = wq->w.pid;
	freewaitq(wq);
	return cpid;
}


Proc*
proctab(int i)
{


@@ 706,6 683,7 @@ kproc(char *name, void (*func)(void *), void *arg)
	 * Kernel stack
	 */
	p = newproc();
	p->psstate = 0;
	p->kp = 1;
	p->upage = newpage(1, 0, USERADDR|(p->pid&0xFFFF));
	k = kmap(p->upage);


@@ 732,15 710,6 @@ kproc(char *name, void (*func)(void *), void *arg)
	 * Sched
	 */
	if(setlabel(&p->sched)){
		/*
		 *  use u->p instead of p, because we
		 *  don't trust the compiler, after a
		 *  gotolabel, to find the correct contents
		 *  of a local variable.  Passed parameters
		 *  (func & arg) are a bit safer since we
		 *  don't play with them anywhere else.
		 */
		p = u->p;
		p->state = Running;
		p->mach = m;
		m->proc = p;


@@ 765,14 734,13 @@ kproc(char *name, void (*func)(void *), void *arg)
	p->parent = 0;
	memset(p->time, 0, sizeof(p->time));
	p->time[TReal] = MACHP(0)->ticks;
	ready(p);
	/*
	 *  since the bss/data segments are now shareable,
	 *  any mmu info about this process is now stale
	 *  and has to be discarded.
	 */
	flushmmu();
	clearmmucache();
	ready(p);
}

void


@@ 811,3 779,37 @@ nexterror(void)
	gotolabel(&u->errlab[--u->nerrlab]);
}

Waitq *
newwaitq(void)
{
	Waitq *wq, *e, *f;

	for(;;) {
		lock(&waitqalloc);
		if(wq = waitqalloc.free) {
			waitqalloc.free = wq->next;
			unlock(&waitqalloc);
			return wq;
		}
		unlock(&waitqalloc);

		wq = (Waitq*)VA(kmap(newpage(0, 0, 0)));
		e = &wq[(BY2PG/sizeof(Waitq))-1];
		for(f = wq; f < e; f++)
			f->next = f+1;

		lock(&waitqalloc);
		e->next = waitqalloc.free;
		waitqalloc.free = wq;
		unlock(&waitqalloc);
	}
}

void
freewaitq(Waitq *wq)
{
	lock(&waitqalloc);
	wq->next = waitqalloc.free;
	waitqalloc.free = wq;
	unlock(&waitqalloc);
}

M port/stasync.c => port/stasync.c +17 -32
@@ 242,6 242,7 @@ asyncoput(Queue *q, Block *bp)
{
	Async *ap = (Async *)q->ptr;
	int c, chan, ctl;
	Block *msg;

	if(bp->type != M_DATA){
		if(streamparse("debug", bp))


@@ 251,28 252,25 @@ asyncoput(Queue *q, Block *bp)
	}

	/*
	 *  get a whole message before handing bytes to the device
	 *  each datakit message has a 2 byte channel number followed by
	 *  one control byte
	 */
	if(!putq(q, bp))
	msg = pullup(bp, 3);
	if(BLEN(msg) < 3){
		print("asyncoput msglen < 3\n");
		freeb(bp);
		return;
	}
	chan = msg->rptr[0] | (msg->rptr[1]<<8);
	ctl = msg->rptr[2];
	msg->rptr += 3;

	/*
	 *  one transmitter at a time
	 */
	qlock(&ap->xmit);

	/*
	 *  parse message
	 */
	bp = getq(q);
	if(bp->wptr - bp->rptr < 3){
		freemsg(q, bp);
	if(waserror()){
		qunlock(&ap->xmit);
		return;
		freeb(msg);
		nexterror();
	}
	chan = bp->rptr[0] | (bp->rptr[1]<<8);
	ctl = bp->rptr[2];
	bp->rptr += 3;

	/*
	 *  new frame if the channel number has changed


@@ 288,27 286,12 @@ asyncoput(Queue *q, Block *bp)
	/*
	 *  send the 8 bit data
	 */
	for(;;){
		/*
		 *  put in next packet
		 */
	for(bp = msg; bp; bp = bp->next){
		while (bp->rptr < bp->wptr) {
			asputc(ap, c = *bp->rptr++);
			if(c == STUF)
				asputc(ap, 0);
		}

		/*
		 *  get next block 
		 */
		if(bp->flags & S_DELIM){
			freeb(bp);
			break;
		}
		freeb(bp);
		bp = getq(q);
		if(bp==0)
			break;
	}

	/*


@@ 329,7 312,9 @@ asyncoput(Queue *q, Block *bp)
	if(debugcount > 0 && --debugcount == 0)
		asyncdebug = 1;

	freeb(msg);
	qunlock(&ap->xmit);
	poperror();
	return;
}


M port/stream.c => port/stream.c +24 -53
@@ 791,7 791,6 @@ streamnew(ushort type, ushort dev, ushort id, Qinfo *qi, int noopen)
	/*
 	 *  hang a device and process q off the stream
	 */
	s->forcedelim = 0;
	s->inuse = 1;
	if(noopen)
		s->opens = 0;


@@ 808,7 807,6 @@ streamnew(ushort type, ushort dev, ushort id, Qinfo *qi, int noopen)
	RD(s->procq)->next = 0;
	RD(s->devq)->next = RD(s->procq);
	WR(s->devq)->next = 0;
	s->flushmsg = 0;

	if(qi->open)
		(*qi->open)(RD(s->devq), s);


@@ 1264,10 1262,10 @@ long
streamwrite(Chan *c, void *a, long n, int docopy)
{
	Stream *s;
	Block *bp;
	Queue *q;
	long rem;
	int i;
	Block *bp, *first, *last;

	s = c->stream;



@@ 1289,60 1287,33 @@ streamwrite(Chan *c, void *a, long n, int docopy)
	}

	/*
	 *  if an error occurs during write n,
	 *  force a delim before write n+1
	 *  copy the whole write into kernel space
	 */
	if(waserror()){
		s->forcedelim = 1;
		nexterror();
	}
	if(s->forcedelim){
		FLOWCTL(q);
		bp = allocb(0);
		bp->flags |= S_DELIM;
	first = last = 0;
	for(rem = n; ; rem -= i) {
		bp = allocb(rem);
		i = bp->lim - bp->wptr;
		if(i >= rem)
			i = rem;
		memmove(bp->wptr, a, i);
		bp->wptr += i;
		bp->type = M_DATA;
		PUTNEXT(q, bp);
		s->forcedelim = 0;
		a = ((char*)a) + i;
		if(first == 0)
			first = bp;
		else
			last->next = bp;
		last = bp;
		if(i == rem)
			break;
	}

	if(0 && !docopy && isphys(a)){
		/*
		 *  `a' is global to the whole system, just create a
		 *  pointer to it and pass it on.
		 */
		FLOWCTL(q);
		bp = allocb(0);
		bp->rptr = bp->base = (uchar *)a;
		bp->wptr = bp->lim = (uchar *)a+n;
		bp->flags |= S_DELIM;
		bp->type = M_DATA;
		PUTNEXT(q, bp);
	} else {
		/*
		 *  `a' is in the user's address space, copy it into
		 *  system buffers and pass the buffers on.
		 */
		for(rem = n; ; rem -= i) {
			FLOWCTL(q);
			bp = allocb(rem);
			i = bp->lim - bp->wptr;
			if(i >= rem){
				memmove(bp->wptr, a, rem);
				bp->flags |= S_DELIM;
				bp->wptr += rem;
				bp->type = M_DATA;
				PUTNEXT(q, bp);
				break;
			} else {
				memmove(bp->wptr, a, i);
				bp->wptr += i;
				bp->type = M_DATA;
				PUTNEXT(q, bp);
				a = ((char*)a) + i;
			}
		}
	}
	poperror();
	/*
	 *  send it down stream
	 */
	last->flags |= S_DELIM;
	FLOWCTL(q);
	PUTNEXT(q, first);
	return n;
}


M port/swap.c => port/swap.c +2 -0
@@ 112,7 112,9 @@ pager(void *junk)
			if(p->state == Dead || p->kp)
				continue;

			u->p->psstate = "Idle";
			sleep(&swapalloc.r, needpages, 0);
			u->p->psstate = "Pageout";

			if(p->state == Dead || p->kp)
				continue;

M port/sysproc.c => port/sysproc.c +2 -0
@@ 121,7 121,9 @@ rfork(ulong flag)
	p->parentpid = u->p->pid;

	p->fpstate = u->p->fpstate;
	lock(&u->p->exl);
	u->p->nchild++;
	unlock(&u->p->exl);
	pid = p->pid;
	memset(p->time, 0, sizeof(p->time));
	p->time[TReal] = MACHP(0)->ticks;

M port/systab.h => port/systab.h +38 -0
@@ 47,3 47,41 @@ Syscall *systab[]={
	[SEGFLUSH]	syssegflush,
	[RENDEZVOUS]	sysrendezvous,
};

char *sysctab[]={
	[SYSR1]		"Running",
	[ERRSTR]	"Errstr",
	[BIND]		"Bind",
	[CHDIR]		"Chdir",
	[CLOSE]		"Close",
	[DUP]		"Dup",
	[ALARM]		"Alarm",
	[EXEC]		"Exec",
	[EXITS]		"Exits",
	[FORK]		"Fork",
	[FORKPGRP]	"Forkpgrp",
	[FSTAT]		"Fstat",
	[SEGBRK]	"Segbrk",
	[MOUNT]		"Mount",
	[OPEN]		"Open",
	[READ]		"Read",
	[SEEK]		"Seek",
	[SLEEP]		"Sleep",
	[STAT]		"Stat",
	[WAIT]		"Wait",
	[WRITE]		"Write",
	[PIPE]		"Pipe",
	[CREATE]	"Create",
	[RFORK]		"Rfork",
	[BRK_]		"Brk",
	[REMOVE]	"Remove",
	[WSTAT]		"Wstat",
	[FWSTAT]	"Fwstat",
	[NOTIFY]	"Notify",
	[NOTED]		"Noted",
	[SEGATTACH]	"Segattach",
	[SEGDETACH]	"Segdetach",
	[SEGFREE]	"Segfree",
	[SEGFLUSH]	"Segflush",
	[RENDEZVOUS]	"Rendez",
};

M port/tcpinput.c => port/tcpinput.c +1 -1
@@ 438,7 438,7 @@ tcp_icmp(Ipconv *ipc, Ipaddr source, Ipaddr dest, char type, char code, Block **
			close_self(s, Etimedout);
		break;
	case ICMP_SOURCEQUENCH:
		tcb->cwind /= 2;
		tcb->cwind = tcb->cwind/2;
		tcb->cwind = MAX(tcb->mss,tcb->cwind);
		break;
	}

M power/faultmips.c => power/faultmips.c +1 -1
@@ 21,6 21,7 @@ faultmips(Ureg *ur, int user, int code)
	addr = ur->badvaddr;
	addr &= ~(BY2PG-1);
	read = !(code==CTLBM || code==CTLBS);

	if(fault(addr, read) < 0){
		if(user){
			sprint(buf, "sys: fault %s pc=0x%lux addr=0x%lux",


@@ 31,7 32,6 @@ faultmips(Ureg *ur, int user, int code)
		}
		print("kernel %s badvaddr=0x%lux\n", excname[code], ur->badvaddr);
		print("status=0x%lux pc=0x%lux sp=0x%lux\n", ur->status, ur->pc, ur->sp);
		u->p->state = MMUing;
		dumpregs(ur);
		panic("fault");
	}

M power/main.c => power/main.c +8 -1
@@ 213,6 213,7 @@ init0(void)
{
	int i;
	ulong *sp;
	Chan *c;

	m->proc = u->p;
	u->p->state = Running;


@@ 228,8 229,14 @@ init0(void)

	chandevinit();

	sp = (ulong*)(USTKTOP - argsize);
	if(!waserror()){
		c = namec("#e/cputype", Acreate, OWRITE, 0600);
		(*devtab[c->type].write)(c, "mips", strlen("mips"), 0);
		close(c);
		poperror();
	}

	sp = (ulong*)(USTKTOP - argsize);
	touser(sp);
}


M power/mmu.c => power/mmu.c +0 -2
@@ 95,7 95,6 @@ putmmu(ulong tlbvirt, ulong tlbphys, Page *pg)
/*	if(p->state != Running)
		panic("putmmu state %lux %lux %s\n", u, p, statename[p->state]);
*/
	p->state = MMUing;
	tp = p->pidonmach[m->machno];
	if(tp == 0)
		tp = newtlbpid(p);


@@ 103,7 102,6 @@ putmmu(ulong tlbvirt, ulong tlbphys, Page *pg)
	putstlb(tlbvirt, tlbphys);
	puttlb(tlbvirt, tlbphys);
	m->pidhere[tp] = 1;
	p->state = Running;
	spllo();
}


M power/trap.c => power/trap.c +3 -1
@@ 523,6 523,7 @@ syscall(Ureg *aur)
		}
		if(sp<(USTKTOP-BY2PG) || sp>(USTKTOP-(1+MAXSYSARG)*BY2WD))
			validaddr(sp, (1+MAXSYSARG)*BY2WD, 0);
		u->p->psstate = sysctab[r1];
		ret = (*systab[r1])((ulong*)(sp+BY2WD));
	}
	ur->pc += 4;


@@ 531,8 532,9 @@ syscall(Ureg *aur)
		procctl(u->p);

	splhi();
	u->p->psstate = 0;
	u->p->insyscall = 0;
	if(r1 == NOTED)	/* ugly hack */
	if(r1 == NOTED)					/* ugly hack */
		noted(&aur, *(ulong*)(sp+BY2WD));	/* doesn't return */
	if(u->nnote && r1!=FORK){
		ur->r1 = ret;

M ss/dat.h => ss/dat.h +4 -0
@@ 94,6 94,10 @@ struct Conf
	int	nfsyschan;	/* number of filsys open channels */
	ulong	maxialloc;	/* maximum bytes used by ialloc */
	int	copymode;	/* 0 is copy on write, 1 is copy on reference */
	ulong	ipif;		/* Ip protocol interfaces */
	ulong	ip;		/* Ip conversations per interface */
	ulong	arp;		/* Arp table size */
	ulong	frag;		/* Ip fragment assemble queue size */
	int	cntrlp;		/* panic on ^P */
};


M ss/faultsparc.c => ss/faultsparc.c +0 -1
@@ 43,7 43,6 @@ faultsparc(Ureg *ur)
			notify(ur);
			return;
		}
		u->p->state = MMUing;
		dumpregs(ur);
		panic("fault: 0x%lux", badvaddr);
		exit();

M ss/fns.h => ss/fns.h +1 -1
@@ 53,7 53,7 @@ void	putwD16(ulong, ulong);
void	putwD(ulong, ulong);
void	putwE16(ulong, ulong);
void	putwE(ulong, ulong);
void	reset(void);
void	systemreset(void);
void	restartprint(Alarm*);
void	restfpregs(FPsave*);
void	screeninit(void);

M ss/main.c => ss/main.c +17 -3
@@ 58,7 58,7 @@ intrinit(void)
}

void
reset(void)
systemreset(void)
{
	delay(100);
	putb2(ENAB, ENABRESET);


@@ 110,6 110,16 @@ init0(void)
	u->slash = (*devtab[0].attach)(0);
	u->dot = clone(u->slash, 0);

	if(!waserror()){
		c = namec("#e/terminal", Acreate, OWRITE, 0600);
		(*devtab[c->type].write)(c, "sun sparc slc", strlen("sun sparc slc"), 0);
		close(c);
		c = namec("#e/cputype", Acreate, OWRITE, 0600);
		(*devtab[c->type].write)(c, "sparc", strlen("sparc"), 0);
		close(c);
		poperror();
	}

	touser(USTKTOP-(1+MAXSYSARG)*BY2WD);
}



@@ 178,7 188,7 @@ exit(void)
		for(i=0; i<1000; i++)
			;
	splhi();
	reset();
	systemreset();
}

Conf	conf;


@@ 231,6 241,10 @@ confinit(void)
	conf.nservice = 3*mul;			/* was conf.nproc/5 */
	conf.nfsyschan = 31 + conf.nchan/20;
	conf.copymode = 0;		/* copy on write */
	conf.ipif = 8;
	conf.ip = 64;
	conf.arp = 32;
	conf.frag = 32;
	conf.cntrlp = 0;
}



@@ 302,5 316,5 @@ print("%d lance buffers\n", i);
void
firmware(void)
{
	reset();
	systemreset();
}

M ss/trap.c => ss/trap.c +2 -0
@@ 365,6 365,7 @@ syscall(Ureg *aur)
		}
		if(sp<(USTKTOP-BY2PG) || sp>(USTKTOP-(1+MAXSYSARG)*BY2WD))
			validaddr(sp, ((1+MAXSYSARG)*BY2WD), 0);
		u->p->psstate = sysctab[r7];
		ret = (*systab[r7])((ulong*)(sp+1*BY2WD));
		poperror();
	}


@@ 377,6 378,7 @@ syscall(Ureg *aur)
		panic("error stack");
	}
	u->p->insyscall = 0;
	u->p->psstate = 0;
	if(r7 == NOTED)	/* ugly hack */
		noted(&aur, *(ulong*)(sp+1*BY2WD));	/* doesn't return */
	if(u->nnote && r7!=FORK){