Browse Source

Plan 9 from Bell Labs 2008-07-23

David du Colombier 15 years ago
parent
commit
8ba8523bb6

+ 6 - 5
dist/replica/_plan9.db

@@ -7477,7 +7477,7 @@ sys/man/1/ps - 664 sys sys 1196638933 1722
 sys/man/1/ps2pdf - 664 sys sys 1196638936 1359
 sys/man/1/ps2pdf - 664 sys sys 1196638936 1359
 sys/man/1/pump - 664 sys sys 1213765898 1777
 sys/man/1/pump - 664 sys sys 1213765898 1777
 sys/man/1/pwd - 664 sys sys 1196638933 744
 sys/man/1/pwd - 664 sys sys 1196638933 744
-sys/man/1/rc - 664 sys sys 1196638936 20021
+sys/man/1/rc - 664 sys sys 1216774296 20112
 sys/man/1/replica - 664 sys sys 1196638936 7210
 sys/man/1/replica - 664 sys sys 1196638936 7210
 sys/man/1/resample - 664 sys sys 1196638933 1083
 sys/man/1/resample - 664 sys sys 1196638933 1083
 sys/man/1/rio - 664 sys sys 1196638933 14707
 sys/man/1/rio - 664 sys sys 1196638933 14707
@@ -9188,7 +9188,7 @@ sys/src/boot/pc/cis.c - 664 sys sys 1144961189 9232
 sys/src/boot/pc/clock.c - 664 sys sys 1212010463 6825
 sys/src/boot/pc/clock.c - 664 sys sys 1212010463 6825
 sys/src/boot/pc/conf.c - 664 sys sys 1094674484 10217
 sys/src/boot/pc/conf.c - 664 sys sys 1094674484 10217
 sys/src/boot/pc/console.c - 664 sys sys 1212010517 3422
 sys/src/boot/pc/console.c - 664 sys sys 1212010517 3422
-sys/src/boot/pc/dat.h - 664 sys sys 1190921443 3637
+sys/src/boot/pc/dat.h - 664 sys sys 1216774050 3637
 sys/src/boot/pc/devbios.c - 664 sys sys 1212010497 9431
 sys/src/boot/pc/devbios.c - 664 sys sys 1212010497 9431
 sys/src/boot/pc/devfloppy.c - 664 sys sys 1212010456 15657
 sys/src/boot/pc/devfloppy.c - 664 sys sys 1212010456 15657
 sys/src/boot/pc/devfloppy.h - 664 sys sys 1032409559 4081
 sys/src/boot/pc/devfloppy.h - 664 sys sys 1032409559 4081
@@ -9224,7 +9224,7 @@ sys/src/boot/pc/etherigbe.c - 664 sys sys 1201822335 41718
 sys/src/boot/pc/ethermii.c - 664 sys sys 1103641771 4413
 sys/src/boot/pc/ethermii.c - 664 sys sys 1103641771 4413
 sys/src/boot/pc/ethermii.h - 664 sys sys 1071175087 3259
 sys/src/boot/pc/ethermii.h - 664 sys sys 1071175087 3259
 sys/src/boot/pc/etherrhine.c - 664 sys sys 1212432164 13178
 sys/src/boot/pc/etherrhine.c - 664 sys sys 1212432164 13178
-sys/src/boot/pc/fns.h - 664 sys sys 1193171343 4880
+sys/src/boot/pc/fns.h - 664 sys sys 1216773354 4900
 sys/src/boot/pc/fs.c - 664 sys sys 1094674483 1509
 sys/src/boot/pc/fs.c - 664 sys sys 1094674483 1509
 sys/src/boot/pc/fs.h - 664 sys sys 1094674488 653
 sys/src/boot/pc/fs.h - 664 sys sys 1094674488 653
 sys/src/boot/pc/ilock.c - 664 sys sys 1015007952 303
 sys/src/boot/pc/ilock.c - 664 sys sys 1015007952 303
