Browse Source

Plan 9 from Bell Labs 2005-11-19

David du Colombier 15 years ago
parent
commit
068be308c8

+ 10 - 10
dist/replica/_plan9.db

@@ -7974,17 +7974,17 @@ sys/src/9/pc/main.c - 664 sys sys 1131290418 15224
 sys/src/9/pc/mem.h - 664 sys sys 1131290422 5209
 sys/src/9/pc/memory.c - 664 sys sys 1131573303 18191
 sys/src/9/pc/mkfile - 664 sys sys 1131907946 3571
-sys/src/9/pc/mmu.c - 664 sys sys 1131497813 22628
+sys/src/9/pc/mmu.c - 664 sys sys 1132341477 23864
 sys/src/9/pc/mouse.c - 664 sys sys 1098479254 7057
 sys/src/9/pc/mp.c - 664 sys sys 1131538523 17317
 sys/src/9/pc/mp.h - 664 sys sys 1131538511 6652
 sys/src/9/pc/nv_dma.h - 664 sys sys 1081384508 12943
-sys/src/9/pc/pc - 664 sys sys 1131907692 1428
+sys/src/9/pc/pc - 664 sys sys 1132333161 1428
 sys/src/9/pc/pcauth - 664 sys sys 1131907692 715
 sys/src/9/pc/pccd - 664 sys sys 1131636104 1427
 sys/src/9/pc/pccpu - 664 sys sys 1131907692 867
 sys/src/9/pc/pccpuf - 664 sys sys 1131907692 1487
-sys/src/9/pc/pcdisk - 664 sys sys 1131907692 1447
+sys/src/9/pc/pcdisk - 664 sys sys 1132333161 1447
 sys/src/9/pc/pcf - 664 sys sys 1131907692 1505
 sys/src/9/pc/pcfl - 664 sys sys 1042004821 1563
 sys/src/9/pc/pcflop - 664 sys sys 1131907692 1474
@@ -8006,7 +8006,7 @@ sys/src/9/pc/sdata.c - 664 sys sys 1131290578 52168
 sys/src/9/pc/sdmv50xx.c - 664 sys sys 1131290638 25780
 sys/src/9/pc/sdmylex.c - 664 sys sys 1131290583 27737
 sys/src/9/pc/sdscsi.c - 664 sys sys 1131293342 7133
-sys/src/9/pc/trap.c - 664 sys sys 1131375347 21210
+sys/src/9/pc/trap.c - 664 sys sys 1132341484 21278
 sys/src/9/pc/uarti8250.c - 664 sys sys 1102820421 13958
 sys/src/9/pc/uartisa.c - 664 sys sys 1127126907 1777
 sys/src/9/pc/uartpci.c - 664 sys sys 1096379063 2891
@@ -8024,7 +8024,7 @@ sys/src/9/pc/vgaet4000.c - 664 sys sys 1131290601 5111
 sys/src/9/pc/vgahiqvideo.c - 664 sys sys 1131290601 4098
 sys/src/9/pc/vgai81x.c - 664 sys sys 1131290601 4030
 sys/src/9/pc/vgamach64xx.c - 664 sys sys 1131290601 28257
-sys/src/9/pc/vgamga2164w.c - 664 sys sys 1131290602 4637
+sys/src/9/pc/vgamga2164w.c - 664 sys sys 1132331257 4769
 sys/src/9/pc/vgamga4xx.c - 664 sys sys 1131290602 10201
 sys/src/9/pc/vganeomagic.c - 664 sys sys 1131422294 10255
 sys/src/9/pc/vganvidia.c - 664 sys sys 1131290602 11783
@@ -13400,7 +13400,7 @@ sys/src/cmd/upas/send/makefile - 664 sys sys 944961322 1247
 sys/src/cmd/upas/send/message.c - 664 sys sys 1065717617 11064
 sys/src/cmd/upas/send/mkfile - 664 sys sys 1064589602 706
 sys/src/cmd/upas/send/regtest.c - 664 sys sys 944961322 566
-sys/src/cmd/upas/send/rewrite.c - 664 sys sys 1031707304 6294
+sys/src/cmd/upas/send/rewrite.c - 664 sys sys 1132331205 6386
 sys/src/cmd/upas/send/send.h - 664 sys sys 1069366924 3265
 sys/src/cmd/upas/send/skipequiv.c - 664 sys sys 944961322 1747
 sys/src/cmd/upas/send/translate.c - 664 sys sys 944961322 804
@@ -13413,7 +13413,7 @@ sys/src/cmd/upas/smtp/rfc822.y - 664 sys sys 1064589606 13417
 sys/src/cmd/upas/smtp/rmtdns.c - 664 sys sys 1015013150 1069
 sys/src/cmd/upas/smtp/smtp.c - 664 sys sys 1127394218 20091
 sys/src/cmd/upas/smtp/smtp.h - 664 sys sys 1108827986 1270
-sys/src/cmd/upas/smtp/smtpd.c - 664 sys sys 1120737512 30820
+sys/src/cmd/upas/smtp/smtpd.c - 664 sys sys 1132331205 31097
 sys/src/cmd/upas/smtp/smtpd.h - 664 sys sys 1067722781 1111
 sys/src/cmd/upas/smtp/smtpd.y - 664 sys sys 1061836986 6949
 sys/src/cmd/upas/smtp/spam.c - 664 sys sys 1098803961 10231
@@ -13869,7 +13869,7 @@ sys/src/lib9p - 20000000775 sys sys 1015023311 0
 sys/src/lib9p/_post.c - 664 sys sys 1103565871 1642
 sys/src/lib9p/dirread.c - 664 sys sys 1015023310 641
 sys/src/lib9p/fid.c - 664 sys sys 1089299187 1066
-sys/src/lib9p/file.c - 664 sys sys 1130597663 6695
+sys/src/lib9p/file.c - 664 sys sys 1132336580 6695
 sys/src/lib9p/ftest.c - 664 sys sys 1015023310 502
 sys/src/lib9p/intmap.c - 664 sys sys 1016833881 2255
 sys/src/lib9p/mem.c - 664 sys sys 1015023310 765
@@ -14084,7 +14084,7 @@ sys/src/libc/9sys/dirstat.c - 664 sys sys 1041363499 688
 sys/src/libc/9sys/dirwstat.c - 664 sys sys 1014927337 246
 sys/src/libc/9sys/fcallfmt.c - 664 sys sys 1108319655 5740
 sys/src/libc/9sys/fork.c - 664 sys sys 950892938 89
-sys/src/libc/9sys/getenv.c - 664 sys sys 985023079 548
+sys/src/libc/9sys/getenv.c - 664 sys sys 1132331534 589
 sys/src/libc/9sys/getnetconninfo.c - 664 sys sys 1108157974 2477
 sys/src/libc/9sys/getpid.c - 664 sys sys 944961712 198
 sys/src/libc/9sys/getppid.c - 664 sys sys 944961712 202
@@ -14182,7 +14182,7 @@ sys/src/libc/fmt/runevseprint.c - 664 sys sys 1014927316 313
 sys/src/libc/fmt/runevsmprint.c - 664 sys sys 1050433061 1043
 sys/src/libc/fmt/runevsnprint.c - 664 sys sys 1014927316 330
 sys/src/libc/fmt/seprint.c - 664 sys sys 1014927317 196
-sys/src/libc/fmt/smprint.c - 664 sys sys 1014927317 168
+sys/src/libc/fmt/smprint.c - 664 sys sys 1132331535 205
 sys/src/libc/fmt/snprint.c - 664 sys sys 1014927317 195
 sys/src/libc/fmt/sprint.c - 664 sys sys 1015088665 236
 sys/src/libc/fmt/vfprint.c - 664 sys sys 1014927317 518

+ 10 - 10
dist/replica/plan9.db

@@ -7974,17 +7974,17 @@ sys/src/9/pc/main.c - 664 sys sys 1131290418 15224
 sys/src/9/pc/mem.h - 664 sys sys 1131290422 5209
 sys/src/9/pc/memory.c - 664 sys sys 1131573303 18191
 sys/src/9/pc/mkfile - 664 sys sys 1131907946 3571