@@ -9236,7 +9236,7 @@ sys/src/boot/pc/kfs.h - 664 sys sys 1032215924 861
 sys/src/boot/pc/kfsboot.c - 664 sys sys 1032215914 4788
 sys/src/boot/pc/kfsboot.c - 664 sys sys 1032215914 4788
 sys/src/boot/pc/l.s - 664 sys sys 1193167045 18213
 sys/src/boot/pc/l.s - 664 sys sys 1193167045 18213
 sys/src/boot/pc/lib.h - 664 sys sys 1212090562 3280
 sys/src/boot/pc/lib.h - 664 sys sys 1212090562 3280
-sys/src/boot/pc/load.c - 664 sys sys 1212010219 10578
+sys/src/boot/pc/load.c - 664 sys sys 1212004261 10578
 sys/src/boot/pc/mbr.s - 664 sys sys 1015007953 6234
 sys/src/boot/pc/mbr.s - 664 sys sys 1015007953 6234
 sys/src/boot/pc/mem.h - 664 sys sys 1190921475 3437
 sys/src/boot/pc/mem.h - 664 sys sys 1190921475 3437
 sys/src/boot/pc/memory.c - 664 sys sys 1212010326 10266
 sys/src/boot/pc/memory.c - 664 sys sys 1212010326 10266
@@ -13289,7 +13289,7 @@ sys/src/cmd/ratfs/ratfs.h - 664 sys sys 1016943965 2743
 sys/src/cmd/rc - 20000000775 sys sys 1071884773 0
 sys/src/cmd/rc - 20000000775 sys sys 1071884773 0
 sys/src/cmd/rc/code.c - 664 sys sys 1182898057 8218
 sys/src/cmd/rc/code.c - 664 sys sys 1182898057 8218
 sys/src/cmd/rc/compiling.on.unix - 664 sys sys 1071884773 37638
 sys/src/cmd/rc/compiling.on.unix - 664 sys sys 1071884773 37638
-sys/src/cmd/rc/exec.c - 664 sys sys 1215383574 16601
+sys/src/cmd/rc/exec.c - 664 sys sys 1216774327 16980
 sys/src/cmd/rc/exec.h - 664 sys sys 1174851874 2828
 sys/src/cmd/rc/exec.h - 664 sys sys 1174851874 2828
 sys/src/cmd/rc/fns.h - 664 sys sys 1182899939 1490
 sys/src/cmd/rc/fns.h - 664 sys sys 1182899939 1490
 sys/src/cmd/rc/getflags.c - 664 sys sys 1182917999 3743
 sys/src/cmd/rc/getflags.c - 664 sys sys 1182917999 3743
@@ -15883,3 +15883,4 @@ usr/glenda/lib/profile - 664 glenda glenda 1105128663 890
 usr/glenda/readme.acme - 664 glenda glenda 1019860628 4753
 usr/glenda/readme.acme - 664 glenda glenda 1019860628 4753
 usr/glenda/readme.rio - 664 glenda glenda 1019860628 6370
 usr/glenda/readme.rio - 664 glenda glenda 1019860628 6370
 usr/glenda/tmp - 20000000775 glenda glenda 1018802620 0
 usr/glenda/tmp - 20000000775 glenda glenda 1018802620 0
+sys/src/boot/pc/pci.c - 664 sys sys 1216784600 20769

+ 6 - 6
dist/replica/plan9.db

@@ -7477,7 +7477,7 @@ sys/man/1/ps - 664 sys sys 1196638933 1722
 sys/man/1/ps2pdf - 664 sys sys 1196638936 1359
 sys/man/1/ps2pdf - 664 sys sys 1196638936 1359
 sys/man/1/pump - 664 sys sys 1213765898 1777
 sys/man/1/pump - 664 sys sys 1213765898 1777
 sys/man/1/pwd - 664 sys sys 1196638933 744
 sys/man/1/pwd - 664 sys sys 1196638933 744