-sys/src/9/pc/mmu.c - 664 sys sys 1131497813 22628
+sys/src/9/pc/mmu.c - 664 sys sys 1132341477 23864
 sys/src/9/pc/mouse.c - 664 sys sys 1098479254 7057
 sys/src/9/pc/mp.c - 664 sys sys 1131538523 17317
 sys/src/9/pc/mp.h - 664 sys sys 1131538511 6652
 sys/src/9/pc/nv_dma.h - 664 sys sys 1081384508 12943
-sys/src/9/pc/pc - 664 sys sys 1131907692 1428
+sys/src/9/pc/pc - 664 sys sys 1132333161 1428
 sys/src/9/pc/pcauth - 664 sys sys 1131907692 715
 sys/src/9/pc/pccd - 664 sys sys 1131636104 1427
 sys/src/9/pc/pccpu - 664 sys sys 1131907692 867
 sys/src/9/pc/pccpuf - 664 sys sys 1131907692 1487
-sys/src/9/pc/pcdisk - 664 sys sys 1131907692 1447
+sys/src/9/pc/pcdisk - 664 sys sys 1132333161 1447
 sys/src/9/pc/pcf - 664 sys sys 1131907692 1505
 sys/src/9/pc/pcfl - 664 sys sys 1042004821 1563
 sys/src/9/pc/pcflop - 664 sys sys 1131907692 1474
@@ -8006,7 +8006,7 @@ sys/src/9/pc/sdata.c - 664 sys sys 1131290578 52168
 sys/src/9/pc/sdmv50xx.c - 664 sys sys 1131290638 25780
 sys/src/9/pc/sdmylex.c - 664 sys sys 1131290583 27737
 sys/src/9/pc/sdscsi.c - 664 sys sys 1131293342 7133
-sys/src/9/pc/trap.c - 664 sys sys 1131375347 21210
+sys/src/9/pc/trap.c - 664 sys sys 1132341484 21278
 sys/src/9/pc/uarti8250.c - 664 sys sys 1102820421 13958
 sys/src/9/pc/uartisa.c - 664 sys sys 1127126907 1777
 sys/src/9/pc/uartpci.c - 664 sys sys 1096379063 2891
@@ -8024,7 +8024,7 @@ sys/src/9/pc/vgaet4000.c - 664 sys sys 1131290601 5111
 sys/src/9/pc/vgahiqvideo.c - 664 sys sys 1131290601 4098
 sys/src/9/pc/vgai81x.c - 664 sys sys 1131290601 4030
 sys/src/9/pc/vgamach64xx.c - 664 sys sys 1131290601 28257
-sys/src/9/pc/vgamga2164w.c - 664 sys sys 1131290602 4637
+sys/src/9/pc/vgamga2164w.c - 664 sys sys 1132331257 4769
 sys/src/9/pc/vgamga4xx.c - 664 sys sys 1131290602 10201
 sys/src/9/pc/vganeomagic.c - 664 sys sys 1131422294 10255
 sys/src/9/pc/vganvidia.c - 664 sys sys 1131290602 11783
@@ -13400,7 +13400,7 @@ sys/src/cmd/upas/send/makefile - 664 sys sys 944961322 1247
 sys/src/cmd/upas/send/message.c - 664 sys sys 1065717617 11064
 sys/src/cmd/upas/send/mkfile - 664 sys sys 1064589602 706
 sys/src/cmd/upas/send/regtest.c - 664 sys sys 944961322 566
-sys/src/cmd/upas/send/rewrite.c - 664 sys sys 1031707304 6294
+sys/src/cmd/upas/send/rewrite.c - 664 sys sys 1132331205 6386
 sys/src/cmd/upas/send/send.h - 664 sys sys 1069366924 3265
 sys/src/cmd/upas/send/skipequiv.c - 664 sys sys 944961322 1747
 sys/src/cmd/upas/send/translate.c - 664 sys sys 944961322 804
@@ -13413,7 +13413,7 @@ sys/src/cmd/upas/smtp/rfc822.y - 664 sys sys 1064589606 13417
 sys/src/cmd/upas/smtp/rmtdns.c - 664 sys sys 1015013150 1069
 sys/src/cmd/upas/smtp/smtp.c - 664 sys sys 1127394218 20091
 sys/src/cmd/upas/smtp/smtp.h - 664 sys sys 1108827986 1270
-sys/src/cmd/upas/smtp/smtpd.c - 664 sys sys 1120737512 30820
+sys/src/cmd/upas/smtp/smtpd.c - 664 sys sys 1132331205 31097
 sys/src/cmd/upas/smtp/smtpd.h - 664 sys sys 1067722781 1111
 sys/src/cmd/upas/smtp/smtpd.y - 664 sys sys 1061836986 6949
 sys/src/cmd/upas/smtp/spam.c - 664 sys sys 1098803961 10231
@@ -13869,7 +13869,7 @@ sys/src/lib9p - 20000000775 sys sys 1015023311 0
 sys/src/lib9p/_post.c - 664 sys sys 1103565871 1642
 sys/src/lib9p/dirread.c - 664 sys sys 1015023310 641
 sys/src/lib9p/fid.c - 664 sys sys 1089299187 1066
-sys/src/lib9p/file.c - 664 sys sys 1130597663 6695
+sys/src/lib9p/file.c - 664 sys sys 1132336580 6695
 sys/src/lib9p/ftest.c - 664 sys sys 1015023310 502
 sys/src/lib9p/intmap.c - 664 sys sys 1016833881 2255
 sys/src/lib9p/mem.c - 664 sys sys 1015023310 765
@@ -14084,7 +14084,7 @@ sys/src/libc/9sys/dirstat.c - 664 sys sys 1041363499 688
 sys/src/libc/9sys/dirwstat.c - 664 sys sys 1014927337 246
 sys/src/libc/9sys/fcallfmt.c - 664 sys sys 1108319655 5740
 sys/src/libc/9sys/fork.c - 664 sys sys 950892938 89
-sys/src/libc/9sys/getenv.c - 664 sys sys 985023079 548
+sys/src/libc/9sys/getenv.c - 664 sys sys 1132331534 589
 sys/src/libc/9sys/getnetconninfo.c - 664 sys sys 1108157974 2477
 sys/src/libc/9sys/getpid.c - 664 sys sys 944961712 198
 sys/src/libc/9sys/getppid.c - 664 sys sys 944961712 202
@@ -14182,7 +14182,7 @@ sys/src/libc/fmt/runevseprint.c - 664 sys sys 1014927316 313
 sys/src/libc/fmt/runevsmprint.c - 664 sys sys 1050433061 1043
 sys/src/libc/fmt/runevsnprint.c - 664 sys sys 1014927316 330
 sys/src/libc/fmt/seprint.c - 664 sys sys 1014927317 196
-sys/src/libc/fmt/smprint.c - 664 sys sys 1014927317 168
+sys/src/libc/fmt/smprint.c - 664 sys sys 1132331535 205
 sys/src/libc/fmt/snprint.c - 664 sys sys 1014927317 195
 sys/src/libc/fmt/sprint.c - 664 sys sys 1015088665 236
 sys/src/libc/fmt/vfprint.c - 664 sys sys 1014927317 518

+ 12 - 0
dist/replica/plan9.log

@@ -22979,3 +22979,15 @@
 1131908513 7 c sys/src/9/pc/pccpuf - 664 sys sys 1131907692 1487
 1131908513 8 c sys/src/9/pc/pcflop - 664 sys sys 1131907692 1474
 1131908513 9 c sys/src/9/port/portmkfile - 664 sys sys 1131907975 2062
+1132331439 0 c sys/src/9/pc/pcdisk - 664 sys sys 1132331387 1447
+1132331439 1 c sys/src/9/pc/vgamga2164w.c - 664 sys sys 1132331257 4769
+1132331439 2 c sys/src/cmd/upas/send/rewrite.c - 664 sys sys 1132331205 6386
+1132331439 3 c sys/src/cmd/upas/smtp/smtpd.c - 664 sys sys 1132331205 31097
+1132333239 0 c sys/src/9/pc/pc - 664 sys sys 1132333161 1428
+1132333239 1 c sys/src/9/pc/pcdisk - 664 sys sys 1132333161 1447
+1132333239 2 c sys/src/lib9p/file.c - 664 sys sys 1132332118 6663
+1132333239 3 c sys/src/libc/9sys/getenv.c - 664 sys sys 1132331534 589
+1132333239 4 c sys/src/libc/fmt/smprint.c - 664 sys sys 1132331535 205
+1132336840 0 c sys/src/lib9p/file.c - 664 sys sys 1132336580 6695
+1132342242 0 c sys/src/9/pc/mmu.c - 664 sys sys 1132341477 23864
+1132342242 1 c sys/src/9/pc/trap.c - 664 sys sys 1132341484 21278