-sys/man/1/rc - 664 sys sys 1196638936 20021
+sys/man/1/rc - 664 sys sys 1216774296 20112
 sys/man/1/replica - 664 sys sys 1196638936 7210
 sys/man/1/replica - 664 sys sys 1196638936 7210
 sys/man/1/resample - 664 sys sys 1196638933 1083
 sys/man/1/resample - 664 sys sys 1196638933 1083
 sys/man/1/rio - 664 sys sys 1196638933 14707
 sys/man/1/rio - 664 sys sys 1196638933 14707
@@ -9188,7 +9188,7 @@ sys/src/boot/pc/cis.c - 664 sys sys 1144961189 9232
 sys/src/boot/pc/clock.c - 664 sys sys 1212010463 6825
 sys/src/boot/pc/clock.c - 664 sys sys 1212010463 6825
 sys/src/boot/pc/conf.c - 664 sys sys 1094674484 10217
 sys/src/boot/pc/conf.c - 664 sys sys 1094674484 10217
 sys/src/boot/pc/console.c - 664 sys sys 1212010517 3422
 sys/src/boot/pc/console.c - 664 sys sys 1212010517 3422
-sys/src/boot/pc/dat.h - 664 sys sys 1190921443 3637
+sys/src/boot/pc/dat.h - 664 sys sys 1216774050 3637
 sys/src/boot/pc/devbios.c - 664 sys sys 1212010497 9431
 sys/src/boot/pc/devbios.c - 664 sys sys 1212010497 9431
 sys/src/boot/pc/devfloppy.c - 664 sys sys 1212010456 15657
 sys/src/boot/pc/devfloppy.c - 664 sys sys 1212010456 15657
 sys/src/boot/pc/devfloppy.h - 664 sys sys 1032409559 4081
 sys/src/boot/pc/devfloppy.h - 664 sys sys 1032409559 4081
@@ -9224,7 +9224,7 @@ sys/src/boot/pc/etherigbe.c - 664 sys sys 1201822335 41718
 sys/src/boot/pc/ethermii.c - 664 sys sys 1103641771 4413
 sys/src/boot/pc/ethermii.c - 664 sys sys 1103641771 4413
 sys/src/boot/pc/ethermii.h - 664 sys sys 1071175087 3259
 sys/src/boot/pc/ethermii.h - 664 sys sys 1071175087 3259
 sys/src/boot/pc/etherrhine.c - 664 sys sys 1212432164 13178
 sys/src/boot/pc/etherrhine.c - 664 sys sys 1212432164 13178
-sys/src/boot/pc/fns.h - 664 sys sys 1193171343 4880
+sys/src/boot/pc/fns.h - 664 sys sys 1216773354 4900
 sys/src/boot/pc/fs.c - 664 sys sys 1094674483 1509
 sys/src/boot/pc/fs.c - 664 sys sys 1094674483 1509
 sys/src/boot/pc/fs.h - 664 sys sys 1094674488 653
 sys/src/boot/pc/fs.h - 664 sys sys 1094674488 653
 sys/src/boot/pc/ilock.c - 664 sys sys 1015007952 303
 sys/src/boot/pc/ilock.c - 664 sys sys 1015007952 303
@@ -9236,7 +9236,7 @@ sys/src/boot/pc/kfs.h - 664 sys sys 1032215924 861
 sys/src/boot/pc/kfsboot.c - 664 sys sys 1032215914 4788
 sys/src/boot/pc/kfsboot.c - 664 sys sys 1032215914 4788
 sys/src/boot/pc/l.s - 664 sys sys 1193167045 18213
 sys/src/boot/pc/l.s - 664 sys sys 1193167045 18213
 sys/src/boot/pc/lib.h - 664 sys sys 1212090562 3280
 sys/src/boot/pc/lib.h - 664 sys sys 1212090562 3280