+ 47 - 2
sys/src/9/pc/mmu.c

@@ -393,12 +393,13 @@ upallocpdb(void)
 void
 putmmu(ulong va, ulong pa, Page*)
 {
-	int old;
+	int old, s;
 	Page *page;
 
 	if(up->mmupdb == nil)
 		upallocpdb();
 
+	s = splhi();
 	if(!(vpd[PDX(va)]&PTEVALID)){
 		if(up->mmufree == 0)
 			page = newpage(0, 0, 0);
@@ -417,6 +418,7 @@ putmmu(ulong va, ulong pa, Page*)
 	vpt[VPTX(va)] = pa|PTEUSER|PTEVALID;
 	if(old&PTEVALID)
 		flushpg(va);
+	splx(s);
 }
 
 /*
@@ -896,7 +898,7 @@ paddr(void *v)
 	
 	va = (ulong)v;
 	if(va < KZERO)
-		panic("paddr: va=%#.8lux", va);
+		panic("paddr: va=%#.8lux pc=%#.8lux", va, getcallerpc(&va));
 	return va-KZERO;
 }
 
@@ -989,3 +991,46 @@ countpagerefs(ulong *ref, int print)
 	if(!print)
 		iprint("%d pages in mach pdbpools\n", n);
 }
+
+void
+checkfault(ulong addr, ulong pc)
+{
+	ulong *a;
+	int i;
+	
+	print("user fault: addr=%.8lux pc=%.8lux\n", addr, pc);
+	if(!(vpd[PDX(addr)]&PTEVALID))
+		print("addr not mapped (vpd=%.8lux)\n", vpd[PDX(addr)]);
+	else if(!(vpt[VPTX(addr)]&PTEVALID))
+		print("addr not mapped (vpd=%.8lux vpt=%.8lux)\n",
+			vpd[PDX(addr)], vpt[VPTX(addr)]);
+	else
+		print("addr mapped (vpd=%.8lux vpt=%.8lux)\n",
+			vpd[PDX(addr)], vpt[VPTX(addr)]);
+	
+	if(!(vpd[PDX(pc)]&PTEVALID))
+		print("pc not mapped (vpd=%.8lux)\n", vpd[PDX(pc)]);
+	else if(!(vpt[VPTX(pc)]&PTEVALID))
+		print("pc not mapped (vpd=%.8lux vpt=%.8lux)\n",
+			vpd[PDX(pc)], vpt[VPTX(pc)]);
+	else{
+		print("pc mapped (vpd=%.8lux vpt=%.8lux)\n",
+			vpd[PDX(pc)], vpt[VPTX(pc)]);
+		if(PPN(pc) == PPN(pc+4))	/* not crossing into an unmapped page */
+			print("*pc: %.8lux\n", *(ulong*)pc);
+		a = (ulong*)PPN(pc);
+		for(i=0; i<WD2PG; i++)
+			if(a[i] != 0)
+				break;
+		if(i == WD2PG)
+			print("pc's page is all zeros\n");
+		else{
+			for(i=0; i<256/4; i+=8){
+				print("%.8lux: %.8lux %.8lux %.8lux %.8lux %.8lux %.8lux %.8lux %.8lux\n",
+					PPN(pc)+i*4, a[i], a[i+1], a[i+2], a[i+3], 
+					a[i+4], a[i+5], a[i+6], a[i+7]);
+			}
+		}
+	}
+}
+

+ 1 - 1
sys/src/9/pc/pc

@@ -36,9 +36,9 @@ dev
 	tv
 
 link
+	realmode
 	devpccard
 	devi82365
-	realmode
 	ether2000	ether8390
 	ether2114x	pci
 	ether589	etherelnk3