-sys/src/boot/pc/load.c - 664 sys sys 1212010219 10578
+sys/src/boot/pc/load.c - 664 sys sys 1212004261 10578
 sys/src/boot/pc/mbr.s - 664 sys sys 1015007953 6234
 sys/src/boot/pc/mbr.s - 664 sys sys 1015007953 6234
 sys/src/boot/pc/mem.h - 664 sys sys 1190921475 3437
 sys/src/boot/pc/mem.h - 664 sys sys 1190921475 3437
 sys/src/boot/pc/memory.c - 664 sys sys 1212010326 10266
 sys/src/boot/pc/memory.c - 664 sys sys 1212010326 10266
@@ -9247,7 +9247,7 @@ sys/src/boot/pc/pbs.s - 664 sys sys 1143465387 8291
 sys/src/boot/pc/pbsdebug.s - 664 sys sys 1205786244 6371
 sys/src/boot/pc/pbsdebug.s - 664 sys sys 1205786244 6371
 sys/src/boot/pc/pbslba.s - 664 sys sys 1186031549 8180
 sys/src/boot/pc/pbslba.s - 664 sys sys 1186031549 8180
 sys/src/boot/pc/pbslbadebug.s - 664 sys sys 1205786244 6021
 sys/src/boot/pc/pbslbadebug.s - 664 sys sys 1205786244 6021
-sys/src/boot/pc/pci.c - 664 sys sys 1196312243 20667
+sys/src/boot/pc/pci.c - 664 sys sys 1216784600 20769
 sys/src/boot/pc/print.c - 664 sys sys 1094674483 219
 sys/src/boot/pc/print.c - 664 sys sys 1094674483 219
 sys/src/boot/pc/queue.c - 664 sys sys 1015007954 566
 sys/src/boot/pc/queue.c - 664 sys sys 1015007954 566
 sys/src/boot/pc/sd.h - 664 sys sys 1200690169 2249
 sys/src/boot/pc/sd.h - 664 sys sys 1200690169 2249
@@ -13289,7 +13289,7 @@ sys/src/cmd/ratfs/ratfs.h - 664 sys sys 1016943965 2743
 sys/src/cmd/rc - 20000000775 sys sys 1071884773 0
 sys/src/cmd/rc - 20000000775 sys sys 1071884773 0
 sys/src/cmd/rc/code.c - 664 sys sys 1182898057 8218
 sys/src/cmd/rc/code.c - 664 sys sys 1182898057 8218
 sys/src/cmd/rc/compiling.on.unix - 664 sys sys 1071884773 37638
 sys/src/cmd/rc/compiling.on.unix - 664 sys sys 1071884773 37638
-sys/src/cmd/rc/exec.c - 664 sys sys 1215383574 16601
+sys/src/cmd/rc/exec.c - 664 sys sys 1216774327 16980
 sys/src/cmd/rc/exec.h - 664 sys sys 1174851874 2828
 sys/src/cmd/rc/exec.h - 664 sys sys 1174851874 2828
 sys/src/cmd/rc/fns.h - 664 sys sys 1182899939 1490
 sys/src/cmd/rc/fns.h - 664 sys sys 1182899939 1490
 sys/src/cmd/rc/getflags.c - 664 sys sys 1182917999 3743
 sys/src/cmd/rc/getflags.c - 664 sys sys 1182917999 3743

+ 7 - 0
dist/replica/plan9.log

@@ -20068,3 +20068,10 @@
 1216335604 0 c sys/man/1/vnc - 664 sys sys 1216333990 4339
 1216335604 0 c sys/man/1/vnc - 664 sys sys 1216333990 4339
 1216677605 0 c sys/src/9/pc/uartpci.c - 664 sys sys 1216677181 4912
 1216677605 0 c sys/src/9/pc/uartpci.c - 664 sys sys 1216677181 4912
 1216677605 1 c sys/src/cmd/unix/u9fs/u9fs.c - 664 sys sys 1216676473 32015
 1216677605 1 c sys/src/cmd/unix/u9fs/u9fs.c - 664 sys sys 1216676473 32015