+ 1 - 1
sys/src/9/pc/pcdisk

@@ -33,6 +33,7 @@ dev
 	usb
 
 link
+	realmode
 	devpccard
 	devi82365
 	apm		apmjump
@@ -60,7 +61,6 @@ link
 	usbuhci
 
 misc
-	realmode
 	archmp		mp apic
 
 	sdata		pci sdscsi

+ 2 - 0
sys/src/9/pc/trap.c

@@ -592,6 +592,7 @@ unexpected(Ureg* ureg, void*)
 }
 
 extern void checkpages(void);
+extern void checkfault(ulong, ulong);
 static void
 fault386(Ureg* ureg, void*)
 {
@@ -623,6 +624,7 @@ fault386(Ureg* ureg, void*)
 			panic("fault: 0x%lux\n", addr);
 		}
 		checkpages();
+		checkfault(addr, ureg->pc);
 		sprint(buf, "sys: trap: fault %s addr=0x%lux",
 			read ? "read" : "write", addr);
 		postnote(up, 1, buf, NDebug);

+ 2 - 0
sys/src/9/pc/vgamga2164w.c

@@ -58,11 +58,13 @@ mga2164wenable(VGAscr* scr)
 		scr->mmio = vmap(p->mem[0].bar&~0x0F, p->mem[0].size);
 		if(scr->mmio == nil)
 			return;
+		addvgaseg("mga2164wmmio", p->mem[0].bar&~0x0F, p->mem[0].size);
 		vgalinearaddr(scr, p->mem[1].bar&~0x0F, 8*MB);
 	}else{
 		scr->mmio = vmap(p->mem[1].bar&~0x0F, p->mem[1].size);
 		if(scr->mmio == nil)
 			return;
+		addvgaseg("mga2164wmmio", p->mem[1].bar&~0x0F, p->mem[1].size);
 		vgalinearaddr(scr, p->mem[0].bar&~0x0F, 16*MB);
 	}
 	if(scr->paddr)

+ 2 - 0
sys/src/cmd/upas/send/rewrite.c

@@ -282,6 +282,8 @@ extern void
 regerror(char* s)
 {
 	fprint(2, "rewrite: %s\n", s);
+	/* make sure the message is seen locally */
+	syslog(0, "mail", "error in rewrite: %s", s);
 }
 
 extern void

+ 11 - 1
sys/src/cmd/upas/smtp/smtpd.c

@@ -157,7 +157,7 @@ main(int argc, char **argv)
 
 	if(debug){
 		close(2);
-		snprint(buf, sizeof(buf), "%s/smtpd", UPASLOG);
+		snprint(buf, sizeof(buf), "%s/smtpd.db", UPASLOG);
 		if (open(buf, OWRITE) >= 0) {
 			seek(2, 0, 2);
 			fprint(2, "%d smtpd %s\n", getpid(), thedate());
@@ -1221,6 +1221,16 @@ data(void)
 		}
 		reply("%d mail process terminated abnormally\r\n", code);
 	} else {
+		/*
+		 * if a message appeared on stderr, despite good status,
+		 * log it.  this can happen if rewrite.in contains a bad
+		 * r.e., for example.
+		 */
+		if(*s_to_c(err))
+			syslog(0, "smtpd",
+				"%s returned good status, but said: %s",
+				s_to_c(mailer), s_to_c(err));
+
 		if(filterstate == BLOCKED)
 			reply("554 we believe this is spam.  we don't accept it.\r\n");
 		else

+ 1 - 0
sys/src/libc/9sys/getenv.c

@@ -20,6 +20,7 @@ getenv(char *name)
 	s = seek(f, 0, 2);
 	ans = malloc(s+1);
 	if(ans) {
+		setmalloctag(ans, getcallerpc(&name));
 		seek(f, 0, 0);
 		r = read(f, ans, s);
 		if(r >= 0) {

+ 1 - 0
sys/src/libc/fmt/smprint.c

@@ -10,5 +10,6 @@ smprint(char *fmt, ...)
 	va_start(args, fmt);
 	p = vsmprint(fmt, args);
 	va_end(args);
+	setmalloctag(p, getcallerpc(&fmt));
 	return p;
 }