+1216773003 0 c sys/src/boot/pc/dat.h - 664 sys sys 1216773354 3653
+1216773003 1 c sys/src/boot/pc/fns.h - 664 sys sys 1216773354 4900
+1216774804 0 c sys/man/1/rc - 664 sys sys 1216774296 20112
+1216774804 1 c sys/src/boot/pc/dat.h - 664 sys sys 1216774050 3637
+1216774804 2 c sys/src/boot/pc/load.c - 664 sys sys 1212004261 10578
+1216774804 3 c sys/src/cmd/rc/exec.c - 664 sys sys 1216774327 16980
+1216783804 0 c sys/src/boot/pc/pci.c - 664 sys sys 1216784600 20769

+ 5 - 0
sys/man/1/rc

@@ -213,6 +213,11 @@ If
 is followed by a parenthesized list of subscripts, the
 is followed by a parenthesized list of subscripts, the
 value substituted is a list composed of the requested elements (origin 1).
 value substituted is a list composed of the requested elements (origin 1).
 The parenthesis must follow the variable name with no spaces.
 The parenthesis must follow the variable name with no spaces.
+Subscripts can also take the form
+.IB m - n
+or
+.IB m -
+to indicate a sequence of elements.
 Assignments to variables are described below.
 Assignments to variables are described below.
 .HP
 .HP
 .BI $# argument
 .BI $# argument

+ 1 - 0
sys/src/boot/pc/dat.h

@@ -213,3 +213,4 @@ extern Apminfo	apm;
 extern char	*defaultpartition;
 extern char	*defaultpartition;
 extern int	iniread;
 extern int	iniread;
 extern int	pxe;
 extern int	pxe;
+extern int	vga;

+ 1 - 0
sys/src/boot/pc/fns.h

@@ -107,6 +107,7 @@ PCMmap*	pcmmap(int, ulong, int, int);
 int	pcmspecial(char*, ISAConf*);
 int	pcmspecial(char*, ISAConf*);
 void	pcmspecialclose(int);
 void	pcmspecialclose(int);
 void	pcmunmap(int, PCMmap*);
 void	pcmunmap(int, PCMmap*);
+void	prcpuid(void);
 void	ptcheck(char*);
 void	ptcheck(char*);
 void	putcr3(ulong);
 void	putcr3(ulong);
 void	putidt(Segdesc*, int);
 void	putidt(Segdesc*, int);

+ 28 - 9
sys/src/boot/pc/kbd.c

@@ -455,15 +455,35 @@ i8042intr(Ureg*, void*)
 
 
 static char *initfailed = "kbd init failed\n";
 static char *initfailed = "kbd init failed\n";
 
 
+static int
+outbyte(int port, int c)
+{
+	outb(port, c);
+	if(outready() < 0) {
+		vga = 0;
+		print(initfailed);
+		return -1;
+	}
+	return 0;
+}
+
 void
 void
 i8042init(void)
 i8042init(void)
 {
 {
-	int c;
+	int c, try;
 
 
 	/* wait for a quiescent controller */
 	/* wait for a quiescent controller */
-	while((c = inb(Status)) & (Outbusy | Inready))
+	try = 1000;
+	while(try-- > 0 && (c = inb(Status)) & (Outbusy | Inready)) {
 		if(c & Inready)
 		if(c & Inready)
 			inb(Data);
 			inb(Data);
+		delay(1);
+	}
+	if (try <= 0) {
+		vga = 0;
+		print(initfailed);
+		return;
+	}
 
 
 	/* get current controller command byte */
 	/* get current controller command byte */
 	outb(Cmd, 0x20);
 	outb(Cmd, 0x20);
@@ -476,14 +496,13 @@ i8042init(void)
 	/* enable kbd xfers and interrupts */
 	/* enable kbd xfers and interrupts */
 	ccc &= ~Ckbddis;
 	ccc &= ~Ckbddis;
 	ccc |= Csf | Ckbdint | Cscs1;
 	ccc |= Csf | Ckbdint | Cscs1;
-	if(outready() < 0)
-		print(initfailed);
-	outb(Cmd, 0x60);
-	if(outready() < 0)
-		print(initfailed);
-	outb(Data, ccc);
-	if(outready() < 0)
+	if(outready() < 0) {
+		vga = 0;
 		print(initfailed);
 		print(initfailed);
+		return;
+	}
+	if (outbyte(Cmd, 0x60) < 0 || outbyte(Data, ccc) < 0)
+		return;
 
 
 	setvec(VectorKBD, i8042intr, 0);
 	setvec(VectorKBD, i8042intr, 0);
 }
 }

+ 4 - 2
sys/src/boot/pc/pci.c

@@ -60,6 +60,7 @@ pcibarsize(Pcidev *p, int rno)
 	return -(size & ~0x0F);
 	return -(size & ~0x0F);
 }
 }
 
 
+/* side effect: if a video controller is seen, set vga non-zero */
 int
 int
 pciscan(int bno, Pcidev** list)
 pciscan(int bno, Pcidev** list)
 {
 {
@@ -117,9 +118,11 @@ pciscan(int bno, Pcidev** list)
 			 */
 			 */
 			switch(p->ccrb){
 			switch(p->ccrb){
 
 
+			case 0x03:		/* display controller */
+				vga = 1;
+				/* fall through */
 			case 0x01:		/* mass storage controller */
 			case 0x01:		/* mass storage controller */
 			case 0x02:		/* network controller */
 			case 0x02:		/* network controller */
-			case 0x03:		/* display controller */
 			case 0x04:		/* multimedia device */
 			case 0x04:		/* multimedia device */
 			case 0x07:		/* simple comm. controllers */
 			case 0x07:		/* simple comm. controllers */
 			case 0x08:		/* base system peripherals */
 			case 0x08:		/* base system peripherals */
@@ -464,7 +467,6 @@ pcirouting(void)
 
 
 			pci = nil;
 			pci = nil;
 			while ((pci = pcimatch(pci, vid, did)) != nil) {
 			while ((pci = pcimatch(pci, vid, did)) != nil) {
-
 				if (pci->intl != 0 && pci->intl != 0xFF)
 				if (pci->intl != 0 && pci->intl != 0xFF)
 					continue;
 					continue;
 
 

+ 35 - 5
sys/src/cmd/rc/exec.c

@@ -678,22 +678,52 @@ Xqdol(void)
 	efree(s);
 	efree(s);
 }
 }
 
 
+word*
+copynwords(word *a, word *tail, int n)
+{
+	word *v, **end;
+	
+	v = 0;
+	end = &v;
+	while(n-- > 0){
+		*end = newword(a->word, 0);
+		end = &(*end)->next;
+		a = a->next;
+	}
+	*end = tail;
+	return v;
+}
+
 word*
 word*
 subwords(word *val, int len, word *sub, word *a)
 subwords(word *val, int len, word *sub, word *a)
 {
 {
-	int n;
+	int n, m;
 	char *s;
 	char *s;
 	if(!sub)
 	if(!sub)
 		return a;
 		return a;
 	a = subwords(val, len, sub->next, a);
 	a = subwords(val, len, sub->next, a);
 	s = sub->word;
 	s = sub->word;
 	deglob(s);
 	deglob(s);
+	m = 0;
 	n = 0;
 	n = 0;
-	while('0'<=*s && *s<='9') n = n*10+ *s++ -'0';
-	if(n<1 || len<n)
+	while('0'<=*s && *s<='9')
+		n = n*10+ *s++ -'0';
+	if(*s == '-'){
+		if(*++s == 0)
+			m = len - n;
+		else{
+			while('0'<=*s && *s<='9')
+				m = m*10+ *s++ -'0';
+			m -= n;
+		}
+	}
+	if(n<1 || n>len || m<0)
 		return a;
 		return a;
-	for(;n!=1;--n) val = val->next;
-	return newword(val->word, a);
+	if(n+m>len)
+		m = len-n;
+	while(--n > 0)
+		val = val->next;
+	return copynwords(val, a, m+1);
 }
 }
 
 
 void
 void