Browse Source

Plan 9 from Bell Labs 2004-07-09

David du Colombier 20 years ago
parent
commit
80d7555c8f
100 changed files with 2445 additions and 6892 deletions
  1. 0 42
      29000/include/u.h
  2. 0 58
      29000/include/ureg.h
  3. 0 6
      29000/mkfile
  4. 0 41
      960/include/u.h
  5. 0 7
      960/mkfile
  6. 198 277
      dist/replica/_plan9.db
  7. 199 278
      dist/replica/plan9.db
  8. 325 0
      dist/replica/plan9.log
  9. 23 16
      mail/lib/smtpd.conf.ext
  10. 4 1
      rc/bin/patch/apply
  11. 3 1
      rc/bin/patch/note
  12. 3 2
      rc/bin/replica/scan
  13. 1 0
      sys/games/lib/fortunes
  14. 6 6
      sys/include/a.out.h
  15. 0 34
      sys/include/bootexec.h
  16. 1 0
      sys/include/html.h
  17. 2 0
      sys/include/ip.h
  18. 1 0
      sys/include/libc.h
  19. 23 25
      sys/include/mach.h
  20. 1 1
      sys/include/trace.h
  21. 0 2
      sys/lib/dist/pc/inst/moveoldfs
  22. 2 2
      sys/lib/dist/pc/proto
  23. 2 0
      sys/lib/mimetype
  24. 0 4
      sys/lib/sysconfig/proto/armpaqproto
  25. 6 1
      sys/man/1/2a
  26. 8 24
      sys/man/1/2c
  27. 6 12
      sys/man/1/2l
  28. 23 17
      sys/man/1/INDEX
  29. 52 24
      sys/man/1/INDEX.html
  30. 0 117
      sys/man/1/rtstats
  31. 17 2
      sys/man/2/INDEX
  32. 29 13
      sys/man/2/INDEX.html
  33. 1 1
      sys/man/3/INDEX
  34. 8 4
      sys/man/3/INDEX.html
  35. 3 1
      sys/man/4/INDEX
  36. 20 4
      sys/man/4/INDEX.html
  37. 14 2
      sys/man/8/INDEX
  38. 33 29
      sys/man/8/INDEX.html
  39. 7 5
      sys/src/9/pc/devpccard.c
  40. 143 36
      sys/src/9/pc/ether2000.c
  41. 44 24
      sys/src/9/pc/vganeomagic.c
  42. 281 282
      sys/src/9/ppc/l.s
  43. 5 3
      sys/src/cmd/1a/lex.c
  44. 9 8
      sys/src/cmd/1c/cgen.c
  45. 1 0
      sys/src/cmd/1c/enam.c
  46. 1 1
      sys/src/cmd/1c/gc.h
  47. 1 0
      sys/src/cmd/1c/peep.c
  48. 4 2
      sys/src/cmd/1c/reg.c
  49. 7 5
      sys/src/cmd/1c/sgen.c
  50. 33 11
      sys/src/cmd/1c/swt.c
  51. 3 3
      sys/src/cmd/1l/asm.c
  52. 2 1
      sys/src/cmd/1l/l.h
  53. 20 9
      sys/src/cmd/1l/obj.c
  54. 2 2
      sys/src/cmd/2a/a.h
  55. 10 3
      sys/src/cmd/2a/lex.c
  56. 2 1
      sys/src/cmd/2c/2.out.h
  57. 9 8
      sys/src/cmd/2c/cgen.c
  58. 1 0
      sys/src/cmd/2c/enam.c
  59. 16 6
      sys/src/cmd/2c/list.c
  60. 1 0
      sys/src/cmd/2c/peep.c
  61. 4 2
      sys/src/cmd/2c/reg.c
  62. 7 5
      sys/src/cmd/2c/sgen.c
  63. 33 11
      sys/src/cmd/2c/swt.c
  64. 4 2
      sys/src/cmd/2l/l.h
  65. 21 9
      sys/src/cmd/2l/obj.c
  66. 8 1
      sys/src/cmd/5a/a.y
  67. 36 24
      sys/src/cmd/5a/lex.c
  68. 10 1
      sys/src/cmd/5c/5.out.h
  69. 50 47
      sys/src/cmd/5c/cgen.c
  70. 4 0
      sys/src/cmd/5c/enam.c
  71. 2 1
      sys/src/cmd/5c/gc.h
  72. 1 1
      sys/src/cmd/5c/mkfile
  73. 4 0
      sys/src/cmd/5c/peep.c
  74. 4 3
      sys/src/cmd/5c/reg.c
  75. 3 3
      sys/src/cmd/5c/sgen.c
  76. 40 17
      sys/src/cmd/5c/swt.c
  77. 41 8
      sys/src/cmd/5c/txt.c
  78. 44 16
      sys/src/cmd/5l/asm.c
  79. 26 15
      sys/src/cmd/5l/l.h
  80. 42 18
      sys/src/cmd/5l/noop.c
  81. 130 66
      sys/src/cmd/5l/obj.c
  82. 152 8
      sys/src/cmd/5l/pass.c
  83. 163 10
      sys/src/cmd/5l/span.c
  84. 0 205
      sys/src/cmd/6a/a.h
  85. 0 384
      sys/src/cmd/6a/a.y
  86. 0 10
      sys/src/cmd/6a/l.s
  87. 0 643
      sys/src/cmd/6a/lex.c
  88. 0 28
      sys/src/cmd/6a/main9.s
  89. 0 19
      sys/src/cmd/6a/mkfile
  90. 0 203
      sys/src/cmd/6c/6.out.h
  91. 0 126
      sys/src/cmd/6c/bits.c
  92. 0 1001
      sys/src/cmd/6c/cgen.c
  93. 0 137
      sys/src/cmd/6c/enam.c
  94. 0 334
      sys/src/cmd/6c/gc.h
  95. 0 240
      sys/src/cmd/6c/list.c
  96. 0 15
      sys/src/cmd/6c/mkenam
  97. 0 22
      sys/src/cmd/6c/mkfile
  98. 0 527
      sys/src/cmd/6c/peep.c
  99. 0 1117
      sys/src/cmd/6c/reg.c
  100. 0 149
      sys/src/cmd/6c/reg.h

+ 0 - 42
29000/include/u.h

@@ -1,42 +0,0 @@
-#define nil		((void*)0)
-typedef	unsigned short	ushort;
-typedef	unsigned char	uchar;
-typedef	unsigned long	ulong;
-typedef	unsigned int	uint;
-typedef	signed char	schar;
-typedef	long long	vlong;
-typedef	unsigned long long uvlong;
-typedef	ushort		Rune;
-typedef 	union FPdbleword FPdbleword;
-typedef long	jmp_buf[2];
-#define	JMPBUFSP	0
-#define	JMPBUFPC	1
-#define	JMPBUFDPC	0
-typedef unsigned int	mpdigit;	/* for /sys/include/mp.h */
-typedef unsigned char u8int;
-typedef unsigned short u16int;
-typedef unsigned int	u32int;
-typedef unsigned long long u64int;
-
-union FPdbleword
-{
-	double	x;
-	struct {	/* big endian */
-		ulong hi;
-		ulong lo;
-	};
-};
-
-typedef	char*	va_list;
-#define va_start(list, start) list =\
-	(sizeof(start) < 4?\
-		(char*)((int*)&(start)+1):\
-		(char*)(&(start)+1))
-#define va_end(list)\
-	USED(list)
-#define va_arg(list, mode)\
-	((sizeof(mode) == 1)?\
-		((mode*)(list += 4))[-1]:\
-	(sizeof(mode) == 2)?\
-		((mode*)(list += 4))[-1]:\
-		((mode*)(list += sizeof(mode)))[-1])

+ 0 - 58
29000/include/ureg.h

@@ -1,58 +0,0 @@
-struct Ureg
-{
-	ulong	cause;			/* trap number */
-	ulong	status;			/* old status */
-	ulong	cha;			/* channel address */
-	ulong	chd;			/* channel data */
-	ulong	chc;			/* channel control */
-	union{
-		ulong	pc0;
-		ulong	pc;
-	};
-	ulong	pc1;
-	ulong	pc2;
-	ulong	ipc;
-	ulong	ipa;
-	ulong	ipb;
-	ulong	q;
-	ulong	alustat;
-	ulong	cr;
-	ulong	r64;
-	ulong	sp;			/* r65 */
-	ulong	r66;
-	ulong	r67;
-	ulong	r68;
-	ulong	r69;
-	ulong	r70;
-	ulong	r71;
-	ulong	r72;
-	ulong	r73;
-	ulong	r74;
-	ulong	r75;
-	ulong	r76;
-	ulong	r77;
-	ulong	r78;
-	ulong	r79;
-	ulong	r80;
-	ulong	r81;
-	ulong	r82;
-	ulong	r83;
-	ulong	r84;
-	ulong	r85;
-	ulong	r86;
-	ulong	r87;
-	ulong	r88;
-	ulong	r89;
-	ulong	r90;
-	ulong	r91;
-	ulong	r92;
-	ulong	r93;
-	ulong	r94;
-	ulong	r95;
-	ulong	r96;
-	ulong	r97;
-	ulong	r98;
-	ulong	r99;
-	ulong	r100;
-	ulong	r101;
-};

+ 0 - 6
29000/mkfile

@@ -1,6 +0,0 @@
-</sys/src/mkfile.proto
-
-CC=9c
-LD=9l
-O=9
-AS=9a

+ 0 - 41
960/include/u.h

@@ -1,41 +0,0 @@
-#define nil		((void*)0)
-#define	float	long
-#define	double	long
-typedef	unsigned short	ushort;
-typedef	unsigned char	uchar;
-typedef	unsigned long	ulong;
-typedef	unsigned int	uint;
-typedef	signed char	schar;
-typedef	long		vlong;
-typedef	unsigned long	uvlong;
-typedef	ushort		Rune;
-typedef 	union FPdbleword FPdbleword;
-typedef long	jmp_buf[2];
-typedef unsigned int	mpdigit;	/* for /sys/include/mp.h */
-typedef unsigned char u8int;
-typedef unsigned short u16int;
-typedef unsigned int	u32int;
-typedef unsigned long long u64int;
-
-union FPdbleword
-{
-	double	x;
-	struct {	/* little endian */
-		ulong lo;
-		ulong hi;
-	};
-};
-
-typedef	char*	va_list;
-#define va_start(list, start) list =\
-	(sizeof(start) < 4?\
-		(char*)((int*)&(start)+1):\
-		(char*)(&(start)+1))
-#define va_end(list)\
-	USED(list)
-#define va_arg(list, mode)\
-	((sizeof(mode) == 1)?\
-		((mode*)(list += 4))[-4]:\
-	(sizeof(mode) == 2)?\
-		((mode*)(list += 4))[-2]:\
-		((mode*)(list += sizeof(mode)))[-1])

+ 0 - 7
960/mkfile

@@ -1,7 +0,0 @@
-</sys/src/mkfile.proto
-
-CC=6c
-LD=6l
-O=6
-RL=rl
-AS=6a

File diff suppressed because it is too large
+ 198 - 277
dist/replica/_plan9.db


File diff suppressed because it is too large
+ 199 - 278
dist/replica/plan9.db


+ 325 - 0
dist/replica/plan9.log

@@ -15837,3 +15837,328 @@
 1089084659 8 c sys/man/2/9p - 664 sys sys 1089084170 15221
 1089084659 8 c sys/man/2/9p - 664 sys sys 1089084170 15221
 1089214223 0 c sys/man/2/ip - 664 sys sys 1089213089 7136
 1089214223 0 c sys/man/2/ip - 664 sys sys 1089213089 7136
 1089214223 1 c sys/src/libip/bo.c - 664 sys sys 1089213099 811
 1089214223 1 c sys/src/libip/bo.c - 664 sys sys 1089213099 811
+1089259232 0 c 386/bin/hget - 775 sys sys 1089257531 224015
+1089259232 1 c 386/bin/ftpfs - 775 sys sys 1089257530 146421
+1089259232 2 c 386/bin/netstat - 775 sys sys 1089257538 82357
+1089259232 3 c 386/bin/snoopy - 775 sys sys 1089257538 153188
+1089259232 4 c 386/bin/auth/authsrv - 775 sys sys 1089257526 163370
+1089259232 5 c 386/bin/auth/factotum - 775 sys sys 1089257527 307569
+1089259232 6 c 386/bin/auth/guard.srv - 775 sys sys 1089257528 140762
+1089259232 7 c 386/bin/auth/secstored - 775 sys sys 1089257528 194770
+1089259232 8 c 386/bin/aux/nfsserver - 775 sys sys 1089257529 183491
+1089259232 9 c 386/bin/aux/pcnfsd - 775 sys sys 1089257529 127413
+1089259232 10 c 386/bin/aux/portmapper - 775 sys sys 1089257529 126299
+1089259232 11 c 386/bin/aux/timesync - 775 sys sys 1089257530 125409
+1089259232 12 c 386/bin/ip/dhcpclient - 775 sys sys 1089257531 92091
+1089259232 13 c 386/bin/ip/dhcpd - 775 sys sys 1089257532 147194
+1089259232 14 c 386/bin/ip/dhcpleases - 775 sys sys 1089257532 84202
+1089259232 15 c 386/bin/ip/ftpd - 775 sys sys 1089257532 165934
+1089259232 16 c 386/bin/ip/gping - 775 sys sys 1089257533 180180
+1089259232 17 c 386/bin/ip/ipconfig - 775 sys sys 1089257533 135811
+1089259232 18 c 386/bin/ip/ping - 775 sys sys 1089257533 75000
+1089259232 19 c 386/bin/ip/ppp - 775 sys sys 1089257534 216401
+1089259232 20 c 386/bin/ip/pppoe - 775 sys sys 1089257534 75540
+1089259232 21 c 386/bin/ip/pptp - 775 sys sys 1089257534 124731
+1089259232 22 c 386/bin/ip/pptpd - 775 sys sys 1089257535 123832
+1089259232 23 c 386/bin/ip/rarpd - 775 sys sys 1089257535 109623
+1089259232 24 c 386/bin/ip/rip - 775 sys sys 1089257535 89203
+1089259232 25 c 386/bin/ip/tftpd - 775 sys sys 1089257536 104155
+1089259232 26 c 386/bin/ndb/cs - 775 sys sys 1089257536 147261
+1089259232 27 c 386/bin/ndb/dns - 775 sys sys 1089257537 218031
+1089259232 28 c 386/bin/ndb/dnsdebug - 775 sys sys 1089257537 192630
+1089259232 29 c 386/bin/ndb/dnstcp - 775 sys sys 1089257537 191267
+1089259232 30 c 386/bin/ndb/ipquery - 775 sys sys 1089257538 93556
+1089259232 31 c 386/bin/upas/ratfs - 775 sys sys 1089257539 109406
+1089259232 32 c 386/bin/upas/smtpd - 775 sys sys 1089257540 324203
+1089259232 33 c 386/lib/libip.a - 664 sys sys 1089257540 35264
+1089300639 0 c mail/lib/smtpd.conf.ext - 664 upas upas 1089299188 1032
+1089300639 1 c rc/bin/patch/apply - 775 sys sys 1089299188 1276
+1089300639 2 c rc/bin/patch/note - 664 sys sys 1089299189 655
+1089300639 3 c rc/bin/replica/scan - 775 sys sys 1089299188 472
+1089300639 4 c sys/games/lib/fortunes - 664 sys sys 1089299186 248807
+1089300639 5 c sys/include/html.h - 664 sys sys 1089299189 15169
+1089300639 6 c sys/include/ip.h - 664 sys sys 1089299185 2958
+1089300639 7 c sys/include/libc.h - 664 sys sys 1089299187 19463
+1089300639 8 c sys/include/trace.h - 664 sys sys 1089299189 642
+1089300639 9 c sys/lib/mimetype - 664 sys sys 1089299188 5778
+1089300639 10 c sys/lib/dist/pc/proto - 664 sys sys 1089299188 4314
+1089300639 11 c sys/lib/sysconfig/proto/armpaqproto - 664 sys sys 1089299189 2230
+1089300639 12 c sys/man/1/2a - 664 sys sys 1089299164 1188
+1089300639 13 c sys/man/1/2c - 664 sys sys 1089299164 7193
+1089300639 14 c sys/man/1/2l - 664 sys sys 1089299164 4000
+1089300639 15 c sys/src/9/boot/libboot.a8 - 664 sys sys 1089299185 63496
+1089300639 16 c sys/src/9/pc/devpccard.c - 664 sys sys 1089299187 40138
+1089300639 17 c sys/src/9/pc/ether2000.c - 664 sys sys 1089299187 4819
+1089300639 18 c sys/src/9/pc/vganeomagic.c - 664 sys sys 1089299188 11261
+1089300639 19 c sys/src/9/ppc/l.s - 664 sys sys 1089299185 20371
+1089300639 20 c sys/src/cmd/2a/a.h - 664 sys sys 1089299177 3090
+1089300639 21 c sys/src/cmd/2a/lex.c - 664 sys sys 1089299177 19549
+1089300639 22 c sys/src/cmd/2c/2.out.h - 664 sys sys 1089299176 5075
+1089300639 23 c sys/src/cmd/2c/cgen.c - 664 sys sys 1089299176 28451
+1089300639 24 c sys/src/cmd/2c/enam.c - 664 sys sys 1089299176 4239
+1089300639 25 c sys/src/cmd/2c/list.c - 664 sys sys 1089299176 5521
+1089300639 26 c sys/src/cmd/2c/peep.c - 664 sys sys 1089299176 15926
+1089300639 27 c sys/src/cmd/2c/reg.c - 664 sys sys 1089299176 22310
+1089300639 28 c sys/src/cmd/2c/sgen.c - 664 sys sys 1089299177 12738
+1089300639 29 c sys/src/cmd/2c/swt.c - 664 sys sys 1089299177 17110
+1089300639 30 c sys/src/cmd/2l/l.h - 664 sys sys 1089299175 4596
+1089300639 31 c sys/src/cmd/2l/obj.c - 664 sys sys 1089299175 24382
+1089300639 32 c sys/src/cmd/5a/a.y - 664 sys sys 1089299175 8671
+1089300639 33 c sys/src/cmd/5a/lex.c - 664 sys sys 1089299175 11260
+1089300639 34 c sys/src/cmd/5c/5.out.h - 664 sys sys 1089299174 2566
+1089300639 35 c sys/src/cmd/5c/cgen.c - 664 sys sys 1089299174 19625
+1089300639 36 c sys/src/cmd/5c/enam.c - 664 sys sys 1089299175 849
+1089300639 37 c sys/src/cmd/5c/gc.h - 664 sys sys 1089299174 6070
+1089300639 38 c sys/src/cmd/5c/mkfile - 664 sys sys 1089299173 310
+1089300639 39 c sys/src/cmd/5c/peep.c - 664 sys sys 1089299175 24469
+1089300639 40 c sys/src/cmd/5c/reg.c - 664 sys sys 1089299174 19492
+1089300639 41 c sys/src/cmd/5c/sgen.c - 664 sys sys 1089299174 9114
+1089300639 42 c sys/src/cmd/5c/swt.c - 664 sys sys 1089299174 12828
+1089300639 43 c sys/src/cmd/5c/txt.c - 664 sys sys 1089299173 19028
+1089300639 44 c sys/src/cmd/5l/asm.c - 664 sys sys 1089299173 32633
+1089300639 45 c sys/src/cmd/5l/l.h - 664 sys sys 1089299173 6841
+1089300639 46 c sys/src/cmd/5l/noop.c - 664 sys sys 1089299172 8989
+1089300639 47 c sys/src/cmd/5l/obj.c - 664 sys sys 1089299173 25833
+1089300639 48 c sys/src/cmd/5l/pass.c - 664 sys sys 1089299173 10297
+1089300639 49 c sys/src/cmd/5l/span.c - 664 sys sys 1089299172 16642
+1089300639 50 c sys/src/cmd/8a/a.h - 664 sys sys 1089299185 3016
+1089300639 51 c sys/src/cmd/8a/lex.c - 664 sys sys 1089299184 18202
+1089300639 52 c sys/src/cmd/8c/8.out.h - 664 sys sys 1089299180 4119
+1089300639 53 c sys/src/cmd/8c/cgen.c - 664 sys sys 1089299180 32120
+1089300639 54 c sys/src/cmd/8c/cgen64.c - 664 sys sys 1089299182 45852
+1089300639 55 c sys/src/cmd/8c/enam.c - 664 sys sys 1089299181 3227
+1089300639 56 c sys/src/cmd/8c/gc.h - 664 sys sys 1089299181 6418
+1089300639 57 c sys/src/cmd/8c/machcap.c - 664 sys sys 1089299180 1201
+1089300639 58 c sys/src/cmd/8c/mkfile - 664 sys sys 1089299181 322
+1089300639 59 c sys/src/cmd/8c/peep.c - 664 sys sys 1089299181 11182
+1089300639 60 c sys/src/cmd/8c/reg.c - 664 sys sys 1089299180 20556
+1089300639 61 c sys/src/cmd/8c/sgen.c - 664 sys sys 1089299181 12833
+1089300639 62 c sys/src/cmd/8c/swt.c - 664 sys sys 1089299180 10883
+1089300639 63 c sys/src/cmd/8c/txt.c - 664 sys sys 1089299180 24215
+1089300639 64 c sys/src/cmd/8l/asm.c - 664 sys sys 1089299184 10256
+1089300639 65 c sys/src/cmd/8l/l.h - 664 sys sys 1089299184 5823
+1089300639 66 c sys/src/cmd/8l/obj.c - 664 sys sys 1089299184 25826
+1089300639 67 c sys/src/cmd/8l/pass.c - 664 sys sys 1089299184 13655
+1089300639 68 c sys/src/cmd/8l/span.c - 664 sys sys 1089299184 23295
+1089300639 69 c sys/src/cmd/cc/cc.h - 664 sys sys 1089299183 12053
+1089300639 70 c sys/src/cmd/cc/com.c - 664 sys sys 1089299183 18909
+1089300639 71 c sys/src/cmd/cc/com64.c - 664 sys sys 1089299182 9975
+1089300639 72 c sys/src/cmd/cc/dcl.c - 664 sys sys 1089299183 26723
+1089300639 73 c sys/src/cmd/cc/dpchk.c - 664 sys sys 1089299182 7089
+1089300639 74 c sys/src/cmd/cc/lex.c - 664 sys sys 1089299182 23826
+1089300639 75 c sys/src/cmd/cc/lexbody - 664 sys sys 1089299183 9017
+1089300639 76 c sys/src/cmd/cc/macbody - 664 sys sys 1089299183 11365
+1089300639 77 c sys/src/cmd/cc/mkfile - 664 sys sys 1089299182 578
+1089300639 78 c sys/src/cmd/cc/sub.c - 664 sys sys 1089299183 33811
+1089300639 79 c sys/src/cmd/ip/snoopy/mkfile - 664 sys sys 1089299190 788
+1089300639 80 c sys/src/cmd/ip/snoopy/udp.c - 664 sys sys 1089299190 1990
+1089300639 81 c sys/src/cmd/ka/a.h - 664 sys sys 1089299172 2911
+1089300639 82 c sys/src/cmd/ka/lex.c - 664 sys sys 1089299171 12938
+1089300639 83 c sys/src/cmd/kc/enam.c - 664 sys sys 1089299170 1612
+1089300639 84 c sys/src/cmd/kc/k.out.h - 664 sys sys 1089299170 3063
+1089300639 85 c sys/src/cmd/kc/mul.c - 664 sys sys 1089299171 9255
+1089300639 86 c sys/src/cmd/kc/peep.c - 664 sys sys 1089299171 10332
+1089300639 87 c sys/src/cmd/kc/reg.c - 664 sys sys 1089299171 18937
+1089300639 88 c sys/src/cmd/kc/swt.c - 664 sys sys 1089299171 11895
+1089300639 89 c sys/src/cmd/kc/txt.c - 664 sys sys 1089299171 19578
+1089300639 90 c sys/src/cmd/kl/obj.c - 664 sys sys 1089299170 21649
+1089300639 91 c sys/src/cmd/kl/sched.c - 664 sys sys 1089299170 10796
+1089300639 92 c sys/src/cmd/qa/a.h - 664 sys sys 1089299169 3252
+1089300639 93 c sys/src/cmd/qa/a.y - 664 sys sys 1089299169 13384
+1089300639 94 c sys/src/cmd/qa/lex.c - 664 sys sys 1089299170 16573
+1089300639 95 c sys/src/cmd/1c/cgen.c - 664 sys sys 1089299179 28257
+1089300639 96 c sys/src/cmd/1c/enam.c - 664 sys sys 1089299179 4239
+1089300639 97 c sys/src/cmd/1c/gc.h - 664 sys sys 1089299178 6006
+1089300639 98 c sys/src/cmd/1c/peep.c - 664 sys sys 1089299178 15578
+1089300639 99 c sys/src/cmd/1c/reg.c - 664 sys sys 1089299178 21252
+1089300639 100 c sys/src/cmd/1c/sgen.c - 664 sys sys 1089299179 10853
+1089300639 101 c sys/src/cmd/1c/swt.c - 664 sys sys 1089299179 15357
+1089300639 102 c sys/src/cmd/qc/enam.c - 664 sys sys 1089299168 3653
+1089300639 103 c sys/src/cmd/qc/gc.h - 664 sys sys 1089299169 5971
+1089300639 104 c sys/src/cmd/qc/mkfile - 664 sys sys 1089299168 338
+1089300639 105 c sys/src/cmd/qc/peep.c - 664 sys sys 1089299168 15241
+1089300639 106 c sys/src/cmd/qc/q.out.h - 664 sys sys 1089299169 5042
+1089300639 107 c sys/src/cmd/qc/reg.c - 664 sys sys 1089299169 19059
+1089300639 108 c sys/src/cmd/qc/sgen.c - 664 sys sys 1089299169 9499
+1089300639 109 c sys/src/cmd/qc/swt.c - 664 sys sys 1089299168 11985
+1089300639 110 c sys/src/cmd/qc/txt.c - 664 sys sys 1089299169 20223
+1089300639 111 c sys/src/cmd/ql/asm.c - 664 sys sys 1089299167 13059
+1089300639 112 c sys/src/cmd/ql/asmout.c - 664 sys sys 1089299167 35642
+1089300639 113 c sys/src/cmd/ql/cnam.c - 664 sys sys 1089299167 335
+1089300639 114 c sys/src/cmd/ql/l.h - 664 sys sys 1089299168 5935
+1089300639 115 c sys/src/cmd/ql/list.c - 664 sys sys 1089299166 5663
+1089300639 116 c sys/src/cmd/ql/mkfile - 664 sys sys 1089299166 304
+1089300639 117 c sys/src/cmd/ql/noop.c - 664 sys sys 1089299167 8982
+1089300639 118 c sys/src/cmd/ql/obj.c - 664 sys sys 1089299167 25301
+1089300639 119 c sys/src/cmd/ql/optab.c - 664 sys sys 1089299167 13392
+1089300639 120 c sys/src/cmd/ql/pass.c - 664 sys sys 1089299168 11868
+1089300639 121 c sys/src/cmd/ql/sched.c - 664 sys sys 1089299166 12776
+1089300639 122 c sys/src/cmd/ql/span.c - 664 sys sys 1089299167 19882
+1089300639 123 c sys/src/cmd/upas/bayes/addhash.c - 664 sys sys 1089299190 1054
+1089300639 124 c sys/src/cmd/upas/bayes/hash.c - 664 sys sys 1089299190 4208
+1089300639 125 c sys/src/cmd/upas/bayes/msgclass.c - 664 sys sys 1089299190 4776
+1089300639 126 c sys/src/cmd/upas/fs/fs.c - 664 sys sys 1089299189 27390
+1089300639 127 c sys/src/cmd/upas/marshal/marshal.c - 664 sys sys 1089299189 32566
+1089300639 128 c sys/src/cmd/usb/mkfile - 664 sys sys 1089299190 221
+1089300639 129 c sys/src/cmd/va/a.h - 664 sys sys 1089299166 2915
+1089300639 130 c sys/src/cmd/va/lex.c - 664 sys sys 1089299166 12004
+1089300639 131 c sys/src/cmd/vc/enam.c - 664 sys sys 1089299165 1093
+1089300639 132 c sys/src/cmd/vc/peep.c - 664 sys sys 1089299165 10302
+1089300639 133 c sys/src/cmd/vc/reg.c - 664 sys sys 1089299166 19378
+1089300639 134 c sys/src/cmd/vc/sgen.c - 664 sys sys 1089299165 8548
+1089300639 135 c sys/src/cmd/vc/swt.c - 664 sys sys 1089299165 12101
+1089300639 136 c sys/src/cmd/vc/txt.c - 664 sys sys 1089299165 22720
+1089300639 137 c sys/src/cmd/vc/v.out.h - 664 sys sys 1089299165 2630
+1089300639 138 c sys/src/cmd/vl/l.h - 664 sys sys 1089299164 5422
+1089300639 139 c sys/src/cmd/vl/obj.c - 664 sys sys 1089299164 23039
+1089300639 140 c sys/src/cmd/1a/lex.c - 664 sys sys 1089299179 19313
+1089300639 141 c sys/src/cmd/1l/asm.c - 664 sys sys 1089299178 27888
+1089300639 142 c sys/src/cmd/1l/l.h - 664 sys sys 1089299178 4736
+1089300639 143 c sys/src/cmd/1l/obj.c - 664 sys sys 1089299178 23682
+1089300639 144 c sys/src/cmd/7c/7.out.h - 664 sys sys 1089299276 2660
+1089300639 145 m sys/src/cmd/7c/7.out.h - 664 sys sys 1089299276 2660
+1089300639 146 m sys/src/cmd/7c/enam.c - 664 sys sys 944961627 1595
+1089300639 147 m sys/src/cmd/7c/gc.h - 664 sys sys 1014926894 5832
+1089300639 148 m sys/src/cmd/7c/list.c - 664 sys sys 1067723063 3862
+1089300639 149 m sys/src/cmd/7c/mkenam - 664 sys sys 944961627 112
+1089300639 150 m sys/src/cmd/7c/mkfile - 664 sys sys 944961627 310
+1089300639 151 m sys/src/cmd/7c/mul.c - 664 sys sys 944961627 9189
+1089300639 152 m sys/src/cmd/7c/peep.c - 664 sys sys 950104622 11473
+1089300639 153 c sys/src/cmd/7c/reg.c - 664 sys sys 1089299275 19737
+1089300639 154 m sys/src/cmd/7c/reg.c - 664 sys sys 1089299275 19737
+1089300639 155 m sys/src/cmd/7c/sgen.c - 664 sys sys 952627644 8781
+1089300639 156 m sys/src/cmd/7c/swt.c - 664 sys sys 944961627 11569
+1089300639 157 c sys/src/cmd/7c/txt.c - 664 sys sys 1089299172 20195
+1089300639 158 c sys/src/cmd/fossil/view.c - 664 sys sys 1089299187 19664
+1089300639 159 c sys/src/cmd/trace.c - 664 sys sys 1089299188 17772
+1089300639 160 c sys/src/lib9p/fid.c - 664 sys sys 1089299187 1066
+1089300639 161 c sys/src/lib9p/req.c - 664 sys sys 1089299187 1652
+1089300639 162 c sys/src/libc/mkfile - 664 sys sys 1089299164 630
+1089300639 163 c sys/src/mkfile.proto - 664 sys sys 1089299185 266
+1089300639 164 d sys/src/libc/29000/vlrt.c - 664 sys sys 944961708 0
+1089300639 165 d sys/src/libc/29000/vlop.s - 664 sys sys 944961707 0
+1089300639 166 d sys/src/libc/29000/setjmp.s - 664 sys sys 944961707 0
+1089300639 167 d sys/src/libc/29000/notejmp.c - 664 sys sys 944961708 0
+1089300639 168 d sys/src/libc/29000/mul.s - 664 sys sys 944961708 0
+1089300639 169 d sys/src/libc/29000/mkfile - 664 sys sys 1067723170 0
+1089300639 170 d sys/src/libc/29000/main9p.s - 664 sys sys 1067722815 0
+1089300639 171 d sys/src/libc/29000/main9.s - 664 sys sys 1067722823 0
+1089300639 172 d sys/src/libc/29000/doprint.xc - 664 sys sys 944961707 0
+1089300639 173 d sys/src/libc/29000/div.s - 664 sys sys 944961707 0
+1089300639 174 d sys/src/libc/29000/argv0.s - 664 sys sys 1067722825 0
+1089300639 175 d sys/src/libc/29000 - 20000000775 sys sys 984709298 0
+1089300639 176 d sys/src/cmd/9l/span.c - 664 sys sys 1045503966 0
+1089300639 177 d sys/src/cmd/9l/sched.c - 664 sys sys 1014936054 0
+1089300639 178 d sys/src/cmd/9l/pass.c - 664 sys sys 1045503965 0
+1089300639 179 d sys/src/cmd/9l/optab.c - 664 sys sys 944960738 0
+1089300639 180 d sys/src/cmd/9l/obj.c - 664 sys sys 1045503965 0
+1089300639 181 d sys/src/cmd/9l/noop.c - 664 sys sys 1045503964 0
+1089300639 182 d sys/src/cmd/9l/mkfile - 664 sys sys 944960737 0
+1089300639 183 d sys/src/cmd/9l/list.c - 664 sys sys 1014924900 0
+1089300639 184 d sys/src/cmd/9l/l.h - 664 sys sys 1014924900 0
+1089300639 185 d sys/src/cmd/9l/asm.c - 664 sys sys 1045503951 0
+1089300639 186 d sys/src/cmd/9l - 20000000775 sys sys 954035219 0
+1089300639 187 d sys/src/cmd/9c/y - 664 sys sys 944960736 0
+1089300639 188 d sys/src/cmd/9c/txt.c - 664 sys sys 1067720683 0
+1089300639 189 d sys/src/cmd/9c/swt.c - 664 sys sys 984718266 0
+1089300639 190 d sys/src/cmd/9c/sgen.c - 664 sys sys 952627559 0
+1089300639 191 d sys/src/cmd/9c/reg.c - 664 sys sys 1014936624 0
+1089300639 192 d sys/src/cmd/9c/peep.c - 664 sys sys 944960736 0
+1089300639 193 d sys/src/cmd/9c/mul.c - 664 sys sys 944960735 0
+1089300639 194 d sys/src/cmd/9c/mkfile - 664 sys sys 944960735 0
+1089300639 195 d sys/src/cmd/9c/mkenam - 664 sys sys 944960735 0
+1089300639 196 d sys/src/cmd/9c/list.c - 664 sys sys 1067720727 0
+1089300639 197 d sys/src/cmd/9c/gc.h - 664 sys sys 1014924888 0
+1089300639 198 d sys/src/cmd/9c/enam.c - 664 sys sys 944960735 0
+1089300639 199 d sys/src/cmd/9c/cgen.c - 664 sys sys 984718266 0
+1089300639 200 d sys/src/cmd/9c/bits.c - 664 sys sys 944960735 0
+1089300639 201 d sys/src/cmd/9c/9.out.h - 664 sys sys 944960735 0
+1089300639 202 d sys/src/cmd/9c - 20000000775 sys sys 954034958 0
+1089300639 203 d sys/src/cmd/9a/mkfile - 664 sys sys 944960735 0
+1089300639 204 d sys/src/cmd/9a/lex.c - 664 sys sys 1067725161 0
+1089300639 205 d sys/src/cmd/9a/l.s - 664 sys sys 944960735 0
+1089300639 206 d sys/src/cmd/9a/a.y - 664 sys sys 944960735 0
+1089300639 207 d sys/src/cmd/9a/a.h - 664 sys sys 944960735 0
+1089300639 208 d sys/src/cmd/9a - 20000000775 sys sys 954034958 0
+1089300639 209 d sys/src/cmd/6l/span.c - 664 sys sys 1045503942 0
+1089300639 210 d sys/src/cmd/6l/pass.c - 664 sys sys 1045503941 0
+1089300639 211 d sys/src/cmd/6l/optab.c - 664 sys sys 944960729 0
+1089300639 212 d sys/src/cmd/6l/obj.c - 664 sys sys 1045503940 0
+1089300639 213 d sys/src/cmd/6l/noop.c - 664 sys sys 944960729 0
+1089300639 214 d sys/src/cmd/6l/mkfile - 664 sys sys 969510786 0
+1089300639 215 d sys/src/cmd/6l/list.c - 664 sys sys 1014924827 0
+1089300639 216 d sys/src/cmd/6l/l.s - 664 sys sys 944960729 0
+1089300639 217 d sys/src/cmd/6l/l.h - 664 sys sys 1014924826 0
+1089300639 218 d sys/src/cmd/6l/asm.c - 664 sys sys 1045503940 0
+1089300639 219 d sys/src/cmd/6l - 20000000775 sys sys 944960730 0
+1089300639 220 d sys/src/cmd/6c/txt.c - 664 sys sys 1067720681 0
+1089300639 221 d sys/src/cmd/6c/swt.c - 664 sys sys 944960729 0
+1089300639 222 d sys/src/cmd/6c/sgen.c - 664 sys sys 952627552 0
+1089300639 223 d sys/src/cmd/6c/reg.h - 664 sys sys 944960729 0
+1089300639 224 d sys/src/cmd/6c/reg.c - 664 sys sys 1014936441 0
+1089300639 225 d sys/src/cmd/6c/peep.c - 664 sys sys 944960729 0
+1089300639 226 d sys/src/cmd/6c/mkfile - 664 sys sys 944960729 0
+1089300639 227 d sys/src/cmd/6c/mkenam - 664 sys sys 944960729 0
+1089300639 228 d sys/src/cmd/6c/list.c - 664 sys sys 1067720726 0
+1089300639 229 d sys/src/cmd/6c/gc.h - 664 sys sys 1014924820 0
+1089300639 230 d sys/src/cmd/6c/enam.c - 664 sys sys 944960729 0
+1089300639 231 d sys/src/cmd/6c/cgen.c - 664 sys sys 956275617 0
+1089300639 232 d sys/src/cmd/6c/bits.c - 664 sys sys 944960728 0
+1089300639 233 d sys/src/cmd/6c/6.out.h - 664 sys sys 944960728 0
+1089300639 234 d sys/src/cmd/6c - 20000000775 sys sys 954034958 0
+1089300639 235 d sys/src/cmd/6a/mkfile - 664 sys sys 944960728 0
+1089300639 236 d sys/src/cmd/6a/main9.s - 664 sys sys 944960728 0
+1089300639 237 d sys/src/cmd/6a/lex.c - 664 sys sys 1067725159 0
+1089300639 238 d sys/src/cmd/6a/l.s - 664 sys sys 944960728 0
+1089300639 239 d sys/src/cmd/6a/a.y - 664 sys sys 944960728 0
+1089300639 240 d sys/src/cmd/6a/a.h - 664 sys sys 944960728 0
+1089300639 241 d sys/src/cmd/6a - 20000000775 sys sys 944960728 0
+1089300639 242 d 960/mkfile - 664 sys sys 948141303 0
+1089300639 243 d 960/include/u.h - 664 sys sys 1042604328 0
+1089300639 244 d 960/include - 20000000775 sys sys 948037594 0
+1089300639 245 d 960 - 20000000775 sys sys 948037581 0
+1089300639 246 d 386/bin/qc - 775 sys sys 1063639757 0
+1089300639 247 d 386/bin/1c - 775 sys sys 1063639729 0
+1089300639 248 d 29000/mkfile - 664 sys sys 948141302 0
+1089300639 249 d 29000/lib - 20000000775 sys sys 948037563 0
+1089300639 250 d 29000/include/ureg.h - 664 sys sys 944946363 0
+1089300639 251 d 29000/include/u.h - 664 sys sys 1042604325 0
+1089300639 252 d 29000/include - 20000000775 sys sys 954099548 0
+1089300639 253 d 29000 - 20000000775 sys sys 954099276 0
+1089302440 0 c sys/lib/dist/pc/inst/moveoldfs - 775 sys sys 1089300756 1347
+1089313242 0 c sys/src/libc/mkfile - 664 sys sys 1089312339 636
+1089315042 0 c 386/lib/libmach.a - 664 sys sys 1089313992 733484
+1089315042 1 c sys/include/a.out.h - 664 sys sys 1089314110 1168
+1089315042 2 c sys/include/bootexec.h - 664 sys sys 1089314125 2610
+1089315042 3 c sys/include/mach.h - 664 sys sys 1089313992 8164
+1089315042 4 c sys/src/libmach/executable.c - 664 sys sys 1089313993 13073
+1089315042 5 c sys/src/libmach/mkfile - 664 sys sys 1089313991 439
+1089315042 6 c sys/src/libmach/obj.c - 664 sys sys 1089313993 5760
+1089315042 7 c sys/src/libmach/setmach.c - 664 sys sys 1089313993 2682
+1089315042 8 d sys/src/libmach/xobj.c - 664 sys sys 964540518 0
+1089315042 9 d sys/src/libmach/x.c - 664 sys sys 964540518 0
+1089315042 10 d sys/src/libmach/9obj.c - 664 sys sys 964540516 0
+1089315042 11 d sys/src/libmach/9db.c - 664 sys sys 1014929544 0
+1089315042 12 d sys/src/libmach/9.c - 664 sys sys 964540515 0
+1089315042 13 d sys/src/libmach/6obj.c - 664 sys sys 964540514 0
+1089315042 14 d sys/src/libmach/6db.c - 664 sys sys 964540514 0
+1089315042 15 d sys/src/libmach/6.c - 664 sys sys 964540514 0
+1089322244 0 c sys/man/1/INDEX - 664 sys sys 1089320990 3026
+1089322244 1 c sys/man/1/INDEX.html - 664 sys sys 1089320990 16634
+1089322244 2 c sys/man/2/INDEX - 664 sys sys 1089321036 20431
+1089322244 3 c sys/man/2/INDEX.html - 664 sys sys 1089321037 27437
+1089322244 4 c sys/man/3/INDEX - 664 sys sys 1089321095 363
+1089322244 5 c sys/man/3/INDEX.html - 664 sys sys 1089321095 3590
+1089322244 6 c sys/man/4/INDEX - 664 sys sys 1089321110 987
+1089322244 7 c sys/man/4/INDEX.html - 664 sys sys 1089321110 4928
+1089322244 8 c sys/man/8/INDEX - 664 sys sys 1089321186 2669
+1089322244 9 c sys/man/8/INDEX.html - 664 sys sys 1089321186 7944
+1089322244 10 d sys/man/1/rtstats - 664 sys sys 1018897631 0
+1089340247 0 c 386/lib/libmach.a - 664 sys sys 1089339723 733484
+1089340247 1 c sys/man/1/INDEX - 664 sys sys 1089339723 3026
+1089340247 2 c sys/man/2/INDEX - 664 sys sys 1089339723 20431
+1089340247 3 c sys/man/3/INDEX - 664 sys sys 1089339723 363
+1089340247 4 c sys/man/4/INDEX - 664 sys sys 1089339723 987
+1089340247 5 c sys/man/8/INDEX - 664 sys sys 1089339723 2669
+1089343848 0 a sys/src/cmd/cc/scon.c - 664 sys sys 1089343502 8606
+1089343848 1 d sys/src/cmd/cc/con.c - 664 sys sys 1084472048 0

+ 23 - 16
mail/lib/smtpd.conf.ext

@@ -1,29 +1,36 @@
 #
 #
-#	sample smtpd configuration options for external gateway system
-#	this file, /mail/lib/smtpd.conf.ext, is bound on /mail/lib/smtpd.conf
-#	by /rc/bin/service.alt/tcp25 before smtpd is started on an
-#	external port 25 connection.
+#	smtpd configuration options for external gateway
+#	change verifysenderdom & saveblockedmsg when dirty converted
 #
 #
 
 
-#
-#	replace YOURDOM and YOUROTHERDOM with the names of your domain
-#	replace 10.0.0.0 with the IP address range of your networks
-
-
-defaultdomain		YOURDOM.com
-norelay			on	#turn off relaying
-verifysenderdom		on	#dns verification of sender domain
-saveblockedmsg		on	#save blocked messages
+defaultdomain		plan9.bell-labs.com
+norelay			on		#turn off relaying
+verifysenderdom		on		#dns verification of sender domain
+saveblockedmsg		on		#save blocked messages
 
 
 #
 #
 #	networks that are allowed to relay through us
 #	networks that are allowed to relay through us
-#	our internal networks.
 #
 #
-ournets		10.0.0.0/16		#your networks
+ournets		135.104.0.0/16		#mh
+ournets		135.180.0.0/16		#ho
+ournets		204.178.16.5/32		#www.bell-labs.com
+ournets		204.178.16.6/32		#dirty.bell-labs.com
+ournets		204.178.16.43/32	#www1.bell-labs.com
+ournets		204.178.16.49/32	#crufty.research.bell-labs.com
+ournets		204.178.31.0/24		#outside plan 9 machines
+
+ournets		64.36.89.66/32		#rsc, sorry
 
 
 #
 #
 #	domains that we will accept mail for
 #	domains that we will accept mail for
 #	these must match the rewrite rules
 #	these must match the rewrite rules
 #
 #
 
 
-ourdomains	*.YOURDOM.com, *.YOUROTHERDOM.com
+ourdomains	*.lucent.com, *.bell-labs.com
+ourdomains	[204.178.31.2]		#achille
+ourdomains	ampl.com		#dmg
+ourdomains	*.wavelet.org		#wim
+ourdomains	closedmind.org		#presotto
+ourdomains	huygens.org		#sape
+ourdomains	mullender.nl		#sape
+ourdomains	mdgw.com		#mflaster cliff

+ 4 - 1
rc/bin/patch/apply

@@ -28,7 +28,10 @@ if(! echo >.tmp || ! rm .tmp){
 
 
 echo -n merge... >[1=2]
 echo -n merge... >[1=2]
 fn xxx {
 fn xxx {
-	ape/diff3 -m $1 $2.orig $2 >$2.new
+	if(! test -f $1)
+		cp $2 $2.new
+	if not
+		ape/diff3 -m $1 $2.orig $2 >$2.new
 	if(grep -s '^<<<<' $2.new){
 	if(grep -s '^<<<<' $2.new){
 		echo conflicts merging $1';' see $d/$2.new >[1=2]
 		echo conflicts merging $1';' see $d/$2.new >[1=2]
 		
 		

+ 3 - 1
rc/bin/patch/note

@@ -1,3 +1,5 @@
+#!/bin/rc
+
 if(! ~ $#* 1){
 if(! ~ $#* 1){
 	echo 'usage: patch/note patch-name' >[1=2]
 	echo 'usage: patch/note patch-name' >[1=2]
 	exit usage
 	exit usage
@@ -19,7 +21,7 @@ if(! patch/okay .){
 	exit badpatch
 	exit badpatch
 }
 }
 
 
-if(~ `{cat /proc/$pid/fd | awk 'NR==2{print $NF}'} */dev/cons){
+if(~ `{cat /proc/$pid/fd | awk 'NR==2{print $NF}'} */dev/cons && ~ `{ls -l /dev/consctl | awk '{print $1}'} *rw*){
 	>/dev/consctl {
 	>/dev/consctl {
 		echo holdon
 		echo holdon
 		{echo `{date} `{cat /dev/user}
 		{echo `{date} `{cat /dev/user}

+ 3 - 2
rc/bin/replica/scan

@@ -13,5 +13,6 @@ need serverroot serverexclude serverproto serverdb serverlog
 
 
 must servermount
 must servermount
 replica/updatedb -r^$serverroot $serverexclude -p^$serverproto $serverdb >>$serverlog
 replica/updatedb -r^$serverroot $serverexclude -p^$serverproto $serverdb >>$serverlog
-ndb=`{echo $serverdb | sed 's;(.*)/(.*);\1/_\2;'}
-replica/compactdb $serverdb >$ndb && mv $ndb $serverdb
+ndb=`{echo $serverdb | sed 's;(.*)/(.*);\1/n\2;'}
+odb=`{echo $serverdb | sed 's;(.*)/(.*);\1/_\2;'}
+replica/compactdb $serverdb >$ndb && mv $serverdb $odb && mv $ndb $serverdb

+ 1 - 0
sys/games/lib/fortunes

@@ -4010,3 +4010,4 @@ If you are idle for more than 1000 hours, the system will log you out.  Please s
 We lead by following standards. - sape
 We lead by following standards. - sape
 -bash: /home/r/.bash_logout: Permission denied
 -bash: /home/r/.bash_logout: Permission denied
 I am he as you are he as you are me and we are all together. - forsyth after Lennon on authentication
 I am he as you are he as you are me and we are all together. - forsyth after Lennon on authentication
+Network services at the Murray Hill, NJ, location (100001) will be unavailable due to UPS (Uninterrupted Power Supply) maintenance from 8:00 p.m. EDT on Saturday, June 26, to 4:00 a.m. EDT on Sunday, June 27.

+ 6 - 6
sys/include/a.out.h

@@ -14,13 +14,13 @@ struct	Exec
 #define	_MAGIC(b)	((((4*b)+0)*b)+7)
 #define	_MAGIC(b)	((((4*b)+0)*b)+7)
 #define	A_MAGIC		_MAGIC(8)	/* 68020 */
 #define	A_MAGIC		_MAGIC(8)	/* 68020 */
 #define	I_MAGIC		_MAGIC(11)	/* intel 386 */
 #define	I_MAGIC		_MAGIC(11)	/* intel 386 */
-#define	J_MAGIC		_MAGIC(12)	/* intel 960 */
+#define	J_MAGIC		_MAGIC(12)	/* intel 960 (retired) */
 #define	K_MAGIC		_MAGIC(13)	/* sparc */
 #define	K_MAGIC		_MAGIC(13)	/* sparc */
-#define	V_MAGIC		_MAGIC(16)	/* mips 3000 */
-#define	X_MAGIC		_MAGIC(17)	/* att dsp 3210 */
-#define	M_MAGIC		_MAGIC(18)	/* mips 4000 */
-#define	D_MAGIC		_MAGIC(19)	/* amd 29000 */
-#define	E_MAGIC		_MAGIC(20)	/* arm 7-something */
+#define	V_MAGIC		_MAGIC(16)	/* mips 3000 BE */
+#define	X_MAGIC		_MAGIC(17)	/* att dsp 3210 (retired) */
+#define	M_MAGIC		_MAGIC(18)	/* mips 4000 BE */
+#define	D_MAGIC		_MAGIC(19)	/* amd 29000 (retired) */
+#define	E_MAGIC		_MAGIC(20)	/* arm */
 #define	Q_MAGIC		_MAGIC(21)	/* powerpc */
 #define	Q_MAGIC		_MAGIC(21)	/* powerpc */
 #define	N_MAGIC		_MAGIC(22)	/* mips 4000 LE */
 #define	N_MAGIC		_MAGIC(22)	/* mips 4000 LE */
 #define	L_MAGIC		_MAGIC(23)	/* dec alpha */
 #define	L_MAGIC		_MAGIC(23)	/* dec alpha */

+ 0 - 34
sys/include/bootexec.h

@@ -135,37 +135,3 @@ struct i386exec
 	struct coffsect ibsss;
 	struct coffsect ibsss;
 	struct coffsect icomments;
 	struct coffsect icomments;
 };
 };
-
-struct i960exec
-{
-	struct	i960coff{
-		ulong	i6sectmagic;
-		ulong	i6time;
-		ulong	i6syms;
-		ulong	i6nsyms;
-		ulong	i6opthdrflags;
-	};
-	struct	i960hdr{
-		ulong	i6magic;
-		ulong	i6textsize;
-		ulong	i6datasize;
-		ulong	i6bsssize;
-		ulong	i6entry;
-		ulong	i6textstart;
-		ulong	i6datastart;
-		ulong	i6tagentries;
-	};
-	struct i960sect{
-		char	name[8];
-		ulong	phys;
-		ulong	virt;
-		ulong	size;
-		ulong	fptr;
-		ulong	fptrreloc;
-		ulong	fptrlineno;
-		ulong	nrelocnlineno;
-		ulong	flags;
-		ulong	align;
-	}i6texts;
-	struct i960sect i6datas;
-};

+ 1 - 0
sys/include/html.h

@@ -214,6 +214,7 @@ struct Iimage
 	uchar	vspace;		// in pixels; buffer space on top and bottom
 	uchar	vspace;		// in pixels; buffer space on top and bottom
 	uchar	border;		// in pixels: border width to draw around image
 	uchar	border;		// in pixels: border width to draw around image
 	Iimage*	nextimage;	// next in list of document's images
 	Iimage*	nextimage;	// next in list of document's images
+	void*	aux;
 };
 };
 
 
 
 

+ 2 - 0
sys/include/ip.h

@@ -114,8 +114,10 @@ int	equivip(uchar*, uchar*);
 
 
 Ipifc*	readipifc(char*, Ipifc*, int);
 Ipifc*	readipifc(char*, Ipifc*, int);
 
 
+void	hnputv(void*, uvlong);
 void	hnputl(void*, uint);
 void	hnputl(void*, uint);
 void	hnputs(void*, ushort);
 void	hnputs(void*, ushort);
+uvlong	nhgetv(void*);
 uint	nhgetl(void*);
 uint	nhgetl(void*);
 ushort	nhgets(void*);
 ushort	nhgets(void*);
 ushort	ptclbsum(uchar*, int);
 ushort	ptclbsum(uchar*, int);

+ 1 - 0
sys/include/libc.h

@@ -205,6 +205,7 @@ extern	Rune*	runefmtstrflush(Fmt*);
 #pragma varargck	type	"<" void*
 #pragma varargck	type	"<" void*
 #pragma varargck	type	"[" void*
 #pragma varargck	type	"[" void*
 #pragma varargck	type	"H" void*
 #pragma varargck	type	"H" void*
+#pragma varargck	type	"lH" void*
 
 
 extern	int	fmtinstall(int, int (*)(Fmt*));
 extern	int	fmtinstall(int, int (*)(Fmt*));
 extern	int	dofmt(Fmt*, char*);
 extern	int	dofmt(Fmt*, char*);

+ 23 - 25
sys/include/mach.h

@@ -10,23 +10,22 @@
  *		68020,
  *		68020,
  *		i386,
  *		i386,
  *		sparc,
  *		sparc,
- *		i960 (limited)
- *		3210DSP (limited)
  *		mips2 (R4000)
  *		mips2 (R4000)
- *		arm (limited)
- *		power pc (limited)
-*/
+ *		arm
+ *		power pc
+ *		alpha
+ */
 enum
 enum
 {
 {
 	MMIPS,			/* machine types */
 	MMIPS,			/* machine types */
 	MSPARC,
 	MSPARC,
 	M68020,
 	M68020,
 	MI386,
 	MI386,
-	MI960,
-	M3210,
+	MI960,			/* retired */
+	M3210,			/* retired */
 	MMIPS2,
 	MMIPS2,
 	NMIPS2,
 	NMIPS2,
-	M29000,
+	M29000,			/* retired */
 	MARM,
 	MARM,
 	MPOWER,
 	MPOWER,
 	MALPHA,
 	MALPHA,
@@ -42,17 +41,17 @@ enum
 	FNEXTB,			/* Next bootable */
 	FNEXTB,			/* Next bootable */
 	FI386,			/* 8.out */
 	FI386,			/* 8.out */
 	FI386B,			/* I386 bootable */
 	FI386B,			/* I386 bootable */
-	FI960,			/* 6.out */
-	FI960B,			/* I960 bootable */
-	F3210,			/* x.out */
-	FMIPS2BE,			/* 4.out */
-	F29000,			/* 9.out */
+	FI960,			/* retired */
+	FI960B,			/* retired */
+	F3210,			/* retired */
+	FMIPS2BE,		/* 4.out */
+	F29000,			/* retired */
 	FARM,			/* 5.out */
 	FARM,			/* 5.out */
 	FARMB,			/* ARM bootable */
 	FARMB,			/* ARM bootable */
 	FPOWER,			/* q.out */
 	FPOWER,			/* q.out */
 	FPOWERB,		/* power pc bootable */
 	FPOWERB,		/* power pc bootable */
-	FMIPS2LE,		/* 4k little endian */
-	FALPHA,		/* 7.out */
+	FMIPS2LE,		/* 0.out */
+	FALPHA,			/* 7.out */
 	FALPHAB,		/* DEC Alpha bootable */
 	FALPHAB,		/* DEC Alpha bootable */
 	FMIPSLE,		/* 3k little endian */
 	FMIPSLE,		/* 3k little endian */
 
 
@@ -64,8 +63,8 @@ enum
 	A68020,
 	A68020,
 	AI386,
 	AI386,
 	AI8086,			/* oh god */
 	AI8086,			/* oh god */
-	AI960,
-	A29000,
+	AI960,			/* retired */
+	A29000,			/* retired */
 	AARM,
 	AARM,
 	APOWER,
 	APOWER,
 	AALPHA,
 	AALPHA,
@@ -74,10 +73,10 @@ enum
 	ObjSparc,		/* .k */
 	ObjSparc,		/* .k */
 	ObjMips,		/* .v */
 	ObjMips,		/* .v */
 	Obj386,			/* .8 */
 	Obj386,			/* .8 */
-	Obj960,			/* .6 */
-	Obj3210,		/* .x */
+	Obj960,			/* retired */
+	Obj3210,		/* retired */
 	ObjMips2,		/* .4 */
 	ObjMips2,		/* .4 */
-	Obj29000,		/* .9 */
+	Obj29000,		/* retired */
 	ObjArm,			/* .5 */
 	ObjArm,			/* .5 */
 	ObjPower,		/* .q */
 	ObjPower,		/* .q */
 	ObjMips2le,		/* .0 */
 	ObjMips2le,		/* .0 */
@@ -139,23 +138,22 @@ struct Reglist {
 	char	rformat;		/* print format: 'x', 'X', 'f', '8' */
 	char	rformat;		/* print format: 'x', 'X', 'f', '8' */
 };
 };
 
 
-enum {				/* bits in rflags field */
+enum {					/* bits in rflags field */
 	RINT	= (0<<0),
 	RINT	= (0<<0),
 	RFLT	= (1<<0),
 	RFLT	= (1<<0),
 	RRDONLY	= (1<<1),
 	RRDONLY	= (1<<1),
 };
 };
+
 /*
 /*
  *	Machine-dependent data is stored in two structures:
  *	Machine-dependent data is stored in two structures:
  *		Mach  - miscellaneous general parameters
  *		Mach  - miscellaneous general parameters
  *		Machdata - jump vector of service functions used by debuggers
  *		Machdata - jump vector of service functions used by debuggers
  *
  *
- *	Mach is defined in 2.c, 4.c, v.c, k.c, 8.c, 6.c and set in executable.c
+ *	Mach is defined in ?.c and set in executable.c
  *
  *
- *	Machdata is defined in 2db.c, 4db.c, vdb.c, kdb.c, 8db.c, and 6db.c
+ *	Machdata is defined in ?db.c
  *		and set in the debugger startup.
  *		and set in the debugger startup.
  */
  */
-
-
 struct Mach{
 struct Mach{
 	char	*name;
 	char	*name;
 	int	mtype;			/* machine type code */
 	int	mtype;			/* machine type code */

+ 1 - 1
sys/include/trace.h

@@ -20,5 +20,5 @@ typedef struct Traceevent	Traceevent;
 struct Traceevent {
 struct Traceevent {
 	ulong	pid;	
 	ulong	pid;	
 	ulong	etype;		/* Event type */
 	ulong	etype;		/* Event type */
-	vlong	time;		/* time stamp (ns)  */
+	vlong	time;		/* time stamp  */
 };
 };

+ 0 - 2
sys/lib/dist/pc/inst/moveoldfs

@@ -4,11 +4,9 @@
 # prereq: mountfs
 # prereq: mountfs
 
 
 rootfiles=(\
 rootfiles=(\
-	29000\
 	386\
 	386\
 	68000\
 	68000\
 	68020\
 	68020\
-	960\
 	LICENSE\
 	LICENSE\
 	NOTICE\
 	NOTICE\
 	acme\
 	acme\

+ 2 - 2
sys/lib/dist/pc/proto

@@ -23,8 +23,8 @@
 		disk	d555 sys sys
 		disk	d555 sys sys
 			fdisk	555 sys sys
 			fdisk	555 sys sys
 			format	555 sys sys
 			format	555 sys sys
-			kfs	555 sys sys
-			kfscmd	555 sys sys
+#			kfs	555 sys sys
+#			kfscmd	555 sys sys
 			mbr	555 sys sys
 			mbr	555 sys sys
 			prep	555 sys sys
 			prep	555 sys sys
 		fossil	d555 sys sys
 		fossil	d555 sys sys

+ 2 - 0
sys/lib/mimetype

@@ -90,6 +90,8 @@
 .ppm		image		x-portable-pixmap	-	y
 .ppm		image		x-portable-pixmap	-	y
 .ppt		application	vnd.ms-powerpoint	-	n # Microsoft PowerPoint
 .ppt		application	vnd.ms-powerpoint	-	n # Microsoft PowerPoint
 .ps		application	postscript	-		m
 .ps		application	postscript	-		m
+.qcp		audio		vnd.qcelp	-		y # Qualcomm CELP
+.qcp2		audio		qcp		-		y # Qualcomm CELP
 .qt		video		quicktime	-		y
 .qt		video		quicktime	-		y
 .r		text		plain		-		y # ratfor program
 .r		text		plain		-		y # ratfor program
 .ra		audio		x-pn-realaudio	-		y # G2 RealAudio
 .ra		audio		x-pn-realaudio	-		y # G2 RealAudio

+ 0 - 4
sys/lib/sysconfig/proto/armpaqproto

@@ -24,7 +24,6 @@ adm
 arm
 arm
 	bin
 	bin
 		acme
 		acme
-		acid
 		auth
 		auth
 			factotum
 			factotum
 			fgui
 			fgui
@@ -47,7 +46,6 @@ arm
 		exportfs
 		exportfs
 		date
 		date
 		dc
 		dc
-		ftpfs
 		grep
 		grep
 		dd
 		dd
 		disk
 		disk
@@ -63,7 +61,6 @@ arm
 			ftpd
 			ftpd
 			ipconfig
 			ipconfig
 			ping
 			ping
-			traceroute
 		ls
 		ls
 		mc
 		mc
 		mkdir
 		mkdir
@@ -87,7 +84,6 @@ arm
 		sed
 		sed
 		sleep
 		sleep
 		srv
 		srv
-		srvold9p
 		ssh
 		ssh
 		telnet
 		telnet
 		test
 		test

+ 6 - 1
sys/man/1/2a

@@ -1,6 +1,6 @@
 .TH 2A 1 
 .TH 2A 1 
 .SH NAME
 .SH NAME
-0a, 1a, 2a, 4a, 5a, 6a, 7a, 8a, 9a, ka, qa, va, xa \- assemblers
+1a, 2a, 5a, 7a, 8a, ka, qa, va \- assemblers
 .SH SYNOPSIS
 .SH SYNOPSIS
 .B 2a
 .B 2a
 [
 [
@@ -53,3 +53,8 @@ etc.
 .IR 2l (1).
 .IR 2l (1).
 .PP
 .PP
 Rob Pike, ``A manual for the Plan 9 assembler''
 Rob Pike, ``A manual for the Plan 9 assembler''
+.SH BUGS
+The list of assemblers given above is only partial,
+not all architectures are supported on all systems,
+some have been retired and some
+are provided by third parties.

+ 8 - 24
sys/man/1/2c

@@ -1,6 +1,6 @@
 .TH 2C 1 
 .TH 2C 1 
 .SH NAME
 .SH NAME
-0c, 1c, 2c, 4c, 5c, 6c, 7c, 8c, 9c, kc, qc, vc, xc \- C compilers
+1c, 2c, 5c, 7c, 8c, kc, qc, vc \- C compilers
 .SH SYNOPSIS
 .SH SYNOPSIS
 .B 2c
 .B 2c
 [
 [
@@ -16,35 +16,24 @@ These commands compile the named C
 .I files
 .I files
 into object files for the corresponding architecture.
 into object files for the corresponding architecture.
 Associated with each compiler is a string
 Associated with each compiler is a string
-.IR objtype :
+.IR objtype ,
+for example
 .TP 1.5i
 .TP 1.5i
-.B "0c spim
-little-endian MIPS 4000 family
-.TP
 .B "1c 68000
 .B "1c 68000
 Motorola MC68000
 Motorola MC68000
 .TP
 .TP
 .B "2c 68020
 .B "2c 68020
 Motorola MC68020
 Motorola MC68020
 .TP
 .TP
-.B "4c mips2
-big-endian MIPS 4000 family
-.TP
 .B "5c arm
 .B "5c arm
 ARM 7500
 ARM 7500
 .TP
 .TP
-.B "6c 960
-Intel i960
-.TP
 .B "7c alpha
 .B "7c alpha
 Digital Alpha APX
 Digital Alpha APX
 .TP
 .TP
 .B "8c 386
 .B "8c 386
 Intel i386, i486, Pentium, etc.
 Intel i386, i486, Pentium, etc.
 .TP
 .TP
-.B "9c 29000
-AMD 29000 family
-.TP
 .B "kc sparc
 .B "kc sparc
 Sun SPARC
 Sun SPARC
 .TP
 .TP
@@ -53,9 +42,6 @@ Power PC,
 .TP
 .TP
 .B "vc mips
 .B "vc mips
 big-endian MIPS 3000 family
 big-endian MIPS 3000 family
-.TP
-.B "xc 3210
-AT&T DSP 3210.
 .PP
 .PP
 The compilers handle most preprocessing directives themselves; a complete
 The compilers handle most preprocessing directives themselves; a complete
 preprocessor is available in
 preprocessor is available in
@@ -64,20 +50,16 @@ which must be run separately.
 .PP
 .PP
 Let the first letter of the compiler name be
 Let the first letter of the compiler name be
 .IR O =
 .IR O =
-.BR 0 ,
 .BR 1 ,
 .BR 1 ,
 .BR 2 ,
 .BR 2 ,
 .BR 4 ,
 .BR 4 ,
 .BR 5 ,
 .BR 5 ,
-.BR 6 ,
 .BR 7 ,
 .BR 7 ,
 .BR 8 ,
 .BR 8 ,
-.BR 9 ,
 .BR k ,
 .BR k ,
 .BR q ,
 .BR q ,
-.BR v ,
 or
 or
-.BR x .
+.BR v .
 The output object files end in
 The output object files end in
 .RI . O .
 .RI . O .
 The letter is also the prefix of related programs:
 The letter is also the prefix of related programs:
@@ -381,8 +363,10 @@ machine-dependent part
 Rob Pike,
 Rob Pike,
 ``How to Use the Plan 9 C Compiler''
 ``How to Use the Plan 9 C Compiler''
 .SH BUGS
 .SH BUGS
-The i960 compiler has been used only to program one I/O controller
-and is certainly buggy.
+The list of compilers given above is only partial,
+not all architectures are supported on all systems,
+some have been retired and some
+are provided by third parties.
 .PP
 .PP
 The default preprocessor only handles
 The default preprocessor only handles
 .LR #define ,
 .LR #define ,

+ 6 - 12
sys/man/1/2l

@@ -1,6 +1,6 @@
 .TH 2L 1 
 .TH 2L 1 
 .SH NAME
 .SH NAME
-0l, 1l, 2l, 4l, 5l, 6l, 7l, 8l, 9l, kl, ql, vl, xl \- loaders
+1l, 2l, 5l, 7l, 8l, kl, ql, vl \- loaders
 .SH SYNOPSIS
 .SH SYNOPSIS
 .B 2l
 .B 2l
 [
 [
@@ -101,23 +101,12 @@ Print the object code in assembly language, with addresses.
 .B -v
 .B -v
 Print debugging output that annotates the activities of the load.
 Print debugging output that annotates the activities of the load.
 .TP
 .TP
-.BI -c function
-.RI ( Xl
-only) Place the
-.I function
-in the internal RAM of the DSP3210.
 .TP
 .TP
 .BI -M
 .BI -M
 .RI ( Kl
 .RI ( Kl
 only) Generate instructions rather than calls to emulation routines
 only) Generate instructions rather than calls to emulation routines
 for multiply and divide.
 for multiply and divide.
 .TP
 .TP
-.BI -m size
-.RI ( Xl
-only) Use
-.I size
-(default 0, maximum 8192)
-bytes of internal RAM of the DSP3210 for functions and small data items.
 .TP
 .TP
 .BI -E symbol
 .BI -E symbol
 The entry point for the binary is
 The entry point for the binary is
@@ -191,3 +180,8 @@ etc.
 .PP
 .PP
 Rob Pike,
 Rob Pike,
 ``How to Use the Plan 9 C Compiler''
 ``How to Use the Plan 9 C Compiler''
+.SH BUGS
+The list of loaders given above is only partial,
+not all architectures are supported on all systems,
+some have been retired and some
+are provided by third parties.

+ 23 - 17
sys/man/1/INDEX

@@ -1,50 +1,36 @@
 0intro 0intro
 0intro 0intro
 intro 0intro
 intro 0intro
-0a 2a
 1a 2a
 1a 2a
 2a 2a
 2a 2a
-4a 2a
 5a 2a
 5a 2a
-6a 2a
 7a 2a
 7a 2a
 8a 2a
 8a 2a
-9a 2a
 ka 2a
 ka 2a
 qa 2a
 qa 2a
 va 2a
 va 2a
-xa 2a
-0c 2c
 1c 2c
 1c 2c
 2c 2c
 2c 2c
-4c 2c
 5c 2c
 5c 2c
-6c 2c
 7c 2c
 7c 2c
 8c 2c
 8c 2c
-9c 2c
 kc 2c
 kc 2c
 qc 2c
 qc 2c
 vc 2c
 vc 2c
-xc 2c
-0l 2l
 1l 2l
 1l 2l
 2l 2l
 2l 2l
-4l 2l
 5l 2l
 5l 2l
-6l 2l
 7l 2l
 7l 2l
 8l 2l
 8l 2l
-9l 2l
 kl 2l
 kl 2l
 ql 2l
 ql 2l
 vl 2l
 vl 2l
-xl 2l
 acid acid
 acid acid
 trump acid
 trump acid
 truss acid
 truss acid
 acme acme
 acme acme
 awd acme
 awd acme
 win acme
 win acme
+ap ap
 ar ar
 ar ar
 ascii ascii
 ascii ascii
 unicode ascii
 unicode ascii
@@ -65,6 +51,8 @@ cal cal
 calendar calendar
 calendar calendar
 cat cat
 cat cat
 read cat
 read cat
+.I cb  cb
+cb cb
 chgrp chgrp
 chgrp chgrp
 chmod chmod
 chmod chmod
 cleanname cleanname
 cleanname cleanname
@@ -100,6 +88,14 @@ echo echo
 ed ed
 ed ed
 emacs emacs
 emacs emacs
 eqn eqn
 eqn eqn
+at expect
+drain expect
+expect expect
+pass expect
+face face
+faces face
+seemail face
+vwhois face
 faces faces
 faces faces
 seemail faces
 seemail faces
 vwhois faces
 vwhois faces
@@ -119,6 +115,7 @@ grap grap
 graph graph
 graph graph
 grep grep
 grep grep
 gs gs
 gs gs
+gview gview
 
 
 bunzip2 gzip
 bunzip2 gzip
 bzip2 gzip
 bzip2 gzip
@@ -132,12 +129,15 @@ hoc hoc
 idiff idiff
 idiff idiff
 join join
 join join
 gif jpg
 gif jpg
+ico jpg
 jpg jpg
 jpg jpg
 png jpg
 png jpg
 ppm jpg
 ppm jpg
 togif jpg
 togif jpg
+toico jpg
 topng jpg
 topng jpg
 toppm jpg
 toppm jpg
+kbmap kbmap
 broke kill
 broke kill
 kill kill
 kill kill
 slay kill
 slay kill
@@ -173,12 +173,16 @@ page page
 iam passwd
 iam passwd
 netkey passwd
 netkey passwd
 passwd passwd
 passwd passwd
+patch patch
 pcc pcc
 pcc pcc
 pic pic
 pic pic
 tpic pic
 tpic pic
 pipefile pipefile
 pipefile pipefile
 plot plot
 plot plot
 plumb plumb
 plumb plumb
+pq pq
+pqgen pq
+pqsrv pq
 pr pr
 pr pr
 kprof prof
 kprof prof
 prof prof
 prof prof
@@ -213,7 +217,6 @@ rio rio
 window rio
 window rio
 wloc rio
 wloc rio
 rm rm
 rm rm
-rtstats rtstats
 conswdir rwd
 conswdir rwd
 rwd rwd
 rwd rwd
 B sam
 B sam
@@ -234,7 +237,6 @@ split split
 src src
 src src
 scp ssh
 scp ssh
 ssh ssh
 ssh ssh
-ssh_genkey ssh
 sshnet ssh
 sshnet ssh
 sshserve ssh
 sshserve ssh
 start stop
 start stop
@@ -261,19 +263,23 @@ tee tee
 iwhois tel
 iwhois tel
 tel tel
 tel tel
 test test
 test test
+thesaurus thesaurus
 time time
 time time
 touch touch
 touch touch
 tr tr
 tr tr
+trace trace
 nroff troff
 nroff troff
 troff troff
 troff troff
 troff2html troff2html
 troff2html troff2html
 tweak tweak
 tweak tweak
 uniq uniq
 uniq uniq
 units units
 units units
+uptime uptime
 vac vac
 vac vac
 0i vi
 0i vi
 5i vi
 5i vi
 ki vi
 ki vi
+qi vi
 vi vi
 vi vi
 vnc vnc
 vnc vnc
 vncs vnc
 vncs vnc

+ 52 - 24
sys/man/1/INDEX.html

@@ -12,19 +12,15 @@
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/1/2a">2a</A>
 <DT><A HREF="/magic/man2html/1/2a">2a</A>
 -  assemblers
 -  assemblers
-<DD><TT> 0a, 1a, 2a, 4a, 5a, 6a, 7a, 8a, 9a, ka, qa, va, xa</TT>
+<DD><TT> 1a, 2a, 5a, 7a, 8a, ka, qa, va</TT>
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/1/2c">2c</A>
 <DT><A HREF="/magic/man2html/1/2c">2c</A>
 -  C compilers
 -  C compilers
-<DD><TT> 0c, 1c, 2c, 4c, 5c, 6c, 7c, 8c, 9c, kc, qc, vc, xc</TT>
+<DD><TT> 1c, 2c, 5c, 7c, 8c, kc, qc, vc</TT>
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/1/2l">2l</A>
 <DT><A HREF="/magic/man2html/1/2l">2l</A>
 -  loaders
 -  loaders
-<DD><TT> 0l, 1l, 2l, 4l, 5l, 6l, 7l, 8l, 9l, kl, ql, vl, xl</TT>
-</DT>
-<DT><A HREF="/magic/man2html/1/aan">aan</A>
--  always available network
-<DD><TT> aan</TT>
+<DD><TT> 1l, 2l, 5l, 7l, 8l, kl, ql, vl</TT>
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/1/acid">acid</A>
 <DT><A HREF="/magic/man2html/1/acid">acid</A>
 -  debugger
 -  debugger
@@ -78,6 +74,10 @@
 -  catenate files
 -  catenate files
 <DD><TT> cat, read</TT>
 <DD><TT> cat, read</TT>
 </DT>
 </DT>
+<DT><A HREF="/magic/man2html/1/cb">cb</A>
+-  C program beautifier
+<DD><TT> cb</TT>
+</DT>
 <DT><A HREF="/magic/man2html/1/chgrp">chgrp</A>
 <DT><A HREF="/magic/man2html/1/chgrp">chgrp</A>
 -  change file group
 -  change file group
 <DD><TT> chgrp</TT>
 <DD><TT> chgrp</TT>
@@ -86,10 +86,6 @@
 -  change mode
 -  change mode
 <DD><TT> chmod</TT>
 <DD><TT> chmod</TT>
 </DT>
 </DT>
-<DT><A HREF="/magic/man2html/1/cj">cj</A>
--  compress YCbCr411 frames into a baseline JPG file.
-<DD><TT> cj</TT>
-</DT>
 <DT><A HREF="/magic/man2html/1/cleanname">cleanname</A>
 <DT><A HREF="/magic/man2html/1/cleanname">cleanname</A>
 -  clean a path name
 -  clean a path name
 <DD><TT> cleanname</TT>
 <DD><TT> cleanname</TT>
@@ -106,10 +102,6 @@
 -  select or reject lines common to two sorted files
 -  select or reject lines common to two sorted files
 <DD><TT> comm</TT>
 <DD><TT> comm</TT>
 </DT>
 </DT>
-<DT><A HREF="/magic/man2html/1/compress">compress</A>
--  compress and expand data
-<DD><TT> compress, uncompress, zcat</TT>
-</DT>
 <DT><A HREF="/magic/man2html/1/con">con</A>
 <DT><A HREF="/magic/man2html/1/con">con</A>
 -  remote login, execution, and XMODEM file transfer
 -  remote login, execution, and XMODEM file transfer
 <DD><TT> con, telnet, rx, xms, xmr</TT>
 <DD><TT> con, telnet, rx, xms, xmr</TT>
@@ -182,6 +174,14 @@
 -  typeset mathematics
 -  typeset mathematics
 <DD><TT> eqn</TT>
 <DD><TT> eqn</TT>
 </DT>
 </DT>
+<DT><A HREF="/magic/man2html/1/expect">expect</A>
+-  dialer scripting tools
+<DD><TT> at, drain, expect, pass</TT>
+</DT>
+<DT><A HREF="/magic/man2html/1/face">face</A>
+-  mailbox interface
+<DD><TT> faces, seemail, vwhois</TT>
+</DT>
 <DT><A HREF="/magic/man2html/1/faces">faces</A>
 <DT><A HREF="/magic/man2html/1/faces">faces</A>
 -  mailbox interface
 -  mailbox interface
 <DD><TT> faces, seemail, vwhois</TT>
 <DD><TT> faces, seemail, vwhois</TT>
@@ -195,7 +195,7 @@
 <DD><TT> file</TT>
 <DD><TT> file</TT>
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/1/filter">filter</A>
 <DT><A HREF="/magic/man2html/1/filter">filter</A>
--  filterng mail
+-  filtering mail
 <DD><TT> filter, list, deliver, token, vf</TT>
 <DD><TT> filter, list, deliver, token, vf</TT>
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/1/fmt">fmt</A>
 <DT><A HREF="/magic/man2html/1/fmt">fmt</A>
@@ -226,6 +226,10 @@
 -  Aladdin Ghostscript (PostScript and PDF language interpreter)
 -  Aladdin Ghostscript (PostScript and PDF language interpreter)
 <DD><TT> gs</TT>
 <DD><TT> gs</TT>
 </DT>
 </DT>
+<DT><A HREF="/magic/man2html/1/gview">gview</A>
+-  interactive graph viewer
+<DD><TT> gview</TT>
+</DT>
 <DT><A HREF="/magic/man2html/1/gzip">gzip</A>
 <DT><A HREF="/magic/man2html/1/gzip">gzip</A>
 -  compress and expand data
 -  compress and expand data
 <DD><TT> gzip, gunzip, bzip2, bunzip2, zip, unzip,</TT>
 <DD><TT> gzip, gunzip, bzip2, bunzip2, zip, unzip,</TT>
@@ -252,7 +256,11 @@
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/1/jpg">jpg</A>
 <DT><A HREF="/magic/man2html/1/jpg">jpg</A>
 -  view and convert pictures
 -  view and convert pictures
-<DD><TT> jpg, gif, png, ppm, togif, toppm, topng</TT>
+<DD><TT> jpg, gif, png, ppm, ico, togif, toppm, topng, toico</TT>
+</DT>
+<DT><A HREF="/magic/man2html/1/kbmap">kbmap</A>
+-  show a list of available keyboard maps and switch between them.
+<DD><TT> kbmap</TT>
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/1/kill">kill</A>
 <DT><A HREF="/magic/man2html/1/kill">kill</A>
 -  print commands to kill processes
 -  print commands to kill processes
@@ -350,6 +358,10 @@
 -  change user password
 -  change user password
 <DD><TT> passwd, netkey, iam</TT>
 <DD><TT> passwd, netkey, iam</TT>
 </DT>
 </DT>
+<DT><A HREF="/magic/man2html/1/patch">patch</A>
+-  simple patch creation and tracking system
+<DD><TT> patch</TT>
+</DT>
 <DT><A HREF="/magic/man2html/1/pcc">pcc</A>
 <DT><A HREF="/magic/man2html/1/pcc">pcc</A>
 -  APE C compiler driver
 -  APE C compiler driver
 <DD><TT> pcc</TT>
 <DD><TT> pcc</TT>
@@ -390,6 +402,10 @@
 -  process status
 -  process status
 <DD><TT> ps, psu</TT>
 <DD><TT> ps, psu</TT>
 </DT>
 </DT>
+<DT><A HREF="/magic/man2html/1/ps2pdf">ps2pdf</A>
+-  convert between PostScript and PDF
+<DD><TT> ps2pdf, pdf2ps</TT>
+</DT>
 <DT><A HREF="/magic/man2html/1/pwd">pwd</A>
 <DT><A HREF="/magic/man2html/1/pwd">pwd</A>
 -  working directory
 -  working directory
 <DD><TT> pwd, pbd</TT>
 <DD><TT> pwd, pbd</TT>
@@ -414,9 +430,9 @@
 -  remove files
 -  remove files
 <DD><TT> rm</TT>
 <DD><TT> rm</TT>
 </DT>
 </DT>
-<DT><A HREF="/magic/man2html/1/rtstats">rtstats</A>
--  show real-time process behavior
-<DD><TT> rtstats</TT>
+<DT><A HREF="/magic/man2html/1/rwd">rwd</A>
+-  maintain remote working directory
+<DD><TT> rwd, conswdir</TT>
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/1/sam">sam</A>
 <DT><A HREF="/magic/man2html/1/sam">sam</A>
 -  screen editor with structural regular expressions
 -  screen editor with structural regular expressions
@@ -424,7 +440,7 @@
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/1/secstore">secstore</A>
 <DT><A HREF="/magic/man2html/1/secstore">secstore</A>
 -  secstore commands
 -  secstore commands
-<DD><TT> aescbc, secstore</TT>
+<DD><TT> aescbc, secstore, ipso</TT>
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/1/sed">sed</A>
 <DT><A HREF="/magic/man2html/1/sed">sed</A>
 -  stream editor
 -  stream editor
@@ -464,7 +480,7 @@
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/1/ssh">ssh</A>
 <DT><A HREF="/magic/man2html/1/ssh">ssh</A>
 -  secure login and file copy from/to Unix or Plan 9
 -  secure login and file copy from/to Unix or Plan 9
-<DD><TT> ssh, sshnet, scp, sshserve, ssh_genkey</TT>
+<DD><TT> ssh, sshnet, scp, sshserve</TT>
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/1/stop">stop</A>
 <DT><A HREF="/magic/man2html/1/stop">stop</A>
 -  print commands to stop and start processes
 -  print commands to stop and start processes
@@ -512,12 +528,16 @@
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/1/tel">tel</A>
 <DT><A HREF="/magic/man2html/1/tel">tel</A>
 -  look in phone book
 -  look in phone book
-<DD><TT> tel, ppq, iwhois</TT>
+<DD><TT> tel, iwhois</TT>
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/1/test">test</A>
 <DT><A HREF="/magic/man2html/1/test">test</A>
 -  set status according to condition
 -  set status according to condition
 <DD><TT> test</TT>
 <DD><TT> test</TT>
 </DT>
 </DT>
+<DT><A HREF="/magic/man2html/1/thesaurus">thesaurus</A>
+-  search online thesaurus
+<DD><TT> thesaurus</TT>
+</DT>
 <DT><A HREF="/magic/man2html/1/time">time</A>
 <DT><A HREF="/magic/man2html/1/time">time</A>
 -  time a command
 -  time a command
 <DD><TT> time</TT>
 <DD><TT> time</TT>
@@ -530,6 +550,10 @@
 -  translate characters
 -  translate characters
 <DD><TT> tr</TT>
 <DD><TT> tr</TT>
 </DT>
 </DT>
+<DT><A HREF="/magic/man2html/1/trace">trace</A>
+-  show (real-time) process behavior
+<DD><TT> trace</TT>
+</DT>
 <DT><A HREF="/magic/man2html/1/troff">troff</A>
 <DT><A HREF="/magic/man2html/1/troff">troff</A>
 -  text formatting and typesetting
 -  text formatting and typesetting
 <DD><TT> troff, nroff</TT>
 <DD><TT> troff, nroff</TT>
@@ -550,13 +574,17 @@
 -  conversion program
 -  conversion program
 <DD><TT> units</TT>
 <DD><TT> units</TT>
 </DT>
 </DT>
+<DT><A HREF="/magic/man2html/1/uptime">uptime</A>
+-  show how long the system has been running
+<DD><TT> uptime</TT>
+</DT>
 <DT><A HREF="/magic/man2html/1/vac">vac</A>
 <DT><A HREF="/magic/man2html/1/vac">vac</A>
 -  create a vac archive on Venti
 -  create a vac archive on Venti
 <DD><TT> vac</TT>
 <DD><TT> vac</TT>
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/1/vi">vi</A>
 <DT><A HREF="/magic/man2html/1/vi">vi</A>
 -  instruction simulators
 -  instruction simulators
-<DD><TT> 0i, 5i, ki, vi</TT>
+<DD><TT> 0i, 5i, ki, vi, qi</TT>
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/1/vnc">vnc</A>
 <DT><A HREF="/magic/man2html/1/vnc">vnc</A>
 -  remote frame buffer server and viewer for Virtual Network Computing (VNC)
 -  remote frame buffer server and viewer for Virtual Network Computing (VNC)

+ 0 - 117
sys/man/1/rtstats

@@ -1,117 +0,0 @@
-.TH RTSTATS 1
-.SH NAME
-rtstats \- show real-time process behavior
-.SH SYNOPSIS
-.B rtstats
-[
-.B \-T
-.I period
-]
-[
-.B \-D
-.I deadline
-]
-[
-.B \-C
-.I cost
-]
-[
-.B \-d
-.I dir
-]
-[
-.B \-t
-.I timedev
-]
-[
-.B \-b
-]
-[
-.B \-v
-]
-[
-.B \-w
-]
-.SH DESCRIPTION
-.I Rtstats
-displays the behavor of the real-time tasks running on a machine.
-In its window it shows a time line for each real-time task with
-black up arrows to indicate releases, black down arrows to indicate
-deadlines, red down arrows to indicate early deadline as a consequence
-of reaching cost, and green down arrows to indicate early deadline as
-a consequence of yielding.  Running tasks are shown as colored blocks,
-while pre-empted ones are shown as very thin colored blocks.
-.PP
-Normally,
-.B rtstats
-itself runs in real time so that one of the bars in the display represents
-.B rtstats
-itself.  The
-.B \-b
-flag makes it run as a best-effort process instead.
-.PP
-The
-.BR \-T ,
-.BR \-D ,
-and
-.BR \-C ,
-flags, respectively, specification a period, deadline or cost other than the
-defaults of 200ms, 80ms and 40ms.
-Times can be specified as a fixed-point decimal number, optionally followed
-by one of the units
-.BR s ,
-.BR ms ,
-.BR µs ,(or
-.BR us ),
-or
-.BR ns .
-Choosing periods, deadlines or costs less than 1ms or so will probably not produce very
-desirable results.
-.PP
-The
-.B \-d
-flag can be used to specify a real-time event file other than the default,
-.BR #R/realtime/nblog
-and the
-.B \-t
-flag can be used to specify another time source than
-.BR #R/realtime/time .
-.PP
-The
-.B \-v
-flag prints out the events as they are received from the event file.
-.PP
-The \-w
-flag makes
-.B rtstats
-open a new window for its display.
-.PP
-The following one-character commands are recognized by
-.BR rtstats :
-.TP
-.B +
-Zoom in by a factor of two,
-.TP
-.B -
-Zoom out by a factor of two,
-.TP
-.B p
-Pause or resume,
-.TP
-.B q
-Quit.
-.SH "SEE ALSO
-.IR realtime (3)
-.SH FILES
-.TF #R/realtime/nblog
-.TP
-.B #R/realtime/task
-Task directory
-.TP
-.B #R/realtime/nblog
-Real-time event log (non-blocking version)
-.TP
-.B #R/realtime/time
-Current real time.
-.SH SOURCE
-.B /sys/src/cmd/rtstats

+ 17 - 2
sys/man/2/INDEX

@@ -222,6 +222,7 @@ cmap2rgb color
 cmap2rgba color
 cmap2rgba color
 color color
 color color
 rgb2cmap color
 rgb2cmap color
+complete complete
 Control control
 Control control
 Controlset control
 Controlset control
 activate control
 activate control
@@ -695,6 +696,7 @@ eipfmt ip
 equivip ip
 equivip ip
 hnputl ip
 hnputl ip
 hnputs ip
 hnputs ip
+hnputv ip
 ip ip
 ip ip
 isv4 ip
 isv4 ip
 maskip ip
 maskip ip
@@ -702,6 +704,7 @@ myetheraddr ip
 myipaddr ip
 myipaddr ip
 nhgetl ip
 nhgetl ip
 nhgets ip
 nhgets ip
+nhgetv ip
 parseether ip
 parseether ip
 parseip ip
 parseip ip
 parseipmask ip
 parseipmask ip
@@ -723,7 +726,6 @@ closekeyboard keyboard
 ctlkeyboard keyboard
 ctlkeyboard keyboard
 initkeyboard keyboard
 initkeyboard keyboard
 keyboard keyboard
 keyboard keyboard
-atomic increment and decrement lock
 canlock lock
 canlock lock
 canqlock lock
 canqlock lock
 canrlock lock
 canrlock lock
@@ -734,7 +736,10 @@ lock lock
 qlock lock
 qlock lock
 qunlock lock
 qunlock lock
 rlock lock
 rlock lock
+rsleep lock
 runlock lock
 runlock lock
+rwakeup lock
+rwakeupall lock
 unlock lock
 unlock lock
 wlock lock
 wlock lock
 wunlock lock
 wunlock lock
@@ -926,6 +931,7 @@ isInf nan
 isNaN nan
 isNaN nan
 nan nan
 nan nan
 csgetval ndb
 csgetval ndb
+csgetvalue ndb
 csipinfo ndb
 csipinfo ndb
 dnsquery ndb
 dnsquery ndb
 ipattr ndb
 ipattr ndb
@@ -933,16 +939,23 @@ ndb ndb
 ndbcat ndb
 ndbcat ndb
 ndbchanged ndb
 ndbchanged ndb
 ndbclose ndb
 ndbclose ndb
+ndbconcatenate ndb
+ndbdiscard ndb
+ndbfindattr ndb
 ndbfree ndb
 ndbfree ndb
+ndbgetipaddr ndb
 ndbgetval ndb
 ndbgetval ndb
+ndbgetvalue ndb
 ndbhash ndb
 ndbhash ndb
 ndbipinfo ndb
 ndbipinfo ndb
 ndblookval ndb
 ndblookval ndb
 ndbopen ndb
 ndbopen ndb
 ndbparse ndb
 ndbparse ndb
 ndbreopen ndb
 ndbreopen ndb
+ndbreorder ndb
 ndbsearch ndb
 ndbsearch ndb
 ndbsnext ndb
 ndbsnext ndb
+ndbsubstitute ndb
 atnotify notify
 atnotify notify
 noted notify
 noted notify
 notify notify
 notify notify
@@ -1020,6 +1033,7 @@ initThumbprints pushtls
 okThumbprint pushtls
 okThumbprint pushtls
 pushtls pushtls
 pushtls pushtls
 readcert pushtls
 readcert pushtls
+readcertchain pushtls
 tlsClient pushtls
 tlsClient pushtls
 tlsServer pushtls
 tlsServer pushtls
 qball qball
 qball qball
@@ -1039,6 +1053,7 @@ quaternion quaternion
 qunit quaternion
 qunit quaternion
 slerp quaternion
 slerp quaternion
 doquote quote
 doquote quote
+needsrcquote quote
 quote quote
 quote quote
 quotefmtinstall quote
 quotefmtinstall quote
 quoterunestrdup quote
 quoterunestrdup quote
@@ -1089,7 +1104,7 @@ X509toRSApub rsa
 X509verify rsa
 X509verify rsa
 asn1dump rsa
 asn1dump rsa
 asn1toRSApriv rsa
 asn1toRSApriv rsa
-decodepem rsa
+decodePEM rsa
 rsa rsa
 rsa rsa
 rsadecrypt rsa
 rsadecrypt rsa
 rsaencrypt rsa
 rsaencrypt rsa

+ 29 - 13
sys/man/2/INDEX.html

@@ -14,6 +14,10 @@
 -  9P file service
 -  9P file service
 <DD><TT> Srv, dirread9p, emalloc9p, erealloc9p, estrdup9p, postfd, postmountsrv, readbuf, readstr, respond, threadpostmountsrv, srv</TT>
 <DD><TT> Srv, dirread9p, emalloc9p, erealloc9p, estrdup9p, postfd, postmountsrv, readbuf, readstr, respond, threadpostmountsrv, srv</TT>
 </DT>
 </DT>
+<DT><A HREF="/magic/man2html/2/9pcmdbuf">9pcmdbuf</A>
+-  control message parsing
+<DD><TT> Cmdbuf, parsecmd, respondcmderror, lookupcmd</TT>
+</DT>
 <DT><A HREF="/magic/man2html/2/9pfid">9pfid</A>
 <DT><A HREF="/magic/man2html/2/9pfid">9pfid</A>
 -  9P fid, request tracking
 -  9P fid, request tracking
 <DD><TT> Fid, Fidpool, allocfidpool, freefidpool, allocfid, closefid, lookupfid, removefid, Req, Reqpool, allocreqpool, freereqpool, allocreq, closereq, lookupreq, removereq</TT>
 <DD><TT> Fid, Fidpool, allocfidpool, freefidpool, allocfid, closefid, lookupfid, removefid, Req, Reqpool, allocreqpool, freereqpool, allocreq, closereq, lookupreq, removereq</TT>
@@ -106,6 +110,10 @@
 -  colors and color maps
 -  colors and color maps
 <DD><TT> cmap2rgb, cmap2rgba, rgb2cmap</TT>
 <DD><TT> cmap2rgb, cmap2rgba, rgb2cmap</TT>
 </DT>
 </DT>
+<DT><A HREF="/magic/man2html/2/complete">complete</A>
+-  file name completion
+<DD><TT> complete</TT>
+</DT>
 <DT><A HREF="/magic/man2html/2/control">control</A>
 <DT><A HREF="/magic/man2html/2/control">control</A>
 -  interactive graphical controls
 -  interactive graphical controls
 <DD><TT> Control, Controlset, activate, closecontrol, closecontrolset, controlcalled, controlwire, createbox, createboxbox, createbutton, createcolumn, createentry, createkeyboard, createlabel, createmenu, createradiobutton, createrow, createscribble, createslider, createstack, createtab, createtext, createtextbutton, ctlerror, ctlmalloc, ctlrealloc, ctlstrdup, ctlprint, deactivate, freectlfont, freectlimage, initcontrols, namectlfont, namectlimage, newcontrolset, resizecontrolset</TT>
 <DD><TT> Control, Controlset, activate, closecontrol, closecontrolset, controlcalled, controlwire, createbox, createboxbox, createbutton, createcolumn, createentry, createkeyboard, createlabel, createmenu, createradiobutton, createrow, createscribble, createslider, createstack, createtab, createtext, createtextbutton, ctlerror, ctlmalloc, ctlrealloc, ctlstrdup, ctlprint, deactivate, freectlfont, freectlimage, initcontrols, namectlfont, namectlimage, newcontrolset, resizecontrolset</TT>
@@ -143,16 +151,20 @@
 <DD><TT> opendisk, Disk</TT>
 <DD><TT> opendisk, Disk</TT>
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/2/draw">draw</A>
 <DT><A HREF="/magic/man2html/2/draw">draw</A>
--  graphics functions
+-  graphics functions PB L
 <DD><TT> Image, draw, gendraw, drawreplxy, drawrepl, replclipr, line, poly, fillpoly, bezier, bezspline, fillbezier, fillbezspline, ellipse, fillellipse, arc, fillarc, icossin, icossin2, border, string, stringn, runestring, runestringn, stringbg, stringnbg, runestringbg, runestringnbg, _string, ARROW, drawsetdebug</TT>
 <DD><TT> Image, draw, gendraw, drawreplxy, drawrepl, replclipr, line, poly, fillpoly, bezier, bezspline, fillbezier, fillbezspline, ellipse, fillellipse, arc, fillarc, icossin, icossin2, border, string, stringn, runestring, runestringn, stringbg, stringnbg, runestringbg, runestringnbg, _string, ARROW, drawsetdebug</TT>
 </DT>
 </DT>
+<DT><A HREF="/magic/man2html/2/dsa">dsa</A>
+-  digital signature algorithm
+<DD><TT> dsagen, dsasign, dsaverify, dsapuballoc, dsapubfree, dsaprivalloc, dsaprivfree, dsasigalloc, dsasigfree, dsaprivtopub</TT>
+</DT>
 <DT><A HREF="/magic/man2html/2/dup">dup</A>
 <DT><A HREF="/magic/man2html/2/dup">dup</A>
 -  duplicate an open file descriptor
 -  duplicate an open file descriptor
 <DD><TT> dup</TT>
 <DD><TT> dup</TT>
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/2/elgamal">elgamal</A>
 <DT><A HREF="/magic/man2html/2/elgamal">elgamal</A>
 -  elgamal encryption
 -  elgamal encryption
-<DD><TT> eggen, egencrypt, egdecrypt, egsign, egverify, egalloc, egfree, egpuballoc, egpubfree, egprivalloc, egprivfree, egsigalloc, egsigfree, egprivtopub</TT>
+<DD><TT> eggen, egencrypt, egdecrypt, egsign, egverify, egpuballoc, egpubfree, egprivalloc, egprivfree, egsigalloc, egsigfree, egprivtopub</TT>
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/2/encode">encode</A>
 <DT><A HREF="/magic/man2html/2/encode">encode</A>
 -  encoding byte arrays as strings
 -  encoding byte arrays as strings
@@ -188,7 +200,7 @@
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/2/fcall">fcall</A>
 <DT><A HREF="/magic/man2html/2/fcall">fcall</A>
 -  interface to Plan 9 File protocol
 -  interface to Plan 9 File protocol
-<DD><TT> Fcall, convS2M, convD2M, convM2S, convM2D, fcallfmt, dirfmt, dirmodefmt, read9pmsg, statcheck, sizeD2M</TT>
+<DD><TT> Fcall, convS2M, convD2M, convM2S, convM2D, fcallfmt, dirfmt, dirmodefmt, read9pmsg, statcheck, sizeS2M, sizeD2M</TT>
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/2/fd2path">fd2path</A>
 <DT><A HREF="/magic/man2html/2/fd2path">fd2path</A>
 -  return file name associated with file descriptor
 -  return file name associated with file descriptor
@@ -280,7 +292,7 @@
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/2/httpd">httpd</A>
 <DT><A HREF="/magic/man2html/2/httpd">httpd</A>
 -  routines for creating an http server
 -  routines for creating an http server
-<DD><TT> HConnect, HContent, HContents, HETag, HFields, Hio, Htmlesc, HttpHead, HttpReq, HRange, HSPairs, hmydomain, hversion, htmlesc, halloc, hbodypush, hbuflen, hcheckcontent, hclose, hdate2sec, hdatefmt, hfail, hflush, hgetc, hgethead, hinit, hiserror, hload, hlower, hmkcontent, hmkhfields, hmkmimeboundary, hmkspairs, hmoved, hokheaders, hparseheaders, hparsequery, hparsereq, hprint, hputc, hreadbuf, hredirected, hreqcleanup, hrevhfields, hrevspairs, hstrdup, http11, httpfmt, httpunesc, hunallowed, hungetc, hunload, hurlfmt, hurlunesc, hwrite, hxferenc,</TT>
+<DD><TT> HConnect, HContent, HContents, HETag, HFields, Hio, Htmlesc, HttpHead, HttpReq, HRange, HSPairs, hmydomain, hversion, htmlesc, halloc, hbodypush, hbuflen, hcheckcontent, hclose, hdate2sec, hdatefmt, hfail, hflush, hgetc, hgethead, hinit, hiserror, hload, hlower, hmkcontent, hmkhfields, hmkmimeboundary, hmkspairs, hmoved, hokheaders, hparseheaders, hparsequery, hparsereq, hprint, hputc, hreadbuf, hredirected, hreqcleanup, hrevhfields, hrevspairs, hstrdup, http11, httpfmt, httpunesc, hunallowed, hungetc, hunload, hurlfmt, hurlunesc, hvprint, hwrite, hxferenc,</TT>
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/2/hypot">hypot</A>
 <DT><A HREF="/magic/man2html/2/hypot">hypot</A>
 -  Euclidean distance
 -  Euclidean distance
@@ -290,13 +302,17 @@
 -  integer to data structure maps
 -  integer to data structure maps
 <DD><TT> Intmap, allocmap, freemap, insertkey, caninsertkey, lookupkey, deletekey</TT>
 <DD><TT> Intmap, allocmap, freemap, insertkey, caninsertkey, lookupkey, deletekey</TT>
 </DT>
 </DT>
+<DT><A HREF="/magic/man2html/2/ioproc">ioproc</A>
+-  slave I/O processes for threaded programs
+<DD><TT> closeioproc, iocall, ioclose, iointerrupt, iodial, ioopen, ioproc, ioread, ioreadn, iowrite</TT>
+</DT>
 <DT><A HREF="/magic/man2html/2/iounit">iounit</A>
 <DT><A HREF="/magic/man2html/2/iounit">iounit</A>
 -  return size of atomic I/O unit for file descriptor
 -  return size of atomic I/O unit for file descriptor
 <DD><TT> iounit</TT>
 <DD><TT> iounit</TT>
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/2/ip">ip</A>
 <DT><A HREF="/magic/man2html/2/ip">ip</A>
 -  Internet protocol
 -  Internet protocol
-<DD><TT> eipfmt, parseip, parseipmask, v4parseip, v4parsecidr, parseether, myipaddr, myetheraddr, maskip, equivip, defmask, isv4, v4tov6, v6tov4, nhgetl, nhgets, hnputl, hnputs, ptclbsum, readipifc</TT>
+<DD><TT> eipfmt, parseip, parseipmask, v4parseip, v4parsecidr, parseether, myipaddr, myetheraddr, maskip, equivip, defmask, isv4, v4tov6, v6tov4, nhgetv, nhgetl, nhgets, hnputv, hnputl, hnputs, ptclbsum, readipifc</TT>
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/2/isalpharune">isalpharune</A>
 <DT><A HREF="/magic/man2html/2/isalpharune">isalpharune</A>
 -  Unicode character classes and cases
 -  Unicode character classes and cases
@@ -307,8 +323,8 @@
 <DD><TT> initkeyboard, ctlkeyboard, closekeyboard</TT>
 <DD><TT> initkeyboard, ctlkeyboard, closekeyboard</TT>
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/2/lock">lock</A>
 <DT><A HREF="/magic/man2html/2/lock">lock</A>
--  shared memory spin locks, rendez-vous locks, reader-writer locks, and atomic increment and decrement
-<DD><TT> lock, canlock, unlock, qlock, canqlock, qunlock, rlock, runlock, canrlock, wlock, wunlock, canwlock, incref, decref</TT>
+-  spin locks, queueing rendezvous locks, reader-writer locks, rendezvous points, and reference counts
+<DD><TT> lock, canlock, unlock, qlock, canqlock, qunlock, rlock, canrlock, runlock, wlock, canwlock, wunlock, rsleep, rwakeup, rwakeupall incref, decref</TT>
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/2/mach">mach</A>
 <DT><A HREF="/magic/man2html/2/mach">mach</A>
 -  machine-independent access to executable files
 -  machine-independent access to executable files
@@ -356,7 +372,7 @@
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/2/ndb">ndb</A>
 <DT><A HREF="/magic/man2html/2/ndb">ndb</A>
 -  network database
 -  network database
-<DD><TT> ndbopen, ndbcat, ndbclose, ndbreopen, ndbsearch, ndbsnext, ndbgetval, ndbfree, ipattr, ndbipinfo, csipinfo, ndbhash, ndbparse, csgetval, ndblookval, dnsquery</TT>
+<DD><TT> ndbopen, ndbcat, ndbchanged, ndbclose, ndbreopen, ndbsearch, ndbsnext, ndbgetvalue, ndbfree, ipattr, ndbgetipaddr, ndbipinfo, csipinfo, ndbhash, ndbparse, csgetvalue, ndbfindattr, dnsquery, ndbdiscard, ndbconcatenate, ndbreorder, ndbsubstitute, ndbgetval, csgetval, ndblookval</TT>
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/2/notify">notify</A>
 <DT><A HREF="/magic/man2html/2/notify">notify</A>
 -  handle asynchronous process notification
 -  handle asynchronous process notification
@@ -412,7 +428,7 @@
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/2/pushtls">pushtls</A>
 <DT><A HREF="/magic/man2html/2/pushtls">pushtls</A>
 -  attach TLS1 or SSL3 encryption to a communication channel
 -  attach TLS1 or SSL3 encryption to a communication channel
-<DD><TT> pushtls, tlsClient, tlsServer, initThumbprints, freeThumbprints, okThumbprint, readcert</TT>
+<DD><TT> pushtls, tlsClient, tlsServer, initThumbprints, freeThumbprints, okThumbprint, readcert, readcertchain</TT>
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/2/qball">qball</A>
 <DT><A HREF="/magic/man2html/2/qball">qball</A>
 -  3-d rotation controller
 -  3-d rotation controller
@@ -428,7 +444,7 @@
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/2/quote">quote</A>
 <DT><A HREF="/magic/man2html/2/quote">quote</A>
 -  quoted character strings
 -  quoted character strings
-<DD><TT> quotestrdup, quoterunestrdup, unquotestrdup, unquoterunestrdup, quotestrfmt, quoterunestrfmt, quotefmtinstall, doquote</TT>
+<DD><TT> quotestrdup, quoterunestrdup, unquotestrdup, unquoterunestrdup, quotestrfmt, quoterunestrfmt, quotefmtinstall, doquote, needsrcquote</TT>
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/2/rand">rand</A>
 <DT><A HREF="/magic/man2html/2/rand">rand</A>
 -  random number generator
 -  random number generator
@@ -463,8 +479,8 @@
 <DD><TT> rendezvous</TT>
 <DD><TT> rendezvous</TT>
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/2/rsa">rsa</A>
 <DT><A HREF="/magic/man2html/2/rsa">rsa</A>
-- 
-<DD><TT></TT>
+-  RSA encryption algorithm
+<DD><TT> asn1dump, asn1toRSApriv, decodePEM, rsadecrypt, rsaencrypt, rsagen, rsaprivalloc, rsaprivfree, rsaprivtopub, rsapuballoc, rsapubfree, X509toRSApub, X509gen, X509verify</TT>
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/2/rune">rune</A>
 <DT><A HREF="/magic/man2html/2/rune">rune</A>
 -  rune/UTF conversion
 -  rune/UTF conversion
@@ -544,7 +560,7 @@
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/2/thread">thread</A>
 <DT><A HREF="/magic/man2html/2/thread">thread</A>
 -  thread and proc management
 -  thread and proc management
-<DD><TT> alt, chancreate, chanfree, chaninit, chanprint, mainstacksize, proccreate, procdata, procexec, procexecl, procrfork, recv, recvp, recvul, send, sendp, sendul, nbrecv, nbrecvp, nbrecvul, nbsend, nbsendp, nbsendul, threadcreate, threaddata, threadexits, threadexitsall, threadgetgrp, threadgetname, threadint, threadintgrp, threadkill, threadkillgrp, threadmain, threadnotify, threadid, threadpid, threadprint, threadsetgrp, threadsetname, threadwaitchan, yield</TT>
+<DD><TT> alt, chancreate, chanfree, chaninit, chanprint, mainstacksize, proccreate, procdata, procexec, procexecl, procrfork, recv, recvp, recvul, send, sendp, sendul, nbrecv, nbrecvp, nbrecvul, nbsend, nbsendp, nbsendul, threadcreate, threaddata, threadexits, threadexitsall, threadgetgrp, threadgetname, threadint, threadintgrp, threadkill, threadkillgrp, threadmain, threadnotify, threadid, threadpid, threadsetgrp, threadsetname, threadwaitchan, yield</TT>
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/2/time">time</A>
 <DT><A HREF="/magic/man2html/2/time">time</A>
 -  time in seconds and nanoseconds since epoch
 -  time in seconds and nanoseconds since epoch

+ 1 - 1
sys/man/3/INDEX

@@ -13,6 +13,7 @@ floppy floppy
 fs fs
 fs fs
 i82365 i82365
 i82365 i82365
 ip ip
 ip ip
+kbmap kbmap
 kprof kprof
 kprof kprof
 loopback loopback
 loopback loopback
 lpt lpt
 lpt lpt
@@ -22,7 +23,6 @@ mouse mouse
 pipe pipe
 pipe pipe
 pnp pnp
 pnp pnp
 proc proc
 proc proc
-realtime realtime
 root root
 root root
 rtc rtc
 rtc rtc
 sd sd
 sd sd

+ 8 - 4
sys/man/3/INDEX.html

@@ -50,6 +50,10 @@
 -  floppy disk interface
 -  floppy disk interface
 <DD><TT> floppy</TT>
 <DD><TT> floppy</TT>
 </DT>
 </DT>
+<DT><A HREF="/magic/man2html/3/fs">fs</A>
+-  file system devices
+<DD><TT> fs</TT>
+</DT>
 <DT><A HREF="/magic/man2html/3/i82365">i82365</A>
 <DT><A HREF="/magic/man2html/3/i82365">i82365</A>
 -  Personal Computer Memory Card Interface Association (PCMCIA) device
 -  Personal Computer Memory Card Interface Association (PCMCIA) device
 <DD><TT> i82365</TT>
 <DD><TT> i82365</TT>
@@ -58,6 +62,10 @@
 -  network protocols over IP
 -  network protocols over IP
 <DD><TT> ip</TT>
 <DD><TT> ip</TT>
 </DT>
 </DT>
+<DT><A HREF="/magic/man2html/3/kbmap">kbmap</A>
+-  keyboard map
+<DD><TT> kbmap</TT>
+</DT>
 <DT><A HREF="/magic/man2html/3/kprof">kprof</A>
 <DT><A HREF="/magic/man2html/3/kprof">kprof</A>
 -  kernel profiling
 -  kernel profiling
 <DD><TT> kprof</TT>
 <DD><TT> kprof</TT>
@@ -90,10 +98,6 @@
 -  running processes
 -  running processes
 <DD><TT> proc</TT>
 <DD><TT> proc</TT>
 </DT>
 </DT>
-<DT><A HREF="/magic/man2html/3/realtime">realtime</A>
--  real time scheduling
-<DD><TT> realtime</TT>
-</DT>
 <DT><A HREF="/magic/man2html/3/root">root</A>
 <DT><A HREF="/magic/man2html/3/root">root</A>
 -  the root file system
 -  the root file system
 <DD><TT> root</TT>
 <DD><TT> root</TT>

+ 3 - 1
sys/man/4/INDEX

@@ -20,9 +20,9 @@ eject dossrv
 execnet execnet
 execnet execnet
 exportfs exportfs
 exportfs exportfs
 srvfs exportfs
 srvfs exportfs
+ext2srv ext2srv
 factotum factotum
 factotum factotum
 fgui factotum
 fgui factotum
-secretpem factotum
 fossil fossil
 fossil fossil
 fs fs
 fs fs
 ftpfs ftpfs
 ftpfs ftpfs
@@ -34,6 +34,7 @@ kfs kfs
 lnfs lnfs
 lnfs lnfs
 mntgen mntgen
 mntgen mntgen
 namespace namespace
 namespace namespace
+nfs nfs
 nntpfs nntpfs
 nntpfs nntpfs
 paqfs paqfs
 paqfs paqfs
 plumber plumber
 plumber plumber
@@ -67,6 +68,7 @@ upasfs upasfs
 usb usb
 usb usb
 usbaudio usb
 usbaudio usb
 usbmouse usb
 usbmouse usb
+usbprinter usb
 usbd usbd
 usbd usbd
 vacfs vacfs
 vacfs vacfs
 webcookies webcookies
 webcookies webcookies

+ 20 - 4
sys/man/4/INDEX.html

@@ -42,9 +42,17 @@
 -  network file server plumbing
 -  network file server plumbing
 <DD><TT> exportfs, srvfs</TT>
 <DD><TT> exportfs, srvfs</TT>
 </DT>
 </DT>
+<DT><A HREF="/magic/man2html/4/ext2srv">ext2srv</A>
+-  ext2 file system
+<DD><TT> ext2srv</TT>
+</DT>
 <DT><A HREF="/magic/man2html/4/factotum">factotum</A>
 <DT><A HREF="/magic/man2html/4/factotum">factotum</A>
-- 
-<DD><TT> factotum, fgui, secretpem\- authentication agent and its graphical interface</TT>
+-  authentication agent
+<DD><TT> factotum, fgui</TT>
+</DT>
+<DT><A HREF="/magic/man2html/4/fossil">fossil</A>
+-  archival file server
+<DD><TT> fossil</TT>
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/4/fs">fs</A>
 <DT><A HREF="/magic/man2html/4/fs">fs</A>
 -  file server, dump
 -  file server, dump
@@ -74,10 +82,18 @@
 -  long name file system
 -  long name file system
 <DD><TT> lnfs</TT>
 <DD><TT> lnfs</TT>
 </DT>
 </DT>
+<DT><A HREF="/magic/man2html/4/mntgen">mntgen</A>
+-  automatically generate mount points for file systems
+<DD><TT> mntgen</TT>
+</DT>
 <DT><A HREF="/magic/man2html/4/namespace">namespace</A>
 <DT><A HREF="/magic/man2html/4/namespace">namespace</A>
 -  structure of conventional file name space
 -  structure of conventional file name space
 <DD><TT> namespace</TT>
 <DD><TT> namespace</TT>
 </DT>
 </DT>
+<DT><A HREF="/magic/man2html/4/nfs">nfs</A>
+-  Sun network file system client
+<DD><TT> nfs</TT>
+</DT>
 <DT><A HREF="/magic/man2html/4/nntpfs">nntpfs</A>
 <DT><A HREF="/magic/man2html/4/nntpfs">nntpfs</A>
 -  network news transport protocol (NNTP) file system
 -  network news transport protocol (NNTP) file system
 <DD><TT> nntpfs</TT>
 <DD><TT> nntpfs</TT>
@@ -116,7 +132,7 @@
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/4/srv">srv</A>
 <DT><A HREF="/magic/man2html/4/srv">srv</A>
 -  start network file service
 -  start network file service
-<DD><TT> srv, srvold9p, 9fs</TT>
+<DD><TT> srv, srvold9p, 9fs, srvssh</TT>
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/4/tapefs">tapefs</A>
 <DT><A HREF="/magic/man2html/4/tapefs">tapefs</A>
 -  mount archival file systems
 -  mount archival file systems
@@ -136,7 +152,7 @@
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/4/usb">usb</A>
 <DT><A HREF="/magic/man2html/4/usb">usb</A>
 -  Universal Serial Bus user level device drivers
 -  Universal Serial Bus user level device drivers
-<DD><TT> usbmouse, usbaudio</TT>
+<DD><TT> usbmouse, usbaudio, usbprinter</TT>
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/4/usbd">usbd</A>
 <DT><A HREF="/magic/man2html/4/usbd">usbd</A>
 -  Universal Serial Bus daemon
 -  Universal Serial Bus daemon

+ 14 - 2
sys/man/8/INDEX

@@ -1,6 +1,7 @@
 0intro 0intro
 0intro 0intro
 intro 0intro
 intro 0intro
 9load 9load
 9load 9load
+9pxeload 9load
 ld 9load
 ld 9load
 9pcon 9pcon
 9pcon 9pcon
 aan aan
 aan aan
@@ -38,6 +39,7 @@ imagemap httpd
 man2html httpd
 man2html httpd
 mirror httpd
 mirror httpd
 save httpd
 save httpd
+webls httpd
 init init
 init init
 ipconfig ipconfig
 ipconfig ipconfig
 rip ipconfig
 rip ipconfig
@@ -108,6 +110,9 @@ nfsserver nfsserver
 pcnfsd nfsserver
 pcnfsd nfsserver
 portmapper nfsserver
 portmapper nfsserver
 pcmcia pcmcia
 pcmcia pcmcia
+pem pem
+pemdecode pem
+pemencode pem
 gping ping
 gping ping
 hogports ping
 hogports ping
 ping ping
 ping ping
@@ -131,6 +136,13 @@ applylog replica
 compactdb replica
 compactdb replica
 replica replica
 replica replica
 updatedb replica
 updatedb replica
+asn12rsa rsa
+rsa rsa
+rsa2pub rsa
+rsa2ssh rsa
+rsa2x509 rsa
+rsafill rsa
+rsagen rsa
 scanmail scanmail
 scanmail scanmail
 testscan scanmail
 testscan scanmail
 scuzz scuzz
 scuzz scuzz
@@ -150,6 +162,7 @@ tlsclient tlssrv
 tlsclienttunnel tlssrv
 tlsclienttunnel tlssrv
 tlssrv tlssrv
 tlssrv tlssrv
 tlssrvtunnel tlssrv
 tlssrvtunnel tlssrv
+trampoline trampoline
 udpecho udpecho
 udpecho udpecho
 bootfloppy update
 bootfloppy update
 bootplan9 update
 bootplan9 update
@@ -164,6 +177,7 @@ venti venti
 buildindex ventiaux
 buildindex ventiaux
 checkarenas ventiaux
 checkarenas ventiaux
 checkindex ventiaux
 checkindex ventiaux
+conf ventiaux
 copy ventiaux
 copy ventiaux
 fmtarenas ventiaux
 fmtarenas ventiaux
 fmtindex ventiaux
 fmtindex ventiaux
@@ -175,5 +189,3 @@ ventiaux ventiaux
 wrarenablocks ventiaux
 wrarenablocks ventiaux
 write ventiaux
 write ventiaux
 vga vga
 vga vga
-X509gen x509
-x509 x509

+ 33 - 29
sys/man/8/INDEX.html

@@ -12,12 +12,16 @@
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/8/9load">9load</A>
 <DT><A HREF="/magic/man2html/8/9load">9load</A>
 -  PC bootstrap program
 -  PC bootstrap program
-<DD><TT> 9load, ld</TT>
+<DD><TT> 9load, ld, 9pxeload</TT>
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/8/9pcon">9pcon</A>
 <DT><A HREF="/magic/man2html/8/9pcon">9pcon</A>
 -  9P to text translator
 -  9P to text translator
 <DD><TT> 9pcon</TT>
 <DD><TT> 9pcon</TT>
 </DT>
 </DT>
+<DT><A HREF="/magic/man2html/8/aan">aan</A>
+-  always available network
+<DD><TT> aan</TT>
+</DT>
 <DT><A HREF="/magic/man2html/8/aliasmail">aliasmail</A>
 <DT><A HREF="/magic/man2html/8/aliasmail">aliasmail</A>
 -  expand system wide mail aliases
 -  expand system wide mail aliases
 <DD><TT> aliasmail</TT>
 <DD><TT> aliasmail</TT>
@@ -28,7 +32,7 @@
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/8/auth">auth</A>
 <DT><A HREF="/magic/man2html/8/auth">auth</A>
 -  maintain authentication databases
 -  maintain authentication databases
-<DD><TT> changeuser, wrkey, convkeys, convkeys2, printnetkey, status, auth.srv, guard.srv, login, disable, enable</TT>
+<DD><TT> changeuser, wrkey, convkeys, convkeys2, printnetkey, status, authsrv, guard.srv, login, disable, enable</TT>
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/8/boot">boot</A>
 <DT><A HREF="/magic/man2html/8/boot">boot</A>
 -  connect to the root file server
 -  connect to the root file server
@@ -38,18 +42,10 @@
 -  bootstrapping procedures
 -  bootstrapping procedures
 <DD><TT> booting</TT>
 <DD><TT> booting</TT>
 </DT>
 </DT>
-<DT><A HREF="/magic/man2html/8/buildindex">buildindex</A>
--  rebuild a Venti index
-<DD><TT> buildindex</TT>
-</DT>
 <DT><A HREF="/magic/man2html/8/checkarenas">checkarenas</A>
 <DT><A HREF="/magic/man2html/8/checkarenas">checkarenas</A>
 -  check the integrity, and optionally fix, Venti arenas
 -  check the integrity, and optionally fix, Venti arenas
 <DD><TT> checkarenas</TT>
 <DD><TT> checkarenas</TT>
 </DT>
 </DT>
-<DT><A HREF="/magic/man2html/8/checkindex">checkindex</A>
--  check the integrity and optionally fix a Venti index
-<DD><TT> checkindex</TT>
-</DT>
 <DT><A HREF="/magic/man2html/8/cpurc">cpurc</A>
 <DT><A HREF="/magic/man2html/8/cpurc">cpurc</A>
 -  boot script
 -  boot script
 <DD><TT> cpurc, termrc</TT>
 <DD><TT> cpurc, termrc</TT>
@@ -60,23 +56,15 @@
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/8/dhcpd">dhcpd</A>
 <DT><A HREF="/magic/man2html/8/dhcpd">dhcpd</A>
 -  Internet booting
 -  Internet booting
-<DD><TT> dhcpd, rarpd, tftpd</TT>
+<DD><TT> dhcpd, dhcpleases, rarpd, tftpd</TT>
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/8/drawterm">drawterm</A>
 <DT><A HREF="/magic/man2html/8/drawterm">drawterm</A>
 -  connect to Plan 9 CPU servers from other operating systems
 -  connect to Plan 9 CPU servers from other operating systems
 <DD><TT> drawterm</TT>
 <DD><TT> drawterm</TT>
 </DT>
 </DT>
-<DT><A HREF="/magic/man2html/8/fmtarenas">fmtarenas</A>
--  format a file into a number of Venti arenas
-<DD><TT> fmtarenas</TT>
-</DT>
-<DT><A HREF="/magic/man2html/8/fmtindex">fmtindex</A>
--  format a Venti index
-<DD><TT> fmtindex</TT>
-</DT>
-<DT><A HREF="/magic/man2html/8/fmtisect">fmtisect</A>
--  format a Venti index section
-<DD><TT> fmtisect</TT>
+<DT><A HREF="/magic/man2html/8/fossilcons">fossilcons</A>
+-  fossil console commands
+<DD><TT> fossilcons</TT>
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/8/fs">fs</A>
 <DT><A HREF="/magic/man2html/8/fs">fs</A>
 -  file server maintenance
 -  file server maintenance
@@ -88,7 +76,7 @@
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/8/httpd">httpd</A>
 <DT><A HREF="/magic/man2html/8/httpd">httpd</A>
 -  HTTP server
 -  HTTP server
-<DD><TT> httpd, echo, save, imagemap, man2html</TT>
+<DD><TT> httpd, mirror, save, imagemap, man2html, webls</TT>
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/8/init">init</A>
 <DT><A HREF="/magic/man2html/8/init">init</A>
 -  initialize machine upon booting
 -  initialize machine upon booting
@@ -154,6 +142,10 @@
 -  identify a PCMCIA card
 -  identify a PCMCIA card
 <DD><TT> pcmcia</TT>
 <DD><TT> pcmcia</TT>
 </DT>
 </DT>
+<DT><A HREF="/magic/man2html/8/pem">pem</A>
+-  encode files in Privacy Enhanced Mail (PEM) format
+<DD><TT> pemdecode, pemencode</TT>
+</DT>
 <DT><A HREF="/magic/man2html/8/ping">ping</A>
 <DT><A HREF="/magic/man2html/8/ping">ping</A>
 -  probe the Internet
 -  probe the Internet
 <DD><TT> ping, gping, traceroute, hogports</TT>
 <DD><TT> ping, gping, traceroute, hogports</TT>
@@ -178,10 +170,6 @@
 -  queue management for spooled files
 -  queue management for spooled files
 <DD><TT> qer, runq</TT>
 <DD><TT> qer, runq</TT>
 </DT>
 </DT>
-<DT><A HREF="/magic/man2html/8/rdarena">rdarena</A>
--  extract a Venti arena
-<DD><TT> rdarena</TT>
-</DT>
 <DT><A HREF="/magic/man2html/8/reboot">reboot</A>
 <DT><A HREF="/magic/man2html/8/reboot">reboot</A>
 -  reboot the system upon loss of remote file server connection
 -  reboot the system upon loss of remote file server connection
 <DD><TT> reboot</TT>
 <DD><TT> reboot</TT>
@@ -190,6 +178,10 @@
 -  simple client-server replica management
 -  simple client-server replica management
 <DD><TT> applychanges, applylog, compactdb, updatedb</TT>
 <DD><TT> applychanges, applylog, compactdb, updatedb</TT>
 </DT>
 </DT>
+<DT><A HREF="/magic/man2html/8/rsa">rsa</A>
+-  generate and format rsa keys
+<DD><TT> rsagen, rsafill, asn12rsa, rsa2pub, rsa2ssh, rsa2x509</TT>
+</DT>
 <DT><A HREF="/magic/man2html/8/scanmail">scanmail</A>
 <DT><A HREF="/magic/man2html/8/scanmail">scanmail</A>
 -  spam filters
 -  spam filters
 <DD><TT> scanmail, testscan</TT>
 <DD><TT> scanmail, testscan</TT>
@@ -211,8 +203,8 @@
 <DD><TT> send</TT>
 <DD><TT> send</TT>
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/8/smtp">smtp</A>
 <DT><A HREF="/magic/man2html/8/smtp">smtp</A>
--  mail transport and servers
-<DD><TT> smtp, smtpd, pop3, imap4d</TT>
+-  mail transport
+<DD><TT> smtp, smtpd</TT>
 </DT>
 </DT>
 <DT><A HREF="/magic/man2html/8/snoopy">snoopy</A>
 <DT><A HREF="/magic/man2html/8/snoopy">snoopy</A>
 -  spy on network packets
 -  spy on network packets
@@ -222,6 +214,10 @@
 -  display graphs of system activity
 -  display graphs of system activity
 <DD><TT> stats</TT>
 <DD><TT> stats</TT>
 </DT>
 </DT>
+<DT><A HREF="/magic/man2html/8/stub">stub</A>
+-  provide mount point stubs
+<DD><TT> stub</TT>
+</DT>
 <DT><A HREF="/magic/man2html/8/swap">swap</A>
 <DT><A HREF="/magic/man2html/8/swap">swap</A>
 -  establish a swap file
 -  establish a swap file
 <DD><TT> swap</TT>
 <DD><TT> swap</TT>
@@ -234,6 +230,10 @@
 -  TLS server and client
 -  TLS server and client
 <DD><TT> tlssrv, tlsclient, tlssrvtunnel, tlsclienttunnel</TT>
 <DD><TT> tlssrv, tlsclient, tlssrvtunnel, tlsclienttunnel</TT>
 </DT>
 </DT>
+<DT><A HREF="/magic/man2html/8/trampoline">trampoline</A>
+- 
+<DD><TT></TT>
+</DT>
 <DT><A HREF="/magic/man2html/8/udpecho">udpecho</A>
 <DT><A HREF="/magic/man2html/8/udpecho">udpecho</A>
 -  echo UDP packets
 -  echo UDP packets
 <DD><TT> udpecho</TT>
 <DD><TT> udpecho</TT>
@@ -246,6 +246,10 @@
 -  an archival block storage server
 -  an archival block storage server
 <DD><TT> venti</TT>
 <DD><TT> venti</TT>
 </DT>
 </DT>
+<DT><A HREF="/magic/man2html/8/ventiaux">ventiaux</A>
+-  Venti maintenance and debugging commands
+<DD><TT> buildindex, checkarenas, checkindex, conf, copy, fmtarenas, fmtindex, fmtisect, rdarena, rdarenablocks, read, wrarenablocks, write</TT>
+</DT>
 <DT><A HREF="/magic/man2html/8/vga">vga</A>
 <DT><A HREF="/magic/man2html/8/vga">vga</A>
 -  configure a VGA card
 -  configure a VGA card
 <DD><TT> vga</TT>
 <DD><TT> vga</TT>

+ 7 - 5
sys/src/9/pc/devpccard.c

@@ -20,6 +20,7 @@ enum {
 	TI_1420_did = 0xAC51,
 	TI_1420_did = 0xAC51,
 
 
 	Ricoh_vid = 0x1180,
 	Ricoh_vid = 0x1180,
+	Ricoh_475_did = 0x0475,
 	Ricoh_476_did = 0x0476,
 	Ricoh_476_did = 0x0476,
 	Ricoh_478_did = 0x0478,
 	Ricoh_478_did = 0x0478,
 
 
@@ -53,13 +54,14 @@ struct Variant {
 };
 };
 
 
 static Variant variant[] = {
 static Variant variant[] = {
+{	Ricoh_vid,	Ricoh_475_did,	"Ricoh 475 PCI/Cardbus bridge",	},
 {	Ricoh_vid,	Ricoh_476_did,	"Ricoh 476 PCI/Cardbus bridge",	},
 {	Ricoh_vid,	Ricoh_476_did,	"Ricoh 476 PCI/Cardbus bridge",	},
 {	Ricoh_vid,	Ricoh_478_did,	"Ricoh 478 PCI/Cardbus bridge",	},
 {	Ricoh_vid,	Ricoh_478_did,	"Ricoh 478 PCI/Cardbus bridge",	},
-{	TI_vid,		TI_1131_did,		"TI PCI-1131 Cardbus Controller",	},
-{	TI_vid,		TI_1250_did,		"TI PCI-1250 Cardbus Controller",	},
-{	TI_vid,		TI_1450_did,		"TI PCI-1450 Cardbus Controller",	},
-{	TI_vid,		TI_1251A_did,		"TI PCI-1251A Cardbus Controller",	},
-{	TI_vid,		TI_1420_did,		"TI PCI-1420 Cardbus Controller", },
+{	TI_vid,		TI_1131_did,	"TI PCI-1131 Cardbus Controller", },
+{	TI_vid,		TI_1250_did,	"TI PCI-1250 Cardbus Controller", },
+{	TI_vid,		TI_1450_did,	"TI PCI-1450 Cardbus Controller", },
+{	TI_vid,		TI_1251A_did,	"TI PCI-1251A Cardbus Controller", },
+{	TI_vid,		TI_1420_did,	"TI PCI-1420 Cardbus Controller", },
 };
 };
 
 
 /* Cardbus registers */
 /* Cardbus registers */

+ 143 - 36
sys/src/9/pc/ether2000.c

@@ -26,51 +26,158 @@ enum {
 	Reset		= 0x1F,		/* offset from I/O base of reset port */
 	Reset		= 0x1F,		/* offset from I/O base of reset port */
 };
 };
 
 
+typedef struct Ctlr Ctlr;
+typedef struct Ctlr {
+	Pcidev*	pcidev;
+	Ctlr*	next;
+	int	active;
+} Ctlr;
+
+static Ctlr* ctlrhead;
+static Ctlr* ctlrtail;
+
+static struct {
+	char*	name;
+	int	id;
+} ne2000pci[] = {
+	{ "Realtek 8029",	(0x8029<<16)|0x10EC, },
+	{ "Winbond 89C940",	(0x0940<<16)|0x1050, },
+	{ nil },
+};
+
+static Ctlr*
+ne2000match(Ether* edev, int id)
+{
+	int port;
+	Pcidev *p;
+	Ctlr *ctlr;
+
+	/*
+	 * Any adapter matches if no edev->port is supplied,
+	 * otherwise the ports must match.
+	 */
+	for(ctlr = ctlrhead; ctlr != nil; ctlr = ctlr->next){
+		if(ctlr->active)
+			continue;
+		p = ctlr->pcidev;
+		if(((p->did<<16)|p->vid) != id)
+			continue;
+		port = p->mem[0].bar & ~0x01;
+		if(edev->port != 0 && edev->port != port)
+			continue;
+
+		/*
+		 * It suffices to fill these in,
+		 * the rest is gleaned from the card.
+		 */
+		edev->port = port;
+		edev->irq = p->intl;
+
+		ctlr->active = 1;
+
+		return ctlr;
+	}
+
+	return nil;
+}
+
+static void
+ne2000pnp(Ether* edev)
+{
+	int i, id;
+	Pcidev *p;
+	Ctlr *ctlr;
+
+	/*
+	 * Make a list of all ethernet controllers
+	 * if not already done.
+	 */
+	if(ctlrhead == nil){
+		p = nil;
+		while(p = pcimatch(p, 0, 0)){
+			if(p->ccrb != 0x02 || p->ccru != 0)
+				continue;
+			ctlr = malloc(sizeof(Ctlr));
+			ctlr->pcidev = p;
+
+			if(ctlrhead != nil)
+				ctlrtail->next = ctlr;
+			else
+				ctlrhead = ctlr;
+			ctlrtail = ctlr;
+		}
+	}
+
+	/*
+	 * Is it a card with an unrecognised vid+did?
+	 * Normally a search is made through all the found controllers
+	 * for one which matches any of the known vid+did pairs.
+	 * If a vid+did pair is specified a search is made for that
+	 * specific controller only.
+	 */
+	id = 0;
+	for(i = 0; i < edev->nopt; i++){
+		if(cistrncmp(edev->opt[i], "id=", 3) == 0)
+			id = strtol(&edev->opt[i][3], nil, 0);
+	}
+
+	if(id != 0)
+		ne2000match(edev, id);
+	else for(i = 0; ne2000pci[i].name; i++){
+		if(ne2000match(edev, ne2000pci[i].id) != nil)
+			break;
+	}
+}
+
 static int
 static int
-reset(Ether* ether)
+ne2000reset(Ether* edev)
 {
 {
 	static int first;
 	static int first;
 	ushort buf[16];
 	ushort buf[16];
 	ulong port;
 	ulong port;
-	Dp8390 *ctlr;
+	Dp8390 *dp8390;
 	int i;
 	int i;
 	uchar ea[Eaddrlen];
 	uchar ea[Eaddrlen];
 
 
+	if(edev->port == 0)
+		ne2000pnp(edev);
+
 	/*
 	/*
 	 * Set up the software configuration.
 	 * Set up the software configuration.
-	 * Use defaults for port, irq, mem and size
+	 * Use defaults for irq, mem and size
 	 * if not specified.
 	 * if not specified.
+	 * Must have a port, no more default.
 	 */
 	 */
-	if(ether->port == 0)
-		ether->port = 0x300;
-	if(ether->irq == 0)
-		ether->irq = 2;
-	if(ether->mem == 0)
-		ether->mem = 0x4000;
-	if(ether->size == 0)
-		ether->size = 16*1024;
-	port = ether->port;
-
-	if(ioalloc(ether->port, 0x20, 0, "ne2000") < 0)
+	if(edev->port == 0)
+		return -1;
+	if(edev->irq == 0)
+		edev->irq = 2;
+	if(edev->mem == 0)
+		edev->mem = 0x4000;
+	if(edev->size == 0)
+		edev->size = 16*1024;
+	port = edev->port;
+
+	if(ioalloc(edev->port, 0x20, 0, "ne2000") < 0)
 		return -1;
 		return -1;
 
 
-	ether->ctlr = malloc(sizeof(Dp8390));
-	ctlr = ether->ctlr;
-	ctlr->width = 2;
-	ctlr->ram = 0;
+	edev->ctlr = malloc(sizeof(Dp8390));
+	dp8390 = edev->ctlr;
+	dp8390->width = 2;
+	dp8390->ram = 0;
 
 
-	ctlr->port = port;
-	ctlr->data = port+Data;
+	dp8390->port = port;
+	dp8390->data = port+Data;
 
 
-	ctlr->tstart = HOWMANY(ether->mem, Dp8390BufSz);
-	ctlr->pstart = ctlr->tstart + HOWMANY(sizeof(Etherpkt), Dp8390BufSz);
-	ctlr->pstop = ctlr->tstart + HOWMANY(ether->size, Dp8390BufSz);
+	dp8390->tstart = HOWMANY(edev->mem, Dp8390BufSz);
+	dp8390->pstart = dp8390->tstart + HOWMANY(sizeof(Etherpkt), Dp8390BufSz);
+	dp8390->pstop = dp8390->tstart + HOWMANY(edev->size, Dp8390BufSz);
 
 
-	ctlr->dummyrr = 1;
-	for(i = 0; i < ether->nopt; i++){
-		if(strcmp(ether->opt[i], "nodummyrr"))
+	dp8390->dummyrr = 1;
+	for(i = 0; i < edev->nopt; i++){
+		if(strcmp(edev->opt[i], "nodummyrr"))
 			continue;
 			continue;
-		ctlr->dummyrr = 0;
+		dp8390->dummyrr = 0;
 		break;
 		break;
 	}
 	}
 
 
@@ -92,12 +199,12 @@ reset(Ether* ether)
 	 * enough, there are other ethernet boards which could
 	 * enough, there are other ethernet boards which could
 	 * match.
 	 * match.
 	 */
 	 */
-	dp8390reset(ether);
+	dp8390reset(edev);
 	memset(buf, 0, sizeof(buf));
 	memset(buf, 0, sizeof(buf));
-	dp8390read(ctlr, buf, 0, sizeof(buf));
+	dp8390read(dp8390, buf, 0, sizeof(buf));
 	if((buf[0x0E] & 0xFF) != 0x57 || (buf[0x0F] & 0xFF) != 0x57){
 	if((buf[0x0E] & 0xFF) != 0x57 || (buf[0x0F] & 0xFF) != 0x57){
-		iofree(ether->port);
-		free(ether->ctlr);
+		iofree(edev->port);
+		free(edev->ctlr);
 		return -1;
 		return -1;
 	}
 	}
 
 
@@ -107,11 +214,11 @@ reset(Ether* ether)
 	 * Set the ethernet address.
 	 * Set the ethernet address.
 	 */
 	 */
 	memset(ea, 0, Eaddrlen);
 	memset(ea, 0, Eaddrlen);
-	if(memcmp(ea, ether->ea, Eaddrlen) == 0){
-		for(i = 0; i < sizeof(ether->ea); i++)
-			ether->ea[i] = buf[i];
+	if(memcmp(ea, edev->ea, Eaddrlen) == 0){
+		for(i = 0; i < sizeof(edev->ea); i++)
+			edev->ea[i] = buf[i];
 	}
 	}
-	dp8390setea(ether);
+	dp8390setea(edev);
 
 
 	return 0;
 	return 0;
 }
 }
@@ -119,5 +226,5 @@ reset(Ether* ether)
 void
 void
 ether2000link(void)
 ether2000link(void)
 {
 {
-	addethercard("NE2000", reset);
+	addethercard("NE2000", ne2000reset);
 }
 }

+ 44 - 24
sys/src/9/pc/vganeomagic.c

@@ -36,6 +36,11 @@ neomagiclinear(VGAscr* scr, int* size, int* align)
 	aperture = 0;
 	aperture = 0;
 	if(p = pcimatch(nil, 0x10C8, 0)){
 	if(p = pcimatch(nil, 0x10C8, 0)){
 		switch(p->did){
 		switch(p->did){
+		case 0x0003:		/* MagicGraph 128ZV */
+			aperture = p->mem[0].bar & ~0x0F;
+			*size = p->mem[0].size;
+//print("neomagiclinear0 %lux %d\n", aperture, *size);
+			break;
 		case 0x0004:		/* MagicGraph 128XD */
 		case 0x0004:		/* MagicGraph 128XD */
 		case 0x0005:		/* MagicMedia 256AV */
 		case 0x0005:		/* MagicMedia 256AV */
 		case 0x0006:		/* MagicMedia 256ZX */
 		case 0x0006:		/* MagicMedia 256ZX */
@@ -55,6 +60,7 @@ neomagiclinear(VGAscr* scr, int* size, int* align)
 	scr->isupamem = 0;
 	scr->isupamem = 0;
 
 
 	aperture = upamalloc(aperture, *size, *align);
 	aperture = upamalloc(aperture, *size, *align);
+//print("neomagiclinear1 %lux %d\n", aperture, *size);
 	if(aperture == 0){
 	if(aperture == 0){
 		if(wasupamem && upamalloc(oaperture, oapsize, 0)){
 		if(wasupamem && upamalloc(oaperture, oapsize, 0)){
 			aperture = oaperture;
 			aperture = oaperture;
@@ -75,6 +81,8 @@ neomagicenable(VGAscr* scr)
 	Pcidev *p;
 	Pcidev *p;
 	int align, curoff, size, vmsize;
 	int align, curoff, size, vmsize;
 	ulong aperture;
 	ulong aperture;
+	ulong ioaddr;
+	ulong iosize;
 
 
 	/*
 	/*
 	 * Only once, can't be disabled for now.
 	 * Only once, can't be disabled for now.
@@ -86,17 +94,29 @@ neomagicenable(VGAscr* scr)
 		return;
 		return;
 	if(p = pcimatch(nil, 0x10C8, 0)){
 	if(p = pcimatch(nil, 0x10C8, 0)){
 		switch(p->did){
 		switch(p->did){
+		case 0x0003:		/* MagicGraph 128VZ */
+			curoff = 0x100;
+			vmsize = 1152*1024;
+			ioaddr = (p->mem[0].bar & ~0x0F) + 0x200000;
+			iosize = 0x200000;
+			break;
 		case 0x0004:		/* MagicGraph 128XD */
 		case 0x0004:		/* MagicGraph 128XD */
 			curoff = 0x100;
 			curoff = 0x100;
 			vmsize = 2048*1024;
 			vmsize = 2048*1024;
+			ioaddr = p->mem[1].bar & ~0x0F;
+			iosize = p->mem[1].size;
 			break;
 			break;
 		case 0x0005:		/* MagicMedia 256AV */
 		case 0x0005:		/* MagicMedia 256AV */
 			curoff = 0x1000;
 			curoff = 0x1000;
 			vmsize = 2560*1024;
 			vmsize = 2560*1024;
+			ioaddr = p->mem[1].bar & ~0x0F;
+			iosize = p->mem[1].size;
 			break;
 			break;
 		case 0x0006:		/* MagicMedia 256ZX */
 		case 0x0006:		/* MagicMedia 256ZX */
 			curoff = 0x1000;
 			curoff = 0x1000;
 			vmsize = 4096*1024;
 			vmsize = 4096*1024;
+			ioaddr = p->mem[1].bar & ~0x0F;
+			iosize = p->mem[1].size;
 			break;
 			break;
 		default:
 		default:
 			return;
 			return;
@@ -104,10 +124,10 @@ neomagicenable(VGAscr* scr)
 	}
 	}
 	else
 	else
 		return;
 		return;
-	scr->io = upamalloc(p->mem[1].bar & ~0x0F, p->mem[1].size, 0);
+	scr->io = upamalloc(ioaddr, iosize, 0);
 	if(scr->io == 0)
 	if(scr->io == 0)
 		return;
 		return;
-	addvgaseg("neomagicmmio", scr->io, p->mem[1].size);
+	addvgaseg("neomagicmmio", scr->io, iosize);
 	scr->mmio = KADDR(scr->io);
 	scr->mmio = KADDR(scr->io);
 
 
 	/*
 	/*
@@ -308,10 +328,10 @@ enum {
 	NEO_BC1_X_320 =		0x00000400,
 	NEO_BC1_X_320 =		0x00000400,
 	NEO_BC1_X_640 =		0x00000800,
 	NEO_BC1_X_640 =		0x00000800,
 	NEO_BC1_X_800 =		0x00000c00,
 	NEO_BC1_X_800 =		0x00000c00,
-	NEO_BC1_X_1024 =		0x00001000,
-	NEO_BC1_X_1152 =		0x00001400,
-	NEO_BC1_X_1280 =		0x00001800,
-	NEO_BC1_X_1600 =		0x00001c00,
+	NEO_BC1_X_1024 =	0x00001000,
+	NEO_BC1_X_1152 =	0x00001400,
+	NEO_BC1_X_1280 =	0x00001800,
+	NEO_BC1_X_1600 =	0x00001c00,
 	NEO_BC1_DST_TRANS =	0x00002000,
 	NEO_BC1_DST_TRANS =	0x00002000,
 	NEO_BC1_MSTR_BLT =	0x00004000,
 	NEO_BC1_MSTR_BLT =	0x00004000,
 	NEO_BC1_FILTER_Z =	0x00008000,
 	NEO_BC1_FILTER_Z =	0x00008000,
@@ -320,41 +340,41 @@ enum {
 
 
 	NEO_BC3_SRC_XY_ADDR =	0x01000000,
 	NEO_BC3_SRC_XY_ADDR =	0x01000000,
 	NEO_BC3_DST_XY_ADDR =	0x02000000,
 	NEO_BC3_DST_XY_ADDR =	0x02000000,
-	NEO_BC3_CLIP_ON =		0x04000000,
-	NEO_BC3_FIFO_EN =		0x08000000,
+	NEO_BC3_CLIP_ON =	0x04000000,
+	NEO_BC3_FIFO_EN =	0x08000000,
 	NEO_BC3_BLT_ON_ADDR =	0x10000000,
 	NEO_BC3_BLT_ON_ADDR =	0x10000000,
 	NEO_BC3_SKIP_MAPPING =	0x80000000,
 	NEO_BC3_SKIP_MAPPING =	0x80000000,
 
 
-	NEO_MODE1_DEPTH8 =			0x0100,
-	NEO_MODE1_DEPTH16 =			0x0200,
-	NEO_MODE1_DEPTH24 =			0x0300,
-	NEO_MODE1_X_320 =			0x0400,
-	NEO_MODE1_X_640 =			0x0800,
-	NEO_MODE1_X_800 =			0x0c00,
-	NEO_MODE1_X_1024 =			0x1000,
-	NEO_MODE1_X_1152 =			0x1400,
-	NEO_MODE1_X_1280 =			0x1800,
-	NEO_MODE1_X_1600 =			0x1c00,
+	NEO_MODE1_DEPTH8 =	0x0100,
+	NEO_MODE1_DEPTH16 =	0x0200,
+	NEO_MODE1_DEPTH24 =	0x0300,
+	NEO_MODE1_X_320 =	0x0400,
+	NEO_MODE1_X_640 =	0x0800,
+	NEO_MODE1_X_800 =	0x0c00,
+	NEO_MODE1_X_1024 =	0x1000,
+	NEO_MODE1_X_1152 =	0x1400,
+	NEO_MODE1_X_1280 =	0x1800,
+	NEO_MODE1_X_1600 =	0x1c00,
 	NEO_MODE1_BLT_ON_ADDR =	0x2000,
 	NEO_MODE1_BLT_ON_ADDR =	0x2000,
 };
 };
 
 
 /* Raster Operations */
 /* Raster Operations */
 enum {
 enum {
-	GXclear =			0x000000,	/* 0x0000 */
+	GXclear =		0x000000,	/* 0x0000 */
 	GXand =			0x080000,	/* 0x1000 */
 	GXand =			0x080000,	/* 0x1000 */
-	GXandReverse =	0x040000,	/* 0x0100 */
-	GXcopy =			0x0c0000,	/* 0x1100 */
+	GXandReverse =		0x040000,	/* 0x0100 */
+	GXcopy =		0x0c0000,	/* 0x1100 */
 	GXandInvert =		0x020000,	/* 0x0010 */
 	GXandInvert =		0x020000,	/* 0x0010 */
-	GXnoop =			0x0a0000,	/* 0x1010 */
+	GXnoop =		0x0a0000,	/* 0x1010 */
 	GXxor =			0x060000,	/* 0x0110 */
 	GXxor =			0x060000,	/* 0x0110 */
 	GXor =			0x0e0000,	/* 0x1110 */
 	GXor =			0x0e0000,	/* 0x1110 */
 	GXnor =			0x010000,	/* 0x0001 */
 	GXnor =			0x010000,	/* 0x0001 */
-	GXequiv =			0x090000,	/* 0x1001 */
+	GXequiv =		0x090000,	/* 0x1001 */
 	GXinvert =		0x050000,	/* 0x0101 */
 	GXinvert =		0x050000,	/* 0x0101 */
 	GXorReverse =		0x0d0000,	/* 0x1101 */
 	GXorReverse =		0x0d0000,	/* 0x1101 */
 	GXcopyInvert =		0x030000,	/* 0x0011 */
 	GXcopyInvert =		0x030000,	/* 0x0011 */
 	GXorInverted =		0x0b0000,	/* 0x1011 */
 	GXorInverted =		0x0b0000,	/* 0x1011 */
-	GXnand =			0x070000,	/* 0x0111 */
+	GXnand =		0x070000,	/* 0x0111 */
 	GXset =			0x0f0000,	/* 0x1111 */
 	GXset =			0x0f0000,	/* 0x1111 */
 };
 };
 
 

+ 281 - 282
sys/src/9/ppc/l.s

@@ -15,12 +15,12 @@
 #endif /* ucuconf */
 #endif /* ucuconf */
 
 
 /* special instruction definitions */
 /* special instruction definitions */
-#define	BDNZ	BC	16,0,
-#define	BDNE	BC	0,2,
-#define	MTCRF(r,crm)	WORD	$((31<<26)|((r)<<21)|(crm<<12)|(144<<1))
+#define	BDNZ		BC	16, 0,
+#define	BDNE		BC	0, 2,
+#define	MTCRF(r, crm)	WORD	$((31<<26)|((r)<<21)|(crm<<12)|(144<<1))
 
 
 /* #define	TLBIA	WORD	$((31<<26)|(370<<1)) Not implemented on the 603e */
 /* #define	TLBIA	WORD	$((31<<26)|(370<<1)) Not implemented on the 603e */
-#define	TLBSYNC	WORD	$((31<<26)|(566<<1))
+#define	TLBSYNC		WORD	$((31<<26)|(566<<1))
 #define	TLBLI(n)	WORD	$((31<<26)|((n)<<11)|(1010<<1))
 #define	TLBLI(n)	WORD	$((31<<26)|((n)<<11)|(1010<<1))
 #define	TLBLD(n)	WORD	$((31<<26)|((n)<<11)|(978<<1))
 #define	TLBLD(n)	WORD	$((31<<26)|((n)<<11)|(978<<1))
 
 
@@ -29,7 +29,7 @@
 
 
 #define	UREGSPACE	(UREGSIZE+8)
 #define	UREGSPACE	(UREGSIZE+8)
 
 
-	TEXT start(SB), $-4
+TEXT start(SB), $-4
 
 
 	/*
 	/*
 	 * setup MSR
 	 * setup MSR
@@ -53,27 +53,27 @@
 	ANDN	R3, R2
 	ANDN	R3, R2
 
 
 	/* before this we're not running above KZERO */
 	/* before this we're not running above KZERO */
-	BL		mmuinit0(SB)
+	BL	mmuinit0(SB)
 	/* after this we are */
 	/* after this we are */
 
 
 #ifdef ucuconf
 #ifdef ucuconf
 	MOVW	$0x2000000, R4		/* size */
 	MOVW	$0x2000000, R4		/* size */
 	MOVW	$0, R3			/* base address */
 	MOVW	$0, R3			/* base address */
 	RLWNM	$0, R3, $~(CACHELINESZ-1), R5
 	RLWNM	$0, R3, $~(CACHELINESZ-1), R5
-	CMP		R4, $0
-	BLE		_dcf1
-	SUB		R5, R3
-	ADD		R3, R4
-	ADD		$(CACHELINESZ-1), R4
+	CMP	R4, $0
+	BLE	_dcf1
+	SUB	R5, R3
+	ADD	R3, R4
+	ADD	$(CACHELINESZ-1), R4
 	SRAW	$CACHELINELOG, R4
 	SRAW	$CACHELINELOG, R4
 	MOVW	R4, CTR
 	MOVW	R4, CTR
 _dcf0:	DCBF	(R5)
 _dcf0:	DCBF	(R5)
-	ADD		$CACHELINESZ, R5
+	ADD	$CACHELINESZ, R5
 	BDNZ	_dcf0
 	BDNZ	_dcf0
 _dcf1:
 _dcf1:
 	SYNC
 	SYNC
 
 
-	/* BAT0,3 unused, copy of BAT2 */
+	/* BAT0, 3 unused, copy of BAT2 */
 	MOVW	SPR(IBATL(2)), R3
 	MOVW	SPR(IBATL(2)), R3
 	MOVW	R3, SPR(IBATL(0))
 	MOVW	R3, SPR(IBATL(0))
 	MOVW	SPR(IBATU(2)), R3
 	MOVW	SPR(IBATU(2)), R3
@@ -100,14 +100,14 @@ _dcf1:
 
 
 	/* set up Mach */
 	/* set up Mach */
 	MOVW	$MACHADDR, R(MACH)
 	MOVW	$MACHADDR, R(MACH)
-	ADD		$(MACHSIZE-8), R(MACH), R1	/* set stack */
+	ADD	$(MACHSIZE-8), R(MACH), R1	/* set stack */
 
 
 	MOVW	R0, R(USER)		/* up-> set to zero */
 	MOVW	R0, R(USER)		/* up-> set to zero */
-	MOVW	R0, 0(R(MACH))	/* machno set to zero */
+	MOVW	R0, 0(R(MACH))		/* machno set to zero */
 
 
 	BL	main(SB)
 	BL	main(SB)
 
 
-	RETURN		/* not reached */
+	RETURN				/* not reached */
 
 
 /*
 /*
  * on return from this function we will be running in virtual mode.
  * on return from this function we will be running in virtual mode.
@@ -115,7 +115,7 @@ _dcf1:
  * 1) first 3 BATs are 256M blocks, starting from KZERO->0
  * 1) first 3 BATs are 256M blocks, starting from KZERO->0
  * 2) remaining BAT maps last 256M directly
  * 2) remaining BAT maps last 256M directly
  */
  */
-TEXT	mmuinit0(SB), $0
+TEXT mmuinit0(SB), $0
 	/* reset all the tlbs */
 	/* reset all the tlbs */
 	MOVW	$64, R3
 	MOVW	$64, R3
 	MOVW	R3, CTR
 	MOVW	R3, CTR
@@ -124,7 +124,7 @@ TEXT	mmuinit0(SB), $0
 tlbloop:
 tlbloop:
 	TLBIE	R4
 	TLBIE	R4
 	SYNC
 	SYNC
-	ADD		$BIT(19), R4
+	ADD	$BIT(19), R4
 	BDNZ	tlbloop
 	BDNZ	tlbloop
 	TLBSYNC
 	TLBSYNC
 
 
@@ -140,8 +140,8 @@ tlbloop:
 	MOVW	R4, SPR(DBATL(0))
 	MOVW	R4, SPR(DBATL(0))
 
 
 	/* KZERO+256M -> 256M, IBAT and DBAT, 256 MB */
 	/* KZERO+256M -> 256M, IBAT and DBAT, 256 MB */
-	ADD		$(1<<28), R3
-	ADD		$(1<<28), R4
+	ADD	$(1<<28), R3
+	ADD	$(1<<28), R4
 	MOVW	R3, SPR(IBATU(1))
 	MOVW	R3, SPR(IBATU(1))
 	MOVW	R4, SPR(IBATL(1))
 	MOVW	R4, SPR(IBATL(1))
 	MOVW	R3, SPR(DBATU(1))
 	MOVW	R3, SPR(DBATU(1))
@@ -180,18 +180,18 @@ tlbloop:
 
 
 	/* enable MMU */
 	/* enable MMU */
 	MOVW	LR, R3
 	MOVW	LR, R3
-	OR		$KZERO, R3
-	MOVW	R3, SPR(SRR0)	/* Stored PC for RFI instruction */
+	OR	$KZERO, R3
+	MOVW	R3, SPR(SRR0)		/* Stored PC for RFI instruction */
 	MOVW	MSR, R4
 	MOVW	MSR, R4
-	OR		$(MSR_IR|MSR_DR|MSR_RI|MSR_FP), R4
+	OR	$(MSR_IR|MSR_DR|MSR_RI|MSR_FP), R4
 	MOVW	R4, SPR(SRR1)
 	MOVW	R4, SPR(SRR1)
-	RFI		/* resume in kernel mode in caller */
+	RFI				/* resume in kernel mode in caller */
 
 
 	RETURN
 	RETURN
 
 
-TEXT	kfpinit(SB), $0
-	MOVFL	$0,FPSCR(7)
-	MOVFL	$0xD,FPSCR(6)	/* VE, OE, ZE */
+TEXT kfpinit(SB), $0
+	MOVFL	$0, FPSCR(7)
+	MOVFL	$0xD, FPSCR(6)		/* VE, OE, ZE */
 	MOVFL	$0, FPSCR(5)
 	MOVFL	$0, FPSCR(5)
 	MOVFL	$0, FPSCR(3)
 	MOVFL	$0, FPSCR(3)
 	MOVFL	$0, FPSCR(2)
 	MOVFL	$0, FPSCR(2)
@@ -200,7 +200,7 @@ TEXT	kfpinit(SB), $0
 
 
 	FMOVD	$4503601774854144.0, F27
 	FMOVD	$4503601774854144.0, F27
 	FMOVD	$0.5, F29
 	FMOVD	$0.5, F29
-	FSUB		F29, F29, F28
+	FSUB	F29, F29, F28
 	FADD	F29, F29, F30
 	FADD	F29, F29, F30
 	FADD	F30, F30, F31
 	FADD	F30, F30, F31
 	FMOVD	F28, F0
 	FMOVD	F28, F0
@@ -232,9 +232,9 @@ TEXT	kfpinit(SB), $0
 	FMOVD	F28, F26
 	FMOVD	F28, F26
 	RETURN
 	RETURN
 
 
-TEXT	splhi(SB), $0
+TEXT splhi(SB), $0
 	MOVW	LR, R31
 	MOVW	LR, R31
-	MOVW	R31, 4(R(MACH))	/* save PC in m->splpc */
+	MOVW	R31, 4(R(MACH))		/* save PC in m->splpc */
 	MOVW	MSR, R3
 	MOVW	MSR, R3
 	RLWNM	$0, R3, $~MSR_EE, R4
 	RLWNM	$0, R3, $~MSR_EE, R4
 	SYNC
 	SYNC
@@ -242,12 +242,12 @@ TEXT	splhi(SB), $0
 	MSRSYNC
 	MSRSYNC
 	RETURN
 	RETURN
 
 
-TEXT	splx(SB), $0
+TEXT splx(SB), $0
 	/* fall though */
 	/* fall though */
 
 
-TEXT	splxpc(SB), $0
+TEXT splxpc(SB), $0
 	MOVW	LR, R31
 	MOVW	LR, R31
-	MOVW	R31, 4(R(MACH))	/* save PC in m->splpc */
+	MOVW	R31, 4(R(MACH))		/* save PC in m->splpc */
 	MOVW	MSR, R4
 	MOVW	MSR, R4
 	RLWMI	$0, R3, $MSR_EE, R4
 	RLWMI	$0, R3, $MSR_EE, R4
 	SYNC
 	SYNC
@@ -255,7 +255,7 @@ TEXT	splxpc(SB), $0
 	MSRSYNC
 	MSRSYNC
 	RETURN
 	RETURN
 
 
-TEXT	spllo(SB), $0
+TEXT spllo(SB), $0
 	MOVW	MSR, R3
 	MOVW	MSR, R3
 	OR	$MSR_EE, R3, R4
 	OR	$MSR_EE, R3, R4
 	SYNC
 	SYNC
@@ -263,29 +263,29 @@ TEXT	spllo(SB), $0
 	MSRSYNC
 	MSRSYNC
 	RETURN
 	RETURN
 
 
-TEXT	spldone(SB), $0
+TEXT spldone(SB), $0
 	RETURN
 	RETURN
 
 
-TEXT	islo(SB), $0
+TEXT islo(SB), $0
 	MOVW	MSR, R3
 	MOVW	MSR, R3
 	RLWNM	$0, R3, $MSR_EE, R3
 	RLWNM	$0, R3, $MSR_EE, R3
 	RETURN
 	RETURN
 
 
-TEXT	setlabel(SB), $-4
+TEXT setlabel(SB), $-4
 	MOVW	LR, R31
 	MOVW	LR, R31
 	MOVW	R1, 0(R3)
 	MOVW	R1, 0(R3)
 	MOVW	R31, 4(R3)
 	MOVW	R31, 4(R3)
 	MOVW	$0, R3
 	MOVW	$0, R3
 	RETURN
 	RETURN
 
 
-TEXT	gotolabel(SB), $-4
+TEXT gotolabel(SB), $-4
 	MOVW	4(R3), R31
 	MOVW	4(R3), R31
 	MOVW	R31, LR
 	MOVW	R31, LR
 	MOVW	0(R3), R1
 	MOVW	0(R3), R1
 	MOVW	$1, R3
 	MOVW	$1, R3
 	RETURN
 	RETURN
 
 
-TEXT	touser(SB), $-4
+TEXT touser(SB), $-4
 	MOVW	$(UTZERO+32), R5	/* header appears in text */
 	MOVW	$(UTZERO+32), R5	/* header appears in text */
 	MOVW	$(MSR_EE|MSR_PR|MSR_IR|MSR_DR|MSR_RI), R4
 	MOVW	$(MSR_EE|MSR_PR|MSR_IR|MSR_DR|MSR_RI), R4
 	MOVW	R4, SPR(SRR1)
 	MOVW	R4, SPR(SRR1)
@@ -293,95 +293,95 @@ TEXT	touser(SB), $-4
 	MOVW	R5, SPR(SRR0)
 	MOVW	R5, SPR(SRR0)
 	RFI
 	RFI
 
 
-TEXT	dczap(SB), $-4	/* dczap(virtaddr, count) */
+TEXT dczap(SB), $-4			/* dczap(virtaddr, count) */
 	MOVW	n+4(FP), R4
 	MOVW	n+4(FP), R4
 	RLWNM	$0, R3, $~(CACHELINESZ-1), R5
 	RLWNM	$0, R3, $~(CACHELINESZ-1), R5
-	CMP		R4, $0
-	BLE		dcz1
-	SUB		R5, R3
-	ADD		R3, R4
-	ADD		$(CACHELINESZ-1), R4
+	CMP	R4, $0
+	BLE	dcz1
+	SUB	R5, R3
+	ADD	R3, R4
+	ADD	$(CACHELINESZ-1), R4
 	SRAW	$CACHELINELOG, R4
 	SRAW	$CACHELINELOG, R4
 	MOVW	R4, CTR
 	MOVW	R4, CTR
 dcz0:
 dcz0:
 	DCBI	(R5)
 	DCBI	(R5)
-	ADD		$CACHELINESZ, R5
+	ADD	$CACHELINESZ, R5
 	BDNZ	dcz0
 	BDNZ	dcz0
 dcz1:
 dcz1:
 	SYNC
 	SYNC
 	RETURN
 	RETURN
 
 
-TEXT	dcflush(SB), $-4	/* dcflush(virtaddr, count) */
+TEXT dcflush(SB), $-4			/* dcflush(virtaddr, count) */
 	MOVW	n+4(FP), R4
 	MOVW	n+4(FP), R4
 	RLWNM	$0, R3, $~(CACHELINESZ-1), R5
 	RLWNM	$0, R3, $~(CACHELINESZ-1), R5
-	CMP		R4, $0
-	BLE		dcf1
-	SUB		R5, R3
-	ADD		R3, R4
-	ADD		$(CACHELINESZ-1), R4
+	CMP	R4, $0
+	BLE	dcf1
+	SUB	R5, R3
+	ADD	R3, R4
+	ADD	$(CACHELINESZ-1), R4
 	SRAW	$CACHELINELOG, R4
 	SRAW	$CACHELINELOG, R4
 	MOVW	R4, CTR
 	MOVW	R4, CTR
 dcf0:	DCBST	(R5)
 dcf0:	DCBST	(R5)
-	ADD		$CACHELINESZ, R5
+	ADD	$CACHELINESZ, R5
 	BDNZ	dcf0
 	BDNZ	dcf0
 dcf1:
 dcf1:
 	SYNC
 	SYNC
 	RETURN
 	RETURN
 
 
-TEXT	icflush(SB), $-4	/* icflush(virtaddr, count) */
+TEXT icflush(SB), $-4			/* icflush(virtaddr, count) */
 	MOVW	n+4(FP), R4
 	MOVW	n+4(FP), R4
 	RLWNM	$0, R3, $~(CACHELINESZ-1), R5
 	RLWNM	$0, R3, $~(CACHELINESZ-1), R5
-	CMP		R4, $0
-	BLE		icf1
-	SUB		R5, R3
-	ADD		R3, R4
-	ADD		$(CACHELINESZ-1), R4
+	CMP	R4, $0
+	BLE	icf1
+	SUB	R5, R3
+	ADD	R3, R4
+	ADD	$(CACHELINESZ-1), R4
 	SRAW	$CACHELINELOG, R4
 	SRAW	$CACHELINELOG, R4
 	MOVW	R4, CTR
 	MOVW	R4, CTR
-icf0:	ICBI		(R5)		/* invalidate the instruction cache */
-	ADD		$CACHELINESZ, R5
+icf0:	ICBI	(R5)			/* invalidate the instruction cache */
+	ADD	$CACHELINESZ, R5
 	BDNZ	icf0
 	BDNZ	icf0
 	ISYNC
 	ISYNC
 icf1:
 icf1:
 	RETURN
 	RETURN
 
 
-TEXT	tas(SB), $0
+TEXT tas(SB), $0
 	MOVW	R3, R4
 	MOVW	R3, R4
-	MOVW	$0xdead,R5
+	MOVW	$0xdead, R5
 tas1:
 tas1:
-	DCBF	(R4)	/* fix for 603x bug */
+	DCBF	(R4)			/* fix for 603x bug */
 	SYNC
 	SYNC
 	LWAR	(R4), R3
 	LWAR	(R4), R3
-	CMP		R3, $0
-	BNE		tas0
+	CMP	R3, $0
+	BNE	tas0
 	STWCCC	R5, (R4)
 	STWCCC	R5, (R4)
-	BNE		tas1
+	BNE	tas1
 	EIEIO
 	EIEIO
 tas0:
 tas0:
 	SYNC
 	SYNC
 	RETURN
 	RETURN
 
 
-TEXT	_xinc(SB),$0	/* void _xinc(long *); */
+TEXT _xinc(SB), $0			/* void _xinc(long *); */
 	MOVW	R3, R4
 	MOVW	R3, R4
 xincloop:
 xincloop:
-	DCBF	(R4)	/* fix for 603x bug */
+	DCBF	(R4)			/* fix for 603x bug */
 	LWAR	(R4), R3
 	LWAR	(R4), R3
-	ADD		$1, R3
+	ADD	$1, R3
 	STWCCC	R3, (R4)
 	STWCCC	R3, (R4)
-	BNE		xincloop
+	BNE	xincloop
 	RETURN
 	RETURN
 
 
-TEXT	_xdec(SB),$0	/* long _xdec(long *); */
+TEXT _xdec(SB), $0			/* long _xdec(long *); */
 	MOVW	R3, R4
 	MOVW	R3, R4
 xdecloop:
 xdecloop:
-	DCBF	(R4)	/* fix for 603x bug */
+	DCBF	(R4)			/* fix for 603x bug */
 	LWAR	(R4), R3
 	LWAR	(R4), R3
-	ADD		$-1, R3
+	ADD	$-1, R3
 	STWCCC	R3, (R4)
 	STWCCC	R3, (R4)
-	BNE		xdecloop
+	BNE	xdecloop
 	RETURN
 	RETURN
 
 
-TEXT	tlbflushall(SB), $0
+TEXT tlbflushall(SB), $0
 	MOVW	$TLBENTRIES, R3
 	MOVW	$TLBENTRIES, R3
 	MOVW	R3, CTR
 	MOVW	R3, CTR
 	MOVW	$0, R4
 	MOVW	$0, R4
@@ -389,66 +389,66 @@ TEXT	tlbflushall(SB), $0
 tlbflushall0:
 tlbflushall0:
 	TLBIE	R4
 	TLBIE	R4
 	SYNC
 	SYNC
-	ADD		$BIT(19), R4
+	ADD	$BIT(19), R4
 	BDNZ	tlbflushall0
 	BDNZ	tlbflushall0
 	TLBSYNC
 	TLBSYNC
 	RETURN
 	RETURN
 
 
-TEXT	tlbflush(SB), $0
+TEXT tlbflush(SB), $0
 	ISYNC
 	ISYNC
 	TLBIE	R3
 	TLBIE	R3
 	SYNC
 	SYNC
 	TLBSYNC
 	TLBSYNC
 	RETURN
 	RETURN
 
 
-TEXT	gotopc(SB), $0
+TEXT gotopc(SB), $0
 	MOVW	R3, CTR
 	MOVW	R3, CTR
-	MOVW	LR, R31	/* for trace back */
-	BR		(CTR)
+	MOVW	LR, R31			/* for trace back */
+	BR	(CTR)
 
 
 /* On an imiss, we get here.  If we can resolve it, we do.
 /* On an imiss, we get here.  If we can resolve it, we do.
  * Otherwise take the real trap.  The code at the vector is
  * Otherwise take the real trap.  The code at the vector is
  *	MOVW	R0, SPR(SAVER0)	No point to this, of course
  *	MOVW	R0, SPR(SAVER0)	No point to this, of course
  *	MOVW	LR, R0
  *	MOVW	LR, R0
- *	MOVW	R0, SPR(SAVELR) 
- *	BL		imiss(SB)			or dmiss, as the case may be
- *	BL		tlbvec(SB)
+ *	MOVW	R0, SPR(SAVELR)
+ *	BL	imiss(SB)		or dmiss, as the case may be
+ *	BL	tlbvec(SB)
  */
  */
-TEXT	imiss(SB), $-4
+TEXT imiss(SB), $-4
 	/* Statistics */
 	/* Statistics */
 	MOVW	$MACHPADDR, R1
 	MOVW	$MACHPADDR, R1
 	MOVW	0xc(R1), R3		/* count m->tlbfault */
 	MOVW	0xc(R1), R3		/* count m->tlbfault */
-	ADD		$1, R3
+	ADD	$1, R3
 	MOVW	R3, 0xc(R1)
 	MOVW	R3, 0xc(R1)
 	MOVW	0x10(R1), R3		/* count m->imiss */
 	MOVW	0x10(R1), R3		/* count m->imiss */
-	ADD		$1, R3
+	ADD	$1, R3
 	MOVW	R3, 0x10(R1)
 	MOVW	R3, 0x10(R1)
 
 
 	/* Real work */
 	/* Real work */
-	MOVW	SPR(HASH1), R1	/* (phys) pointer into the hash table */
-	ADD		$BY2PTEG, R1, R2	/* end pointer */
+	MOVW	SPR(HASH1), R1		/* (phys) pointer into the hash table */
+	ADD	$BY2PTEG, R1, R2	/* end pointer */
 	MOVW	SPR(iCMP), R3		/* pattern to look for */
 	MOVW	SPR(iCMP), R3		/* pattern to look for */
 imiss1:
 imiss1:
 	MOVW	(R1), R0
 	MOVW	(R1), R0
-	CMP		R3, R0
-	BEQ		imiss2			/* found the entry */
-	ADD		$8, R1
-	CMP		R1, R2			/* test end of loop */
-	BNE		imiss1			/* Loop */
+	CMP	R3, R0
+	BEQ	imiss2			/* found the entry */
+	ADD	$8, R1
+	CMP	R1, R2			/* test end of loop */
+	BNE	imiss1			/* Loop */
 	/* Failed to find an entry; take the full trap */
 	/* Failed to find an entry; take the full trap */
 	MOVW	SPR(SRR1), R1
 	MOVW	SPR(SRR1), R1
-	MTCRF(1,0x80)			/* restore CR0 bits (they're auto saved in SRR1) */
+	MTCRF(1, 0x80)			/* restore CR0 bits (they're auto saved in SRR1) */
 	RETURN
 	RETURN
 imiss2:
 imiss2:
 	/* Found the entry */
 	/* Found the entry */
-	MOVW	4(R1), R2			/* Phys addr */
+	MOVW	4(R1), R2		/* Phys addr */
 	MOVW	R2, SPR(RPA)
 	MOVW	R2, SPR(RPA)
-	MOVW	SPR(IMISS),R3
+	MOVW	SPR(IMISS), R3
 	TLBLI(3)
 	TLBLI(3)
 
 
 	/* Restore Registers */
 	/* Restore Registers */
 	MOVW	SPR(SRR1), R1		/* Restore the CR0 field of the CR register from SRR1 */
 	MOVW	SPR(SRR1), R1		/* Restore the CR0 field of the CR register from SRR1 */
-	MTCRF(1,0x80)
+	MTCRF(1, 0x80)
 	MOVW	SPR(SAVELR), R0
 	MOVW	SPR(SAVELR), R0
 	MOVW	R0, LR
 	MOVW	R0, LR
 	RFI
 	RFI
@@ -456,39 +456,39 @@ imiss2:
 /* On a data load or store miss, we get here.  If we can resolve it, we do.
 /* On a data load or store miss, we get here.  If we can resolve it, we do.
  * Otherwise take the real trap
  * Otherwise take the real trap
  */
  */
-TEXT	dmiss(SB), $-4
+TEXT dmiss(SB), $-4
 	/* Statistics */
 	/* Statistics */
 	MOVW	$MACHPADDR, R1
 	MOVW	$MACHPADDR, R1
 	MOVW	0xc(R1), R3		/* count m->tlbfault */
 	MOVW	0xc(R1), R3		/* count m->tlbfault */
-	ADD		$1, R3
+	ADD	$1, R3
 	MOVW	R3, 0xc(R1)
 	MOVW	R3, 0xc(R1)
 	MOVW	0x14(R1), R3		/* count m->dmiss */
 	MOVW	0x14(R1), R3		/* count m->dmiss */
-	ADD		$1, R3
+	ADD	$1, R3
 	MOVW	R3, 0x14(R1)
 	MOVW	R3, 0x14(R1)
 	/* Real work */
 	/* Real work */
-	MOVW	SPR(HASH1), R1	/* (phys) pointer into the hash table */
-	ADD		$BY2PTEG, R1, R2	/* end pointer */
+	MOVW	SPR(HASH1), R1		/* (phys) pointer into the hash table */
+	ADD	$BY2PTEG, R1, R2	/* end pointer */
 	MOVW	SPR(DCMP), R3		/* pattern to look for */
 	MOVW	SPR(DCMP), R3		/* pattern to look for */
 dmiss1:
 dmiss1:
 	MOVW	(R1), R0
 	MOVW	(R1), R0
-	CMP		R3, R0
-	BEQ		dmiss2			/* found the entry */
-	ADD		$8, R1
-	CMP		R1, R2			/* test end of loop */
-	BNE		dmiss1			/* Loop */
+	CMP	R3, R0
+	BEQ	dmiss2			/* found the entry */
+	ADD	$8, R1
+	CMP	R1, R2			/* test end of loop */
+	BNE	dmiss1			/* Loop */
 	/* Failed to find an entry; take the full trap */
 	/* Failed to find an entry; take the full trap */
 	MOVW	SPR(SRR1), R1
 	MOVW	SPR(SRR1), R1
-	MTCRF(1,0x80)			/* restore CR0 bits (they're auto saved in SRR1) */
+	MTCRF(1, 0x80)			/* restore CR0 bits (they're auto saved in SRR1) */
 	RETURN
 	RETURN
 dmiss2:
 dmiss2:
 	/* Found the entry */
 	/* Found the entry */
-	MOVW	4(R1), R2			/* Phys addr */
+	MOVW	4(R1), R2		/* Phys addr */
 	MOVW	R2, SPR(RPA)
 	MOVW	R2, SPR(RPA)
-	MOVW	SPR(DMISS),R3
+	MOVW	SPR(DMISS), R3
 	TLBLD(3)
 	TLBLD(3)
 	/* Restore Registers */
 	/* Restore Registers */
 	MOVW	SPR(SRR1), R1		/* Restore the CR0 field of the CR register from SRR1 */
 	MOVW	SPR(SRR1), R1		/* Restore the CR0 field of the CR register from SRR1 */
-	MTCRF(1,0x80)
+	MTCRF(1, 0x80)
 	MOVW	SPR(SAVELR), R0
 	MOVW	SPR(SAVELR), R0
 	MOVW	R0, LR
 	MOVW	R0, LR
 	RFI
 	RFI
@@ -502,8 +502,8 @@ dmiss2:
  * coming to tlbvec:
  * coming to tlbvec:
  *	MOVW	R0, SPR(SAVER0)	No point to this, of course
  *	MOVW	R0, SPR(SAVER0)	No point to this, of course
  *	MOVW	LR, R0
  *	MOVW	LR, R0
- *	MOVW	R0, SPR(SAVELR) 
- *	BL		tlbvec(SB)
+ *	MOVW	R0, SPR(SAVELR)
+ *	BL	tlbvec(SB)
  * SAVER0 can be reused.  We're not interested in the value of TR0
  * SAVER0 can be reused.  We're not interested in the value of TR0
  */
  */
 TEXT tlbvec(SB), $-4
 TEXT tlbvec(SB), $-4
@@ -520,45 +520,45 @@ TEXT tlbvec(SB), $-4
  * traps force memory mapping off.
  * traps force memory mapping off.
  * the following code has been executed at the exception
  * the following code has been executed at the exception
  * vector location
  * vector location
- *	MOVW R0, SPR(SAVER0)
- *	MOVW LR, R0
- *	MOVW R0, SPR(SAVELR) 
+ *	MOVW	R0, SPR(SAVER0)
+ *	MOVW	LR, R0
+ *	MOVW	R0, SPR(SAVELR)
  *	bl	trapvec(SB)
  *	bl	trapvec(SB)
  *
  *
  */
  */
-TEXT	trapvec(SB), $-4
+TEXT trapvec(SB), $-4
 	MOVW	LR, R0
 	MOVW	LR, R0
 	MOVW	R1, SPR(SAVER1)
 	MOVW	R1, SPR(SAVER1)
-	MOVW	R0, SPR(SAVEXX)	/* vector */
+	MOVW	R0, SPR(SAVEXX)		/* vector */
 
 
 	/* did we come from user space */
 	/* did we come from user space */
 	MOVW	SPR(SRR1), R0
 	MOVW	SPR(SRR1), R0
 	MOVW	CR, R1
 	MOVW	CR, R1
 	MOVW	R0, CR
 	MOVW	R0, CR
-	BC		4,17,ktrap
+	BC	4, 17, ktrap
 
 
 	/* switch to kernel stack */
 	/* switch to kernel stack */
 	MOVW	R1, CR
 	MOVW	R1, CR
 	MOVW	$MACHPADDR, R1		/* PADDR(m->) */
 	MOVW	$MACHPADDR, R1		/* PADDR(m->) */
-	MOVW	8(R1), R1				/* m->proc  */
-	RLWNM	$0, R1, $~KZERO, R1		/* PADDR(m->proc) */
-	MOVW	8(R1), R1				/* m->proc->kstack */
-	RLWNM	$0, R1, $~KZERO, R1		/* PADDR(m->proc->kstack) */
-	ADD		$(KSTACK-UREGSIZE), R1	/* make room on stack */
-
-	BL		saveureg(SB)
-	BL		trap(SB)
-	BR		restoreureg
+	MOVW	8(R1), R1		/* m->proc */
+	RLWNM	$0, R1, $~KZERO, R1	/* PADDR(m->proc) */
+	MOVW	8(R1), R1		/* m->proc->kstack */
+	RLWNM	$0, R1, $~KZERO, R1	/* PADDR(m->proc->kstack) */
+	ADD	$(KSTACK-UREGSIZE), R1	/* make room on stack */
+
+	BL	saveureg(SB)
+	BL	trap(SB)
+	BR	restoreureg
 
 
 ktrap:
 ktrap:
 	MOVW	R1, CR
 	MOVW	R1, CR
 	MOVW	SPR(SAVER1), R1
 	MOVW	SPR(SAVER1), R1
-	RLWNM	$0, R1, $~KZERO, R1		/* set stack pointer */
-	SUB		$UREGSPACE, R1
+	RLWNM	$0, R1, $~KZERO, R1	/* set stack pointer */
+	SUB	$UREGSPACE, R1
 
 
-	BL		saveureg(SB)			/* addressed relative to PC */
-	BL		trap(SB)
-	BR		restoreureg
+	BL	saveureg(SB)		/* addressed relative to PC */
+	BL	trap(SB)
+	BR	restoreureg
 
 
 /*
 /*
  * enter with stack set and mapped.
  * enter with stack set and mapped.
@@ -567,14 +567,14 @@ ktrap:
  * R(MACH) has been set, and R0 contains 0.
  * R(MACH) has been set, and R0 contains 0.
  *
  *
  */
  */
-TEXT	saveureg(SB), $-4
+TEXT saveureg(SB), $-4
 /*
 /*
  * save state
  * save state
  */
  */
-	MOVMW	R2, 48(R1)				/* save r2 .. r31 in 48(R1) .. 164(R1) */
-	MOVW	$MACHPADDR, R(MACH)		/* PADDR(m->) */
-	MOVW	8(R(MACH)), R(USER)		/* up-> */
-	MOVW	$MACHADDR, R(MACH)		/* m-> */
+	MOVMW	R2, 48(R1)		/* save r2 .. r31 in 48(R1) .. 164(R1) */
+	MOVW	$MACHPADDR, R(MACH)	/* PADDR(m->) */
+	MOVW	8(R(MACH)), R(USER)	/* up-> */
+	MOVW	$MACHADDR, R(MACH)	/* m-> */
 	MOVW	SPR(SAVER1), R4
 	MOVW	SPR(SAVER1), R4
 	MOVW	R4, 44(R1)
 	MOVW	R4, 44(R1)
 	MOVW	SPR(SAVER0), R5
 	MOVW	SPR(SAVER0), R5
@@ -585,15 +585,15 @@ TEXT	saveureg(SB), $-4
 	MOVW	R4, 32(R1)
 	MOVW	R4, 32(R1)
 	MOVW	CR, R5
 	MOVW	CR, R5
 	MOVW	R5, 28(R1)
 	MOVW	R5, 28(R1)
-	MOVW	SPR(SAVELR), R6			/* LR */
+	MOVW	SPR(SAVELR), R6		/* LR */
 	MOVW	R6, 24(R1)
 	MOVW	R6, 24(R1)
 	/* pad at 20(R1) */
 	/* pad at 20(R1) */
 	MOVW	SPR(SRR0), R0
 	MOVW	SPR(SRR0), R0
-	MOVW	R0, 16(R1)				/* old PC */
+	MOVW	R0, 16(R1)		/* old PC */
 	MOVW	SPR(SRR1), R0
 	MOVW	SPR(SRR1), R0
-	MOVW	R0, 12(R1)				/* old status */
+	MOVW	R0, 12(R1)		/* old status */
 	MOVW	SPR(SAVEXX), R0
 	MOVW	SPR(SAVEXX), R0
-	MOVW	R0, 8(R1)					/* cause/vector */
+	MOVW	R0, 8(R1)		/* cause/vector */
 	MOVW	SPR(DCMP), R0
 	MOVW	SPR(DCMP), R0
 	MOVW	R0, (160+8)(R1)
 	MOVW	R0, (160+8)(R1)
 	MOVW	SPR(iCMP), R0
 	MOVW	SPR(iCMP), R0
@@ -610,177 +610,177 @@ TEXT	saveureg(SB), $-4
 	MOVW	R0, (184+8)(R1)
 	MOVW	R0, (184+8)(R1)
 	MOVW	SPR(DSISR), R0
 	MOVW	SPR(DSISR), R0
 	MOVW	R0, (188+8)(R1)
 	MOVW	R0, (188+8)(R1)
-	ADD		$8, R1, R3					/* Ureg* */
-	OR		$KZERO, R3				/* fix ureg */
-	STWCCC	R3, (R1)					/* break any pending reservations */
-	MOVW	$0, R0					/* compiler/linker expect R0 to be zero */
-	MOVW	$setSB(SB), R2				/* SB register */
+	ADD	$8, R1, R3		/* Ureg* */
+	OR	$KZERO, R3		/* fix ureg */
+	STWCCC	R3, (R1)		/* break any pending reservations */
+	MOVW	$0, R0			/* compiler/linker expect R0 to be zero */
+	MOVW	$setSB(SB), R2		/* SB register */
 
 
 	MOVW	MSR, R5
 	MOVW	MSR, R5
-	OR		$(MSR_IR|MSR_DR|MSR_FP|MSR_RI), R5	/* enable MMU */
+	OR	$(MSR_IR|MSR_DR|MSR_FP|MSR_RI), R5	/* enable MMU */
 	MOVW	R5, SPR(SRR1)
 	MOVW	R5, SPR(SRR1)
 	MOVW	LR, R31
 	MOVW	LR, R31
-	OR		$KZERO, R31				/* return PC in KSEG0 */
+	OR	$KZERO, R31		/* return PC in KSEG0 */
 	MOVW	R31, SPR(SRR0)
 	MOVW	R31, SPR(SRR0)
-	OR		$KZERO, R1				/* fix stack pointer */
-	RFI								/* returns to trap handler */
+	OR	$KZERO, R1		/* fix stack pointer */
+	RFI				/* returns to trap handler */
 
 
 /*
 /*
  * restore state from Ureg and return from trap/interrupt
  * restore state from Ureg and return from trap/interrupt
  */
  */
-TEXT	forkret(SB), $0
+TEXT forkret(SB), $0
 	BR	restoreureg
 	BR	restoreureg
 
 
 restoreureg:
 restoreureg:
-	MOVMW	48(R1), R2				/* restore r2 through r31 */
+	MOVMW	48(R1), R2		/* restore r2 through r31 */
 	/* defer R1 */
 	/* defer R1 */
 	MOVW	40(R1), R0
 	MOVW	40(R1), R0
-	MOVW	R0, SPR(SAVER0)			/* resave saved R0 */
+	MOVW	R0, SPR(SAVER0)		/* resave saved R0 */
 	MOVW	36(R1), R0
 	MOVW	36(R1), R0
 	MOVW	R0, CTR
 	MOVW	R0, CTR
 	MOVW	32(R1), R0
 	MOVW	32(R1), R0
 	MOVW	R0, XER
 	MOVW	R0, XER
 	MOVW	28(R1), R0
 	MOVW	28(R1), R0
-	MOVW	R0, CR					/* Condition register*/
+	MOVW	R0, CR			/* Condition register*/
 	MOVW	24(R1), R0
 	MOVW	24(R1), R0
 	MOVW	R0, LR
 	MOVW	R0, LR
 	/* pad, skip */
 	/* pad, skip */
 	MOVW	16(R1), R0
 	MOVW	16(R1), R0
-	MOVW	R0, SPR(SRR0)				/* old PC */
+	MOVW	R0, SPR(SRR0)		/* old PC */
 	MOVW	12(R1), R0
 	MOVW	12(R1), R0
-	MOVW	R0, SPR(SRR1)				/* old MSR */
+	MOVW	R0, SPR(SRR1)		/* old MSR */
 	/* cause, skip */
 	/* cause, skip */
-	MOVW	44(R1), R1				/* old SP */
+	MOVW	44(R1), R1		/* old SP */
 	MOVW	SPR(SAVER0), R0
 	MOVW	SPR(SAVER0), R0
 	RFI
 	RFI
 
 
-TEXT	getpvr(SB), $0
+TEXT getpvr(SB), $0
 	MOVW	SPR(PVR), R3
 	MOVW	SPR(PVR), R3
 	RETURN
 	RETURN
 
 
-TEXT	getdec(SB), $0
+TEXT getdec(SB), $0
 	MOVW	SPR(DEC), R3
 	MOVW	SPR(DEC), R3
 	RETURN
 	RETURN
 
 
-TEXT	putdec(SB), $0
+TEXT putdec(SB), $0
 	MOVW	R3, SPR(DEC)
 	MOVW	R3, SPR(DEC)
 	RETURN
 	RETURN
 
 
-TEXT	getdar(SB), $0
+TEXT getdar(SB), $0
 	MOVW	SPR(DAR), R3
 	MOVW	SPR(DAR), R3
 	RETURN
 	RETURN
 
 
-TEXT	getdsisr(SB), $0
+TEXT getdsisr(SB), $0
 	MOVW	SPR(DSISR), R3
 	MOVW	SPR(DSISR), R3
 	RETURN
 	RETURN
 
 
-TEXT	getmsr(SB), $0
+TEXT getmsr(SB), $0
 	MOVW	MSR, R3
 	MOVW	MSR, R3
 	RETURN
 	RETURN
 
 
-TEXT	putmsr(SB), $0
+TEXT putmsr(SB), $0
 	MOVW	R3, MSR
 	MOVW	R3, MSR
 	MSRSYNC
 	MSRSYNC
 	RETURN
 	RETURN
 
 
-TEXT	putsdr1(SB), $0
+TEXT putsdr1(SB), $0
 	SYNC
 	SYNC
 	MOVW	R3, SPR(SDR1)
 	MOVW	R3, SPR(SDR1)
 	ISYNC
 	ISYNC
 	RETURN
 	RETURN
 
 
-TEXT	putsr(SB), $0
+TEXT putsr(SB), $0
 	MOVW	4(FP), R4
 	MOVW	4(FP), R4
 	SYNC
 	SYNC
 	MOVW	R4, SEG(R3)
 	MOVW	R4, SEG(R3)
 	MSRSYNC
 	MSRSYNC
 	RETURN
 	RETURN
 
 
-TEXT	getsr(SB), $0
+TEXT getsr(SB), $0
 	MOVW	SEG(R3), R3
 	MOVW	SEG(R3), R3
 	RETURN
 	RETURN
 
 
-TEXT	gethid0(SB), $0
+TEXT gethid0(SB), $0
 	MOVW	SPR(HID0), R3
 	MOVW	SPR(HID0), R3
 	RETURN
 	RETURN
 
 
-TEXT	puthid0(SB), $0
+TEXT puthid0(SB), $0
 	SYNC
 	SYNC
 	ISYNC
 	ISYNC
 	MOVW	R3, SPR(HID0)
 	MOVW	R3, SPR(HID0)
 	SYNC
 	SYNC
 	RETURN
 	RETURN
 
 
-TEXT	gethid1(SB), $0
+TEXT gethid1(SB), $0
 	MOVW	SPR(HID1), R3
 	MOVW	SPR(HID1), R3
 	RETURN
 	RETURN
 
 
-TEXT	gethid2(SB), $0
+TEXT gethid2(SB), $0
 	MOVW	SPR(HID2), R3
 	MOVW	SPR(HID2), R3
 	RETURN
 	RETURN
 
 
-TEXT	puthid2(SB), $0
+TEXT puthid2(SB), $0
 	MOVW	R3, SPR(HID2)
 	MOVW	R3, SPR(HID2)
 	RETURN
 	RETURN
 
 
-TEXT	eieio(SB), $0
+TEXT eieio(SB), $0
 	EIEIO
 	EIEIO
 	RETURN
 	RETURN
 
 
-TEXT	sync(SB), $0
+TEXT sync(SB), $0
 	SYNC
 	SYNC
 	RETURN
 	RETURN
 
 
 /* Power PC 603e specials */
 /* Power PC 603e specials */
-TEXT	getimiss(SB), $0
+TEXT getimiss(SB), $0
 	MOVW	SPR(IMISS), R3
 	MOVW	SPR(IMISS), R3
 	RETURN
 	RETURN
 
 
-TEXT	geticmp(SB), $0
+TEXT geticmp(SB), $0
 	MOVW	SPR(iCMP), R3
 	MOVW	SPR(iCMP), R3
 	RETURN
 	RETURN
 
 
-TEXT	puticmp(SB), $0
+TEXT puticmp(SB), $0
 	MOVW	R3, SPR(iCMP)
 	MOVW	R3, SPR(iCMP)
 	RETURN
 	RETURN
 
 
-TEXT	getdmiss(SB), $0
+TEXT getdmiss(SB), $0
 	MOVW	SPR(DMISS), R3
 	MOVW	SPR(DMISS), R3
 	RETURN
 	RETURN
 
 
-TEXT	getdcmp(SB), $0
+TEXT getdcmp(SB), $0
 	MOVW	SPR(DCMP), R3
 	MOVW	SPR(DCMP), R3
 	RETURN
 	RETURN
 
 
-TEXT	putdcmp(SB), $0
+TEXT putdcmp(SB), $0
 	MOVW	R3, SPR(DCMP)
 	MOVW	R3, SPR(DCMP)
 	RETURN
 	RETURN
 
 
-TEXT	getsdr1(SB), $0
+TEXT getsdr1(SB), $0
 	MOVW	SPR(SDR1), R3
 	MOVW	SPR(SDR1), R3
 	RETURN
 	RETURN
 
 
-TEXT	gethash1(SB), $0
+TEXT gethash1(SB), $0
 	MOVW	SPR(HASH1), R3
 	MOVW	SPR(HASH1), R3
 	RETURN
 	RETURN
 
 
-TEXT	puthash1(SB), $0
+TEXT puthash1(SB), $0
 	MOVW	R3, SPR(HASH1)
 	MOVW	R3, SPR(HASH1)
 	RETURN
 	RETURN
 
 
-TEXT	gethash2(SB), $0
+TEXT gethash2(SB), $0
 	MOVW	SPR(HASH2), R3
 	MOVW	SPR(HASH2), R3
 	RETURN
 	RETURN
 
 
-TEXT	puthash2(SB), $0
+TEXT puthash2(SB), $0
 	MOVW	R3, SPR(HASH2)
 	MOVW	R3, SPR(HASH2)
 	RETURN
 	RETURN
 
 
-TEXT	getrpa(SB), $0
+TEXT getrpa(SB), $0
 	MOVW	SPR(RPA), R3
 	MOVW	SPR(RPA), R3
 	RETURN
 	RETURN
 
 
-TEXT	putrpa(SB), $0
+TEXT putrpa(SB), $0
 	MOVW	R3, SPR(RPA)
 	MOVW	R3, SPR(RPA)
 	RETURN
 	RETURN
 
 
@@ -795,15 +795,15 @@ TEXT tlbld(SB), $0
 	ISYNC
 	ISYNC
 	RETURN
 	RETURN
 
 
-TEXT	getsrr1(SB), $0
+TEXT getsrr1(SB), $0
 	MOVW	SPR(SRR1), R3
 	MOVW	SPR(SRR1), R3
 	RETURN
 	RETURN
 
 
-TEXT	putsrr1(SB), $0
+TEXT putsrr1(SB), $0
 	MOVW	R3, SPR(SRR1)
 	MOVW	R3, SPR(SRR1)
 	RETURN
 	RETURN
 
 
-TEXT	fpsave(SB), $0
+TEXT fpsave(SB), $0
 	FMOVD	F0, (0*8)(R3)
 	FMOVD	F0, (0*8)(R3)
 	FMOVD	F1, (1*8)(R3)
 	FMOVD	F1, (1*8)(R3)
 	FMOVD	F2, (2*8)(R3)
 	FMOVD	F2, (2*8)(R3)
@@ -840,7 +840,7 @@ TEXT	fpsave(SB), $0
 	FMOVD	F0, (32*8)(R3)
 	FMOVD	F0, (32*8)(R3)
 	RETURN
 	RETURN
 
 
-TEXT	fprestore(SB), $0
+TEXT fprestore(SB), $0
 	FMOVD	(32*8)(R3), F0
 	FMOVD	(32*8)(R3), F0
 	MOVFL	F0, FPSCR
 	MOVFL	F0, FPSCR
 	FMOVD	(0*8)(R3), F0
 	FMOVD	(0*8)(R3), F0
@@ -877,162 +877,161 @@ TEXT	fprestore(SB), $0
 	FMOVD	(31*8)(R3), F31
 	FMOVD	(31*8)(R3), F31
 	RETURN
 	RETURN
 
 
-TEXT	dcacheenb(SB), $0
+TEXT dcacheenb(SB), $0
 	SYNC
 	SYNC
-	MOVW	SPR(HID0), R4			/* Get HID0 and clear unwanted bits */
+	MOVW	SPR(HID0), R4		/* Get HID0 and clear unwanted bits */
 	RLWNM	$0, R4, $~(HID_DLOCK), R4
 	RLWNM	$0, R4, $~(HID_DLOCK), R4
 	MOVW	$(HID_DCFI|HID_DCE), R5
 	MOVW	$(HID_DCFI|HID_DCE), R5
-	OR		R4, R5
+	OR	R4, R5
 	MOVW	$HID_DCE, R3
 	MOVW	$HID_DCE, R3
-	OR		R4, R3
+	OR	R4, R3
 	SYNC
 	SYNC
-//	MOVW	R5, SPR(HID0)			/* Cache enable and flash invalidate */
-	MOVW	R3, SPR(HID0)			/* Cache enable */
+//	MOVW	R5, SPR(HID0)		/* Cache enable and flash invalidate */
+	MOVW	R3, SPR(HID0)		/* Cache enable */
 	SYNC
 	SYNC
 	RETURN
 	RETURN
 
 
-TEXT	icacheenb(SB), $0
+TEXT icacheenb(SB), $0
 	SYNC
 	SYNC
-	MOVW	SPR(HID0), R4			/* Get HID0 and clear unwanted bits */
+	MOVW	SPR(HID0), R4		/* Get HID0 and clear unwanted bits */
 	RLWNM	$0, R4, $~(HID_ILOCK), R4
 	RLWNM	$0, R4, $~(HID_ILOCK), R4
 	MOVW	$(HID_ICFI|HID_ICE), R5
 	MOVW	$(HID_ICFI|HID_ICE), R5
-	OR		R4, R5
+	OR	R4, R5
 	MOVW	$HID_ICE, R3
 	MOVW	$HID_ICE, R3
-	OR		R4, R3
+	OR	R4, R3
 	SYNC
 	SYNC
-	MOVW	R5, SPR(HID0)			/* Cache enable and flash invalidate */
-	MOVW	R3, SPR(HID0)			/* Cache enable */
+	MOVW	R5, SPR(HID0)		/* Cache enable and flash invalidate */
+	MOVW	R3, SPR(HID0)		/* Cache enable */
 	SYNC
 	SYNC
 	RETURN
 	RETURN
 
 
 #ifdef ucuconf
 #ifdef ucuconf
-TEXT getpll(SB),$0
-	MOVW	SPR(1009),R3
+TEXT getpll(SB), $0
+	MOVW	SPR(1009), R3
 	ISYNC
 	ISYNC
 	RETURN
 	RETURN
 
 
-TEXT getl2pm(SB),$0
-	MOVW	SPR(1016),R3
+TEXT getl2pm(SB), $0
+	MOVW	SPR(1016), R3
 	RETURN
 	RETURN
 
 
-TEXT getl2cr(SB),$0
-	MOVW	SPR(1017),R3
+TEXT getl2cr(SB), $0
+	MOVW	SPR(1017), R3
 	RETURN
 	RETURN
 
 
-TEXT putl2cr(SB),$0
-	MOVW	R3,SPR(1017)
+TEXT putl2cr(SB), $0
+	MOVW	R3, SPR(1017)
 	RETURN
 	RETURN
 
 
-TEXT	dcachedis(SB), $0
+TEXT dcachedis(SB), $0
 	SYNC
 	SYNC
-/*	MOVW	SPR(HID0), R4			
+/*	MOVW	SPR(HID0), R4
 	RLWNM	$0, R4, $~(HID_DCE), R4
 	RLWNM	$0, R4, $~(HID_DCE), R4
-	MOVW	R4, SPR(HID0)			/* L1 Cache disable */
+	MOVW	R4, SPR(HID0)		/* L1 Cache disable */
 
 
-	MOVW	SPR(1017), R4			
+	MOVW	SPR(1017), R4
 	RLWNM	$0, R4, $~(0x80000000), R4
 	RLWNM	$0, R4, $~(0x80000000), R4
-	MOVW	R4, SPR(1017)			/* L2 Cache disable */
-	
+	MOVW	R4, SPR(1017)		/* L2 Cache disable */
+
 	SYNC
 	SYNC
 	RETURN
 	RETURN
 
 
-TEXT	l2disable(SB), $0
+TEXT l2disable(SB), $0
 	SYNC
 	SYNC
-	MOVW	SPR(1017), R4			
+	MOVW	SPR(1017), R4
 	RLWNM	$0, R4, $~(0x80000000), R4
 	RLWNM	$0, R4, $~(0x80000000), R4
-	MOVW	R4, SPR(1017)			/* L2 Cache disable */
+	MOVW	R4, SPR(1017)		/* L2 Cache disable */
 	SYNC
 	SYNC
 	RETURN
 	RETURN
 
 
-TEXT getbats(SB),$0
-	MOVW	SPR(DBATU(0)),R4
-	MOVW	R4,0(R3)
-	MOVW	SPR(DBATL(0)),R4
-	MOVW	R4,4(R3)
-	MOVW	SPR(IBATU(0)),R4
-	MOVW	R4,8(R3)
-	MOVW	SPR(IBATL(0)),R4
-	MOVW	R4,12(R3)
-	MOVW	SPR(DBATU(1)),R4
-	MOVW	R4,16(R3)
-	MOVW	SPR(DBATL(1)),R4
-	MOVW	R4,20(R3)
-	MOVW	SPR(IBATU(1)),R4
-	MOVW	R4,24(R3)
-	MOVW	SPR(IBATL(1)),R4
-	MOVW	R4,28(R3)
-	MOVW	SPR(DBATU(2)),R4
-	MOVW	R4,32(R3)
-	MOVW	SPR(DBATL(2)),R4
-	MOVW	R4,36(R3)
-	MOVW	SPR(IBATU(2)),R4
-	MOVW	R4,40(R3)
-	MOVW	SPR(IBATL(2)),R4
-	MOVW	R4,44(R3)
-	MOVW	SPR(DBATU(3)),R4
-	MOVW	R4,48(R3)
-	MOVW	SPR(DBATL(3)),R4
-	MOVW	R4,52(R3)
-	MOVW	SPR(IBATU(3)),R4
-	MOVW	R4,56(R3)
-	MOVW	SPR(IBATL(3)),R4
-	MOVW	R4,60(R3)
-	RETURN
-
-TEXT setdbat0(SB),$0
-	MOVW	0(R3),R4
-	MOVW	R4,SPR(DBATU(0))
-	MOVW	4(R3),R4
-	MOVW	R4,SPR(DBATL(0))
+TEXT getbats(SB), $0
+	MOVW	SPR(DBATU(0)), R4
+	MOVW	R4, 0(R3)
+	MOVW	SPR(DBATL(0)), R4
+	MOVW	R4, 4(R3)
+	MOVW	SPR(IBATU(0)), R4
+	MOVW	R4, 8(R3)
+	MOVW	SPR(IBATL(0)), R4
+	MOVW	R4, 12(R3)
+	MOVW	SPR(DBATU(1)), R4
+	MOVW	R4, 16(R3)
+	MOVW	SPR(DBATL(1)), R4
+	MOVW	R4, 20(R3)
+	MOVW	SPR(IBATU(1)), R4
+	MOVW	R4, 24(R3)
+	MOVW	SPR(IBATL(1)), R4
+	MOVW	R4, 28(R3)
+	MOVW	SPR(DBATU(2)), R4
+	MOVW	R4, 32(R3)
+	MOVW	SPR(DBATL(2)), R4
+	MOVW	R4, 36(R3)
+	MOVW	SPR(IBATU(2)), R4
+	MOVW	R4, 40(R3)
+	MOVW	SPR(IBATL(2)), R4
+	MOVW	R4, 44(R3)
+	MOVW	SPR(DBATU(3)), R4
+	MOVW	R4, 48(R3)
+	MOVW	SPR(DBATL(3)), R4
+	MOVW	R4, 52(R3)
+	MOVW	SPR(IBATU(3)), R4
+	MOVW	R4, 56(R3)
+	MOVW	SPR(IBATL(3)), R4
+	MOVW	R4, 60(R3)
+	RETURN
+
+TEXT setdbat0(SB), $0
+	MOVW	0(R3), R4
+	MOVW	R4, SPR(DBATU(0))
+	MOVW	4(R3), R4
+	MOVW	R4, SPR(DBATL(0))
 	RETURN
 	RETURN
 #endif /* ucuconf */
 #endif /* ucuconf */
 
 
-TEXT mmudisable(SB),$0
+TEXT mmudisable(SB), $0
 	/* disable MMU */
 	/* disable MMU */
 	MOVW	LR, R4
 	MOVW	LR, R4
 	MOVW	$KZERO, R5
 	MOVW	$KZERO, R5
 	ANDN	R5, R4
 	ANDN	R5, R4
-	MOVW	R4, SPR(SRR0)			/* Stored PC for RFI instruction */
+	MOVW	R4, SPR(SRR0)		/* Stored PC for RFI instruction */
 
 
 	MOVW	MSR, R4
 	MOVW	MSR, R4
 	MOVW	$(MSR_IR|MSR_DR|MSR_RI|MSR_FP), R5
 	MOVW	$(MSR_IR|MSR_DR|MSR_RI|MSR_FP), R5
 	ANDN	R5, R4
 	ANDN	R5, R4
 	MOVW	R4, SPR(SRR1)
 	MOVW	R4, SPR(SRR1)
 
 
-	MOVW	SPR(HID0), R4			/* Get HID0 and clear unwanted bits */
+	MOVW	SPR(HID0), R4		/* Get HID0 and clear unwanted bits */
 	MOVW	$(HID_ICE|HID_DCE), R5
 	MOVW	$(HID_ICE|HID_DCE), R5
 	ANDN	R5, R4
 	ANDN	R5, R4
-	MOVW	R4, SPR(HID0)			/* Cache disable */
-	RFI		/* resume caller with MMU off */
+	MOVW	R4, SPR(HID0)		/* Cache disable */
+	RFI				/* resume caller with MMU off */
 	RETURN
 	RETURN
 
 
-TEXT kreboot(SB),$0
-	BL		mmudisable(SB)
+TEXT kreboot(SB), $0
+	BL	mmudisable(SB)
 	MOVW	R3, LR
 	MOVW	R3, LR
 	RETURN
 	RETURN
 
 
-TEXT	mul64fract(SB), $0
+TEXT mul64fract(SB), $0
 	MOVW	a0+8(FP), R9
 	MOVW	a0+8(FP), R9
 	MOVW	a1+4(FP), R10
 	MOVW	a1+4(FP), R10
 	MOVW	b0+16(FP), R4
 	MOVW	b0+16(FP), R4
 	MOVW	b1+12(FP), R5
 	MOVW	b1+12(FP), R5
 
 
-	MULLW	R10,R5,R13	/* c2 = lo(a1*b1) */
+	MULLW	R10, R5, R13		/* c2 = lo(a1*b1) */
 
 
-	MULLW	R10,R4,R12	/* c1 = lo(a1*b0) */
-	MULHWU	R10,R4,R7	/* hi(a1*b0) */
-	ADD		R7, R13		/* c2 += hi(a1*b0) */
+	MULLW	R10, R4, R12		/* c1 = lo(a1*b0) */
+	MULHWU	R10, R4, R7		/* hi(a1*b0) */
+	ADD	R7, R13			/* c2 += hi(a1*b0) */
 
 
-	MULLW	R9,R5,R6	/* lo(a0*b1) */
-	MULHWU	R9,R5,R7	/* hi(a0*b1) */
-	ADDC	R6, R12		/* c1 += lo(a0*b1) */
-	ADDE	R7, R13		/* c2 += hi(a0*b1) + carry */
+	MULLW	R9, R5, R6		/* lo(a0*b1) */
+	MULHWU	R9, R5, R7		/* hi(a0*b1) */
+	ADDC	R6, R12			/* c1 += lo(a0*b1) */
+	ADDE	R7, R13			/* c2 += hi(a0*b1) + carry */
 
 
-	MULHWU	R9,R4,R7	/* hi(a0*b0) */
-	ADDC	R7, R12		/* c1 += hi(a0*b0) */
-	ADDE	R0,	R13		/* c2 += carry */
+	MULHWU	R9, R4, R7		/* hi(a0*b0) */
+	ADDC	R7, R12			/* c1 += hi(a0*b0) */
+	ADDE	R0, R13			/* c2 += carry */
 
 
 	MOVW	R12, 4(R3)
 	MOVW	R12, 4(R3)
 	MOVW	R13, 0(R3)
 	MOVW	R13, 0(R3)
 	RETURN
 	RETURN
-

+ 5 - 3
sys/src/cmd/1a/lex.c

@@ -871,10 +871,10 @@ outhist(void)
 		op = 0;
 		op = 0;
 		if(p && p[0] != c && h->offset == 0 && pathname){
 		if(p && p[0] != c && h->offset == 0 && pathname){
 			/* on windows skip drive specifier in pathname */
 			/* on windows skip drive specifier in pathname */
-			if(systemtype(Windows) && pathname[2] == c) {
+			if(systemtype(Windows) && pathname[1] == ':') {
 				op = p;
 				op = p;
 				p = pathname+2;
 				p = pathname+2;
-				*p = '/';
+				c = *p;
 			} else if(pathname[0] == c){
 			} else if(pathname[0] == c){
 				op = p;
 				op = p;
 				p = pathname;
 				p = pathname;
@@ -884,8 +884,10 @@ outhist(void)
 			q = strchr(p, c);
 			q = strchr(p, c);
 			if(q) {
 			if(q) {
 				n = q-p;
 				n = q-p;
-				if(n == 0)
+				if(n == 0){
 					n = 1;	/* leading "/" */
 					n = 1;	/* leading "/" */
+					*p = '/';	/* don't emit "\" on windows */
+				}
 				q++;
 				q++;
 			} else {
 			} else {
 				n = strlen(p);
 				n = strlen(p);

+ 9 - 8
sys/src/cmd/1c/cgen.c

@@ -26,14 +26,15 @@ cgen(Node *n, int result, Node *nn)
 	o = n->op;
 	o = n->op;
 	if(n->addable >= INDEXED) {
 	if(n->addable >= INDEXED) {
 		if(result == D_NONE) {
 		if(result == D_NONE) {
-			switch(o) {
-			default:
-				nullwarn(Z, Z);
-				break;
-			case OINDEX:
-				nullwarn(l, r);
-				break;
-			}
+			if(nn == Z)
+				switch(o) {
+				default:
+					nullwarn(Z, Z);
+					break;
+				case OINDEX:
+					nullwarn(l, r);
+					break;
+				}
 			return;
 			return;
 		}
 		}
 		gmove(n->type, nn->type, D_TREE, n, result, nn);
 		gmove(n->type, nn->type, D_TREE, n, result, nn);

+ 1 - 0
sys/src/cmd/1c/enam.c

@@ -420,4 +420,5 @@ char	*anames[] =
 	"UNLK",
 	"UNLK",
 	"UNPK",
 	"UNPK",
 	"WORD",
 	"WORD",
+	"SIGNAME",
 };
 };

+ 1 - 1
sys/src/cmd/1c/gc.h

@@ -14,7 +14,7 @@
 #define	SZ_VLONG	8
 #define	SZ_VLONG	8
 #define	SZ_DOUBLE	8
 #define	SZ_DOUBLE	8
 
 
-#define	ALLOP	91
+#define	ALLOP	92
 #define	NRGN	300
 #define	NRGN	300
 #define	FNX	100
 #define	FNX	100
 #define	INDEXED	9
 #define	INDEXED	9

+ 1 - 0
sys/src/cmd/1c/peep.c

@@ -34,6 +34,7 @@ peep(void)
 		case ADATA:
 		case ADATA:
 		case AGLOBL:
 		case AGLOBL:
 		case ANAME:
 		case ANAME:
+		case ASIGNAME:
 			p = p->link;
 			p = p->link;
 		}
 		}
 	}
 	}

+ 4 - 2
sys/src/cmd/1c/reg.c

@@ -91,6 +91,7 @@ regopt(Prog *p)
 		case ADATA:
 		case ADATA:
 		case AGLOBL:
 		case AGLOBL:
 		case ANAME:
 		case ANAME:
+		case ASIGNAME:
 			continue;
 			continue;
 		}
 		}
 		r = rega();
 		r = rega();
@@ -444,6 +445,7 @@ brk:
 			case ADATA:
 			case ADATA:
 			case AGLOBL:
 			case AGLOBL:
 			case ANAME:
 			case ANAME:
+			case ASIGNAME:
 				break;
 				break;
 			}
 			}
 		}
 		}
@@ -744,7 +746,7 @@ rpolca(long *idom, long rpo1, long rpo2)
 		while(rpo1 < rpo2){
 		while(rpo1 < rpo2){
 			t = idom[rpo2];
 			t = idom[rpo2];
 			if(t >= rpo2)
 			if(t >= rpo2)
-				sysfatal("bad idom");
+				fatal(Z, "bad idom");
 			rpo2 = t;
 			rpo2 = t;
 		}
 		}
 	}
 	}
@@ -800,7 +802,7 @@ loopit(Reg *r, long nr)
 
 
 	d = postorder(r, rpo2r, 0);
 	d = postorder(r, rpo2r, 0);
 	if(d > nr)
 	if(d > nr)
-		sysfatal("too many reg nodes");
+		fatal(Z, "too many reg nodes");
 	nr = d;
 	nr = d;
 	for(i = 0; i < nr / 2; i++){
 	for(i = 0; i < nr / 2; i++){
 		r1 = rpo2r[i];
 		r1 = rpo2r[i];

+ 7 - 5
sys/src/cmd/1c/sgen.c

@@ -310,13 +310,15 @@ usedset(Node *n, int o)
 	complex(n);
 	complex(n);
 	switch(n->op) {
 	switch(n->op) {
 	case OADDR:	/* volatile */
 	case OADDR:	/* volatile */
-//		gins(ANOP, n, Z);
+		gopcode(OTST, types[TINT], D_TREE, n, D_NONE, Z);
+		p->as = ANOP;
 		break;
 		break;
 	case ONAME:
 	case ONAME:
-//		if(o == OSET)
-//			gins(ANOP, Z, n);
-//		else
-//			gins(ANOP, n, Z);
+		if(o == OSET)
+			gopcode(OTST, types[TINT], D_NONE, Z, D_TREE, n);
+		else
+			gopcode(OTST, types[TINT], D_TREE, n, D_NONE, Z);
+		p->as = ANOP;
 		break;
 		break;
 	}
 	}
 }
 }

+ 33 - 11
sys/src/cmd/1c/swt.c

@@ -404,7 +404,7 @@ eval(Node *n, int g)
 }
 }
 
 
 void	outhist(Biobuf*);
 void	outhist(Biobuf*);
-void	zname(Biobuf*, char*, int, int);
+void	zname(Biobuf*, Sym*, int);
 void	zaddr(Biobuf*, Adr*, int);
 void	zaddr(Biobuf*, Adr*, int);
 void	zwrite(Biobuf*, Prog*, int, int);
 void	zwrite(Biobuf*, Prog*, int, int);
 
 
@@ -452,8 +452,8 @@ outcode(void)
 			if(h[sf].type == t)
 			if(h[sf].type == t)
 			if(h[sf].sym == s)
 			if(h[sf].sym == s)
 				break;
 				break;
-			zname(&b, s->name, t, sym);
 			s->sym = sym;
 			s->sym = sym;
+			zname(&b, s, t);
 			h[sym].sym = s;
 			h[sym].sym = s;
 			h[sym].type = t;
 			h[sym].type = t;
 			sf = sym;
 			sf = sym;
@@ -472,8 +472,8 @@ outcode(void)
 			if(h[st].type == t)
 			if(h[st].type == t)
 			if(h[st].sym == s)
 			if(h[st].sym == s)
 				break;
 				break;
-			zname(&b, s->name, t, sym);
 			s->sym = sym;
 			s->sym = sym;
+			zname(&b, s, t);
 			h[sym].sym = s;
 			h[sym].sym = s;
 			h[sym].type = t;
 			h[sym].type = t;
 			st = sym;
 			st = sym;
@@ -510,13 +510,28 @@ zwrite(Biobuf *b, Prog *p, int sf, int st)
 }
 }
 
 
 void
 void
-zname(Biobuf *b, char *n, int t, int s)
+zname(Biobuf *b, Sym *s, int t)
 {
 {
-
-	Bputc(b, ANAME);	/* as */
-	Bputc(b, ANAME>>8);
+	char *n;
+	ulong sig;
+
+	if(debug['T'] && t == D_EXTERN && s->sig != SIGDONE && s->type != types[TENUM] && s != symrathole){
+		sig = sign(s);
+		Bputc(b, ASIGNAME);
+		Bputc(b, ASIGNAME>>8);
+		Bputc(b, sig);
+		Bputc(b, sig>>8);
+		Bputc(b, sig>>16);
+		Bputc(b, sig>>24);
+		s->sig = SIGDONE;
+	}
+	else{
+		Bputc(b, ANAME);	/* as */
+		Bputc(b, ANAME>>8);	/* as */
+	}
 	Bputc(b, t);		/* type */
 	Bputc(b, t);		/* type */
-	Bputc(b, s);		/* sym */
+	Bputc(b, s->sym);		/* sym */
+	n = s->name;
 	while(*n) {
 	while(*n) {
 		Bputc(b, *n);
 		Bputc(b, *n);
 		n++;
 		n++;
@@ -625,12 +640,17 @@ outhist(Biobuf *b)
 	for(h = hist; h != H; h = h->link) {
 	for(h = hist; h != H; h = h->link) {
 		p = h->name;
 		p = h->name;
 		op = 0;
 		op = 0;
+		/* on windows skip drive specifier in pathname */
+		if(systemtype(Windows) && p && p[1] == ':'){
+			p += 2;
+			c = *p;
+		}
 		if(p && p[0] != c && h->offset == 0 && pathname){
 		if(p && p[0] != c && h->offset == 0 && pathname){
 			/* on windows skip drive specifier in pathname */
 			/* on windows skip drive specifier in pathname */
-			if(systemtype(Windows) && pathname[2] == c) {
+			if(systemtype(Windows) && pathname[1] == ':') {
 				op = p;
 				op = p;
 				p = pathname+2;
 				p = pathname+2;
-				*p = '/';
+				c = *p;
 			} else if(pathname[0] == c){
 			} else if(pathname[0] == c){
 				op = p;
 				op = p;
 				p = pathname;
 				p = pathname;
@@ -640,8 +660,10 @@ outhist(Biobuf *b)
 			q = utfrune(p, c);
 			q = utfrune(p, c);
 			if(q) {
 			if(q) {
 				n = q-p;
 				n = q-p;
-				if(n == 0)
+				if(n == 0){
 					n = 1;	/* leading "/" */
 					n = 1;	/* leading "/" */
+					*p = '/';	/* don't emit "\" on windows */
+				}
 				q++;
 				q++;
 			} else {
 			} else {
 				n = strlen(p);
 				n = strlen(p);

+ 3 - 3
sys/src/cmd/1l/asm.c

@@ -890,16 +890,16 @@ asmins(Prog *p)
 	case 23:	/* word, long */
 	case 23:	/* word, long */
 		op = opa;
 		op = opa;
 		a = asmea(p, &p->to);
 		a = asmea(p, &p->to);
-		if(a == (7<<3)|4)
+		if(a == ((7<<3)|4))
 			return;
 			return;
-		if(a == (7<<3)|1) {
+		if(a == ((7<<3)|1)) {
 			if(p->as == AWORD) {
 			if(p->as == AWORD) {
 				op = opa;
 				op = opa;
 				*op++ = opa[1];
 				*op++ = opa[1];
 			}
 			}
 			return;
 			return;
 		}
 		}
-		if(a == (7<<3)|0) {
+		if(a == ((7<<3)|0)) {
 			if(p->as == ALONG) {
 			if(p->as == ALONG) {
 				*op++ = opa[0];
 				*op++ = opa[0];
 				opa[0] = 0;
 				opa[0] = 0;

+ 2 - 1
sys/src/cmd/1l/l.h

@@ -175,6 +175,7 @@ EXTERN	int	histgen;
 EXTERN	char*	library[50];
 EXTERN	char*	library[50];
 EXTERN	char*	libraryobj[50];
 EXTERN	char*	libraryobj[50];
 EXTERN	int	libraryp;
 EXTERN	int	libraryp;
+EXTERN	int	xrefresolv;
 EXTERN	char*	hunk;
 EXTERN	char*	hunk;
 EXTERN	char	inuxi1[1];
 EXTERN	char	inuxi1[1];
 EXTERN	char	inuxi2[2];
 EXTERN	char	inuxi2[2];
@@ -246,7 +247,7 @@ long	ieeedtof(Ieee*);
 void	initmuldiv1(void);
 void	initmuldiv1(void);
 void	initmuldiv2(void);
 void	initmuldiv2(void);
 void	ldobj(int, long, char*);
 void	ldobj(int, long, char*);
-void	loadlib(int, int);
+void	loadlib(void);
 void	listinit(void);
 void	listinit(void);
 Sym*	lookup(char*, int);
 Sym*	lookup(char*, int);
 void	lput(long);
 void	lput(long);

+ 20 - 9
sys/src/cmd/1l/obj.c

@@ -218,7 +218,7 @@ main(int argc, char *argv[])
 	while(*argv)
 	while(*argv)
 		objfile(*argv++);
 		objfile(*argv++);
 	if(!debug['l'])
 	if(!debug['l'])
-		loadlib(0, libraryp);
+		loadlib();
 	firstp = firstp->link;
 	firstp = firstp->link;
 	if(firstp == P)
 	if(firstp == P)
 		errorexit();
 		errorexit();
@@ -249,18 +249,24 @@ main(int argc, char *argv[])
 }
 }
 
 
 void
 void
-loadlib(int beg, int end)
+loadlib(void)
 {
 {
-	int i, t;
+	int i;
+	long h;
+	Sym *s;
 
 
-	for(i=end-1; i>=beg; i--) {
-		t = libraryp;
+loop:
+	xrefresolv = 0;
+	for(i=0; i<libraryp; i++) {
 		if(debug['v'])
 		if(debug['v'])
-			Bprint(&bso, "%5.2f autolib: %s\n", cputime(), library[i]);
+			Bprint(&bso, "%5.2f autolib: %s (from %s)\n", cputime(), library[i], libraryobj[i]);
 		objfile(library[i]);
 		objfile(library[i]);
-		if(t != libraryp)
-			loadlib(t, libraryp);
 	}
 	}
+	if(xrefresolv)
+	for(h=0; h<nelem(hash); h++)
+	for(s = hash[h]; s != S; s = s->link)
+		if(s->type == SXREF)
+			goto loop;
 }
 }
 
 
 void
 void
@@ -368,6 +374,7 @@ objfile(char *file)
 				errorexit();
 				errorexit();
 			}
 			}
 			work = 1;
 			work = 1;
+			xrefresolv = 1;
 		}
 		}
 	}
 	}
 	return;
 	return;
@@ -695,7 +702,11 @@ loop:
 		errorexit();
 		errorexit();
 	}
 	}
 
 
-	if(o == ANAME) {
+	if(o == ANAME || o == ASIGNAME) {
+		if(o == ASIGNAME) {
+			bloc += 4;
+			c -= 4;
+		}
 		stop = memchr(&bloc[4], 0, bsize-&bloc[4]);
 		stop = memchr(&bloc[4], 0, bsize-&bloc[4]);
 		if(stop == 0){
 		if(stop == 0){
 			bsize = readsome(f, buf.xbuf, bloc, bsize, c);
 			bsize = readsome(f, buf.xbuf, bloc, bsize, c);

+ 2 - 2
sys/src/cmd/2a/a.h

@@ -105,7 +105,7 @@ enum
 	CLAST,
 	CLAST,
 	CMACARG,
 	CMACARG,
 	CMACRO,
 	CMACRO,
-	CPREPROC,
+	CPREPROC
 };
 };
 
 
 EXTERN	char	debug[256];
 EXTERN	char	debug[256];
@@ -183,7 +183,7 @@ enum				/* keep in synch with ../cc/cc.h */
 {
 {
 	Plan9	= 1<<0,
 	Plan9	= 1<<0,
 	Unix	= 1<<1,
 	Unix	= 1<<1,
-	Windows	= 1<<2,
+	Windows	= 1<<2
 };
 };
 
 
 /*
 /*

+ 10 - 3
sys/src/cmd/2a/lex.c

@@ -874,12 +874,17 @@ outhist(void)
 	for(h = hist; h != H; h = h->link) {
 	for(h = hist; h != H; h = h->link) {
 		p = h->name;
 		p = h->name;
 		op = 0;
 		op = 0;
+		/* on windows skip drive specifier in pathname */
+		if(systemtype(Windows) && p && p[1] == ':'){
+			p += 2;
+			c = *p;
+		}
 		if(p && p[0] != c && h->offset == 0 && pathname){
 		if(p && p[0] != c && h->offset == 0 && pathname){
 			/* on windows skip drive specifier in pathname */
 			/* on windows skip drive specifier in pathname */
-			if(systemtype(Windows) && pathname[2] == c) {
+			if(systemtype(Windows) && pathname[1] == ':') {
 				op = p;
 				op = p;
 				p = pathname+2;
 				p = pathname+2;
-				*p = '/';
+				c = *p;
 			} else if(pathname[0] == c){
 			} else if(pathname[0] == c){
 				op = p;
 				op = p;
 				p = pathname;
 				p = pathname;
@@ -889,8 +894,10 @@ outhist(void)
 			q = strchr(p, c);
 			q = strchr(p, c);
 			if(q) {
 			if(q) {
 				n = q-p;
 				n = q-p;
-				if(n == 0)
+				if(n == 0){
 					n = 1;	/* leading "/" */
 					n = 1;	/* leading "/" */
+					*p = '/';	/* don't emit "\" on windows */
+				}
 				q++;
 				q++;
 			} else {
 			} else {
 				n = strlen(p);
 				n = strlen(p);

+ 2 - 1
sys/src/cmd/2c/2.out.h

@@ -430,6 +430,7 @@ enum	as
 	AUNLK,
 	AUNLK,
 	AUNPK,
 	AUNPK,
 	AWORD,
 	AWORD,
+	ASIGNAME,
 };
 };
 
 
 enum
 enum
@@ -499,7 +500,7 @@ enum
 	T_OFFSET	= 1<<3,
 	T_OFFSET	= 1<<3,
 	T_FCONST	= 1<<4,
 	T_FCONST	= 1<<4,
 	T_SYM		= 1<<5,
 	T_SYM		= 1<<5,
-	T_SCONST	= 1<<6,
+	T_SCONST	= 1<<6
 };
 };
 
 
 /*
 /*

+ 9 - 8
sys/src/cmd/2c/cgen.c

@@ -26,14 +26,15 @@ cgen(Node *n, int result, Node *nn)
 	o = n->op;
 	o = n->op;
 	if(n->addable >= INDEXED) {
 	if(n->addable >= INDEXED) {
 		if(result == D_NONE) {
 		if(result == D_NONE) {
-			switch(o) {
-			default:
-				nullwarn(Z, Z);
-				break;
-			case OINDEX:
-				nullwarn(l, r);
-				break;
-			}
+			if(nn == Z)
+				switch(o) {
+				default:
+					nullwarn(Z, Z);
+					break;
+				case OINDEX:
+					nullwarn(l, r);
+					break;
+				}
 			return;
 			return;
 		}
 		}
 		gmove(n->type, nn->type, D_TREE, n, result, nn);
 		gmove(n->type, nn->type, D_TREE, n, result, nn);

+ 1 - 0
sys/src/cmd/2c/enam.c

@@ -420,4 +420,5 @@ char	*anames[] =
 	"UNLK",
 	"UNLK",
 	"UNPK",
 	"UNPK",
 	"WORD",
 	"WORD",
+	"SIGNAME",
 };
 };

+ 16 - 6
sys/src/cmd/2c/list.c

@@ -14,6 +14,16 @@ listinit(void)
 	fmtinstall('B', Bconv);
 	fmtinstall('B', Bconv);
 }
 }
 
 
+static Index
+indexv(int i, int j)
+{
+	Index x;
+
+	x.o0 = i;
+	x.o1 = j;
+	return x;
+}
+
 int
 int
 Bconv(Fmt *fp)
 Bconv(Fmt *fp)
 {
 {
@@ -102,25 +112,25 @@ Dconv(Fmt *fp)
 		a->displace = 0;
 		a->displace = 0;
 		switch(i & I_MASK) {
 		switch(i & I_MASK) {
 		default:
 		default:
-			sprint(str, "???%ld(%D%X)", d, a, (Index){i, j});
+			sprint(str, "???%ld(%D%X)", d, a, indexv(i, j));
 			break;
 			break;
 
 
 		case I_INDEX1:
 		case I_INDEX1:
-			sprint(str, "%D%X", a, (Index){i, a->scale});
+			sprint(str, "%D%X", a, indexv(i, a->scale));
 			break;
 			break;
 
 
 		case I_INDEX2:
 		case I_INDEX2:
 			if(d)
 			if(d)
-				sprint(str, "%ld(%D)%X", d, a, (Index){i, j});
+				sprint(str, "%ld(%D)%X", d, a, indexv(i, j));
 			else
 			else
-				sprint(str, "(%D)%X", a, (Index){i, j});
+				sprint(str, "(%D)%X", a, indexv(i, j));
 			break;
 			break;
 
 
 		case I_INDEX3:
 		case I_INDEX3:
 			if(d)
 			if(d)
-				sprint(str, "%ld(%D%X)", d, a, (Index){i, j});
+				sprint(str, "%ld(%D%X)", d, a, indexv(i, j));
 			else
 			else
-				sprint(str, "(%D%X)", a, (Index){i, j});
+				sprint(str, "(%D%X)", a, indexv(i, j));
 			break;
 			break;
 		}
 		}
 		a->displace = d;
 		a->displace = d;

+ 1 - 0
sys/src/cmd/2c/peep.c

@@ -34,6 +34,7 @@ peep(void)
 		case ADATA:
 		case ADATA:
 		case AGLOBL:
 		case AGLOBL:
 		case ANAME:
 		case ANAME:
+		case ASIGNAME:
 			p = p->link;
 			p = p->link;
 		}
 		}
 	}
 	}

+ 4 - 2
sys/src/cmd/2c/reg.c

@@ -91,6 +91,7 @@ regopt(Prog *p)
 		case ADATA:
 		case ADATA:
 		case AGLOBL:
 		case AGLOBL:
 		case ANAME:
 		case ANAME:
+		case ASIGNAME:
 			continue;
 			continue;
 		}
 		}
 		r = rega();
 		r = rega();
@@ -444,6 +445,7 @@ brk:
 			case ADATA:
 			case ADATA:
 			case AGLOBL:
 			case AGLOBL:
 			case ANAME:
 			case ANAME:
+			case ASIGNAME:
 				break;
 				break;
 			}
 			}
 		}
 		}
@@ -755,7 +757,7 @@ rpolca(long *idom, long rpo1, long rpo2)
 		while(rpo1 < rpo2){
 		while(rpo1 < rpo2){
 			t = idom[rpo2];
 			t = idom[rpo2];
 			if(t >= rpo2)
 			if(t >= rpo2)
-				sysfatal("bad idom");
+				fatal(Z, "bad idom");
 			rpo2 = t;
 			rpo2 = t;
 		}
 		}
 	}
 	}
@@ -811,7 +813,7 @@ loopit(Reg *r, long nr)
 
 
 	d = postorder(r, rpo2r, 0);
 	d = postorder(r, rpo2r, 0);
 	if(d > nr)
 	if(d > nr)
-		sysfatal("too many reg nodes");
+		fatal(Z, "too many reg nodes");
 	nr = d;
 	nr = d;
 	for(i = 0; i < nr / 2; i++){
 	for(i = 0; i < nr / 2; i++){
 		r1 = rpo2r[i];
 		r1 = rpo2r[i];

+ 7 - 5
sys/src/cmd/2c/sgen.c

@@ -310,13 +310,15 @@ usedset(Node *n, int o)
 	complex(n);
 	complex(n);
 	switch(n->op) {
 	switch(n->op) {
 	case OADDR:	/* volatile */
 	case OADDR:	/* volatile */
-//		gins(ANOP, n, Z);
+		gopcode(OTST, types[TINT], D_TREE, n, D_NONE, Z);
+		p->as = ANOP;
 		break;
 		break;
 	case ONAME:
 	case ONAME:
-//		if(o == OSET)
-//			gins(ANOP, Z, n);
-//		else
-//			gins(ANOP, n, Z);
+		if(o == OSET)
+			gopcode(OTST, types[TINT], D_NONE, Z, D_TREE, n);
+		else
+			gopcode(OTST, types[TINT], D_TREE, n, D_NONE, Z);
+		p->as = ANOP;
 		break;
 		break;
 	}
 	}
 }
 }

+ 33 - 11
sys/src/cmd/2c/swt.c

@@ -484,7 +484,7 @@ eval(Node *n, int g)
 }
 }
 
 
 void	outhist(Biobuf*);
 void	outhist(Biobuf*);
-void	zname(Biobuf*, char*, int, int);
+void	zname(Biobuf*, Sym*, int);
 void	zaddr(Biobuf*, Adr*, int);
 void	zaddr(Biobuf*, Adr*, int);
 void	zwrite(Biobuf*, Prog*, int, int);
 void	zwrite(Biobuf*, Prog*, int, int);
 
 
@@ -532,8 +532,8 @@ outcode(void)
 			if(h[sf].type == t)
 			if(h[sf].type == t)
 			if(h[sf].sym == s)
 			if(h[sf].sym == s)
 				break;
 				break;
-			zname(&b, s->name, t, sym);
 			s->sym = sym;
 			s->sym = sym;
+			zname(&b, s, t);
 			h[sym].sym = s;
 			h[sym].sym = s;
 			h[sym].type = t;
 			h[sym].type = t;
 			sf = sym;
 			sf = sym;
@@ -552,8 +552,8 @@ outcode(void)
 			if(h[st].type == t)
 			if(h[st].type == t)
 			if(h[st].sym == s)
 			if(h[st].sym == s)
 				break;
 				break;
-			zname(&b, s->name, t, sym);
 			s->sym = sym;
 			s->sym = sym;
+			zname(&b, s, t);
 			h[sym].sym = s;
 			h[sym].sym = s;
 			h[sym].type = t;
 			h[sym].type = t;
 			st = sym;
 			st = sym;
@@ -590,13 +590,28 @@ zwrite(Biobuf *b, Prog *p, int sf, int st)
 }
 }
 
 
 void
 void
-zname(Biobuf *b, char *n, int t, int s)
+zname(Biobuf *b, Sym *s, int t)
 {
 {
-
-	Bputc(b, ANAME);	/* as */
-	Bputc(b, ANAME>>8);
+	char *n;
+	ulong sig;
+
+	if(debug['T'] && t == D_EXTERN && s->sig != SIGDONE && s->type != types[TENUM] && s != symrathole){
+		sig = sign(s);
+		Bputc(b, ASIGNAME);
+		Bputc(b, ASIGNAME>>8);
+		Bputc(b, sig);
+		Bputc(b, sig>>8);
+		Bputc(b, sig>>16);
+		Bputc(b, sig>>24);
+		s->sig = SIGDONE;
+	}
+	else{
+		Bputc(b, ANAME);	/* as */
+		Bputc(b, ANAME>>8);	/* as */
+	}
 	Bputc(b, t);		/* type */
 	Bputc(b, t);		/* type */
-	Bputc(b, s);		/* sym */
+	Bputc(b, s->sym);		/* sym */
+	n = s->name;
 	while(*n) {
 	while(*n) {
 		Bputc(b, *n);
 		Bputc(b, *n);
 		n++;
 		n++;
@@ -707,12 +722,17 @@ outhist(Biobuf *b)
 	for(h = hist; h != H; h = h->link) {
 	for(h = hist; h != H; h = h->link) {
 		p = h->name;
 		p = h->name;
 		op = 0;
 		op = 0;
+		/* on windows skip drive specifier in pathname */
+		if(systemtype(Windows) && p && p[1] == ':'){
+			p += 2;
+			c = *p;
+		}
 		if(p && p[0] != c && h->offset == 0 && pathname){
 		if(p && p[0] != c && h->offset == 0 && pathname){
 			/* on windows skip drive specifier in pathname */
 			/* on windows skip drive specifier in pathname */
-			if(systemtype(Windows) && pathname[2] == c) {
+			if(systemtype(Windows) && pathname[1] == ':') {
 				op = p;
 				op = p;
 				p = pathname+2;
 				p = pathname+2;
-				*p = '/';
+				c = *p;
 			} else if(pathname[0] == c){
 			} else if(pathname[0] == c){
 				op = p;
 				op = p;
 				p = pathname;
 				p = pathname;
@@ -722,8 +742,10 @@ outhist(Biobuf *b)
 			q = utfrune(p, c);
 			q = utfrune(p, c);
 			if(q) {
 			if(q) {
 				n = q-p;
 				n = q-p;
-				if(n == 0)
+				if(n == 0){
 					n = 1;	/* leading "/" */
 					n = 1;	/* leading "/" */
+					*p = '/';	/* don't emit "\" on windows */
+				}
 				q++;
 				q++;
 			} else {
 			} else {
 				n = strlen(p);
 				n = strlen(p);

+ 4 - 2
sys/src/cmd/2l/l.h

@@ -121,7 +121,7 @@ enum
 	STRINGSZ	= 200,
 	STRINGSZ	= 200,
 	MAXIO		= 8192,
 	MAXIO		= 8192,
 	MAXHIST		= 20,				/* limit of path elements for history symbols */
 	MAXHIST		= 20,				/* limit of path elements for history symbols */
-	A6OFFSET 	= 32766,
+	A6OFFSET 	= 32766
 };
 };
 
 
 EXTERN union
 EXTERN union
@@ -167,6 +167,7 @@ EXTERN	int	histgen;
 EXTERN	char*	library[50];
 EXTERN	char*	library[50];
 EXTERN	char*	libraryobj[50];
 EXTERN	char*	libraryobj[50];
 EXTERN	int	libraryp;
 EXTERN	int	libraryp;
+EXTERN	int	xrefresolv;
 EXTERN	char*	hunk;
 EXTERN	char*	hunk;
 EXTERN	char	inuxi1[1];
 EXTERN	char	inuxi1[1];
 EXTERN	char	inuxi2[2];
 EXTERN	char	inuxi2[2];
@@ -209,6 +210,7 @@ int	Dconv(Fmt*);
 int	Pconv(Fmt*);
 int	Pconv(Fmt*);
 int	Rconv(Fmt*);
 int	Rconv(Fmt*);
 int	Sconv(Fmt*);
 int	Sconv(Fmt*);
+int	Xconv(Fmt*);
 void	addhist(long, int);
 void	addhist(long, int);
 int	andsize(Prog*, Adr*);
 int	andsize(Prog*, Adr*);
 Prog*	appendp(Prog*);
 Prog*	appendp(Prog*);
@@ -241,7 +243,7 @@ void	histtoauto(void);
 double	ieeedtod(Ieee*);
 double	ieeedtod(Ieee*);
 long	ieeedtof(Ieee*);
 long	ieeedtof(Ieee*);
 void	ldobj(int, long, char*);
 void	ldobj(int, long, char*);
-void	loadlib(int, int);
+void	loadlib(void);
 void	listinit(void);
 void	listinit(void);
 Sym*	lookup(char*, int);
 Sym*	lookup(char*, int);
 void	lput(long);
 void	lput(long);

+ 21 - 9
sys/src/cmd/2l/obj.c

@@ -232,7 +232,7 @@ main(int argc, char *argv[])
 	while(*argv)
 	while(*argv)
 		objfile(*argv++);
 		objfile(*argv++);
 	if(!debug['l'])
 	if(!debug['l'])
-		loadlib(0, libraryp);
+		loadlib();
 	firstp = firstp->link;
 	firstp = firstp->link;
 	if(firstp == P)
 	if(firstp == P)
 		errorexit();
 		errorexit();
@@ -263,24 +263,31 @@ main(int argc, char *argv[])
 }
 }
 
 
 void
 void
-loadlib(int beg, int end)
+loadlib(void)
 {
 {
-	int i, t;
+	int i;
+	long h;
+	Sym *s;
 
 
-	for(i=end-1; i>=beg; i--) {
-		t = libraryp;
+loop:
+	xrefresolv = 0;
+	for(i=0; i<libraryp; i++) {
 		if(debug['v'])
 		if(debug['v'])
-			Bprint(&bso, "%5.2f autolib: %s\n", cputime(), library[i]);
+			Bprint(&bso, "%5.2f autolib: %s (from %s)\n", cputime(), library[i], libraryobj[i]);
 		objfile(library[i]);
 		objfile(library[i]);
-		if(t != libraryp)
-			loadlib(t, libraryp);
 	}
 	}
+	if(xrefresolv)
+	for(h=0; h<nelem(hash); h++)
+	for(s = hash[h]; s != S; s = s->link)
+		if(s->type == SXREF)
+			goto loop;
 }
 }
 
 
 void
 void
 errorexit(void)
 errorexit(void)
 {
 {
 
 
+	Bflush(&bso);
 	if(nerrors) {
 	if(nerrors) {
 		if(cout >= 0)
 		if(cout >= 0)
 			remove(outfile);
 			remove(outfile);
@@ -385,6 +392,7 @@ objfile(char *file)
 				errorexit();
 				errorexit();
 			}
 			}
 			work = 1;
 			work = 1;
+			xrefresolv = 1;
 		}
 		}
 	}
 	}
 	return;
 	return;
@@ -721,7 +729,11 @@ loop:
 		errorexit();
 		errorexit();
 	}
 	}
 
 
-	if(o == ANAME) {
+	if(o == ANAME || o == ASIGNAME) {
+		if(o == ASIGNAME) {
+			bloc += 4;
+			c -= 4;
+		}
 		stop = memchr(&bloc[4], 0, bsize-&bloc[4]);
 		stop = memchr(&bloc[4], 0, bsize-&bloc[4]);
 		if(stop == 0){
 		if(stop == 0){
 			bsize = readsome(f, buf.xbuf, bloc, bsize, c);
 			bsize = readsome(f, buf.xbuf, bloc, bsize, c);

+ 8 - 1
sys/src/cmd/5a/a.y

@@ -19,7 +19,7 @@
 %token	<lval>	LTYPE6 LTYPE7 LTYPE8 LTYPE9 LTYPEA
 %token	<lval>	LTYPE6 LTYPE7 LTYPE8 LTYPE9 LTYPEA
 %token	<lval>	LTYPEB LTYPEC LTYPED LTYPEE LTYPEF
 %token	<lval>	LTYPEB LTYPEC LTYPED LTYPEE LTYPEF
 %token	<lval>	LTYPEG LTYPEH LTYPEI LTYPEJ LTYPEK
 %token	<lval>	LTYPEG LTYPEH LTYPEI LTYPEJ LTYPEK
-%token	<lval>	LTYPEL LTYPEM LTYPEN
+%token	<lval>	LTYPEL LTYPEM LTYPEN LTYPEBX
 %token	<lval>	LCONST LSP LSB LFP LPC
 %token	<lval>	LCONST LSP LSB LFP LPC
 %token	<lval>	LTYPEX LR LREG LF LFREG LC LCREG LPSR LFCR
 %token	<lval>	LTYPEX LR LREG LF LFREG LC LCREG LPSR LFCR
 %token	<lval>	LCOND LS LAT
 %token	<lval>	LCOND LS LAT
@@ -104,6 +104,13 @@ inst:
 	{
 	{
 		outcode($1, $2, &nullgen, NREG, &$4);
 		outcode($1, $2, &nullgen, NREG, &$4);
 	}
 	}
+/*
+ * BX
+ */
+|	LTYPEBX comma ireg
+	{
+		outcode($1, Always, &nullgen, NREG, &$3);
+	}
 /*
 /*
  * BEQ
  * BEQ
  */
  */

+ 36 - 24
sys/src/cmd/5a/lex.c

@@ -1,7 +1,7 @@
-#include <ctype.h>
 #define	EXTERN
 #define	EXTERN
 #include "a.h"
 #include "a.h"
 #include "y.tab.h"
 #include "y.tab.h"
+#include <ctype.h>
 
 
 void
 void
 main(int argc, char *argv[])
 main(int argc, char *argv[])
@@ -36,6 +36,10 @@ main(int argc, char *argv[])
 		p = ARGF();
 		p = ARGF();
 		setinclude(p);
 		setinclude(p);
 		break;
 		break;
+	case 't':
+		thechar = 't';
+		thestring = "thumb";
+		break;
 	} ARGEND
 	} ARGEND
 	if(*argv == 0) {
 	if(*argv == 0) {
 		print("usage: %ca [-options] file.s\n", thechar);
 		print("usage: %ca [-options] file.s\n", thechar);
@@ -299,13 +303,13 @@ struct
 	"MOVW",		LTYPE3, AMOVW,
 	"MOVW",		LTYPE3, AMOVW,
 
 
 	"MOVD",		LTYPE3, AMOVD,
 	"MOVD",		LTYPE3, AMOVD,
-	"MOVDF",	LTYPE3, AMOVDF,
+	"MOVDF",		LTYPE3, AMOVDF,
 	"MOVDW",	LTYPE3, AMOVDW,
 	"MOVDW",	LTYPE3, AMOVDW,
 	"MOVF",		LTYPE3, AMOVF,
 	"MOVF",		LTYPE3, AMOVF,
-	"MOVFD",	LTYPE3, AMOVFD,
-	"MOVFW",	LTYPE3, AMOVFW,
+	"MOVFD",		LTYPE3, AMOVFD,
+	"MOVFW",		LTYPE3, AMOVFW,
 	"MOVWD",	LTYPE3, AMOVWD,
 	"MOVWD",	LTYPE3, AMOVWD,
-	"MOVWF",	LTYPE3, AMOVWF,
+	"MOVWF",		LTYPE3, AMOVWF,
 
 
 /*
 /*
 	"ABSF",		LTYPEI, AABSF,
 	"ABSF",		LTYPEI, AABSF,
@@ -335,6 +339,7 @@ struct
 
 
 	"B",		LTYPE4, AB,
 	"B",		LTYPE4, AB,
 	"BL",		LTYPE4, ABL,
 	"BL",		LTYPE4, ABL,
+	"BX",		LTYPEBX,	ABX,
 
 
 	"BEQ",		LTYPE5,	ABEQ,
 	"BEQ",		LTYPE5,	ABEQ,
 	"BNE",		LTYPE5,	ABNE,
 	"BNE",		LTYPE5,	ABNE,
@@ -520,22 +525,22 @@ zaddr(Gen *a, int s)
 
 
 static int bcode[] =
 static int bcode[] =
 {
 {
-[0]	ABEQ,
-[1]	ABNE,
-[2]	ABCS,
-[3]	ABCC,
-[4]	ABMI,
-[5]	ABPL,
-[6]	ABVS,
-[7]	ABVC,
-[8]	ABHI,
-[9]	ABLS,
-[10]	ABGE,
-[11]	ABLT,
-[12]	ABGT,
-[13]	ABLE,
-[14]	AB,
-[15]	ANOP,
+	ABEQ,
+	ABNE,
+	ABCS,
+	ABCC,
+	ABMI,
+	ABPL,
+	ABVS,
+	ABVC,
+	ABHI,
+	ABLS,
+	ABGE,
+	ABLT,
+	ABGT,
+	ABLE,
+	AB,
+	ANOP,
 };
 };
 
 
 void
 void
@@ -623,12 +628,17 @@ outhist(void)
 	for(h = hist; h != H; h = h->link) {
 	for(h = hist; h != H; h = h->link) {
 		p = h->name;
 		p = h->name;
 		op = 0;
 		op = 0;
+		/* on windows skip drive specifier in pathname */
+		if(systemtype(Windows) && p && p[1] == ':'){
+			p += 2;
+			c = *p;
+		}
 		if(p && p[0] != c && h->offset == 0 && pathname){
 		if(p && p[0] != c && h->offset == 0 && pathname){
 			/* on windows skip drive specifier in pathname */
 			/* on windows skip drive specifier in pathname */
-			if(systemtype(Windows) && pathname[2] == c) {
+			if(systemtype(Windows) && pathname[1] == ':') {
 				op = p;
 				op = p;
 				p = pathname+2;
 				p = pathname+2;
-				*p = '/';
+				c = *p;
 			} else if(pathname[0] == c){
 			} else if(pathname[0] == c){
 				op = p;
 				op = p;
 				p = pathname;
 				p = pathname;
@@ -638,8 +648,10 @@ outhist(void)
 			q = strchr(p, c);
 			q = strchr(p, c);
 			if(q) {
 			if(q) {
 				n = q-p;
 				n = q-p;
-				if(n == 0)
+				if(n == 0){
 					n = 1;	/* leading "/" */
 					n = 1;	/* leading "/" */
+					*p = '/';	/* don't emit "\" on windows */
+				}
 				q++;
 				q++;
 			} else {
 			} else {
 				n = strlen(p);
 				n = strlen(p);

+ 10 - 1
sys/src/cmd/5c/5.out.h

@@ -4,6 +4,7 @@
 
 
 #define NOPROF		(1<<0)
 #define NOPROF		(1<<0)
 #define DUPOK		(1<<1)
 #define DUPOK		(1<<1)
+#define	ALLTHUMBS	(1<<2)
 
 
 #define	REGRET		0
 #define	REGRET		0
 #define	REGARG		0
 #define	REGARG		0
@@ -17,6 +18,8 @@
 #define	REGLINK		14
 #define	REGLINK		14
 #define	REGPC		15
 #define	REGPC		15
 
 
+#define	REGTMPT		7	/* used by the loader for thumb code */
+
 #define	NFREG		8
 #define	NFREG		8
 #define	FREGRET		0
 #define	FREGRET		0
 #define	FREGEXT		7
 #define	FREGEXT		7
@@ -132,6 +135,12 @@ enum	as
 	AMULLU,
 	AMULLU,
 	AMULALU,
 	AMULALU,
 
 
+	ABX,
+	ABXRET,
+	ADWORD,
+
+	ASIGNAME,
+
 	ALAST,
 	ALAST,
 };
 };
 
 
@@ -162,7 +171,7 @@ enum	as
 
 
 #define	D_SHIFT		(D_NONE+19)
 #define	D_SHIFT		(D_NONE+19)
 #define	D_FPCR		(D_NONE+20)
 #define	D_FPCR		(D_NONE+20)
-#define D_REGREG	(D_NONE+21)
+#define 	D_REGREG	(D_NONE+21)
 
 
 /* name */
 /* name */
 #define	D_EXTERN	(D_NONE+3)
 #define	D_EXTERN	(D_NONE+3)

+ 50 - 47
sys/src/cmd/5c/cgen.c

@@ -1,7 +1,7 @@
 #include "gc.h"
 #include "gc.h"
 
 
 void
 void
-cgen(Node *n, Node *nn)
+cgen(Node *n, Node *nn, int inrel)
 {
 {
 	Node *l, *r;
 	Node *l, *r;
 	Prog *p1;
 	Prog *p1;
@@ -45,7 +45,7 @@ cgen(Node *n, Node *nn)
 	switch(o) {
 	switch(o) {
 	default:
 	default:
 		regret(&nod, r);
 		regret(&nod, r);
-		cgen(r, &nod);
+		cgen(r, &nod, 0);
 
 
 		regsalloc(&nod1, r);
 		regsalloc(&nod1, r);
 		gopcode(OAS, &nod, Z, &nod1);
 		gopcode(OAS, &nod, Z, &nod1);
@@ -53,7 +53,7 @@ cgen(Node *n, Node *nn)
 		regfree(&nod);
 		regfree(&nod);
 		nod = *n;
 		nod = *n;
 		nod.right = &nod1;
 		nod.right = &nod1;
-		cgen(&nod, nn);
+		cgen(&nod, nn, 0);
 		return;
 		return;
 
 
 	case OFUNC:
 	case OFUNC:
@@ -79,7 +79,7 @@ cgen(Node *n, Node *nn)
 					regret(&nod, r);
 					regret(&nod, r);
 				else
 				else
 					regalloc(&nod, r, nn);
 					regalloc(&nod, r, nn);
-				cgen(r, &nod);
+				cgen(r, &nod, 0);
 				gmove(&nod, l);
 				gmove(&nod, l);
 				if(nn != Z)
 				if(nn != Z)
 					gmove(&nod, nn);
 					gmove(&nod, nn);
@@ -98,10 +98,10 @@ cgen(Node *n, Node *nn)
 				break;
 				break;
 			}
 			}
 			regalloc(&nod, r, nn);
 			regalloc(&nod, r, nn);
-			cgen(r, &nod);
+			cgen(r, &nod, 0);
 		} else {
 		} else {
 			regalloc(&nod, r, nn);
 			regalloc(&nod, r, nn);
-			cgen(r, &nod);
+			cgen(r, &nod, 0);
 			reglcgen(&nod1, l, Z);
 			reglcgen(&nod1, l, Z);
 		}
 		}
 		gmove(&nod, &nod1);
 		gmove(&nod, &nod1);
@@ -114,9 +114,9 @@ cgen(Node *n, Node *nn)
 		regalloc(&nod, r, nn);
 		regalloc(&nod, r, nn);
 		if(l->complex >= r->complex) {
 		if(l->complex >= r->complex) {
 			reglcgen(&nod1, n, Z);
 			reglcgen(&nod1, n, Z);
-			cgen(r, &nod);
+			cgen(r, &nod, 0);
 		} else {
 		} else {
-			cgen(r, &nod);
+			cgen(r, &nod, 0);
 			reglcgen(&nod1, n, Z);
 			reglcgen(&nod1, n, Z);
 		}
 		}
 		regalloc(&nod2, n, Z);
 		regalloc(&nod2, n, Z);
@@ -139,7 +139,7 @@ cgen(Node *n, Node *nn)
 		if(nn != Z)
 		if(nn != Z)
 		if((t = vlog(r)) >= 0) {
 		if((t = vlog(r)) >= 0) {
 			/* signed div/mod by constant power of 2 */
 			/* signed div/mod by constant power of 2 */
-			cgen(l, nn);
+			cgen(l, nn, 0);
 			gopcode(OGE, nodconst(0), nn, Z);
 			gopcode(OGE, nodconst(0), nn, Z);
 			p1 = p;
 			p1 = p;
 			if(o == ODIV) {
 			if(o == ODIV) {
@@ -164,7 +164,7 @@ cgen(Node *n, Node *nn)
 		if(nn != Z)
 		if(nn != Z)
 		if(l->op == OCONST)
 		if(l->op == OCONST)
 		if(!typefd[n->type->etype]) {
 		if(!typefd[n->type->etype]) {
-			cgen(r, nn);
+			cgen(r, nn, 0);
 			gopcode(o, Z, l, nn);
 			gopcode(o, Z, l, nn);
 			break;
 			break;
 		}
 		}
@@ -181,7 +181,7 @@ cgen(Node *n, Node *nn)
 		if(nn != Z)
 		if(nn != Z)
 		if(r->op == OCONST)
 		if(r->op == OCONST)
 		if(!typefd[n->type->etype]) {
 		if(!typefd[n->type->etype]) {
-			cgen(l, nn);
+			cgen(l, nn, 0);
 			if(r->vconst == 0)
 			if(r->vconst == 0)
 			if(o != OAND)
 			if(o != OAND)
 				break;
 				break;
@@ -205,15 +205,15 @@ cgen(Node *n, Node *nn)
 		}
 		}
 		if(l->complex >= r->complex) {
 		if(l->complex >= r->complex) {
 			regalloc(&nod, l, nn);
 			regalloc(&nod, l, nn);
-			cgen(l, &nod);
+			cgen(l, &nod, 0);
 			regalloc(&nod1, r, Z);
 			regalloc(&nod1, r, Z);
-			cgen(r, &nod1);
+			cgen(r, &nod1, 0);
 			gopcode(o, &nod1, Z, &nod);
 			gopcode(o, &nod1, Z, &nod);
 		} else {
 		} else {
 			regalloc(&nod, r, nn);
 			regalloc(&nod, r, nn);
-			cgen(r, &nod);
+			cgen(r, &nod, 0);
 			regalloc(&nod1, l, Z);
 			regalloc(&nod1, l, Z);
-			cgen(l, &nod1);
+			cgen(l, &nod1, 0);
 			gopcode(o, &nod, &nod1, &nod);
 			gopcode(o, &nod, &nod1, &nod);
 		}
 		}
 		gopcode(OAS, &nod, Z, nn);
 		gopcode(OAS, &nod, Z, nn);
@@ -263,10 +263,10 @@ cgen(Node *n, Node *nn)
 			else
 			else
 				nod2 = *l;
 				nod2 = *l;
 			regalloc(&nod1, r, Z);
 			regalloc(&nod1, r, Z);
-			cgen(r, &nod1);
+			cgen(r, &nod1, 0);
 		} else {
 		} else {
 			regalloc(&nod1, r, Z);
 			regalloc(&nod1, r, Z);
-			cgen(r, &nod1);
+			cgen(r, &nod1, 0);
 			if(l->addable < INDEXED)
 			if(l->addable < INDEXED)
 				reglcgen(&nod2, l, Z);
 				reglcgen(&nod2, l, Z);
 			else
 			else
@@ -290,10 +290,10 @@ cgen(Node *n, Node *nn)
 		if(l->complex >= r->complex) {
 		if(l->complex >= r->complex) {
 			bitload(l, &nod, &nod1, &nod2, &nod4);
 			bitload(l, &nod, &nod1, &nod2, &nod4);
 			regalloc(&nod3, r, Z);
 			regalloc(&nod3, r, Z);
-			cgen(r, &nod3);
+			cgen(r, &nod3, 0);
 		} else {
 		} else {
 			regalloc(&nod3, r, Z);
 			regalloc(&nod3, r, Z);
-			cgen(r, &nod3);
+			cgen(r, &nod3, 0);
 			bitload(l, &nod, &nod1, &nod2, &nod4);
 			bitload(l, &nod, &nod1, &nod2, &nod4);
 		}
 		}
 		gmove(&nod, &nod4);
 		gmove(&nod, &nod4);
@@ -318,7 +318,7 @@ cgen(Node *n, Node *nn)
 				diag(n, "bad function call");
 				diag(n, "bad function call");
 
 
 			regret(&nod, l->left);
 			regret(&nod, l->left);
-			cgen(l->left, &nod);
+			cgen(l->left, &nod, 0);
 			regsalloc(&nod1, l->left);
 			regsalloc(&nod1, l->left);
 			gopcode(OAS, &nod, Z, &nod1);
 			gopcode(OAS, &nod, Z, &nod1);
 			regfree(&nod);
 			regfree(&nod);
@@ -328,7 +328,7 @@ cgen(Node *n, Node *nn)
 			nod2 = *l;
 			nod2 = *l;
 			nod2.left = &nod1;
 			nod2.left = &nod1;
 			nod2.complex = 1;
 			nod2.complex = 1;
-			cgen(&nod, nn);
+			cgen(&nod, nn, 0);
 
 
 			return;
 			return;
 		}
 		}
@@ -363,11 +363,11 @@ cgen(Node *n, Node *nn)
 		if(sconst(r) && (v = r->vconst+nod.xoffset) > -4096 && v < 4096) {
 		if(sconst(r) && (v = r->vconst+nod.xoffset) > -4096 && v < 4096) {
 			v = r->vconst;
 			v = r->vconst;
 			r->vconst = 0;
 			r->vconst = 0;
-			cgen(l, &nod);
+			cgen(l, &nod, 0);
 			nod.xoffset += v;
 			nod.xoffset += v;
 			r->vconst = v;
 			r->vconst = v;
 		} else
 		} else
-			cgen(l, &nod);
+			cgen(l, &nod, 0);
 		regind(&nod, n);
 		regind(&nod, n);
 		gopcode(OAS, &nod, Z, nn);
 		gopcode(OAS, &nod, Z, nn);
 		regfree(&nod);
 		regfree(&nod);
@@ -406,8 +406,8 @@ cgen(Node *n, Node *nn)
 		break;
 		break;
 
 
 	case OCOMMA:
 	case OCOMMA:
-		cgen(l, Z);
-		cgen(r, nn);
+		cgen(l, Z, 0);
+		cgen(r, nn, 0);
 		break;
 		break;
 
 
 	case OCAST:
 	case OCAST:
@@ -420,14 +420,17 @@ cgen(Node *n, Node *nn)
 		 */
 		 */
 		if(nocast(l->type, n->type)) {
 		if(nocast(l->type, n->type)) {
 			if(nocast(n->type, nn->type)) {
 			if(nocast(n->type, nn->type)) {
-				cgen(l, nn);
+				cgen(l, nn, 0);
 				break;
 				break;
 			}
 			}
 		}
 		}
 		regalloc(&nod, l, nn);
 		regalloc(&nod, l, nn);
-		cgen(l, &nod);
+		cgen(l, &nod, 0);
 		regalloc(&nod1, n, &nod);
 		regalloc(&nod1, n, &nod);
-		gopcode(OAS, &nod, Z, &nod1);
+		if(inrel)
+			gmover(&nod, &nod1);
+		else
+			gopcode(OAS, &nod, Z, &nod1);
 		gopcode(OAS, &nod1, Z, nn);
 		gopcode(OAS, &nod1, Z, nn);
 		regfree(&nod1);
 		regfree(&nod1);
 		regfree(&nod);
 		regfree(&nod);
@@ -444,18 +447,18 @@ cgen(Node *n, Node *nn)
 			}
 			}
 			nod.xoffset += (long)r->vconst;
 			nod.xoffset += (long)r->vconst;
 			nod.type = n->type;
 			nod.type = n->type;
-			cgen(&nod, nn);
+			cgen(&nod, nn, 0);
 		}
 		}
 		break;
 		break;
 
 
 	case OCOND:
 	case OCOND:
 		bcgen(l, 1);
 		bcgen(l, 1);
 		p1 = p;
 		p1 = p;
-		cgen(r->left, nn);
+		cgen(r->left, nn, 0);
 		gbranch(OGOTO);
 		gbranch(OGOTO);
 		patch(p1, pc);
 		patch(p1, pc);
 		p1 = p;
 		p1 = p;
-		cgen(r->right, nn);
+		cgen(r->right, nn, 0);
 		patch(p1, pc);
 		patch(p1, pc);
 		break;
 		break;
 
 
@@ -576,7 +579,7 @@ reglcgen(Node *t, Node *n, Node *nn)
 	} else if(n->op == OINDREG) {
 	} else if(n->op == OINDREG) {
 		if((v = n->xoffset) > -4096 && v < 4096) {
 		if((v = n->xoffset) > -4096 && v < 4096) {
 			n->op = OREGISTER;
 			n->op = OREGISTER;
-			cgen(n, t);
+			cgen(n, t, 0);
 			t->xoffset += v;
 			t->xoffset += v;
 			n->op = OINDREG;
 			n->op = OINDREG;
 			regind(t, n);
 			regind(t, n);
@@ -635,12 +638,12 @@ lcgen(Node *n, Node *nn)
 		break;
 		break;
 
 
 	case OCOMMA:
 	case OCOMMA:
-		cgen(n->left, n->left);
+		cgen(n->left, n->left, 0);
 		lcgen(n->right, nn);
 		lcgen(n->right, nn);
 		break;
 		break;
 
 
 	case OIND:
 	case OIND:
-		cgen(n->left, nn);
+		cgen(n->left, nn, 0);
 		break;
 		break;
 
 
 	case OCOND:
 	case OCOND:
@@ -685,7 +688,7 @@ boolgen(Node *n, int true, Node *nn)
 
 
 	default:
 	default:
 		regalloc(&nod, n, nn);
 		regalloc(&nod, n, nn);
-		cgen(n, &nod);
+		cgen(n, &nod, 0);
 		o = ONE;
 		o = ONE;
 		if(true)
 		if(true)
 			o = comrel[relindex(o)];
 			o = comrel[relindex(o)];
@@ -709,7 +712,7 @@ boolgen(Node *n, int true, Node *nn)
 		goto com;
 		goto com;
 
 
 	case OCOMMA:
 	case OCOMMA:
-		cgen(l, Z);
+		cgen(l, Z, 0);
 		boolgen(r, true, nn);
 		boolgen(r, true, nn);
 		break;
 		break;
 
 
@@ -776,7 +779,7 @@ boolgen(Node *n, int true, Node *nn)
 			o = comrel[relindex(o)];
 			o = comrel[relindex(o)];
 		if(l->complex >= FNX && r->complex >= FNX) {
 		if(l->complex >= FNX && r->complex >= FNX) {
 			regret(&nod, r);
 			regret(&nod, r);
-			cgen(r, &nod);
+			cgen(r, &nod, 1);
 			regsalloc(&nod1, r);
 			regsalloc(&nod1, r);
 			gopcode(OAS, &nod, Z, &nod1);
 			gopcode(OAS, &nod, Z, &nod1);
 			regfree(&nod);
 			regfree(&nod);
@@ -787,7 +790,7 @@ boolgen(Node *n, int true, Node *nn)
 		}
 		}
 		if(sconst(l)) {
 		if(sconst(l)) {
 			regalloc(&nod, r, nn);
 			regalloc(&nod, r, nn);
-			cgen(r, &nod);
+			cgen(r, &nod, 1);
 			o = invrel[relindex(o)];
 			o = invrel[relindex(o)];
 			gopcode(o, l, &nod, Z);
 			gopcode(o, l, &nod, Z);
 			regfree(&nod);
 			regfree(&nod);
@@ -795,21 +798,21 @@ boolgen(Node *n, int true, Node *nn)
 		}
 		}
 		if(sconst(r)) {
 		if(sconst(r)) {
 			regalloc(&nod, l, nn);
 			regalloc(&nod, l, nn);
-			cgen(l, &nod);
+			cgen(l, &nod, 1);
 			gopcode(o, r, &nod, Z);
 			gopcode(o, r, &nod, Z);
 			regfree(&nod);
 			regfree(&nod);
 			goto com;
 			goto com;
 		}
 		}
 		if(l->complex >= r->complex) {
 		if(l->complex >= r->complex) {
 			regalloc(&nod1, l, nn);
 			regalloc(&nod1, l, nn);
-			cgen(l, &nod1);
+			cgen(l, &nod1, 1);
 			regalloc(&nod, r, Z);
 			regalloc(&nod, r, Z);
-			cgen(r, &nod);
+			cgen(r, &nod, 1);
 		} else {
 		} else {
 			regalloc(&nod, r, nn);
 			regalloc(&nod, r, nn);
-			cgen(r, &nod);
+			cgen(r, &nod, 1);
 			regalloc(&nod1, l, Z);
 			regalloc(&nod1, l, Z);
-			cgen(l, &nod1);
+			cgen(l, &nod1, 1);
 		}
 		}
 		gopcode(o, &nod, &nod1, Z);
 		gopcode(o, &nod, &nod1, Z);
 		regfree(&nod);
 		regfree(&nod);
@@ -933,7 +936,7 @@ sugen(Node *n, Node *nn, long w)
 				r = r->right;
 				r = r->right;
 			}
 			}
 			if(nn == Z) {
 			if(nn == Z) {
-				cgen(l, nn);
+				cgen(l, nn, 0);
 				continue;
 				continue;
 			}
 			}
 			/*
 			/*
@@ -971,7 +974,7 @@ sugen(Node *n, Node *nn, long w)
 			xcom(&nod0);
 			xcom(&nod0);
 			nod0.addable = 0;
 			nod0.addable = 0;
 
 
-			cgen(&nod0, Z);
+			cgen(&nod0, Z, 0);
 		}
 		}
 		break;
 		break;
 
 
@@ -1001,7 +1004,7 @@ sugen(Node *n, Node *nn, long w)
 		n = new(OFUNC, n->left, new(OLIST, nn, n->right));
 		n = new(OFUNC, n->left, new(OLIST, nn, n->right));
 		n->type = types[TVOID];
 		n->type = types[TVOID];
 		n->left->type = types[TVOID];
 		n->left->type = types[TVOID];
-		cgen(n, Z);
+		cgen(n, Z, 0);
 		break;
 		break;
 
 
 	case OCOND:
 	case OCOND:
@@ -1016,7 +1019,7 @@ sugen(Node *n, Node *nn, long w)
 		break;
 		break;
 
 
 	case OCOMMA:
 	case OCOMMA:
-		cgen(n->left, Z);
+		cgen(n->left, Z, 0);
 		sugen(n->right, nn, w);
 		sugen(n->right, nn, w);
 		break;
 		break;
 	}
 	}

+ 4 - 0
sys/src/cmd/5c/enam.c

@@ -90,5 +90,9 @@ char*	anames[] =
 	"MULAL",
 	"MULAL",
 	"MULLU",
 	"MULLU",
 	"MULALU",
 	"MULALU",
+	"BX",
+	"BXRET",
+	"DWORD",
+	"SIGNAME",
 	"LAST",
 	"LAST",
 };
 };

+ 2 - 1
sys/src/cmd/5c/gc.h

@@ -216,7 +216,7 @@ int	bcomplex(Node*, Node*);
 /*
 /*
  * cgen.c
  * cgen.c
  */
  */
-void	cgen(Node*, Node*);
+void	cgen(Node*, Node*, int);
 void	reglcgen(Node*, Node*, Node*);
 void	reglcgen(Node*, Node*, Node*);
 void	lcgen(Node*, Node*);
 void	lcgen(Node*, Node*);
 void	bcgen(Node*, int);
 void	bcgen(Node*, int);
@@ -250,6 +250,7 @@ void	raddr(Node*, Prog*);
 void	naddr(Node*, Adr*);
 void	naddr(Node*, Adr*);
 void	gmovm(Node*, Node*, int);
 void	gmovm(Node*, Node*, int);
 void	gmove(Node*, Node*);
 void	gmove(Node*, Node*);
+void	gmover(Node*, Node*);
 void	gins(int a, Node*, Node*);
 void	gins(int a, Node*, Node*);
 void	gopcode(int, Node*, Node*, Node*);
 void	gopcode(int, Node*, Node*, Node*);
 int	samaddr(Node*, Node*);
 int	samaddr(Node*, Node*);

+ 1 - 1
sys/src/cmd/5c/mkfile

@@ -5,12 +5,12 @@ OFILES=\
 	cgen.$O\
 	cgen.$O\
 	enam.$O\
 	enam.$O\
 	list.$O\
 	list.$O\
+	mul.$O\
 	peep.$O\
 	peep.$O\
 	reg.$O\
 	reg.$O\
 	sgen.$O\
 	sgen.$O\
 	swt.$O\
 	swt.$O\
 	txt.$O\
 	txt.$O\
-	mul.$O\
 
 
 HFILES=\
 HFILES=\
 	gc.h\
 	gc.h\

+ 4 - 0
sys/src/cmd/5c/peep.c

@@ -36,6 +36,7 @@ peep(void)
 		case ADATA:
 		case ADATA:
 		case AGLOBL:
 		case AGLOBL:
 		case ANAME:
 		case ANAME:
+		case ASIGNAME:
 			p = p->link;
 			p = p->link;
 		}
 		}
 	}
 	}
@@ -792,6 +793,8 @@ xtramodes(Reg *r, Adr *a)
 	Adr v;
 	Adr v;
 
 
 	p = r->prog;
 	p = r->prog;
+	if(debug['h'] && p->as == AMOVB && p->from.type == D_OREG)	/* byte load */
+		return 0;
 	v = *a;
 	v = *a;
 	v.type = D_REG;
 	v.type = D_REG;
 	r1 = findpre(r, &v);
 	r1 = findpre(r, &v);
@@ -1287,6 +1290,7 @@ predicable(Prog *p)
 		|| p->as == AGOK
 		|| p->as == AGOK
 		|| p->as == AHISTORY
 		|| p->as == AHISTORY
 		|| p->as == ANAME
 		|| p->as == ANAME
+		|| p->as == ASIGNAME
 		|| p->as == ATEXT
 		|| p->as == ATEXT
 		|| p->as == AWORD
 		|| p->as == AWORD
 		|| p->as == ADYNT
 		|| p->as == ADYNT

+ 4 - 3
sys/src/cmd/5c/reg.c

@@ -80,6 +80,7 @@ regopt(Prog *p)
 		case ADATA:
 		case ADATA:
 		case AGLOBL:
 		case AGLOBL:
 		case ANAME:
 		case ANAME:
+		case ASIGNAME:
 			continue;
 			continue;
 		}
 		}
 		r = rega();
 		r = rega();
@@ -419,6 +420,7 @@ brk:
 			case ADATA:
 			case ADATA:
 			case AGLOBL:
 			case AGLOBL:
 			case ANAME:
 			case ANAME:
+			case ASIGNAME:
 				break;
 				break;
 			}
 			}
 		}
 		}
@@ -734,7 +736,7 @@ rpolca(long *idom, long rpo1, long rpo2)
 		while(rpo1 < rpo2){
 		while(rpo1 < rpo2){
 			t = idom[rpo2];
 			t = idom[rpo2];
 			if(t >= rpo2)
 			if(t >= rpo2)
-				sysfatal("bad idom");
+				fatal(Z, "bad idom");
 			rpo2 = t;
 			rpo2 = t;
 		}
 		}
 	}
 	}
@@ -790,7 +792,7 @@ loopit(Reg *r, long nr)
 
 
 	d = postorder(r, rpo2r, 0);
 	d = postorder(r, rpo2r, 0);
 	if(d > nr)
 	if(d > nr)
-		sysfatal("too many reg nodes");
+		fatal(Z, "too many reg nodes");
 	nr = d;
 	nr = d;
 	for(i = 0; i < nr / 2; i++){
 	for(i = 0; i < nr / 2; i++){
 		r1 = rpo2r[i];
 		r1 = rpo2r[i];
@@ -1123,7 +1125,6 @@ RtoB(int r)
 int
 int
 BtoR(long b)
 BtoR(long b)
 {
 {
-
 	b &= 0x07fcL;
 	b &= 0x07fcL;
 	if(b == 0)
 	if(b == 0)
 		return 0;
 		return 0;

+ 3 - 3
sys/src/cmd/5c/sgen.c

@@ -100,7 +100,7 @@ loop:
 
 
 	default:
 	default:
 		complex(n);
 		complex(n);
-		cgen(n, Z);
+		cgen(n, Z, 0);
 		break;
 		break;
 
 
 	case OLIST:
 	case OLIST:
@@ -128,7 +128,7 @@ loop:
 			break;
 			break;
 		}
 		}
 		regret(&nod, n);
 		regret(&nod, n);
-		cgen(l, &nod);
+		cgen(l, &nod, 0);
 		regfree(&nod);
 		regfree(&nod);
 		if(typefd[n->type->etype])
 		if(typefd[n->type->etype])
 			noretval(1);
 			noretval(1);
@@ -223,7 +223,7 @@ loop:
 		patch(sp, pc);
 		patch(sp, pc);
 		regalloc(&nod, l, Z);
 		regalloc(&nod, l, Z);
 		nod.type = types[TLONG];
 		nod.type = types[TLONG];
-		cgen(l, &nod);
+		cgen(l, &nod, 0);
 		doswit(&nod);
 		doswit(&nod);
 		regfree(&nod);
 		regfree(&nod);
 		patch(spb, pc);
 		patch(spb, pc);

+ 40 - 17
sys/src/cmd/5c/swt.c

@@ -153,7 +153,7 @@ bitload(Node *b, Node *n1, Node *n2, Node *n3, Node *nn)
 		gopcode(OAS, n3, Z, n1);
 		gopcode(OAS, n3, Z, n1);
 	} else {
 	} else {
 		regalloc(n1, l, nn);
 		regalloc(n1, l, nn);
-		cgen(l, n1);
+		cgen(l, n1, 0);
 	}
 	}
 	if(b->type->shift == 0 && typeu[b->type->etype]) {
 	if(b->type->shift == 0 && typeu[b->type->etype]) {
 		v = ~0 + (1L << b->type->nbits);
 		v = ~0 + (1L << b->type->nbits);
@@ -297,7 +297,7 @@ mulcon(Node *n, Node *nn)
 	if(p[1] == 'i')
 	if(p[1] == 'i')
 		p += 2;
 		p += 2;
 	regalloc(&nod1, n, nn);
 	regalloc(&nod1, n, nn);
-	cgen(l, &nod1);
+	cgen(l, &nod1, 0);
 	vs = v;
 	vs = v;
 	regalloc(&nod2, n, Z);
 	regalloc(&nod2, n, Z);
 
 
@@ -355,9 +355,9 @@ nullwarn(Node *l, Node *r)
 {
 {
 	warn(Z, "result of operation not used");
 	warn(Z, "result of operation not used");
 	if(l != Z)
 	if(l != Z)
-		cgen(l, Z);
+		cgen(l, Z, 0);
 	if(r != Z)
 	if(r != Z)
-		cgen(r, Z);
+		cgen(r, Z, 0);
 }
 }
 
 
 void
 void
@@ -403,7 +403,7 @@ gextern(Sym *s, Node *a, long o, long w)
 		p->to.type = D_CONST;
 		p->to.type = D_CONST;
 }
 }
 
 
-void	zname(Biobuf*, char*, int, int);
+void	zname(Biobuf*, Sym*, int);
 char*	zaddr(char*, Adr*, int);
 char*	zaddr(char*, Adr*, int);
 void	zwrite(Biobuf*, Prog*, int, int);
 void	zwrite(Biobuf*, Prog*, int, int);
 void	outhist(Biobuf*);
 void	outhist(Biobuf*);
@@ -461,8 +461,8 @@ outcode(void)
 			if(h[sf].type == t)
 			if(h[sf].type == t)
 			if(h[sf].sym == s)
 			if(h[sf].sym == s)
 				break;
 				break;
-			zname(&outbuf, s->name, t, sym);
 			s->sym = sym;
 			s->sym = sym;
+			zname(&outbuf, s, t);
 			h[sym].sym = s;
 			h[sym].sym = s;
 			h[sym].type = t;
 			h[sym].type = t;
 			sf = sym;
 			sf = sym;
@@ -481,8 +481,8 @@ outcode(void)
 			if(h[st].type == t)
 			if(h[st].type == t)
 			if(h[st].sym == s)
 			if(h[st].sym == s)
 				break;
 				break;
-			zname(&outbuf, s->name, t, sym);
 			s->sym = sym;
 			s->sym = sym;
+			zname(&outbuf, s, t);
 			h[sym].sym = s;
 			h[sym].sym = s;
 			h[sym].type = t;
 			h[sym].type = t;
 			st = sym;
 			st = sym;
@@ -513,12 +513,17 @@ outhist(Biobuf *b)
 	for(h = hist; h != H; h = h->link) {
 	for(h = hist; h != H; h = h->link) {
 		p = h->name;
 		p = h->name;
 		op = 0;
 		op = 0;
+		/* on windows skip drive specifier in pathname */
+		if(systemtype(Windows) && p && p[1] == ':'){
+			p += 2;
+			c = *p;
+		}
 		if(p && p[0] != c && h->offset == 0 && pathname){
 		if(p && p[0] != c && h->offset == 0 && pathname){
 			/* on windows skip drive specifier in pathname */
 			/* on windows skip drive specifier in pathname */
-			if(systemtype(Windows) && pathname[2] == c) {
+			if(systemtype(Windows) && pathname[1] == ':') {
 				op = p;
 				op = p;
 				p = pathname+2;
 				p = pathname+2;
-				*p = '/';
+				c = *p;
 			} else if(pathname[0] == c){
 			} else if(pathname[0] == c){
 				op = p;
 				op = p;
 				p = pathname;
 				p = pathname;
@@ -528,8 +533,10 @@ outhist(Biobuf *b)
 			q = utfrune(p, c);
 			q = utfrune(p, c);
 			if(q) {
 			if(q) {
 				n = q-p;
 				n = q-p;
-				if(n == 0)
+				if(n == 0){
 					n = 1;	/* leading "/" */
 					n = 1;	/* leading "/" */
+					*p = '/';	/* don't emit "\" on windows */
+				}
 				q++;
 				q++;
 			} else {
 			} else {
 				n = strlen(p);
 				n = strlen(p);
@@ -560,14 +567,30 @@ outhist(Biobuf *b)
 }
 }
 
 
 void
 void
-zname(Biobuf *b, char *n, int t, int s)
+zname(Biobuf *b, Sym *s, int t)
 {
 {
-	char bf[3];
-
-	bf[0] = ANAME;
-	bf[1] = t;	/* type */
-	bf[2] = s;	/* sym */
-	Bwrite(b, bf, 3);
+	char *n, bf[7];
+	ulong sig;
+
+	n = s->name;
+	if(debug['T'] && t == D_EXTERN && s->sig != SIGDONE && s->type != types[TENUM] && s != symrathole){
+		sig = sign(s);
+		bf[0] = ASIGNAME;
+		bf[1] = sig;
+		bf[2] = sig>>8;
+		bf[3] = sig>>16;
+		bf[4] = sig>>24;
+		bf[5] = t;
+		bf[6] = s->sym;
+		Bwrite(b, bf, 7);
+		s->sig = SIGDONE;
+	}
+	else{
+		bf[0] = ANAME;
+		bf[1] = t;	/* type */
+		bf[2] = s->sym;	/* sym */
+		Bwrite(b, bf, 3);
+	}
 	Bwrite(b, n, strlen(n)+1);
 	Bwrite(b, n, strlen(n)+1);
 }
 }
 
 

+ 41 - 8
sys/src/cmd/5c/txt.c

@@ -170,7 +170,7 @@ garg1(Node *n, Node *tn1, Node *tn2, int f, Node **fnxp)
 			nod.left = *fnxp;
 			nod.left = *fnxp;
 			nod.right = n;
 			nod.right = n;
 			nod.type = n->type;
 			nod.type = n->type;
-			cgen(&nod, Z);
+			cgen(&nod, Z, 0);
 			(*fnxp)++;
 			(*fnxp)++;
 		}
 		}
 		return;
 		return;
@@ -187,18 +187,18 @@ garg1(Node *n, Node *tn1, Node *tn2, int f, Node **fnxp)
 	if(REGARG >= 0 && curarg == 0 && typechlp[n->type->etype]) {
 	if(REGARG >= 0 && curarg == 0 && typechlp[n->type->etype]) {
 		regaalloc1(tn1, n);
 		regaalloc1(tn1, n);
 		if(n->complex >= FNX) {
 		if(n->complex >= FNX) {
-			cgen(*fnxp, tn1);
+			cgen(*fnxp, tn1, 0);
 			(*fnxp)++;
 			(*fnxp)++;
 		} else
 		} else
-			cgen(n, tn1);
+			cgen(n, tn1, 0);
 		return;
 		return;
 	}
 	}
 	regalloc(tn1, n, Z);
 	regalloc(tn1, n, Z);
 	if(n->complex >= FNX) {
 	if(n->complex >= FNX) {
-		cgen(*fnxp, tn1);
+		cgen(*fnxp, tn1, 0);
 		(*fnxp)++;
 		(*fnxp)++;
 	} else
 	} else
-		cgen(n, tn1);
+		cgen(n, tn1, 0);
 	regaalloc(tn2, n);
 	regaalloc(tn2, n);
 	gopcode(OAS, tn1, Z, tn2);
 	gopcode(OAS, tn1, Z, tn2);
 	regfree(tn1);
 	regfree(tn1);
@@ -262,7 +262,7 @@ void
 regalloc(Node *n, Node *tn, Node *o)
 regalloc(Node *n, Node *tn, Node *o)
 {
 {
 	int i, j;
 	int i, j;
-	static lasti;
+	static int lasti;
 
 
 	switch(tn->type->etype) {
 	switch(tn->type->etype) {
 	case TCHAR:
 	case TCHAR:
@@ -609,10 +609,14 @@ gmove(Node *f, Node *t)
 			a = AMOVW;
 			a = AMOVW;
 			break;
 			break;
 		case TUCHAR:
 		case TUCHAR:
+			a = AMOVBU;
+			break;
 		case TCHAR:
 		case TCHAR:
 			a = AMOVB;
 			a = AMOVB;
 			break;
 			break;
 		case TUSHORT:
 		case TUSHORT:
+			a = AMOVHU;
+			break;
 		case TSHORT:
 		case TSHORT:
 			a = AMOVH;
 			a = AMOVH;
 			break;
 			break;
@@ -832,6 +836,36 @@ gmove(Node *f, Node *t)
 	gins(a, f, t);
 	gins(a, f, t);
 }
 }
 
 
+void
+gmover(Node *f, Node *t)
+{
+	int ft, tt, a;
+
+	ft = f->type->etype;
+	tt = t->type->etype;
+	a = AGOK;
+	if(typechlp[ft] && typechlp[tt] && ewidth[ft] >= ewidth[tt]){
+		switch(tt){
+		case TSHORT:
+			a = AMOVH;
+			break;
+		case TUSHORT:
+			a = AMOVHU;
+			break;
+		case TCHAR:
+			a = AMOVB;
+			break;
+		case TUCHAR:
+			a = AMOVBU;
+			break;
+		}
+	}
+	if(a == AGOK)
+		gmove(f, t);
+	else
+		gins(a, f, t);
+}
+
 void
 void
 gins(int a, Node *f, Node *t)
 gins(int a, Node *f, Node *t)
 {
 {
@@ -1098,7 +1132,6 @@ gpseudo(int a, Sym *s, Node *n)
 	p->as = a;
 	p->as = a;
 	p->from.type = D_OREG;
 	p->from.type = D_OREG;
 	p->from.sym = s;
 	p->from.sym = s;
-	p->reg = (profileflg ? 0 : NOPROF);
 	p->from.name = D_EXTERN;
 	p->from.name = D_EXTERN;
 	p->reg = (profileflg ? 0 : NOPROF);
 	p->reg = (profileflg ? 0 : NOPROF);
 	if(s->class == CSTATIC)
 	if(s->class == CSTATIC)
@@ -1150,7 +1183,7 @@ exreg(Type *t)
 	long o;
 	long o;
 
 
 	if(typechlp[t->etype]) {
 	if(typechlp[t->etype]) {
-		if(exregoffset <= NREG-1)
+		if(exregoffset <= REGEXT-4)
 			return 0;
 			return 0;
 		o = exregoffset;
 		o = exregoffset;
 		exregoffset--;
 		exregoffset--;

+ 44 - 16
sys/src/cmd/5l/asm.c

@@ -21,7 +21,7 @@ entryvalue(void)
 	case SLEAF:
 	case SLEAF:
 		break;
 		break;
 	case SDATA:
 	case SDATA:
-		if(reloc)
+		if(dlm)
 			return s->value+INITDAT;
 			return s->value+INITDAT;
 	default:
 	default:
 		diag("entry not text: %s", s->name);
 		diag("entry not text: %s", s->name);
@@ -88,6 +88,12 @@ asmb(void)
 		seek(cout, OFFSET, 0);
 		seek(cout, OFFSET, 0);
 		break;
 		break;
 	}
 	}
+	if(dlm){
+		char buf[8];
+
+		write(cout, buf, INITDAT-textsize);
+		textsize = INITDAT;
+	}
 	for(t = 0; t < datsize; t += sizeof(buf)-100) {
 	for(t = 0; t < datsize; t += sizeof(buf)-100) {
 		if(datsize-t > sizeof(buf)-100)
 		if(datsize-t > sizeof(buf)-100)
 			datblk(t, sizeof(buf)-100, 0);
 			datblk(t, sizeof(buf)-100, 0);
@@ -124,6 +130,13 @@ asmb(void)
 		Bflush(&bso);
 		Bflush(&bso);
 		if(!debug['s'])
 		if(!debug['s'])
 			asmlc();
 			asmlc();
+		if(dlm)
+			asmdyn();
+		cflush();
+	}
+	else if(dlm){
+		seek(cout, HEADR+textsize+datsize, 0);
+		asmdyn();
 		cflush();
 		cflush();
 	}
 	}
 
 
@@ -166,7 +179,10 @@ asmb(void)
 		lputl(0xe1a0f00e);		/* B (R14) - zero init return */
 		lputl(0xe1a0f00e);		/* B (R14) - zero init return */
 		break;
 		break;
 	case 2:	/* plan 9 */
 	case 2:	/* plan 9 */
-		lput(0x647);			/* magic */
+		if(dlm)
+			lput(0x80000000|0x647);	/* magic */
+		else
+			lput(0x647);			/* magic */
 		lput(textsize);			/* sizes */
 		lput(textsize);			/* sizes */
 		lput(datsize);
 		lput(datsize);
 		lput(bsssize);
 		lput(bsssize);
@@ -218,6 +234,18 @@ cput(int c)
 		cflush();
 		cflush();
 }
 }
 
 
+void
+wput(long l)
+{
+
+	cbp[0] = l>>8;
+	cbp[1] = l;
+	cbp += 2;
+	cbc -= 2;
+	if(cbc <= 0)
+		cflush();
+}
+
 void
 void
 lput(long l)
 lput(long l)
 {
 {
@@ -536,9 +564,9 @@ datblk(long s, long n, int str)
 			v = p->to.sym;
 			v = p->to.sym;
 			if(v) {
 			if(v) {
 				switch(v->type) {
 				switch(v->type) {
+				case SUNDEF:
+					ckoff(v, d);
 				case STEXT:
 				case STEXT:
-					if(v->value == -1)
-						undefsym(v);
 				case SLEAF:
 				case SLEAF:
 				case SSTRING:
 				case SSTRING:
 					d += p->to.sym->value;
 					d += p->to.sym->value;
@@ -547,8 +575,8 @@ datblk(long s, long n, int str)
 				case SBSS:
 				case SBSS:
 					d += p->to.sym->value + INITDAT;
 					d += p->to.sym->value + INITDAT;
 				}
 				}
-				if(reloc)
-					undefpc(a + INITDAT);
+				if(dlm)
+					dynreloc(v, a+INITDAT, 1);
 			}
 			}
 			cast = (char*)&d;
 			cast = (char*)&d;
 			switch(c) {
 			switch(c) {
@@ -657,10 +685,10 @@ PP = p;
 		v = -8;
 		v = -8;
 		if(p->cond == UP) {
 		if(p->cond == UP) {
 			s = p->to.sym;
 			s = p->to.sym;
-			if(s->value == -1)
-				undefsym(s);
-			v = s->value;
-			undefpc(p->pc);
+			if(s->type != SUNDEF)
+				diag("bad branch sym type");
+			v = (ulong)s->value >> (Roffset-2);
+			dynreloc(s, p->pc, 0);
 		}
 		}
 		else if(p->cond != P)
 		else if(p->cond != P)
 			v = (p->cond->pc - pc) - 8;
 			v = (p->cond->pc - pc) - 8;
@@ -721,14 +749,14 @@ PP = p;
 	case 11:	/* word */
 	case 11:	/* word */
 		switch(aclass(&p->to)) {
 		switch(aclass(&p->to)) {
 		case C_LCON:
 		case C_LCON:
-			if(!reloc)
+			if(!dlm)
 				break;
 				break;
 			if(p->to.name != D_EXTERN && p->to.name != D_STATIC)
 			if(p->to.name != D_EXTERN && p->to.name != D_STATIC)
 				break;
 				break;
 		case C_ADDR:
 		case C_ADDR:
-			if(p->to.offset < 0 || p->to.offset >= (1 << UIXSHIFT))
-				diag("reloc offset out of range: %s %ld", p->to.sym->name, p->to.offset);
-			undefpc(p->pc);
+			if(p->to.sym->type == SUNDEF)
+				ckoff(p->to.sym, p->to.offset);
+			dynreloc(p->to.sym, p->pc, 1);
 		}
 		}
 		o1 = instoffset;
 		o1 = instoffset;
 		break;
 		break;
@@ -1148,9 +1176,9 @@ PP = p;
 
 
 	case 63:	/* bcase */
 	case 63:	/* bcase */
 		if(p->cond != P) {
 		if(p->cond != P) {
-			if(reloc)
-				undefpc(p->pc);
 			o1 = p->cond->pc;
 			o1 = p->cond->pc;
+			if(dlm)
+				dynreloc(S, p->pc, 1);
 		}
 		}
 		break;
 		break;
 
 

+ 26 - 15
sys/src/cmd/5l/l.h

@@ -76,9 +76,15 @@ struct	Sym
 	short	version;
 	short	version;
 	short	become;
 	short	become;
 	short	frame;
 	short	frame;
+	uchar	subtype;
+	ushort	file;
 	long	value;
 	long	value;
+	long	sig;
 	Sym*	link;
 	Sym*	link;
 };
 };
+
+#define SIGNINTERN	(1729*325*1729)
+
 struct	Autom
 struct	Autom
 {
 {
 	Sym*	asym;
 	Sym*	asym;
@@ -119,6 +125,10 @@ enum
 	SFILE,
 	SFILE,
 	SCONST,
 	SCONST,
 	SSTRING,
 	SSTRING,
+	SUNDEF,
+
+	SIMPORT,
+	SEXPORT,
 
 
 	LFROM		= 1<<0,
 	LFROM		= 1<<0,
 	LTO		= 1<<1,
 	LTO		= 1<<1,
@@ -185,6 +195,9 @@ enum
 	NENT		= 100,
 	NENT		= 100,
 	MAXIO		= 8192,
 	MAXIO		= 8192,
 	MAXHIST		= 20,	/* limit of path elements for history symbols */
 	MAXHIST		= 20,	/* limit of path elements for history symbols */
+
+	Roffset	= 22,		/* no. bits for offset in relocation address */
+	Rindex	= 10,		/* no. bits for index in relocation address */
 };
 };
 
 
 EXTERN union
 EXTERN union
@@ -257,23 +270,14 @@ EXTERN	Prog	zprg;
 EXTERN	int	dtype;
 EXTERN	int	dtype;
 EXTERN	int	armv4;
 EXTERN	int	armv4;
 
 
-EXTERN	int	reloc;
-EXTERN	Adr*	reloca;
-EXTERN	long	relocv;
-EXTERN	char*	undefs;
-EXTERN	Sym**	undefv;
-EXTERN	int	undefn;
+EXTERN	int	doexp, dlm;
+EXTERN	int	imports, nimports;
+EXTERN	int	exports, nexports;
+EXTERN	char*	EXPTAB;
 EXTERN	Prog	undefp;
 EXTERN	Prog	undefp;
 
 
 #define	UP	(&undefp)
 #define	UP	(&undefp)
 
 
-enum
-{
-	UIXSHIFT	= 18,
-	UIXBITS		= 27 - UIXSHIFT,
-	UIXLIM		= 1 << UIXBITS,
-};
-
 extern	char*	anames[];
 extern	char*	anames[];
 extern	Optab	optab[];
 extern	Optab	optab[];
 
 
@@ -304,6 +308,7 @@ int	aclass(Adr*);
 void	addhist(long, int);
 void	addhist(long, int);
 void	append(Prog*, Prog*);
 void	append(Prog*, Prog*);
 void	asmb(void);
 void	asmb(void);
+void	asmdyn(void);
 void	asmlc(void);
 void	asmlc(void);
 void	asmout(Prog*, Optab*);
 void	asmout(Prog*, Optab*);
 void	asmsym(void);
 void	asmsym(void);
@@ -312,24 +317,29 @@ Prog*	brloop(Prog*);
 void	buildop(void);
 void	buildop(void);
 void	buildrep(int, int);
 void	buildrep(int, int);
 void	cflush(void);
 void	cflush(void);
+void	ckoff(Sym*, long);
 int	chipfloat(Ieee*);
 int	chipfloat(Ieee*);
 int	cmp(int, int);
 int	cmp(int, int);
 int	compound(Prog*);
 int	compound(Prog*);
 double	cputime(void);
 double	cputime(void);
 void	datblk(long, long, int);
 void	datblk(long, long, int);
 void	diag(char*, ...);
 void	diag(char*, ...);
+void	divsig(void);
 void	dodata(void);
 void	dodata(void);
 void	doprof1(void);
 void	doprof1(void);
 void	doprof2(void);
 void	doprof2(void);
+void	dynreloc(Sym*, long, int);
 long	entryvalue(void);
 long	entryvalue(void);
 void	errorexit(void);
 void	errorexit(void);
 void	exchange(Prog*);
 void	exchange(Prog*);
+void	export(void);
 int	find1(long, int);
 int	find1(long, int);
 void	follow(void);
 void	follow(void);
 void	gethunk(void);
 void	gethunk(void);
 void	histtoauto(void);
 void	histtoauto(void);
 double	ieeedtod(Ieee*);
 double	ieeedtod(Ieee*);
 long	ieeedtof(Ieee*);
 long	ieeedtof(Ieee*);
+void	import(void);
 int	isnop(Prog*);
 int	isnop(Prog*);
 void	ldobj(int, long, char*);
 void	ldobj(int, long, char*);
 void	loadlib(void);
 void	loadlib(void);
@@ -364,17 +374,18 @@ void	prepend(Prog*, Prog*);
 Prog*	prg(void);
 Prog*	prg(void);
 int	pseudo(Prog*);
 int	pseudo(Prog*);
 void	putsymb(char*, int, long, int);
 void	putsymb(char*, int, long, int);
-void	readundefs(void);
+void	readundefs(char*, int);
 long	regoff(Adr*);
 long	regoff(Adr*);
 int	relinv(int);
 int	relinv(int);
 long	rnd(long, long);
 long	rnd(long, long);
 void	span(void);
 void	span(void);
 void	strnput(char*, int);
 void	strnput(char*, int);
 void	undef(void);
 void	undef(void);
-void	undefpc(long);
 void	undefsym(Sym*);
 void	undefsym(Sym*);
+void	wput(long);
 void	xdefine(char*, int, long);
 void	xdefine(char*, int, long);
 void	xfol(Prog*);
 void	xfol(Prog*);
+void	zerosig(char*);
 void	noops(void);
 void	noops(void);
 long	immrot(ulong);
 long	immrot(ulong);
 long	immaddr(long);
 long	immaddr(long);

+ 42 - 18
sys/src/cmd/5l/noop.c

@@ -414,14 +414,41 @@ noops(void)
 	}
 	}
 }
 }
 
 
-static Sym *
+static void
+sigdiv(char *n)
+{
+	Sym *s;
+
+	s = lookup(n, 0);
+	if(s->type == STEXT){
+		if(s->sig == 0)
+			s->sig = SIGNINTERN;
+	}
+	else if(s->type == 0 || s->type == SXREF)
+		s->type = SUNDEF;
+}
+
+void
+divsig(void)
+{
+	sigdiv("_div");
+	sigdiv("_divu");
+	sigdiv("_mod");
+	sigdiv("_modu");
+}
+
+static void
 sdiv(Sym *s)
 sdiv(Sym *s)
 {
 {
-	if(s->type == STEXT)
-		undefsym(s);
-	else
+	if(s->type == 0 || s->type == SXREF){
+		/* undefsym(s); */
+		s->type = SXREF;
+		if(s->sig == 0)
+			s->sig = SIGNINTERN;
+		s->subtype = SIMPORT;
+	}
+	else if(s->type != STEXT)
 		diag("undefined: %s", s->name);
 		diag("undefined: %s", s->name);
-	return s;
 }
 }
 
 
 void
 void
@@ -430,20 +457,17 @@ initdiv(void)
 	Sym *s2, *s3, *s4, *s5;
 	Sym *s2, *s3, *s4, *s5;
 	Prog *p;
 	Prog *p;
 
 
-	s2 = lookup("_div", 0);
-	s3 = lookup("_divu", 0);
-	s4 = lookup("_mod", 0);
-	s5 = lookup("_modu", 0);
-	if(reloc) {
-		sym_div = sdiv(s2);
-		sym_divu = sdiv(s3);
-		sym_mod = sdiv(s4);
-		sym_modu = sdiv(s5);
-		prog_div = UP;
-		prog_divu = UP;
-		prog_mod = UP;
-		prog_modu = UP;
+	if(prog_div != P)
 		return;
 		return;
+	sym_div = s2 = lookup("_div", 0);
+	sym_divu = s3 = lookup("_divu", 0);
+	sym_mod = s4 = lookup("_mod", 0);
+	sym_modu = s5 = lookup("_modu", 0);
+	if(dlm) {
+		sdiv(s2); if(s2->type == SXREF) prog_div = UP;
+		sdiv(s3); if(s3->type == SXREF) prog_divu = UP;
+		sdiv(s4); if(s4->type == SXREF) prog_mod = UP;
+		sdiv(s5); if(s5->type == SXREF) prog_modu = UP;
 	}
 	}
 	for(p = firstp; p != P; p = p->link)
 	for(p = firstp; p != P; p = p->link)
 		if(p->as == ATEXT) {
 		if(p->as == ATEXT) {

+ 130 - 66
sys/src/cmd/5l/obj.c

@@ -19,6 +19,28 @@ char	*thestring 	= "arm";
  *	-H5 -T0xC0008010 -R1024		is ipaq
  *	-H5 -T0xC0008010 -R1024		is ipaq
  */
  */
 
 
+static int
+isobjfile(char *f)
+{
+	int n, v;
+	Biobuf *b;
+	char buf1[5], buf2[SARMAG];
+
+	b = Bopen(f, OREAD);
+	if(b == nil)
+		return 0;
+	n = Bread(b, buf1, 5);
+	if(n == 5 && (buf1[2] == 1 && buf1[3] == '<' || buf1[3] == 1 && buf1[4] == '<'))
+		v = 1;	/* good enough for our purposes */
+	else{
+		Bseek(b, 0, 0);
+		n = Bread(b, buf2, SARMAG);
+		v = n == SARMAG && strncmp(buf2, ARMAG, SARMAG) == 0;
+	}
+	Bterm(b);
+	return v;
+}
+
 void
 void
 main(int argc, char *argv[])
 main(int argc, char *argv[])
 {
 {
@@ -43,10 +65,6 @@ main(int argc, char *argv[])
 		if(c >= 0 && c < sizeof(debug))
 		if(c >= 0 && c < sizeof(debug))
 			debug[c]++;
 			debug[c]++;
 		break;
 		break;
-	case 'u':
-		debug['r'] = 1;
-		undefs = ARGF();
-		break;
 	case 'o':
 	case 'o':
 		outfile = ARGF();
 		outfile = ARGF();
 		break;
 		break;
@@ -76,6 +94,16 @@ main(int argc, char *argv[])
 			HEADTYPE = atolwhex(a);
 			HEADTYPE = atolwhex(a);
 		/* do something about setting INITTEXT */
 		/* do something about setting INITTEXT */
 		break;
 		break;
+	case 'x':	/* produce export table */
+		doexp = 1;
+		if(argv[1] != nil && argv[1][0] != '-' && !isobjfile(argv[1]))
+			readundefs(ARGF(), SEXPORT);
+		break;
+	case 'u':	/* produce dynamically loadable module */
+		dlm = 1;
+		if(argv[1] != nil && argv[1][0] != '-' && !isobjfile(argv[1]))
+			readundefs(ARGF(), SIMPORT);
+		break;
 	} ARGEND
 	} ARGEND
 
 
 	USED(argc);
 	USED(argc);
@@ -84,12 +112,6 @@ main(int argc, char *argv[])
 		diag("usage: 5l [-options] objects");
 		diag("usage: 5l [-options] objects");
 		errorexit();
 		errorexit();
 	}
 	}
-	if(!debug['9'] && debug['r']) {
-		if(INITTEXT == -1)
-			INITTEXT = 0x80000000;
-		if(INITRND == -1)
-			INITRND = 4;
-	}
 	if(!debug['9'] && !debug['U'] && !debug['B'])
 	if(!debug['9'] && !debug['U'] && !debug['B'])
 		debug[DEFAULT] = 1;
 		debug[DEFAULT] = 1;
 	if(HEADTYPE == -1) {
 	if(HEADTYPE == -1) {
@@ -203,10 +225,6 @@ main(int argc, char *argv[])
 	} else
 	} else
 		lookup(INITENTRY, 0)->type = SXREF;
 		lookup(INITENTRY, 0)->type = SXREF;
 
 
-	if(debug['r']) {
-		if(undefs)
-			readundefs();
-	}
 	while(*argv)
 	while(*argv)
 		objfile(*argv++);
 		objfile(*argv++);
 	if(!debug['l'])
 	if(!debug['l'])
@@ -214,7 +232,24 @@ main(int argc, char *argv[])
 	firstp = firstp->link;
 	firstp = firstp->link;
 	if(firstp == P)
 	if(firstp == P)
 		goto out;
 		goto out;
-	reloc = debug['r'];
+	if(doexp || dlm){
+		EXPTAB = "_exporttab";
+		zerosig(EXPTAB);
+		zerosig("etext");
+		zerosig("edata");
+		zerosig("end");
+		if(dlm){
+			initdiv();
+			import();
+			HEADTYPE = 2;
+			INITTEXT = INITDAT = 0;
+			INITRND = 8;
+			INITENTRY = EXPTAB;
+		}
+		else
+			divsig();
+		export();
+	}
 	patch();
 	patch();
 	if(debug['p'])
 	if(debug['p'])
 		if(debug['1'])
 		if(debug['1'])
@@ -669,6 +704,18 @@ ldobj(int f, long c, char *pn)
 	uchar *bloc, *bsize, *stop;
 	uchar *bloc, *bsize, *stop;
 	Sym *h[NSYM], *s, *di;
 	Sym *h[NSYM], *s, *di;
 	int v, o, r, skip;
 	int v, o, r, skip;
+	ulong sig;
+	static int files;
+	static char **filen;
+	char **nfilen;
+
+	if((files&15) == 0){
+		nfilen = malloc((files+16)*sizeof(char*));
+		memmove(nfilen, filen, files*sizeof(char*));
+		free(filen);
+		filen = nfilen;
+	}
+	filen[files++] = strdup(pn);
 
 
 	bsize = buf.xbuf;
 	bsize = buf.xbuf;
 	bloc = buf.xbuf;
 	bloc = buf.xbuf;
@@ -698,7 +745,13 @@ loop:
 		print("	probably not a .5 file\n");
 		print("	probably not a .5 file\n");
 		errorexit();
 		errorexit();
 	}
 	}
-	if(o == ANAME) {
+	if(o == ANAME || o == ASIGNAME) {
+		sig = 0;
+		if(o == ASIGNAME){
+			sig = bloc[1] | (bloc[2]<<8) | (bloc[3]<<16) | (bloc[4]<<24);
+			bloc += 4;
+			c -= 4;
+		}
 		stop = memchr(&bloc[3], 0, bsize-&bloc[3]);
 		stop = memchr(&bloc[3], 0, bsize-&bloc[3]);
 		if(stop == 0){
 		if(stop == 0){
 			bsize = readsome(f, buf.xbuf, bloc, bsize, c);
 			bsize = readsome(f, buf.xbuf, bloc, bsize, c);
@@ -723,6 +776,13 @@ loop:
 		c -= &stop[1] - bloc;
 		c -= &stop[1] - bloc;
 		bloc = stop + 1;
 		bloc = stop + 1;
 
 
+		if(sig != 0){
+			if(s->sig != 0 && s->sig != sig)
+				diag("incompatible type signatures %lux(%s) and %lux(%s) for %s", s->sig, filen[s->file], sig, pn, s->name);
+			s->sig = sig;
+			s->file = files-1;
+		}
+
 		if(debug['W'])
 		if(debug['W'])
 			print("	ANAME	%s\n", s->name);
 			print("	ANAME	%s\n", s->name);
 		h[o] = s;
 		h[o] = s;
@@ -1036,6 +1096,7 @@ lookup(char *symb, int v)
 	s->type = 0;
 	s->type = 0;
 	s->version = v;
 	s->version = v;
 	s->value = 0;
 	s->value = 0;
+	s->sig = 0;
 	hash[h] = s;
 	hash[h] = s;
 	return s;
 	return s;
 }
 }
@@ -1266,8 +1327,14 @@ nuxiinit(void)
 			inuxi1[i] = c;
 			inuxi1[i] = c;
 		inuxi4[i] = c;
 		inuxi4[i] = c;
 		fnuxi4[i] = c;
 		fnuxi4[i] = c;
-		fnuxi8[i] = c;
-		fnuxi8[i+4] = c+4;
+		if(debug['d'] == 0){
+			fnuxi8[i] = c;
+			fnuxi8[i+4] = c+4;
+		}
+		else{
+			fnuxi8[i] = c+4;		/* ms word first, then ls, even in little endian mode */
+			fnuxi8[i+4] = c;
+		}
 	}
 	}
 	if(debug['v']) {
 	if(debug['v']) {
 		Bprint(&bso, "inuxi = ");
 		Bprint(&bso, "inuxi = ");
@@ -1354,69 +1421,66 @@ ieeedtod(Ieee *ieeep)
 }
 }
 
 
 void
 void
-readundefs(void)
+undefsym(Sym *s)
 {
 {
-	int i, n, z;
-	Sym *s, **t;
-	char *l;
-	char buf[256];
-	char *fields[64];
+	int n;
+
+	n = imports;
+	if(s->value != 0)
+		diag("value != 0 on SXREF");
+	if(n >= 1<<Rindex)
+		diag("import index %d out of range", n);
+	s->value = n<<Roffset;
+	s->type = SUNDEF;
+	imports++;
+}
+
+void
+zerosig(char *sp)
+{
+	Sym *s;
+
+	s = lookup(sp, 0);
+	s->sig = 0;
+}
+
+void
+readundefs(char *f, int t)
+{
+	int i, n;
+	Sym *s;
 	Biobuf *b;
 	Biobuf *b;
+	char *l, buf[256], *fields[64];
 
 
-	b = Bopen(undefs, OREAD);
-	if(b == nil) {
-		diag("could not open %s: %r", undefs);
+	if(f == nil)
+		return;
+	b = Bopen(f, OREAD);
+	if(b == nil){
+		diag("could not open %s: %r", f);
 		errorexit();
 		errorexit();
 	}
 	}
-	z = 64;
-	undefv = malloc(z * sizeof(Sym *));
-	while((l = Brdline(b, '\n')) != nil) {
+	while((l = Brdline(b, '\n')) != nil){
 		n = Blinelen(b);
 		n = Blinelen(b);
-		if(n >= sizeof(buf)-1) {
-			diag("%s: line too long", undefs);
+		if(n >= sizeof(buf)){
+			diag("%s: line too long", f);
 			errorexit();
 			errorexit();
 		}
 		}
 		memmove(buf, l, n);
 		memmove(buf, l, n);
-		buf[n] = '\0';
+		buf[n-1] = '\0';
 		n = getfields(buf, fields, nelem(fields), 1, " \t\r\n");
 		n = getfields(buf, fields, nelem(fields), 1, " \t\r\n");
-		if(n == nelem(fields)) {
-			diag("%s: bad format", undefs);
+		if(n == nelem(fields)){
+			diag("%s: bad format", f);
 			errorexit();
 			errorexit();
 		}
 		}
 		for(i = 0; i < n; i++) {
 		for(i = 0; i < n; i++) {
 			s = lookup(fields[i], 0);
 			s = lookup(fields[i], 0);
-			s->type = STEXT;
-			s->value = -1;
-			if(undefn == z) {
-				z = 3 * z / 2;
-				t = malloc(z * sizeof(Sym *));
-				if(t == nil) {
-					diag("%s: no memory: %r", undefs);
-					errorexit();
-				}
-				memmove(t, undefv, undefn * sizeof(Sym *));
-				free(undefv);
-				undefv = t;
-			}
-			undefv[undefn++] = s;
+			s->type = SXREF;
+			s->subtype = t;
+			if(t == SIMPORT)
+				nimports++;
+			else
+				nexports++;
 		}
 		}
 	}
 	}
 	Bterm(b);
 	Bterm(b);
 }
 }
-
-void
-undefpc(long pc)
-{
-	Bprint(&bso, "%lx\n", pc & 0x7FFFFFFF);
-}
-
-void
-undefsym(Sym *s)
-{
-	static int uix;
-
-	Bprint(&bso, "s%s\n", s->name);
-	s->value = 0x80000000 | (++uix << UIXSHIFT);
-	if(uix >= UIXLIM)
-		diag("%s: too many undefs", s->name);
-}

+ 152 - 8
sys/src/cmd/5l/pass.c

@@ -298,21 +298,28 @@ patch(void)
 		if((a == ABL || a == AB || a == ARET) &&
 		if((a == ABL || a == AB || a == ARET) &&
 		   p->to.type != D_BRANCH && p->to.sym != S) {
 		   p->to.type != D_BRANCH && p->to.sym != S) {
 			s = p->to.sym;
 			s = p->to.sym;
-			if(s->type != STEXT) {
+			switch(s->type) {
+			default:
 				diag("undefined: %s\n%P", s->name, p);
 				diag("undefined: %s\n%P", s->name, p);
 				s->type = STEXT;
 				s->type = STEXT;
 				s->value = vexit;
 				s->value = vexit;
+				break;
+			case STEXT:
+				p->to.offset = s->value;
+				p->to.type = D_BRANCH;
+				break;
+			case SUNDEF:
+				if(p->as != ABL)
+					diag("help: SUNDEF in AB || ARET");
+				p->to.offset = 0;
+				p->to.type = D_BRANCH;
+				p->cond = UP;
+				break;
 			}
 			}
-			p->to.offset = s->value;
-			p->to.type = D_BRANCH;
 		}
 		}
-		if(p->to.type != D_BRANCH)
+		if(p->to.type != D_BRANCH || p->cond == UP)
 			continue;
 			continue;
 		c = p->to.offset;
 		c = p->to.offset;
-		if(reloc && p->as == ABL && c == -1) {
-			p->cond = UP;
-			continue;
-		}
 		for(q = firstp; q != P;) {
 		for(q = firstp; q != P;) {
 			if(q->forwd != P)
 			if(q->forwd != P)
 			if(c >= q->forwd->pc) {
 			if(c >= q->forwd->pc) {
@@ -449,3 +456,140 @@ rnd(long v, long r)
 	v -= c;
 	v -= c;
 	return v;
 	return v;
 }
 }
+
+void
+import(void)
+{
+	int i;
+	Sym *s;
+
+	for(i = 0; i < NHASH; i++)
+		for(s = hash[i]; s != S; s = s->link)
+			if(s->sig != 0 && s->type == SXREF && (nimports == 0 || s->subtype == SIMPORT)){
+				undefsym(s);
+				Bprint(&bso, "IMPORT: %s sig=%lux v=%ld\n", s->name, s->sig, s->value);
+			}
+}
+
+void
+ckoff(Sym *s, long v)
+{
+	if(v < 0 || v >= 1<<Roffset)
+		diag("relocation offset %ld for %s out of range", v, s->name);
+}
+
+static Prog*
+newdata(Sym *s, int o, int w, int t)
+{
+	Prog *p;
+
+	p = prg();
+	p->link = datap;
+	datap = p;
+	p->as = ADATA;
+	p->reg = w;
+	p->from.type = D_OREG;
+	p->from.name = t;
+	p->from.sym = s;
+	p->from.offset = o;
+	p->to.type = D_CONST;
+	p->to.name = D_NONE;
+	return p;
+}
+
+void
+export(void)
+{
+	int i, j, n, off, nb, sv, ne;
+	Sym *s, *et, *str, **esyms;
+	Prog *p;
+	char buf[NSNAME], *t;
+
+	n = 0;
+	for(i = 0; i < NHASH; i++)
+		for(s = hash[i]; s != S; s = s->link)
+			if(s->sig != 0 && s->type != SXREF && s->type != SUNDEF && (nexports == 0 || s->subtype == SEXPORT))
+				n++;
+	esyms = malloc(n*sizeof(Sym*));
+	ne = n;
+	n = 0;
+	for(i = 0; i < NHASH; i++)
+		for(s = hash[i]; s != S; s = s->link)
+			if(s->sig != 0 && s->type != SXREF && s->type != SUNDEF && (nexports == 0 || s->subtype == SEXPORT))
+				esyms[n++] = s;
+	for(i = 0; i < ne-1; i++)
+		for(j = i+1; j < ne; j++)
+			if(strcmp(esyms[i]->name, esyms[j]->name) > 0){
+				s = esyms[i];
+				esyms[i] = esyms[j];
+				esyms[j] = s;
+			}
+
+	nb = 0;
+	off = 0;
+	et = lookup(EXPTAB, 0);
+	if(et->type != 0 && et->type != SXREF)
+		diag("%s already defined", EXPTAB);
+	et->type = SDATA;
+	str = lookup(".string", 0);
+	if(str->type == 0)
+		str->type = SDATA;
+	sv = str->value;
+	for(i = 0; i < ne; i++){
+		s = esyms[i];
+		Bprint(&bso, "EXPORT: %s sig=%lux t=%d\n", s->name, s->sig, s->type);
+
+		/* signature */
+		p = newdata(et, off, sizeof(long), D_EXTERN);
+		off += sizeof(long);
+		p->to.offset = s->sig;
+
+		/* address */
+		p = newdata(et, off, sizeof(long), D_EXTERN);
+		off += sizeof(long);
+		p->to.name = D_EXTERN;
+		p->to.sym = s;
+
+		/* string */
+		t = s->name;
+		n = strlen(t)+1;
+		for(;;){
+			buf[nb++] = *t;
+			sv++;
+			if(nb >= NSNAME){
+				p = newdata(str, sv-NSNAME, NSNAME, D_STATIC);
+				p->to.type = D_SCONST;
+				p->to.sval = malloc(NSNAME);
+				memmove(p->to.sval, buf, NSNAME);
+				nb = 0;
+			}
+			if(*t++ == 0)
+				break;
+		}
+
+		/* name */
+		p = newdata(et, off, sizeof(long), D_EXTERN);
+		off += sizeof(long);
+		p->to.name = D_STATIC;
+		p->to.sym = str;
+		p->to.offset = sv-n;
+	}
+
+	if(nb > 0){
+		p = newdata(str, sv-nb, nb, D_STATIC);
+		p->to.type = D_SCONST;
+		p->to.sval = malloc(NSNAME);
+		memmove(p->to.sval, buf, nb);
+	}
+
+	for(i = 0; i < 3; i++){
+		newdata(et, off, sizeof(long), D_EXTERN);
+		off += sizeof(long);
+	}
+	et->value = off;
+	if(sv == 0)
+		sv = 1;
+	str->value = sv;
+	exports = ne;
+	free(esyms);
+}

+ 163 - 10
sys/src/cmd/5l/span.c

@@ -346,14 +346,13 @@ aclass(Adr *a)
 					s->name, TNAME);
 					s->name, TNAME);
 				s->type = SDATA;
 				s->type = SDATA;
 			}
 			}
-			if(reloc) {
+			if(dlm) {
 				switch(t) {
 				switch(t) {
 				default:
 				default:
 					instoffset = s->value + a->offset + INITDAT;
 					instoffset = s->value + a->offset + INITDAT;
 					break;
 					break;
+				case SUNDEF:
 				case STEXT:
 				case STEXT:
-					if(s->value == -1)
-						undefsym(s);
 				case SCONST:
 				case SCONST:
 				case SLEAF:
 				case SLEAF:
 				case SSTRING:
 				case SSTRING:
@@ -432,11 +431,8 @@ aclass(Adr *a)
 				s->type = SDATA;
 				s->type = SDATA;
 			}
 			}
 			instoffset = s->value + a->offset + INITDAT;
 			instoffset = s->value + a->offset + INITDAT;
-			if(s->type == STEXT || s->type == SLEAF) {
-				if(s->value == -1)
-					undefsym(s);
+			if(s->type == STEXT || s->type == SLEAF || s->type == SUNDEF)
 				instoffset = s->value + a->offset;
 				instoffset = s->value + a->offset;
-			}
 			return C_LCON;
 			return C_LCON;
 		}
 		}
 		return C_GOK;
 		return C_GOK;
@@ -473,16 +469,15 @@ aclass(Adr *a)
 					s->name, TNAME);
 					s->name, TNAME);
 				s->type = SDATA;
 				s->type = SDATA;
 				break;
 				break;
+			case SUNDEF:
 			case STEXT:
 			case STEXT:
-				if(s->value == -1)
-					undefsym(s);
 			case SSTRING:
 			case SSTRING:
 			case SCONST:
 			case SCONST:
 			case SLEAF:
 			case SLEAF:
 				instoffset = s->value + a->offset;
 				instoffset = s->value + a->offset;
 				return C_LCON;
 				return C_LCON;
 			}
 			}
-			if(!reloc) {
+			if(!dlm) {
 				instoffset = s->value + a->offset - BIG;
 				instoffset = s->value + a->offset - BIG;
 				t = immrot(instoffset);
 				t = immrot(instoffset);
 				if(t && instoffset != 0)
 				if(t && instoffset != 0)
@@ -742,6 +737,8 @@ buildop(void)
 			break;
 			break;
 		case AB:
 		case AB:
 		case ABL:
 		case ABL:
+		case ABX:
+		case ABXRET:
 		case ASWI:
 		case ASWI:
 		case AWORD:
 		case AWORD:
 		case AMOVM:
 		case AMOVM:
@@ -823,3 +820,159 @@ buildrep(int x, int as)
 	oprange[as].start = 0;
 	oprange[as].start = 0;
 }
 }
 */
 */
+
+enum{
+	ABSD = 0,
+	ABSU = 1,
+	RELD = 2,
+	RELU = 3,
+};
+
+int modemap[4] = { 0, 1, -1, 2, };
+
+typedef struct Reloc Reloc;
+
+struct Reloc
+{
+	int n;
+	int t;
+	uchar *m;
+	ulong *a;
+};
+
+Reloc rels;
+
+static void
+grow(Reloc *r)
+{
+	int t;
+	uchar *m, *nm;
+	ulong *a, *na;
+
+	t = r->t;
+	r->t += 64;
+	m = r->m;
+	a = r->a;
+	r->m = nm = malloc(r->t*sizeof(uchar));
+	r->a = na = malloc(r->t*sizeof(ulong));
+	memmove(nm, m, t*sizeof(uchar));
+	memmove(na, a, t*sizeof(ulong));
+	free(m);
+	free(a);
+}
+
+void
+dynreloc(Sym *s, long v, int abs)
+{
+	int i, k, n;
+	uchar *m;
+	ulong *a;
+	Reloc *r;
+
+	if(v&3)
+		diag("bad relocation address");
+	v >>= 2;
+	if(s != S && s->type == SUNDEF)
+		k = abs ? ABSU : RELU;
+	else
+		k = abs ? ABSD : RELD;
+	/* Bprint(&bso, "R %s a=%ld(%lx) %d\n", s->name, a, a, k); */
+	k = modemap[k];
+	r = &rels;
+	n = r->n;
+	if(n >= r->t)
+		grow(r);
+	m = r->m;
+	a = r->a;
+	for(i = n; i > 0; i--){
+		if(v < a[i-1]){	/* happens occasionally for data */
+			m[i] = m[i-1];
+			a[i] = a[i-1];
+		}
+		else
+			break;
+	}
+	m[i] = k;
+	a[i] = v;
+	r->n++;
+}
+
+static int
+sput(char *s)
+{
+	char *p;
+
+	p = s;
+	while(*s)
+		cput(*s++);
+	cput(0);
+	return  s-p+1;
+}
+
+void
+asmdyn()
+{
+	int i, n, t, c;
+	Sym *s;
+	ulong la, ra, *a;
+	vlong off;
+	uchar *m;
+	Reloc *r;
+
+	cflush();
+	off = seek(cout, 0, 1);
+	lput(0);
+	t = 0;
+	lput(imports);
+	t += 4;
+	for(i = 0; i < NHASH; i++)
+		for(s = hash[i]; s != S; s = s->link)
+			if(s->type == SUNDEF){
+				lput(s->sig);
+				t += 4;
+				t += sput(s->name);
+			}
+	
+	la = 0;
+	r = &rels;
+	n = r->n;
+	m = r->m;
+	a = r->a;
+	lput(n);
+	t += 4;
+	for(i = 0; i < n; i++){
+		ra = *a-la;
+		if(*a < la)
+			diag("bad relocation order");
+		if(ra < 256)
+			c = 0;
+		else if(ra < 65536)
+			c = 1;
+		else
+			c = 2;
+		cput((c<<6)|*m++);
+		t++;
+		if(c == 0){
+			cput(ra);
+			t++;
+		}
+		else if(c == 1){
+			wput(ra);
+			t += 2;
+		}
+		else{
+			lput(ra);
+			t += 4;
+		}
+		la = *a++;
+	}
+
+	cflush();
+	seek(cout, off, 0);
+	lput(t);
+
+	if(debug['v']){
+		Bprint(&bso, "import table entries = %d\n", imports);
+		Bprint(&bso, "export table entries = %d\n", exports);
+	}
+}

+ 0 - 205
sys/src/cmd/6a/a.h

@@ -1,205 +0,0 @@
-
-typedef	struct	Sym	Sym;
-typedef	struct	Ref	Ref;
-typedef	struct	Gen	Gen;
-typedef	struct	Io	Io;
-typedef	struct	Hist	Hist;
-typedef	struct	Gen2 	Gen2;
-
-#define	MAXALIGN	7
-#define	FPCHIP		1
-#define	NSYMB		500
-#define	BUFSIZ		8192
-#define	HISTSZ		20
-#define	NINCLUDE	10
-#define	NHUNK		10000
-#define	EOF		(-1)
-#define	IGN		(-2)
-#define	GETC()		((--fi.c < 0)? filbuf(): *fi.p++ & 0xff)
-#define	NHASH		503
-#define	STRINGSZ	200
-#define	NMACRO		10
-
-#define	ALLOC(lhs, type)\
-	while(nhunk < sizeof(type))\
-		gethunk();\
-	lhs = (type*)hunk;\
-	nhunk -= sizeof(type);\
-	hunk += sizeof(type);
-
-#define	ALLOCN(lhs, len, n)\
-	if(lhs+len != hunk || nhunk < n) {\
-		while(nhunk <= len)\
-			gethunk();\
-		memmove(hunk, lhs, len);\
-		lhs = hunk;\
-		hunk += len;\
-		nhunk -= len;\
-	}\
-	hunk += n;\
-	nhunk -= n;
-
-struct	Sym
-{
-	Sym*	link;
-	Ref*	ref;
-	char*	macro;
-	long	value;
-	ushort	type;
-	char	*name;
-	char	sym;
-};
-#define	S	((Sym*)0)
-
-struct	Ref
-{
-	int	class;
-};
-
-struct
-{
-	char*	p;
-	int	c;
-} fi;
-
-struct	Io
-{
-	Io*	link;
-	char	b[BUFSIZ];
-	char*	p;
-	short	c;
-	short	f;
-};
-#define	I	((Io*)0)
-
-struct
-{
-	Sym*	sym;
-	short	type;
-} h[NSYM];
-
-struct	Gen
-{
-	double	dval;
-	char	sval[8];
-	long	offset;
-	Sym*	sym;
-	uchar	type;
-	uchar	index;
-	uchar	scale;
-};
-struct	Gen2
-{
-	Gen	from;
-	Gen	to;
-	uchar	type;
-	long	offset;
-};
-
-struct	Hist
-{
-	Hist*	link;
-	char*	name;
-	long	line;
-	long	offset;
-};
-#define	H	((Hist*)0)
-
-enum
-{
-	CLAST,
-	CMACARG,
-	CMACRO,
-	CPREPROC,
-};
-
-char	debug[256];
-Sym*	hash[NHASH];
-char*	Dlist[30];
-int	nDlist;
-Hist*	ehist;
-int	newflag;
-Hist*	hist;
-char*	hunk;
-char*	include[NINCLUDE];
-Io*	iofree;
-Io*	ionext;
-Io*	iostack;
-long	lineno;
-int	nerrors;
-long	nhunk;
-int	ninclude;
-Gen	nullgen;
-char*	outfile;
-int	pass;
-char*	pathname;
-long	pc;
-int	peekc;
-int	sym;
-char	symb[NSYMB];
-int	thechar;
-char*	thestring;
-long	thunk;
-Biobuf	obuf;
-
-void	errorexit(void);
-void	pushio(void);
-void	newio(void);
-void	newfile(char*, int);
-Sym*	slookup(char*);
-Sym*	lookup(void);
-void	syminit(Sym*);
-long	yylex(void);
-int	getc(void);
-int	getnsc(void);
-void	unget(int);
-int	escchar(int);
-void	cinit(void);
-void	checkscale(int);
-void	pinit(char*);
-void	cclean(void);
-int	isreg(Gen*);
-void	outcode(int, Gen2*);
-void	outhist(void);
-void	zaddr(Gen*, int);
-void	zname(char*, int, int);
-void	ieeedtod(Ieee*, double);
-int	filbuf(void);
-Sym*	getsym(void);
-void	domacro(void);
-void	macund(void);
-void	macdef(void);
-void	macexpand(Sym*, char*);
-void	macinc(void);
-void	macprag(void);
-void	maclin(void);
-void	macif(int);
-void	macend(void);
-void	dodefine(char*);
-void	prfile(long);
-void	linehist(char*, int);
-void	gethunk(void);
-void	yyerror(char*, ...);
-int	yyparse(void);
-void	setinclude(char*);
-int	assemble(char*);
-
-/*
- *	system-dependent stuff from ../cc/compat.c
- */
-enum	/* keep in synch with ../cc/cc.h */
-{
-	Plan9	= 1<<0,
-	Unix	= 1<<1,
-	Windows	= 1<<2,
-};
-int	mywait(int*);
-int	mycreat(char*, int);
-int	systemtype(int);
-int	pathchar(void);
-char*	mygetwd(char*, int);
-int	myexec(char*, char*[]);
-int	mydup(int, int);
-int	myfork(void);
-int	mypipe(int*);
-void*	mysbrk(ulong);

+ 0 - 384
sys/src/cmd/6a/a.y

@@ -1,384 +0,0 @@
-%{
-#include <u.h>
-#include <libc.h>
-#include <bio.h>
-#include "../6c/6.out.h"
-#include "a.h"
-%}
-%union	{
-	Sym	*sym;
-	long	lval;
-	double	dval;
-	char	sval[8];
-	Gen	gen;
-	Gen2	gen2;
-}
-%left	'|'
-%left	'^'
-%left	'&'
-%left	'<' '>'
-%left	'+' '-'
-%left	'*' '/' '%'
-%token	<lval>	LTYPES LTYPED LTYPEB LTYPE1 LTYPE2
-%token	<lval>	LCONST LSP LFP LPC LSB LTYPEX
-%token	<lval>	LRREG LFREG
-%token	<dval>	LFCONST
-%token	<sval>	LSCONST
-%token	<sym>	LNAME LLAB LVAR
-%type	<lval>	con expr pointer offset reg
-%type	<gen>	addr
-%type	<gen>	imm nam
-%type	<gen2>	regs srrr2 drrr2 spec1 spec2
-%%
-prog:
-|	prog line
-
-line:
-	LLAB ':'
-	{
-		if($1->value != pc)
-			yyerror("redeclaration of %s", $1->name);
-		$1->value = pc;
-	}
-	line
-|	LNAME ':'
-	{
-		$1->type = LLAB;
-		$1->value = pc;
-	}
-	line
-|	';'
-|	inst ';'
-|	error ';'
-
-inst:
-	LNAME '=' expr
-	{
-		$1->type = LVAR;
-		$1->value = $3;
-	}
-|	LVAR '=' expr
-	{
-		if($1->value != $3)
-			yyerror("redeclaration of %s", $1->name);
-		$1->value = $3;
-	}
-|	LTYPEB regs	{ outcode($1, &$2); }
-|	LTYPES srrr2	{ outcode($1, &$2); }
-|	LTYPED drrr2	{ outcode($1, &$2); }
-|	LTYPE1 spec1	{ outcode($1, &$2); }
-|	LTYPE2 spec2	{ outcode($1, &$2); }
-
-
-srrr2:
-	regs
-|	addr
-	{
-		$$.from = $1;
-		$$.to = nullgen;
-		$$.type = D_NONE;
-	}
-
-drrr2:
-	regs
-|	addr
-	{
-		$$.from = nullgen;
-		$$.to = $1;
-		$$.type = D_NONE;
-	}
-
-regs:
-	comma
-	{
-		$$.from = nullgen;
-		$$.to = nullgen;
-		$$.type = D_NONE;
-	}
-|	addr ','
-	{
-		$$.from = $1;
-		$$.to = nullgen;
-		$$.type = D_NONE;
-	}
-|	',' addr
-	{
-		$$.from = nullgen;
-		$$.to = $2;
-		$$.type = D_NONE;
-	}
-|	addr ',' addr
-	{
-		$$.from = $1;
-		$$.to = $3;
-		$$.type = D_NONE;
-	}
-|	addr ',' reg ',' addr
-	{
-		$$.from = $1;
-		$$.to = $5;
-		$$.type = $3;
-	}
-
-spec1:	/* DATA */
-	addr '/' con ',' imm
-	{
-		$$.from = $1;
-		$$.from.scale = $3;
-		$$.to = $5;
-		$$.type = D_NONE;
-	}
-
-spec2:	/* SHL/SHR/MOV */
-	regs
-|	regs ':' LRREG
-	{
-		$$ = $1;
-		if($$.from.index != D_NONE)
-			yyerror("dp shift with lhs index");
-		$$.from.index = $3;
-	}
-
-addr:
-	reg
-	{
-		$$ = nullgen;
-		$$.type = $1;
-	}
-|	con
-	{
-		$$ = nullgen;
-		$$.type = D_INDIR+D_NONE;
-		$$.offset = $1;
-	}
-|	con '(' LRREG ')'
-	{
-		$$ = nullgen;
-		$$.type = D_INDIR+$3;
-		$$.offset = $1;
-	}
-|	con '(' LSP ')'
-	{
-		$$ = nullgen;
-		$$.type = D_INDIR+REGSP;
-		$$.offset = $1;
-	}
-|	con '(' LRREG '*' con ')'
-	{
-		$$ = nullgen;
-		$$.type = D_INDIR+D_NONE;
-		$$.offset = $1;
-		$$.index = $3;
-		$$.scale = $5;
-		checkscale($$.scale);
-	}
-|	con '(' LRREG ')' '(' LRREG '*' con ')'
-	{
-		$$ = nullgen;
-		$$.type = D_INDIR+$3;
-		$$.offset = $1;
-		$$.index = $6;
-		$$.scale = $8;
-		checkscale($$.scale);
-	}
-|	'(' LRREG ')'
-	{
-		$$ = nullgen;
-		$$.type = D_INDIR+$2;
-	}
-|	'(' LSP ')'
-	{
-		$$ = nullgen;
-		$$.type = D_INDIR+REGSP;
-	}
-|	'(' LRREG '*' con ')'
-	{
-		$$ = nullgen;
-		$$.type = D_INDIR+D_NONE;
-		$$.index = $2;
-		$$.scale = $4;
-		checkscale($$.scale);
-	}
-|	'(' LRREG ')' '(' LRREG '*' con ')'
-	{
-		$$ = nullgen;
-		$$.type = D_INDIR+$2;
-		$$.index = $5;
-		$$.scale = $7;
-		checkscale($$.scale);
-	}
-|	nam
-	{
-		$$ = $1;
-	}
-|	nam '(' LRREG '*' con ')'
-	{
-		$$ = $1;
-		$$.index = $3;
-		$$.scale = $5;
-		checkscale($$.scale);
-	}
-|	con '(' LPC ')'
-	{
-		$$ = nullgen;
-		$$.type = D_BRANCH;
-		$$.offset = $1 + pc;
-	}
-|	LNAME offset
-	{
-		$$ = nullgen;
-		if(pass == 2)
-			yyerror("undefined label: %s", $1->name);
-		$$.type = D_BRANCH;
-		$$.sym = $1;
-		$$.offset = $2;
-	}
-|	LLAB offset
-	{
-		$$ = nullgen;
-		$$.type = D_BRANCH;
-		$$.sym = $1;
-		$$.offset = $1->value + $2;
-	}
-|	imm
-
-imm:
-	'$' con
-	{
-		$$ = nullgen;
-		$$.type = D_CONST;
-		$$.offset = $2;
-	}
-|	'$' nam
-	{
-		$$ = $2;
-		$$.index = $2.type;
-		$$.type = D_ADDR;
-		if($2.type == D_AUTO || $2.type == D_PARAM)
-			yyerror("constant cannot be automatic: %s",
-				$2.sym->name);
-	}
-|	'$' LSCONST
-	{
-		$$ = nullgen;
-		$$.type = D_SCONST;
-		memcpy($$.sval, $2, sizeof($$.sval));
-	}
-|	'$' LFCONST
-	{
-		$$ = nullgen;
-		$$.type = D_FCONST;
-		$$.dval = $2;
-	}
-|	'$' '-' LFCONST
-	{
-		$$ = nullgen;
-		$$.type = D_FCONST;
-		$$.dval = -$3;
-	}
-reg:
-	LRREG
-|	LFREG
-
-nam:
-	LNAME offset '(' pointer ')'
-	{
-		$$ = nullgen;
-		$$.type = $4;
-		$$.sym = $1;
-		$$.offset = $2;
-	}
-|	LNAME '<' '>' offset '(' LSB ')'
-	{
-		$$ = nullgen;
-		$$.type = D_STATIC;
-		$$.sym = $1;
-		$$.offset = $4;
-	}
-
-offset:
-	{
-		$$ = 0;
-	}
-|	'+' con
-	{
-		$$ = $2;
-	}
-|	'-' con
-	{
-		$$ = -$2;
-	}
-
-pointer:
-	LSB
-|	LSP
-|	LFP
-
-con:
-	LCONST
-|	LVAR
-	{
-		$$ = $1->value;
-	}
-|	'-' con
-	{
-		$$ = -$2;
-	}
-|	'+' con
-	{
-		$$ = $2;
-	}
-|	'~' con
-	{
-		$$ = ~$2;
-	}
-|	'(' expr ')'
-	{
-		$$ = $2;
-	}
-
-expr:
-	con
-|	expr '+' expr
-	{
-		$$ = $1 + $3;
-	}
-|	expr '-' expr
-	{
-		$$ = $1 - $3;
-	}
-|	expr '*' expr
-	{
-		$$ = $1 * $3;
-	}
-|	expr '/' expr
-	{
-		$$ = $1 / $3;
-	}
-|	expr '%' expr
-	{
-		$$ = $1 % $3;
-	}
-|	expr '<' '<' expr
-	{
-		$$ = $1 << $4;
-	}
-|	expr '>' '>' expr
-	{
-		$$ = $1 >> $4;
-	}
-|	expr '&' expr
-	{
-		$$ = $1 & $3;
-	}
-|	expr '^' expr
-	{
-		$$ = $1 ^ $3;
-	}
-|	expr '|' expr
-	{
-		$$ = $1 | $3;
-	}
-
-comma:
-	| ','

+ 0 - 10
sys/src/cmd/6a/l.s

@@ -1,10 +0,0 @@
-	TEXT	main+0(SB),$44
-	MOV	$0,i+-4(SP)
-	MOV	i+-4(SP),R0
-	ADDO	$1,R0
-	MOV	R0,i+-4(SP)
-	MOV	$10,R0
-	MOV	i+-4(SP),R1
-	MOV	i+-4(SP),R0
-	MOV	$0,a+-44(SP)(R0*4)
-	RTS	,

+ 0 - 643
sys/src/cmd/6a/lex.c

@@ -1,643 +0,0 @@
-#include <u.h>
-#include <libc.h>
-#include <ctype.h>
-#include <bio.h>
-#include "../6c/6.out.h"
-#include "a.h"
-#include "y.tab.h"
-
-void
-main(int argc, char *argv[])
-{
-	char *p;
-	int nout, nproc, status, i, c;
-
-	thechar = '6';
-	thestring = "960";
-	memset(debug, 0, sizeof(debug));
-	cinit();
-	outfile = 0;
-	include[ninclude++] = ".";
-	ARGBEGIN {
-	default:
-		c = ARGC();
-		if(c >= 0 || c < sizeof(debug))
-			debug[c] = 1;
-		break;
-
-	case 'o':
-		outfile = ARGF();
-		break;
-
-	case 'D':
-		p = ARGF();
-		if(p)
-			Dlist[nDlist++] = p;
-		break;
-
-	case 'I':
-		p = ARGF();
-		setinclude(p);
-		break;
-	} ARGEND
-	if(*argv == 0) {
-		print("usage: %ca [-options] file.s\n", thechar);
-		errorexit();
-	}
-	if(argc > 1 && systemtype(Windows)){
-		print("can't assemble multiple files on windows\n");
-		errorexit();
-	}
-	if(argc > 1 && !systemtype(Windows)) {
-		nproc = 1;
-		if(p = getenv("NPROC"))
-			nproc = atol(p);	/* */
-		c = 0;
-		nout = 0;
-		for(;;) {
-			while(nout < nproc && argc > 0) {
-				i = myfork();
-				if(i < 0) {
-					i = mywait(&status);
-					if(i < 0)
-						errorexit();
-					if(status)
-						c++;
-					nout--;
-					continue;
-				}
-				if(i == 0) {
-					print("%s:\n", *argv);
-					if(assemble(*argv))
-						errorexit();
-					exits(0);
-				}
-				nout++;
-				argc--;
-				argv++;
-			}
-			i = mywait(&status);
-			if(i < 0) {
-				if(c)
-					errorexit();
-				exits(0);
-			}
-			if(status)
-				c++;
-			nout--;
-		}
-	}
-	if(assemble(argv[0]))
-		errorexit();
-	exits(0);
-}
-int
-assemble(char *file)
-{
-	char ofile[100], incfile[20], *p;
-	int i, of;
-
-	strcpy(ofile, file);
-	p = utfrrune(ofile, pathchar());
-	if(p) {
-		include[0] = ofile;
-		*p++ = 0;
-	} else
-		p = ofile;
-	if(outfile == 0) {
-		outfile = p;
-		if(outfile){
-			p = utfrrune(outfile, '.');
-			if(p)
-				if(p[1] == 's' && p[2] == 0)
-					p[0] = 0;
-			p = utfrune(outfile, 0);
-			p[0] = '.';
-			p[1] = thechar;
-			p[2] = 0;
-		} else
-			outfile = "/dev/null";
-	}
-	p = getenv("INCLUDE");
-	if(p) {
-		setinclude(p);
-	} else {
-		if(systemtype(Plan9)) {
-			sprint(incfile,"/%s/include", thestring);
-			setinclude(strdup(incfile));
-		}
-	}
-
-	of = mycreat(outfile, 0664);
-	if(of < 0) {
-		yyerror("%ca: cannot create %s", thechar, outfile);
-		errorexit();
-	}
-	Binit(&obuf, of, OWRITE);
-
-	pass = 1;
-	pinit(file);
-	for(i=0; i<nDlist; i++)
-		dodefine(Dlist[i]);
-	yyparse();
-	if(nerrors) {
-		cclean();
-		return nerrors;
-	}
-
-	pass = 2;
-	outhist();
-	pinit(file);
-	for(i=0; i<nDlist; i++)
-		dodefine(Dlist[i]);
-	yyparse();
-	cclean();
-	return nerrors;
-}
-
-struct
-{
-	char	*name;
-	ushort	type;
-	ushort	value;
-} itab[] =
-{
-	"SP",		LSP,	D_AUTO,
-	"SB",		LSB,	D_EXTERN,
-	"FP",		LFP,	D_PARAM,
-	"PC",		LPC,	D_BRANCH,
-
-	"R0",		LRREG,	D_R0+0,			/* 960 pfp, r0 */
-	"R1",		LRREG,	D_R0+1,			/* 960 sp, r1 */
-	"R2",		LRREG,	D_R0+2,			/* 960 rip, r2 */
-	"R3",		LRREG,	D_R0+3,
-	"R4",		LRREG,	D_R0+4,
-	"R5",		LRREG,	D_R0+5,
-	"R6",		LRREG,	D_R0+6,
-	"R7",		LRREG,	D_R0+7,
-	"R8",		LRREG,	D_R0+8,
-	"R9",		LRREG,	D_R0+9,
-	"R10",		LRREG,	D_R0+10,
-	"R11",		LRREG,	D_R0+11,
-	"R12",		LRREG,	D_R0+12,
-	"R13",		LRREG,	D_R0+13,
-	"R14",		LRREG,	D_R0+14,
-	"R15",		LRREG,	D_R0+15,
-	"R16",		LRREG,	D_R0+16,		/* g0 */
-	"R17",		LRREG,	D_R0+17,
-	"R18",		LRREG,	D_R0+18,
-	"R19",		LRREG,	D_R0+19,
-	"R20",		LRREG,	D_R0+20,
-	"R21",		LRREG,	D_R0+21,
-	"R22",		LRREG,	D_R0+22,
-	"R23",		LRREG,	D_R0+23,
-	"R24",		LRREG,	D_R0+24,
-	"R25",		LRREG,	D_R0+25,
-	"R26",		LRREG,	D_R0+26,
-	"R27",		LRREG,	D_R0+27,
-	"R28",		LRREG,	D_R0+28,		/* static register */
-	"R29",		LRREG,	D_R0+29,		/* stack register */
-	"R30",		LRREG,	D_R0+30,		/* link register */
-	"R31",		LRREG,	D_R0+31,		/* 960 fp, g15 */
-
-	"DATA",		LTYPE1,	ADATA,
-
-	"ADJSP",	LTYPEX,	AADJSP,
-	"SYSCALL",	LTYPEX,	ASYSCALL,
-	"CALL",		LTYPEX, ACALL,
-	"CALLS",	LTYPEX, ACALLS,
-
-	"GLOBL",	LTYPEB,	AGLOBL,
-	"TEXT",		LTYPEB,	ATEXT,
-	"LONG",		LTYPES,	ALONG,
-	"NOP",		LTYPES,	ANOP,
-	"RTS",		LTYPEB,	ARTS,
-
-	"ADDC",		LTYPEB, AADDC,
-	"ADDI",		LTYPEB, AADDI,
-	"ADDO",		LTYPEB, AADDO,
-	"ALTERBIT",	LTYPEB, AALTERBIT,
-	"AND",		LTYPEB, AAND,
-	"ANDNOT",	LTYPEB, AANDNOT,
-	"ATADD",	LTYPEB, AATADD,
-	"ATMOD",	LTYPEB, AATMOD,
-	"B",		LTYPED, AB,
-	"BAL",		LTYPED, ABAL,
-	"BBC",		LTYPED, ABBC,
-	"BBS",		LTYPED, ABBS,
-	"BE",		LTYPED, ABE,
-	"BG",		LTYPED, ABG,
-	"BGE",		LTYPED, ABGE,
-	"BL",		LTYPED, ABL,
-	"BLE",		LTYPED, ABLE,
-	"BNE",		LTYPED, ABNE,
-	"BNO",		LTYPED, ABNO,
-	"BO",		LTYPED, ABO,
-	"CHKBIT",	LTYPEB, ACHKBIT,
-	"CLRBIT",	LTYPEB, ACLRBIT,
-	"CMPDECI",	LTYPEB, ACMPDECI,
-	"CMPDECO",	LTYPEB, ACMPDECO,
-	"CMPI",		LTYPEB, ACMPI,
-	"CMPIBE",	LTYPEB, ACMPIBE,
-	"CMPIBG",	LTYPEB, ACMPIBG,
-	"CMPIBGE",	LTYPEB, ACMPIBGE,
-	"CMPIBL",	LTYPEB, ACMPIBL,
-	"CMPIBLE",	LTYPEB, ACMPIBLE,
-	"CMPIBNE",	LTYPEB, ACMPIBNE,
-	"CMPIBNO",	LTYPEB, ACMPIBNO,
-	"CMPIBO",	LTYPEB, ACMPIBO,
-	"CMPINCI",	LTYPEB, ACMPINCI,
-	"CMPINCO",	LTYPEB, ACMPINCO,
-	"CMPO",		LTYPEB, ACMPO,
-	"CMPOBE",	LTYPEB, ACMPOBE,
-	"CMPOBG",	LTYPEB, ACMPOBG,
-	"CMPOBGE",	LTYPEB, ACMPOBGE,
-	"CMPOBL",	LTYPEB, ACMPOBL,
-	"CMPOBLE",	LTYPEB, ACMPOBLE,
-	"CMPOBNE",	LTYPEB, ACMPOBNE,
-	"CONCMPI",	LTYPEB, ACONCMPI,
-	"CONCMPO",	LTYPEB, ACONCMPO,
-	"DADDC",	LTYPEB, ADADDC,
-	"DIVI",		LTYPEB, ADIVI,
-	"DIVO",		LTYPEB, ADIVO,
-	"DMOVT",	LTYPEB, ADMOVT,
-	"DSUBC",	LTYPEB, ADSUBC,
-	"EDIV",		LTYPEB, AEDIV,
-	"EMUL",		LTYPEB, AEMUL,
-	"EXTRACT",	LTYPEB, AEXTRACT,
-	"FAULTE",	LTYPEB, AFAULTE,
-	"FAULTG",	LTYPEB, AFAULTG,
-	"FAULTGE",	LTYPEB, AFAULTGE,
-	"FAULTL",	LTYPEB, AFAULTL,
-	"FAULTLE",	LTYPEB, AFAULTLE,
-	"FAULTNE",	LTYPEB, AFAULTNE,
-	"FAULTNO",	LTYPEB, AFAULTNO,
-	"FAULTO",	LTYPEB, AFAULTO,
-	"FLUSHREG",	LTYPEB, AFLUSHREG,
-	"FMARK",	LTYPEB, AFMARK,
-	"MARK",		LTYPEB, AMARK,
-	"MODAC",	LTYPEB, AMODAC,
-	"MODI",		LTYPEB, AMODI,
-	"MODIFY",	LTYPEB, AMODIFY,
-	"MODPC",	LTYPEB, AMODPC,
-	"MODTC",	LTYPEB, AMODTC,
-	"MOV",		LTYPEB, AMOV,
-	"MOVA",		LTYPEB, AMOVA,
-	"MOVIB",	LTYPEB, AMOVIB,
-	"MOVIS",	LTYPEB, AMOVIS,
-	"MOVOB",	LTYPEB, AMOVOB,
-	"MOVOS",	LTYPEB, AMOVOS,
-	"MOVQ",		LTYPEB, AMOVQ,
-	"MOVT",		LTYPEB, AMOVT,
-	"MOVV",		LTYPEB, AMOVV,
-	"MULI",		LTYPEB, AMULI,
-	"MULO",		LTYPEB, AMULO,
-	"NAND",		LTYPEB, ANAND,
-	"NOR",		LTYPEB, ANOR,
-	"NOT",		LTYPEB, ANOT,
-	"NOTAND",	LTYPEB, ANOTAND,
-	"NOTBIT",	LTYPEB, ANOTBIT,
-	"NOTOR",	LTYPEB, ANOTOR,
-	"OR",		LTYPEB, AOR,
-	"ORNOT",	LTYPEB, AORNOT,
-	"REMI",		LTYPEB, AREMI,
-	"REMO",		LTYPEB, AREMO,
-	"RET",		LTYPEB, ARET,
-	"ROTATE",	LTYPEB, AROTATE,
-	"SCANBIT",	LTYPEB, ASCANBIT,
-	"SCANBYTE",	LTYPEB, ASCANBYTE,
-	"SETBIT",	LTYPEB, ASETBIT,
-	"SHLI",		LTYPEB, ASHLI,
-	"SHLO",		LTYPEB, ASHLO,
-	"SHRDI",	LTYPEB, ASHRDI,
-	"SHRI",		LTYPEB, ASHRI,
-	"SHRO",		LTYPEB, ASHRO,
-	"SPANBIT",	LTYPEB, ASPANBIT,
-	"SUBC",		LTYPEB, ASUBC,
-	"SUBI",		LTYPEB, ASUBI,
-	"SUBO",		LTYPEB, ASUBO,
-	"SYNCF",	LTYPEB, ASYNCF,
-	"SYNMOV",	LTYPEB, ASYNMOV,
-	"SYNMOVQ",	LTYPEB, ASYNMOVQ,
-	"SYNMOVV",	LTYPEB, ASYNMOVV,
-	"SYSCTL",	LTYPEB,	ASYSCTL,
-	"END",		LTYPEB,	AEND,
-	"TESTE",	LTYPED, ATESTE,
-	"TESTG",	LTYPED, ATESTG,
-	"TESTGE",	LTYPED, ATESTGE,
-	"TESTL",	LTYPED, ATESTL,
-	"TESTLE",	LTYPED, ATESTLE,
-	"TESTNE",	LTYPED, ATESTNE,
-	"TESTNO",	LTYPED, ATESTNO,
-	"TESTO",	LTYPED, ATESTO,
-	"XNOR",		LTYPEB, AXNOR,
-	"XOR",		LTYPEB, AXOR,
-
-	0
-};
-
-void
-cinit(void)
-{
-	Sym *s;
-	int i;
-
-	nullgen.sym = S;
-	nullgen.offset = 0;
-	if(FPCHIP)
-		nullgen.dval = 0;
-	for(i=0; i<sizeof(nullgen.sval); i++)
-		nullgen.sval[i] = 0;
-	nullgen.type = D_NONE;
-	nullgen.index = D_NONE;
-	nullgen.scale = 0;
-
-	nerrors = 0;
-	iostack = I;
-	iofree = I;
-	peekc = IGN;
-	nhunk = 0;
-	for(i=0; i<NHASH; i++)
-		hash[i] = S;
-	for(i=0; itab[i].name; i++) {
-		s = slookup(itab[i].name);
-		if(s->type != LNAME)
-			yyerror("double initialization %s", itab[i].name);
-		s->type = itab[i].type;
-		s->value = itab[i].value;
-	}
-
-	ALLOCN(pathname, 0, 100);
-	if(getwd(pathname, 99) == 0) {
-		ALLOCN(pathname, 100, 900);
-		if(getwd(pathname, 999) == 0)
-			strcpy(pathname, "/???");
-	}
-}
-
-void
-checkscale(int scale)
-{
-
-	switch(scale) {
-	case 1:
-	case 2:
-	case 4:
-	case 8:
-	case 16:
-		return;
-	}
-	yyerror("scale must be 1<<[01234]: %d", scale);
-}
-
-void
-syminit(Sym *s)
-{
-
-	s->type = LNAME;
-	s->value = 0;
-}
-
-void
-cclean(void)
-{
-	Gen2 g2;
-
-	g2.from = nullgen;
-	g2.to = nullgen;
-	outcode(AEND, &g2);
-	Bflush(&obuf);
-}
-
-void
-zname(char *n, int t, int s)
-{
-
-	Bputc(&obuf, ANAME);	/* as */
-	Bputc(&obuf, t);		/* type */
-	Bputc(&obuf, s);		/* sym */
-	while(*n) {
-		Bputc(&obuf, *n);
-		n++;
-	}
-	Bputc(&obuf, 0);
-}
-
-void
-zaddr(Gen *a, int s)
-{
-	long l;
-	int i, t;
-	char *n;
-	Ieee e;
-
-	t = 0;
-	if(a->index != D_NONE || a->scale != 0)
-		t |= T_INDEX;
-	if(s != 0)
-		t |= T_SYM;
-
-	switch(a->type) {
-	default:
-		t |= T_TYPE;
-	case D_NONE:
-		if(a->offset != 0)
-			t |= T_OFFSET;
-		break;
-	case D_FCONST:
-		t |= T_FCONST;
-		break;
-	case D_SCONST:
-		t |= T_SCONST;
-		break;
-	}
-	Bputc(&obuf, t);
-
-	if(t & T_INDEX) {	/* implies index, scale */
-		Bputc(&obuf, a->index);
-		Bputc(&obuf, a->scale);
-	}
-	if(t & T_OFFSET) {	/* implies offset */
-		l = a->offset;
-		Bputc(&obuf, l);
-		Bputc(&obuf, l>>8);
-		Bputc(&obuf, l>>16);
-		Bputc(&obuf, l>>24);
-	}
-	if(t & T_SYM)		/* implies sym */
-		Bputc(&obuf, s);
-	if(t & T_FCONST) {
-		ieeedtod(&e, a->dval);
-		l = e.l;
-		Bputc(&obuf, l);
-		Bputc(&obuf, l>>8);
-		Bputc(&obuf, l>>16);
-		Bputc(&obuf, l>>24);
-		l = e.h;
-		Bputc(&obuf, l);
-		Bputc(&obuf, l>>8);
-		Bputc(&obuf, l>>16);
-		Bputc(&obuf, l>>24);
-		return;
-	}
-	if(t & T_SCONST) {
-		n = a->sval;
-		for(i=0; i<NSNAME; i++) {
-			Bputc(&obuf, *n);
-			n++;
-		}
-		return;
-	}
-	if(t & T_TYPE)
-		Bputc(&obuf, a->type);
-}
-
-void
-outcode(int a, Gen2 *g2)
-{
-	int sf, st, t;
-	Sym *s;
-
-	if(pass == 1)
-		goto out;
-
-jackpot:
-	sf = 0;
-	s = g2->from.sym;
-	while(s != S) {
-		sf = s->sym;
-		if(sf < 0 || sf >= NSYM)
-			sf = 0;
-		t = g2->from.type;
-		if(t == D_ADDR)
-			t = g2->from.index;
-		if(h[sf].type == t)
-		if(h[sf].sym == s)
-			break;
-		zname(s->name, t, sym);
-		s->sym = sym;
-		h[sym].sym = s;
-		h[sym].type = t;
-		sf = sym;
-		sym++;
-		if(sym >= NSYM)
-			sym = 1;
-		break;
-	}
-	st = 0;
-	s = g2->to.sym;
-	while(s != S) {
-		st = s->sym;
-		if(st < 0 || st >= NSYM)
-			st = 0;
-		t = g2->to.type;
-		if(t == D_ADDR)
-			t = g2->to.index;
-		if(h[st].type == t)
-		if(h[st].sym == s)
-			break;
-		zname(s->name, t, sym);
-		s->sym = sym;
-		h[sym].sym = s;
-		h[sym].type = t;
-		st = sym;
-		sym++;
-		if(sym >= NSYM)
-			sym = 1;
-		if(st == sf)
-			goto jackpot;
-		break;
-	}
-	Bputc(&obuf, a);
-	Bputc(&obuf, lineno);
-	Bputc(&obuf, lineno>>8);
-	Bputc(&obuf, lineno>>16);
-	Bputc(&obuf, lineno>>24);
-	switch(t = g2->type) {
-	case D_NONE:
-		t = 0;			/* 0 D_NONE */
-		break;
-
-	default:
-		if(t < D_R0 || t >= D_R0+32) {
-			yyerror("bad type in outcode: %d", t);
-			t = D_R0;
-		}
-		t = (t - D_R0) + 1;	/* 1-32 D_R0+ */
-		break;
-
-	case D_CONST:
-		t = g2->offset;
-		if(t >= 32) {
-			yyerror("bad offset in outcode", t);
-			t = 0;
-		}
-		t = (t - 0) + 33;	/* 33-64 D_CONST+ */
-		break;
-	}
-	Bputc(&obuf, t);
-	zaddr(&g2->from, sf);
-	zaddr(&g2->to, st);
-
-out:
-	if(a != AGLOBL && a != ADATA)
-		pc++;
-}
-
-void
-outhist(void)
-{
-	Gen g;
-	Hist *h;
-	char *p, *q, *op;
-	int n;
-
-	g = nullgen;
-	for(h = hist; h != H; h = h->link) {
-		p = h->name;
-		op = 0;
-		if(p && p[0] != '/' && h->offset == 0 && pathname && pathname[0] == '/') {
-			op = p;
-			p = pathname;
-		}
-		while(p) {
-			q = strchr(p, '/');
-			if(q) {
-				n = q-p;
-				if(n == 0)
-					n = 1;	/* leading "/" */
-				q++;
-			} else {
-				n = strlen(p);
-				q = 0;
-			}
-			if(n) {
-				Bputc(&obuf, ANAME);
-				Bputc(&obuf, D_FILE);	/* type */
-				Bputc(&obuf, 1);	/* sym */
-				Bputc(&obuf, '<');
-				Bwrite(&obuf, p, n);
-				Bputc(&obuf, 0);
-			}
-			p = q;
-			if(p == 0 && op) {
-				p = op;
-				op = 0;
-			}
-		}
-		g.offset = h->offset;
-
-		Bputc(&obuf, AHISTORY);
-		Bputc(&obuf, h->line);
-		Bputc(&obuf, h->line>>8);
-		Bputc(&obuf, h->line>>16);
-		Bputc(&obuf, h->line>>24);
-		Bputc(&obuf, 0);			/* reg */
-		zaddr(&nullgen, 0);
-		zaddr(&g, 0);
-	}
-}
-
-#include "../cc/lexbody"
-#include "../cc/macbody"
-#include "../cc/compat"

+ 0 - 28
sys/src/cmd/6a/main9.s

@@ -1,28 +0,0 @@
-	TEXT	_main(SB), $-4
-
-	MOV	$setSB(SB), R28
-	SUBO	R3, R3
-	MOV	$0x10000, R29
-
-	BAL	main(SB)
-	BAL	exits(SB)
-	B	0(PC)
-
-	TEXT	exits(SB), $0
-	LONG	$0x66003e00
-	LONG	$0x66003f80
-	LONG	$0xfeedface
-	B	0(PC)
-
-	TEXT	sysctl(SB),$0
-	MOV	n+0(FP),R4
-	MOV	n+4(FP),R5
-	MOV	n+8(FP),R6
-	SYSCTL	R4,R5,R6
-	RTS
-
-	TEXT	modpc(SB), $0
-	MOV	n+0(FP),R5
-	MOV	n+4(FP),R4
-	MODPC	R5, R5, R4
-	RTS

+ 0 - 19
sys/src/cmd/6a/mkfile

@@ -1,19 +0,0 @@
-</$objtype/mkfile
-
-TARG=6a
-OFILES=\
-	y.tab.$O\
-	lex.$O\
-
-HFILES=\
-	../6c/6.out.h\
-	y.tab.h\
-	a.h\
-
-YFILES=a.y
-
-BIN=/$objtype/bin
-< /sys/src/cmd/mkone
-YFLAGS=-D1 -d
-
-lex.$O:	../cc/macbody ../cc/lexbody ../cc/compat

+ 0 - 203
sys/src/cmd/6c/6.out.h

@@ -1,203 +0,0 @@
-#define	NSYM	50
-#define	NSNAME	8
-
-enum	as
-{
-	AXXX,
-	AADJSP,
-	ABYTE,
-	ADATA,
-	AGLOBL,
-	AGOK,
-	AHISTORY,
-	ALONG,
-	ANAME,
-	ANOP,
-	ARTS,
-	ATEXT,
-	ASYSCALL,
-	ASYSCTL,
-
-	AMOV,
-	AMOVA,
-	AMOVIB,
-	AMOVIS,
-	AMOVOB,
-	AMOVOS,
-	AMOVQ,
-	AMOVT,
-	AMOVV,
-
-	ASYNMOV,
-	ASYNMOVV,
-	ASYNMOVQ,
-
-	AADDC,
-	AADDI,
-	AADDO,
-	AALTERBIT,
-	AAND,
-	AANDNOT,
-	AATADD,
-	AATMOD,
-	ABAL,
-	AB,
-	ABBC,
-	ABBS,
-	ABE,
-	ABNE,
-	ABL,
-	ABLE,
-	ABG,
-	ABGE,
-	ABO,
-	ABNO,
-	ACALL,
-	ACALLS,
-	ACHKBIT,
-	ACLRBIT,
-	ACMPI,
-	ACMPO,
-	ACMPDECI,
-	ACMPDECO,
-	ACMPINCI,
-	ACMPINCO,
-	ACMPIBE,
-	ACMPIBNE,
-	ACMPIBL,
-	ACMPIBLE,
-	ACMPIBG,
-	ACMPIBGE,
-	ACMPIBO,
-	ACMPIBNO,
-	ACMPOBE,
-	ACMPOBNE,
-	ACMPOBL,
-	ACMPOBLE,
-	ACMPOBG,
-	ACMPOBGE,
-	ACONCMPI,
-	ACONCMPO,
-	ADADDC,
-	ADIVI,
-	ADIVO,
-	ADMOVT,
-	ADSUBC,
-	AEDIV,
-	AEMUL,
-	AEXTRACT,
-	AFAULTE,
-	AFAULTNE,
-	AFAULTL,
-	AFAULTLE,
-	AFAULTG,
-	AFAULTGE,
-	AFAULTO,
-	AFAULTNO,
-	AFLUSHREG,
-	AFMARK,
-	AMARK,
-	AMODAC,
-	AMODI,
-	AMODIFY,
-	AMODPC,
-	AMODTC,
-	AMULI,
-	AMULO,
-	ANAND,
-	ANOR,
-	ANOT,
-	ANOTAND,
-	ANOTBIT,
-	ANOTOR,
-	AOR,
-	AORNOT,
-	AREMI,
-	AREMO,
-	ARET,
-	AROTATE,
-	ASCANBIT,
-	ASCANBYTE,
-	ASETBIT,
-	ASHLO,
-	ASHRO,
-	ASHLI,
-	ASHRI,
-	ASHRDI,
-	ASPANBIT,
-	ASUBC,
-	ASUBI,
-	ASUBO,
-	ASYNCF,
-	ATESTE,
-	ATESTNE,
-	ATESTL,
-	ATESTLE,
-	ATESTG,
-	ATESTGE,
-	ATESTO,
-	ATESTNO,
-	AXNOR,
-	AXOR,
-
-	AEND,
-};
-
-enum
-{
-	D_R0		= 0,
-
-	D_NONE		= D_R0+32,
-
-	D_BRANCH,
-	D_EXTERN,
-	D_STATIC,
-	D_AUTO,
-	D_PARAM,
-	D_CONST,
-	D_FCONST,
-	D_SCONST,
-	D_ADDR,
-
-	D_FILE,
-	D_FILE1,
-
-	D_INDIR,	/* additive */
-
-	T_TYPE		= 1<<0,
-	T_INDEX		= 1<<1,
-	T_OFFSET	= 1<<2,
-	T_FCONST	= 1<<3,
-	T_SYM		= 1<<4,
-	T_SCONST	= 1<<5,
-
-	REGARG		= 0,
-	REGZERO		= D_R0+3,
-	REGRET		= D_R0+4,
-	REGTMP		= D_R0+27,
-	REGSB		= D_R0+28,
-	REGSP		= D_R0+29,
-	REGLINK		= D_R0+30,
-
-	REGBAD1		= D_R0+0,	/* pfp */
-	REGBAD2		= D_R0+1,	/* sp */
-	REGBAD3		= D_R0+2,	/* rip */
-	REGBAD4		= D_R0+31,	/* fp */
-};
-
-/*
- * this is the ranlib header
- */
-#define	SYMDEF	"__.SYMDEF"
-
-/*
- * this is the simulated IEEE floating point
- */
-typedef	struct	ieee	Ieee;
-struct	ieee
-{
-	long	l;	/* contains ls-man	0xffffffff */
-	long	h;	/* contains sign	0x80000000
-				    exp		0x7ff00000
-				    ms-man	0x000fffff */
-};

+ 0 - 126
sys/src/cmd/6c/bits.c

@@ -1,126 +0,0 @@
-#include "gc.h"
-
-/*
-Bits
-bor(Bits a, Bits b)
-{
-	Bits c;
-	int i;
-
-	for(i=0; i<BITS; i++)
-		c.b[i] = a.b[i] | b.b[i];
-	return c;
-}
-*/
-
-/*
-Bits
-band(Bits a, Bits b)
-{
-	Bits c;
-	int i;
-
-	for(i=0; i<BITS; i++)
-		c.b[i] = a.b[i] & b.b[i];
-	return c;
-}
-*/
-
-/*
-Bits
-bnot(Bits a)
-{
-	Bits c;
-	int i;
-
-	for(i=0; i<BITS; i++)
-		c.b[i] = ~a.b[i];
-	return c;
-}
-*/
-
-int
-bany(Bits *a)
-{
-	int i;
-
-	for(i=0; i<BITS; i++)
-		if(a->b[i])
-			return 1;
-	return 0;
-}
-
-/*
-int
-beq(Bits a, Bits b)
-{
-	int i;
-
-	for(i=0; i<BITS; i++)
-		if(a.b[i] != b.b[i])
-			return 0;
-	return 1;
-}
-*/
-
-int
-bnum(Bits a)
-{
-	int i;
-	long b;
-
-	for(i=0; i<BITS; i++)
-		if(b = a.b[i])
-			return 32*i + bitno(b);
-	diag(Z, "bad in bnum");
-	return 0;
-}
-
-Bits
-blsh(unsigned n)
-{
-	Bits c;
-
-	c = zbits;
-	c.b[n/32] = 1L << (n%32);
-	return c;
-}
-
-/*
-int
-bset(Bits a, unsigned n)
-{
-	int i;
-
-	if(a.b[n/32] & (1L << (n%32)))
-		return 1;
-	return 0;
-}
-*/
-
-int
-Bconv(va_list *arg, Fconv *fp)
-{
-	char str[STRINGSZ], ss[STRINGSZ], *s;
-	Bits bits;
-	int i;
-
-	str[0] = 0;
-	bits = va_arg(*arg, Bits);
-	while(bany(&bits)) {
-		i = bnum(bits);
-		if(str[0])
-			strcat(str, " ");
-		if(var[i].sym == S) {
-			sprint(ss, "$%ld", var[i].offset);
-			s = ss;
-		} else
-			s = var[i].sym->name;
-		if(strlen(str) + strlen(s) + 1 >= STRINGSZ)
-			break;
-		strcat(str, s);
-		bits.b[i/32] &= ~(1L << (i%32));
-	}
-	strconv(str, fp);
-	return 0;
-}

+ 0 - 1001
sys/src/cmd/6c/cgen.c

@@ -1,1001 +0,0 @@
-#include "gc.h"
-
-void
-cgen(Node *n, Node *nn)
-{
-	Node *l, *r;
-	Prog *p1;
-	Node nod, nod1, nod2;
-	int o;
-	long v, curs;
-
-	if(debug['g']) {
-		prtree(nn, "cgen lhs");
-		prtree(n, "cgen");
-	}
-	if(n == Z || n->type == T)
-		return;
-	if(typesu[n->type->etype]) {
-		sugen(n, nn, n->type->width);
-		return;
-	}
-	l = n->left;
-	r = n->right;
-	o = n->op;
-	if(n->addable >= INDEXED) {
-		if(nn == Z) {
-			switch(o) {
-			default:
-				nullwarn(Z, Z);
-				break;
-			case OINDEX:
-				nullwarn(l, r);
-				break;
-			}
-			return;
-		}
-		gmove(n, nn);
-		return;
-	}
-	curs = cursafe;
-
-	if(n->complex >= FNX)
-	if(l->complex >= FNX)
-	if(r != Z && r->complex >= FNX)
-	switch(o) {
-	default:
-		regret(&nod, r);
-		cgen(r, &nod);
-
-		regsalloc(&nod1, r);
-		gmove(&nod, &nod1);
-
-		regfree(&nod);
-		nod = *n;
-		nod.right = &nod1;
-
-		cgen(&nod, nn);
-		return;
-
-	case OFUNC:
-	case OCOMMA:
-	case OANDAND:
-	case OOROR:
-	case OCOND:
-	case ODOT:
-		break;
-	}
-
-	switch(o) {
-	default:
-		diag(n, "unknown op in cgen: %O", o);
-		break;
-
-	case OAS:
-		if(typefd[n->type->etype]) {
-			diag(n, "no floating");
-			return;
-		}
-		if(l->op == OBIT)
-			goto bitas;
-		if(l->addable >= INDEXED) {
-			if(nn != Z || r->addable < INDEXED) {
-				if(r->complex >= FNX && nn == Z)
-					regret(&nod, r);
-				else
-					regalloc(&nod, r, nn);
-				cgen(r, &nod);
-				gmove(&nod, l);
-				if(nn != Z)
-					gmove(&nod, nn);
-				regfree(&nod);
-			} else
-				gmove(r, l);
-			break;
-		}
-		if(l->complex >= r->complex) {
-			reglcgen(&nod1, l, Z);
-			if(r->addable >= INDEXED) {
-				gmove(r, &nod1);
-				if(nn != Z)
-					gmove(r, nn);
-				regfree(&nod1);
-				break;
-			}
-			regalloc(&nod, r, nn);
-			cgen(r, &nod);
-		} else {
-			regalloc(&nod, r, nn);
-			cgen(r, &nod);
-			reglcgen(&nod1, l, Z);
-		}
-		gmove(&nod, &nod1);
-		regfree(&nod);
-		regfree(&nod1);
-		break;
-
-	bitas:
-		n = l->left;
-		regalloc(&nod, r, nn);
-		if(l->complex >= r->complex) {
-			reglcgen(&nod1, n, Z);
-			cgen(r, &nod);
-		} else {
-			cgen(r, &nod);
-			reglcgen(&nod1, n, Z);
-		}
-		regalloc(&nod2, n, Z);
-		gopcode(OAS, &nod1, Z, &nod2);
-		bitstore(l, &nod, &nod1, &nod2, nn);
-		break;
-
-	case OBIT:
-		if(nn == Z) {
-			nullwarn(l, Z);
-			break;
-		}
-		bitload(n, &nod, Z, Z, nn);
-		gmove(&nod, nn);
-		regfree(&nod);
-		break;
-
-	case OLSHR:
-	case OASHL:
-	case OASHR:
-	case OADD:
-	case OSUB:
-	case OOR:
-	case OXOR:
-	case OAND:
-		/*
-		 * immediate operands
-		 */
-		if(nn != Z)
-		if(r->op == OCONST)
-		if(!typefd[n->type->etype]) {
-			cgen(l, nn);
-			if(r->vconst == 0)
-			if(o != OAND)
-				break;
-			if(nn != Z)
-				gopcode(o, r, Z, nn);
-			break;
-		}
-
-	case OLMOD:
-	case OMOD:
-	case OLMUL:
-	case OLDIV:
-	case OMUL:
-	case ODIV:
-		if(nn == Z) {
-			nullwarn(l, r);
-			break;
-		}
-		if(typefd[n->type->etype])
-			goto fop;
-		if(l->complex >= r->complex) {
-			regalloc(&nod, l, nn);
-			cgen(l, &nod);
-			regalloc(&nod1, r, Z);
-			cgen(r, &nod1);
-			gopcode(o, &nod1, Z, &nod);
-		} else {
-			regalloc(&nod1, r, nn);
-			cgen(r, &nod1);
-			regalloc(&nod, l, Z);
-			cgen(l, &nod);
-			gopcode(o, &nod1, Z, &nod);
-		}
-		gmove(&nod, nn);
-		regfree(&nod);
-		regfree(&nod1);
-		break;
-
-	case OASLSHR:
-	case OASASHL:
-	case OASASHR:
-	case OASAND:
-	case OASADD:
-	case OASSUB:
-	case OASXOR:
-	case OASOR:
-	case OASLMUL:
-	case OASLDIV:
-	case OASLMOD:
-	case OASMUL:
-	case OASDIV:
-	case OASMOD:
-		if(typefd[n->type->etype])
-			goto asfop;
-		if(l->complex >= r->complex) {
-			if(l->addable < INDEXED)
-				reglcgen(&nod2, l, Z);
-			else
-				nod2 = *l;
-			regalloc(&nod1, r, Z);
-			cgen(r, &nod1);
-		} else {
-			regalloc(&nod1, r, Z);
-			cgen(r, &nod1);
-			if(l->addable < INDEXED)
-				reglcgen(&nod2, l, Z);
-			else
-				nod2 = *l;
-		}
-
-		regalloc(&nod, n, nn);
-		gmove(&nod2, &nod);
-		gopcode(o, &nod1, Z, &nod);
-		gmove(&nod, &nod2);
-		if(nn != Z)
-			gmove(&nod, nn);
-		regfree(&nod);
-		regfree(&nod1);
-		if(l->addable < INDEXED)
-			regfree(&nod2);
-		break;
-
-	fop:
-		diag(n, "no floating");
-		break;
-
-	asfop:
-		diag(n, "no floating");
-		break;
-
-	case OADDR:
-		if(nn == Z) {
-			nullwarn(l, Z);
-			break;
-		}
-		lcgen(l, nn);
-		break;
-
-	case OFUNC:
-		if(l->complex >= FNX) {
-			if(l->op != OIND)
-				diag(n, "bad function call");
-
-			regret(&nod, l->left);
-			cgen(l->left, &nod);
-			regsalloc(&nod1, l->left);
-			gmove(&nod, &nod1);
-			regfree(&nod);
-
-			nod = *n;
-			nod.left = &nod2;
-			nod2 = *l;
-			nod2.left = &nod1;
-			nod2.complex = 1;
-			cgen(&nod, nn);
-
-			return;
-		}
-		gargs(r, &nod, &nod1);
-		if(l->addable < INDEXED) {
-			reglcgen(&nod, l, nn);
-			gopcode(OFUNC, Z, Z, &nod);
-			regfree(&nod);
-		} else
-			gopcode(OFUNC, Z, Z, l);
-		if(REGARG && reg[REGARG])
-			reg[REGARG]--;
-		if(nn != Z) {
-			regret(&nod, n);
-			gmove(&nod, nn);
-			regfree(&nod);
-		}
-		break;
-
-	case OIND:
-		if(nn == Z) {
-			nullwarn(l, Z);
-			break;
-		}
-		regialloc(&nod, n, nn);
-		r = l;
-		while(r->op == OADD)
-			r = r->right;
-		if(sconst(r)) {
-			v = r->vconst;
-			r->vconst = 0;
-			cgen(l, &nod);
-			nod.xoffset += v;
-			r->vconst = v;
-		} else
-			cgen(l, &nod);
-		regind(&nod, n);
-		gmove(&nod, nn);
-		regfree(&nod);
-		break;
-
-	case OEQ:
-	case ONE:
-	case OLE:
-	case OLT:
-	case OGE:
-	case OGT:
-	case OLO:
-	case OLS:
-	case OHI:
-	case OHS:
-		if(nn == Z) {
-			nullwarn(l, r);
-			break;
-		}
-		boolgen(n, 1, nn);
-		break;
-
-	case OANDAND:
-	case OOROR:
-		boolgen(n, 1, nn);
-		if(nn == Z)
-			patch(p, pc);
-		break;
-
-	case ONOT:
-		if(nn == Z) {
-			nullwarn(l, Z);
-			break;
-		}
-		boolgen(n, 1, nn);
-		break;
-
-	case OCOMMA:
-		cgen(l, Z);
-		cgen(r, nn);
-		break;
-
-	case OCAST:
-		if(nn == Z) {
-			nullwarn(l, Z);
-			break;
-		}
-		/*
-		 * convert from types l->n->nn
-		 */
-		if(nocast(l->type, n->type) && nocast(n->type, nn->type)) {
-			/* both null, gen l->nn */
-			cgen(l, nn);
-			break;
-		}
-		regalloc(&nod, l, nn);
-		cgen(l, &nod);
-		regalloc(&nod1, n, &nod);
-		gmove(&nod, &nod1);
-		gmove(&nod1, nn);
-		regfree(&nod1);
-		regfree(&nod);
-		break;
-
-	case ODOT:
-		sugen(l, nodrat, l->type->width);
-		if(nn != Z) {
-			warn(n, "non-interruptable temporary");
-			nod = *nodrat;
-			if(!r || r->op != OCONST) {
-				diag(n, "DOT and no offset");
-				break;
-			}
-			nod.xoffset += r->vconst;
-			nod.type = n->type;
-			cgen(&nod, nn);
-		}
-		break;
-
-	case OCOND:
-		bcgen(l, 1);
-		p1 = p;
-		cgen(r->left, nn);
-		gbranch(OGOTO);
-		patch(p1, pc);
-		p1 = p;
-		cgen(r->right, nn);
-		patch(p1, pc);
-		break;
-
-	case OPOSTINC:
-	case OPOSTDEC:
-		v = 1;
-		if(l->type->etype == TIND)
-			v = l->type->link->width;
-		if(o == OPOSTDEC)
-			v = -v;
-		if(l->op == OBIT)
-			goto bitinc;
-		if(nn == Z)
-			goto pre;
-
-		if(l->addable < INDEXED)
-			reglcgen(&nod2, l, Z);
-		else
-			nod2 = *l;
-
-		regalloc(&nod, l, nn);
-		gmove(&nod2, &nod);
-		regalloc(&nod1, l, Z);
-		if(typefd[l->type->etype]) {
-			diag(n, "no floating");
-		} else
-			gopcode(OADD, nodconst(v), &nod, &nod1);
-		gmove(&nod1, &nod2);
-
-		regfree(&nod);
-		regfree(&nod1);
-		if(l->addable < INDEXED)
-			regfree(&nod2);
-		break;
-
-	case OPREINC:
-	case OPREDEC:
-		v = 1;
-		if(l->type->etype == TIND)
-			v = l->type->link->width;
-		if(o == OPREDEC)
-			v = -v;
-		if(l->op == OBIT)
-			goto bitinc;
-
-	pre:
-		if(l->addable < INDEXED)
-			reglcgen(&nod2, l, Z);
-		else
-			nod2 = *l;
-
-		regalloc(&nod, l, nn);
-		gmove(&nod2, &nod);
-		if(typefd[l->type->etype]) {
-			diag(n, "no floating");
-		} else
-			gopcode(OADD, nodconst(v), Z, &nod);
-		gmove(&nod, &nod2);
-
-		regfree(&nod);
-		if(l->addable < INDEXED)
-			regfree(&nod2);
-		break;
-
-	bitinc:
-		if(nn != Z && (o == OPOSTINC || o == OPOSTDEC))
-			diag(n, "botch");
-		bitload(l, &nod, &nod1, &nod2, nn);
-		gopcode(OADD, nodconst(v), Z, &nod);
-		bitstore(l, &nod, &nod1, &nod2, nn);
-		break;
-	}
-	cursafe = curs;
-}
-
-void
-reglcgen(Node *t, Node *n, Node *nn)
-{
-	Node *r;
-	long v;
-
-	regialloc(t, n, nn);
-	if(n->op == OIND) {
-		r = n->left;
-		while(r->op == OADD)
-			r = r->right;
-		if(sconst(r)) {
-			v = r->vconst;
-			r->vconst = 0;
-			lcgen(n, t);
-			t->xoffset += v;
-			r->vconst = v;
-			regind(t, n);
-			return;
-		}
-	}
-	lcgen(n, t);
-	regind(t, n);
-}
-
-void
-lcgen(Node *n, Node *nn)
-{
-	Prog *p1;
-	Node nod;
-
-	if(debug['g']) {
-		prtree(nn, "lcgen lhs");
-		prtree(n, "lcgen");
-	}
-	if(n == Z || n->type == T)
-		return;
-	if(nn == Z) {
-		nn = &nod;
-		regalloc(&nod, n, Z);
-	}
-	switch(n->op) {
-	default:
-		if(n->addable < INDEXED) {
-			diag(n, "unknown op in lcgen: %O", n->op);
-			break;
-		}
-		gopcode(OADDR, n, Z, nn);
-		break;
-
-	case OCOMMA:
-		cgen(n->left, n->left);
-		lcgen(n->right, nn);
-		break;
-
-	case OIND:
-		cgen(n->left, nn);
-		break;
-
-	case OCOND:
-		bcgen(n->left, 1);
-		p1 = p;
-		lcgen(n->right->left, nn);
-		gbranch(OGOTO);
-		patch(p1, pc);
-		p1 = p;
-		lcgen(n->right->right, nn);
-		patch(p1, pc);
-		break;
-	}
-}
-
-void
-bcgen(Node *n, int true)
-{
-
-	if(n->type == T)
-		gbranch(OGOTO);
-	else
-		boolgen(n, true, Z);
-}
-
-void
-boolgen(Node *n, int true, Node *nn)
-{
-	int o;
-	Prog *p1, *p2;
-	Node *l, *r, nod, nod1;
-	long curs;
-
-	if(debug['g']) {
-		prtree(nn, "boolgen lhs");
-		prtree(n, "boolgen");
-	}
-	curs = cursafe;
-	l = n->left;
-	r = n->right;
-	switch(n->op) {
-
-	default:
-		regalloc(&nod, n, nn);
-		cgen(n, &nod);
-		o = ONE;
-		if(true)
-			o = comrel[relindex(o)];
-		if(typefd[n->type->etype]) {
-			diag(n, "no floating");
-		} else
-			gopcode(o, &nod, Z, nodconst(0L));
-		regfree(&nod);
-		goto com;
-
-	case OCONST:
-		o = vconst(n);
-		if(!true)
-			o = !o;
-		gbranch(OGOTO);
-		if(o) {
-			p1 = p;
-			gbranch(OGOTO);
-			patch(p1, pc);
-		}
-		goto com;
-
-	case OCOMMA:
-		cgen(l, Z);
-		boolgen(r, true, nn);
-		break;
-
-	case ONOT:
-		boolgen(l, !true, nn);
-		break;
-
-	case OCOND:
-		bcgen(l, 1);
-		p1 = p;
-		bcgen(r->left, true);
-		p2 = p;
-		gbranch(OGOTO);
-		patch(p1, pc);
-		p1 = p;
-		bcgen(r->right, !true);
-		patch(p2, pc);
-		p2 = p;
-		gbranch(OGOTO);
-		patch(p1, pc);
-		patch(p2, pc);
-		goto com;
-
-	case OANDAND:
-		if(!true)
-			goto caseor;
-
-	caseand:
-		bcgen(l, true);
-		p1 = p;
-		bcgen(r, !true);
-		p2 = p;
-		patch(p1, pc);
-		gbranch(OGOTO);
-		patch(p2, pc);
-		goto com;
-
-	case OOROR:
-		if(!true)
-			goto caseand;
-
-	caseor:
-		bcgen(l, !true);
-		p1 = p;
-		bcgen(r, !true);
-		p2 = p;
-		gbranch(OGOTO);
-		patch(p1, pc);
-		patch(p2, pc);
-		goto com;
-
-	case OEQ:
-	case ONE:
-	case OLE:
-	case OLT:
-	case OGE:
-	case OGT:
-	case OHI:
-	case OHS:
-	case OLO:
-	case OLS:
-		o = n->op;
-		if(true)
-			o = comrel[relindex(o)];
-		if(l->complex >= FNX && r->complex >= FNX) {
-			regret(&nod, r);
-			cgen(r, &nod);
-			regsalloc(&nod1, r);
-			gmove(&nod, &nod1);
-			regfree(&nod);
-			nod = *n;
-			nod.right = &nod1;
-			boolgen(&nod, true, nn);
-			break;
-		}
-		if(typefd[l->type->etype]) {
-			diag(n, "no floating");
-			break;
-		}
-		if(l->op == OCONST) {
-			regalloc(&nod, r, nn);
-			cgen(r, &nod);
-			gopcode(o, l, Z, &nod);
-			regfree(&nod);
-			goto com;
-		}
-		if(r->op == OCONST) {
-			o = invrel[relindex(o)];
-			regalloc(&nod, l, nn);
-			cgen(l, &nod);
-			gopcode(o, r, Z, &nod);
-			regfree(&nod);
-			goto com;
-		}
-		if(l->complex >= r->complex) {
-			regalloc(&nod1, l, nn);
-			cgen(l, &nod1);
-			regalloc(&nod, r, Z);
-			cgen(r, &nod);
-		} else {
-			regalloc(&nod, r, nn);
-			cgen(r, &nod);
-			regalloc(&nod1, l, Z);
-			cgen(l, &nod1);
-		}
-		gopcode(o, &nod1, Z, &nod);
-		regfree(&nod);
-		regfree(&nod1);
-
-	com:
-		if(nn != Z) {
-			p1 = p;
-			gmove(nodconst(1L), nn);
-			gbranch(OGOTO);
-			p2 = p;
-			patch(p1, pc);
-			gmove(nodconst(0L), nn);
-			patch(p2, pc);
-		}
-		break;
-	}
-	cursafe = curs;
-}
-
-void
-sugen(Node *n, Node *nn, long w)
-{
-	Prog *p1;
-	Node nod0, nod1, nod2, nod3, nod4, *l, *r;
-	Type *t;
-	long pc1;
-	int i, m, c;
-
-	if(n == Z || n->type == T)
-		return;
-	if(debug['g']) {
-		prtree(nn, "sugen lhs");
-		prtree(n, "sugen");
-	}
-	if(nn == nodrat)
-		if(w > nrathole)
-			nrathole = w;
-	switch(n->op) {
-	case OIND:
-		if(nn == Z) {
-			nullwarn(n->left, Z);
-			break;
-		}
-
-	default:
-		goto copy;
-
-	case ODOT:
-		l = n->left;
-		sugen(l, nodrat, l->type->width);
-		if(nn != Z) {
-			warn(n, "non-interruptable temporary");
-			nod1 = *nodrat;
-			r = n->right;
-			if(!r || r->op != OCONST) {
-				diag(n, "DOT and no offset");
-				break;
-			}
-			nod1.xoffset += r->vconst;
-			nod1.type = n->type;
-			sugen(&nod1, nn, w);
-		}
-		break;
-
-	case OSTRUCT:
-		/*
-		 * rewrite so lhs has no fn call
-		 */
-		if(nn != Z && nn->complex >= FNX) {
-			nod1 = *n;
-			nod1.type = typ(TIND, n->type);
-			regret(&nod2, &nod1);
-			lcgen(nn, &nod2);
-			regsalloc(&nod0, &nod1);
-			gopcode(OAS, &nod2, Z, &nod0);
-			regfree(&nod2);
-
-			nod1 = *n;
-			nod1.op = OIND;
-			nod1.left = &nod0;
-			nod1.right = Z;
-			nod1.complex = 1;
-
-			sugen(n, &nod1, w);
-			return;
-		}
-
-		r = n->left;
-		for(t = n->type->link; t != T; t = t->down) {
-			l = r;
-			if(r->op == OLIST) {
-				l = r->left;
-				r = r->right;
-			}
-			if(nn == Z) {
-				cgen(l, nn);
-				continue;
-			}
-			/*
-			 * hand craft *(&nn + o) = l
-			 */
-			nod0 = znode;
-			nod0.op = OAS;
-			nod0.type = t;
-			nod0.left = &nod1;
-			nod0.right = l;
-
-			nod1 = znode;
-			nod1.op = OIND;
-			nod1.type = t;
-			nod1.left = &nod2;
-
-			nod2 = znode;
-			nod2.op = OADD;
-			nod2.type = typ(TIND, t);
-			nod2.left = &nod3;
-			nod2.right = &nod4;
-
-			nod3 = znode;
-			nod3.op = OADDR;
-			nod3.type = nod2.type;
-			nod3.left = nn;
-
-			nod4 = znode;
-			nod4.op = OCONST;
-			nod4.type = nod2.type;
-			nod4.vconst = t->offset;
-
-			ccom(&nod0);
-			acom(&nod0);
-			xcom(&nod0);
-			nod0.addable = 0;
-
-			/* prtree(&nod0, "hand craft"); /* */
-			cgen(&nod0, Z);
-		}
-		break;
-
-	case OAS:
-		if(nn == Z) {
-			if(n->addable < INDEXED)
-				sugen(n->right, n->left, w);
-			break;
-		}
-		/* BOTCH -- functions can clobber rathole */
-		sugen(n->right, nodrat, w);
-		warn(n, "non-interruptable temporary");
-		sugen(nodrat, n->left, w);
-		sugen(nodrat, nn, w);
-		break;
-
-	case OFUNC:
-		if(nn == Z) {
-			sugen(n, nodrat, w);
-			break;
-		}
-		if(nn->op != OIND) {
-			nn = new1(OADDR, nn, Z);
-			nn->type = types[TIND];
-			nn->addable = 0;
-		} else
-			nn = nn->left;
-		n = new(OFUNC, n->left, new(OLIST, nn, n->right));
-		n->type = types[TVOID];
-		n->left->type = types[TVOID];
-		cgen(n, Z);
-		break;
-
-	case OCOND:
-		bcgen(n->left, 1);
-		p1 = p;
-		sugen(n->right->left, nn, w);
-		gbranch(OGOTO);
-		patch(p1, pc);
-		p1 = p;
-		sugen(n->right->right, nn, w);
-		patch(p1, pc);
-		break;
-
-	case OCOMMA:
-		cgen(n->left, Z);
-		sugen(n->right, nn, w);
-		break;
-	}
-	return;
-
-copy:
-	if(nn == Z)
-		return;
-	if(n->complex >= FNX && nn->complex >= FNX) {
-		diag(n, "Ah, come on. Is that you, Rob?");
-		return;
-	}
-
-	if(n->complex > nn->complex) {
-		t = n->type;
-		n->type = types[TLONG];
-		reglcgen(&nod1, n, Z);
-		n->type = t;
-
-		t = nn->type;
-		nn->type = types[TLONG];
-		reglcgen(&nod2, nn, Z);
-		nn->type = t;
-	} else {
-		t = nn->type;
-		nn->type = types[TLONG];
-		reglcgen(&nod2, nn, Z);
-		nn->type = t;
-
-		t = n->type;
-		n->type = types[TLONG];
-		reglcgen(&nod1, n, Z);
-		n->type = t;
-	}
-
-	w /= SZ_LONG;
-	if(w <= 5) {
-		layout(&nod1, &nod2, w, 0, Z);
-		goto out;
-	}
-
-	/*
-	 * minimize space for unrolling loop
-	 * 3,4,5 times. (6 or more is never minimum)
-	 * if small structure, try 2 also.
-	 */
-	c = 0; /* set */
-	m = 100;
-	i = 3;
-	if(w <= 15)
-		i = 2;
-	for(; i<=5; i++)
-		if(i + w%i <= m) {
-			c = i;
-			m = c + w%c;
-		}
-
-	regalloc(&nod3, &regnode, Z);
-	layout(&nod1, &nod2, w%c, w/c, &nod3);
-	
-	pc1 = pc;
-	layout(&nod1, &nod2, c, 0, Z);
-
-	gopcode(OSUB, nodconst(1L), Z, &nod3);
-	nod1.op = OREGISTER;
-	gopcode(OADD, nodconst(c*SZ_LONG), Z, &nod1);
-	nod2.op = OREGISTER;
-	gopcode(OADD, nodconst(c*SZ_LONG), Z, &nod2);
-	
-	gopcode(OEQ, &nod3, Z, Z);
-	p->as = ACMPIBGE;
-	patch(p, pc1);
-
-	regfree(&nod3);
-out:
-	regfree(&nod1);
-	regfree(&nod2);
-}
-
-void
-layout(Node *f, Node *t, int c, int cv, Node *cn)
-{
-	Node t1, t2;
-
-	while(c > 3) {
-		layout(f, t, 2, 0, Z);
-		c -= 2;
-	}
-
-	regalloc(&t1, &regnode, Z);
-	regalloc(&t2, &regnode, Z);
-	if(c > 0) {
-		gmove(f, &t1);
-		f->xoffset += SZ_LONG;
-	}
-	if(cn != Z)
-		gmove(nodconst(cv), cn);
-	if(c > 1) {
-		gmove(f, &t2);
-		f->xoffset += SZ_LONG;
-	}
-	if(c > 0) {
-		gmove(&t1, t);
-		t->xoffset += SZ_LONG;
-	}
-	if(c > 2) {
-		gmove(f, &t1);
-		f->xoffset += SZ_LONG;
-	}
-	if(c > 1) {
-		gmove(&t2, t);
-		t->xoffset += SZ_LONG;
-	}
-	if(c > 2) {
-		gmove(&t1, t);
-		t->xoffset += SZ_LONG;
-	}
-	regfree(&t1);
-	regfree(&t2);
-}

+ 0 - 137
sys/src/cmd/6c/enam.c

@@ -1,137 +0,0 @@
-char	*anames[] =
-{
-	"XXX",
-	"ADJSP",
-	"BYTE",
-	"DATA",
-	"GLOBL",
-	"GOK",
-	"HISTORY",
-	"LONG",
-	"NAME",
-	"NOP",
-	"RTS",
-	"TEXT",
-	"SYSCALL",
-	"WORD",
-	"MOV",
-	"MOVA",
-	"MOVIB",
-	"MOVIS",
-	"MOVOB",
-	"MOVOS",
-	"MOVQ",
-	"MOVT",
-	"MOVV",
-	"SYNMOV",
-	"SYNMOVV",
-	"SYNMOVQ",
-	"ADDC",
-	"ADDI",
-	"ADDO",
-	"ALTERBIT",
-	"AND",
-	"ANDNOT",
-	"ATADD",
-	"ATMOD",
-	"BAL",
-	"B",
-	"BBC",
-	"BBS",
-	"BE",
-	"BNE",
-	"BL",
-	"BLE",
-	"BG",
-	"BGE",
-	"BO",
-	"BNO",
-	"CALL",
-	"CALLS",
-	"CHKBIT",
-	"CLRBIT",
-	"CMPI",
-	"CMPO",
-	"CMPDECI",
-	"CMPDECO",
-	"CMPINCI",
-	"CMPINCO",
-	"CMPIBE",
-	"CMPIBNE",
-	"CMPIBL",
-	"CMPIBLE",
-	"CMPIBG",
-	"CMPIBGE",
-	"CMPIBO",
-	"CMPIBNO",
-	"CMPOBE",
-	"CMPOBNE",
-	"CMPOBL",
-	"CMPOBLE",
-	"CMPOBG",
-	"CMPOBGE",
-	"CONCMPI",
-	"CONCMPO",
-	"DADDC",
-	"DIVI",
-	"DIVO",
-	"DMOVT",
-	"DSUBC",
-	"EDIV",
-	"EMUL",
-	"EXTRACT",
-	"FAULTE",
-	"FAULTNE",
-	"FAULTL",
-	"FAULTLE",
-	"FAULTG",
-	"FAULTGE",
-	"FAULTO",
-	"FAULTNO",
-	"FLUSHREG",
-	"FMARK",
-	"MARK",
-	"MODAC",
-	"MODI",
-	"MODIFY",
-	"MODPC",
-	"MODTC",
-	"MULI",
-	"MULO",
-	"NAND",
-	"NOR",
-	"NOT",
-	"NOTAND",
-	"NOTBIT",
-	"NOTOR",
-	"OR",
-	"ORNOT",
-	"REMI",
-	"REMO",
-	"RET",
-	"ROTATE",
-	"SCANBIT",
-	"SCANBYTE",
-	"SETBIT",
-	"SHLO",
-	"SHRO",
-	"SHLI",
-	"SHRI",
-	"SHRDI",
-	"SPANBIT",
-	"SUBC",
-	"SUBI",
-	"SUBO",
-	"SYNCF",
-	"TESTE",
-	"TESTNE",
-	"TESTL",
-	"TESTLE",
-	"TESTG",
-	"TESTGE",
-	"TESTO",
-	"TESTNO",
-	"XNOR",
-	"XOR",
-	"END",
-};

+ 0 - 334
sys/src/cmd/6c/gc.h

@@ -1,334 +0,0 @@
-#include	"../cc/cc.h"
-#include	"../6c/6.out.h"
-
-/*
- * 6c/960
- * Intel 960
- */
-#define	SZ_CHAR		1
-#define	SZ_SHORT	2
-#define	SZ_INT		4
-#define	SZ_LONG		4
-#define	SZ_IND		4
-#define	SZ_FLOAT	4
-#define	SZ_VLONG	8
-#define	SZ_DOUBLE	8
-#define	FNX		100
-
-typedef	struct	Adr	Adr;
-typedef	struct	Prog	Prog;
-typedef	struct	Case	Case;
-typedef	struct	C1	C1;
-typedef	struct	Var	Var;
-typedef	struct	Reg	Reg;
-typedef	struct	Rgn	Rgn;
-typedef	struct	Index	Index;
-
-struct Index
-{
-	int	i0;
-	int	i1;
-};
-
-struct
-{
-	Node*	regtree;
-	Node*	basetree;
-	short	scale;
-	short	reg;
-} idx;
-
-struct	Adr
-{
-	union
-	{
-		long	offset;
-		double	dval;
-		char	sval[NSNAME];
-	};
-	Sym*	sym;
-	uchar	type;
-	uchar	index;
-	uchar	etype;
-	uchar	scale;	/* doubles as width in DATA op */
-};
-#define	A	((Adr*)0)
-
-#define	INDEXED	9
-struct	Prog
-{
-	Adr	from;
-	Adr	to;
-	Prog*	link;
-	long	lineno;
-	short	as;
-	uchar	type;
-	uchar	offset;
-};
-#define	P	((Prog*)0)
-
-struct	Case
-{
-	Case*	link;
-	long	val;
-	long	label;
-	char	def;
-};
-#define	C	((Case*)0)
-
-struct	C1
-{
-	long	val;
-	long	label;
-};
-
-struct	Var
-{
-	long	offset;
-	Sym*	sym;
-	char	name;
-	char	etype;
-};
-
-struct	Reg
-{
-	long	pc;
-	long	rpo;		/* reverse post ordering */
-
-	Bits	set;
-	Bits	use1;
-	Bits	use2;
-
-	Bits	refbehind;
-	Bits	refahead;
-	Bits	calbehind;
-	Bits	calahead;
-	Bits	regdiff;
-	Bits	act;
-
-	long	regu;
-	long	loop;		/* could be shorter */
-
-	union
-	{
-		Reg*	log5;
-		long	active;
-	};
-	Reg*	p1;
-	Reg*	p2;
-	Reg*	p2link;
-	Reg*	s1;
-	Reg*	s2;
-	Reg*	link;
-	Prog*	prog;
-};
-#define	R	((Reg*)0)
-
-#define	NRGN	300
-struct	Rgn
-{
-	Reg*	enter;
-	short	cost;
-	short	varno;
-	short	regno;
-};
-
-EXTERN	long	breakpc;
-EXTERN	Case*	cases;
-EXTERN	Node	constnode;
-EXTERN	Node	fconstnode;
-EXTERN	long	continpc;
-EXTERN	long	curarg;
-EXTERN	long	cursafe;
-EXTERN	Prog*	firstp;
-EXTERN	Prog*	lastp;
-EXTERN	long	maxargsafe;
-EXTERN	int	mnstring;
-EXTERN	int	retok;
-EXTERN	Node*	nodrat;
-EXTERN	Node*	nodret;
-EXTERN	Node*	nodsafe;
-EXTERN	long	nrathole;
-EXTERN	long	nstring;
-EXTERN	Prog*	p;
-EXTERN	long	pc;
-EXTERN	Node	regnode;
-EXTERN	char	string[NSNAME];
-EXTERN	Sym*	symrathole;
-EXTERN	Node	znode;
-EXTERN	Prog	zprog;
-EXTERN	char	reg[D_NONE];
-EXTERN	long	exregoffset;
-EXTERN	long	exfregoffset;
-
-#define	BLOAD(r)	band(bnot(r->refbehind), r->refahead)
-#define	BSTORE(r)	band(bnot(r->calbehind), r->calahead)
-#define	LOAD(r)		(~r->refbehind.b[z] & r->refahead.b[z])
-#define	STORE(r)	(~r->calbehind.b[z] & r->calahead.b[z])
-
-#define	bset(a,n)	((a).b[(n)/32]&(1L<<(n)%32))
-
-#define	CLOAD	5
-#define	CREF	5
-#define	CINF	1000
-#define	LOOP	3
-
-EXTERN	Rgn	region[NRGN];
-EXTERN	Rgn*	rgp;
-EXTERN	int	nregion;
-EXTERN	int	nvar;
-
-EXTERN	Bits	externs;
-EXTERN	Bits	params;
-EXTERN	Bits	consts;
-EXTERN	Bits	addrs;
-
-EXTERN	long	regbits;
-EXTERN	long	exregbits;
-
-EXTERN	int	change;
-
-EXTERN	Reg*	firstr;
-EXTERN	Reg*	lastr;
-EXTERN	Reg	zreg;
-EXTERN	Reg*	freer;
-EXTERN	Var	var[NVAR];
-EXTERN	long*	idom;
-EXTERN	Reg**	rpo2r;
-EXTERN	long	maxnr;
-
-extern	char*	anames[];
-
-/*
- * sgen.c
- */
-void	codgen(Node*, Node*);
-void	gen(Node*);
-void	noretval(int);
-void	usedset(Node*, int);
-void	xcom(Node*);
-void	indx(Node*);
-void	bcomplex(Node*);
-
-/*
- * cgen.c
- */
-void	cgen(Node*, Node*);
-void	reglcgen(Node*, Node*, Node*);
-void	lcgen(Node*, Node*);
-void	bcgen(Node*, int);
-void	boolgen(Node*, int, Node*);
-void	sugen(Node*, Node*, long);
-void	layout(Node*, Node*, int, int, Node*);
-
-/*
- * txt.c
- */
-void	ginit(void);
-void	gclean(void);
-void	nextpc(void);
-void	gargs(Node*, Node*, Node*);
-void	garg1(Node*, Node*, Node*, int, Node**);
-Node*	nodconst(long);
-Node*	nodfconst(long);
-int	nodreg(Node*, Node*, int);
-void	regret(Node*, Node*);
-void	regalloc(Node*, Node*, Node*);
-void	regfree(Node*);
-void	regialloc(Node*, Node*, Node*);
-void	regsalloc(Node*, Node*);
-void	regaalloc1(Node*, Node*);
-void	regaalloc(Node*, Node*);
-void	regind(Node*, Node*);
-void	gprep(Node*, Node*);
-void	naddr(Node*, Adr*);
-void	gmove(Node*, Node*);
-void	gins(int a, Node*, Node*);
-void	fgopcode(int, Node*, Node*, int, int);
-void	gopcode(int, Node*, Node*, Node*);
-int	samaddr(Node*, Node*);
-void	gbranch(int);
-void	patch(Prog*, long);
-int	sconst(Node*);
-void	gpseudo(int, Sym*, Node*);
-
-/*
- * swt.c
- */
-int	swcmp(void*, void*);
-void	doswit(Node*);
-void	swit1(C1*, int, long, Node*);
-void	cas(void);
-void	bitload(Node*, Node*, Node*, Node*, Node*);
-void	bitstore(Node*, Node*, Node*, Node*, Node*);
-long	outstring(char*, long);
-void	nullwarn(Node*, Node*);
-void	sextern(Sym*, Node*, long, long);
-void	gextern(Sym*, Node*, long, long);
-void	outcode(void);
-void	ieeedtod(Ieee*, double);
-
-/*
- * list
- */
-void	listinit(void);
-int	Pconv(Fmt*);
-int	Aconv(Fmt*);
-int	Dconv(Fmt*);
-int	Zconv(Fmt*);
-int	Rconv(Fmt*);
-int	Xconv(Fmt*);
-int	Bconv(Fmt*);
-
-/*
- * reg.c
- */
-Reg*	rega(void);
-int	rcmp(void*, void*);
-void	regopt(Prog*);
-void	addmove(Reg*, int, int, int);
-Bits	mkvar(Reg*, Adr*);
-void	prop(Reg*, Bits, Bits);
-void	loopit(Reg*, long);
-void	synch(Reg*, Bits);
-ulong	allreg(ulong, Rgn*);
-void	paint1(Reg*, int);
-ulong	paint2(Reg*, int);
-void	paint3(Reg*, int, long, int);
-void	addreg(Adr*, int);
-
-/*
- * peep.c
- */
-void	peep(void);
-void	excise(Reg*);
-Reg*	uniqp(Reg*);
-Reg*	uniqs(Reg*);
-int	regtyp(Adr*);
-int	anyvar(Adr*);
-int	subprop(Reg*);
-int	copyprop(Reg*);
-int	copy1(Adr*, Adr*, Reg*, int);
-int	copyu(Prog*, Adr*, Adr*);
-
-int	copyas(Adr*, Adr*);
-int	copyau(Adr*, Adr*);
-int	copysub(Adr*, Adr*, Adr*, int);
-int	copysub1(Prog*, Adr*, Adr*, int);
-
-long	RtoB(int);
-long	FtoB(int);
-int	BtoR(long);
-int	BtoF(long);
-
-#define	D_HI	D_NONE
-#define	D_LO	D_NONE
-
-#pragma	varargck	type	"A"	int
-#pragma	varargck	type	"B"	Bits
-#pragma	varargck	type	"D"	Adr*
-#pragma	varargck	type	"N"	Adr*
-#pragma	varargck	type	"P"	Prog*
-#pragma	varargck	type	"R"	int
-#pragma	varargck	type	"Z"	char*
-#pragma	varargck	type	"X"	Index

+ 0 - 240
sys/src/cmd/6c/list.c

@@ -1,240 +0,0 @@
-#define EXTERN
-#include "gc.h"
-
-void
-listinit(void)
-{
-
-	fmtinstall('A', Aconv);
-	fmtinstall('P', Pconv);
-	fmtinstall('Z', Zconv);
-	fmtinstall('X', Xconv);
-	fmtinstall('D', Dconv);
-	fmtinstall('R', Rconv);
-	fmtinstall('B', Bconv);
-}
-
-int
-Bconv(Fmt *fp)
-{
-	char str[STRINGSZ], ss[STRINGSZ], *s;
-	Bits bits;
-	int i;
-
-	str[0] = 0;
-	bits = va_arg(fp->args, Bits);
-	while(bany(&bits)) {
-		i = bnum(bits);
-		if(str[0])
-			strcat(str, " ");
-		if(var[i].sym == S) {
-			sprint(ss, "$%ld", var[i].offset);
-			s = ss;
-		} else
-			s = var[i].sym->name;
-		if(strlen(str) + strlen(s) + 1 >= STRINGSZ)
-			break;
-		strcat(str, s);
-		bits.b[i/32] &= ~(1L << (i%32));
-	}
-	return fmtstrcpy(fp, str);
-}
-
-int
-Pconv(Fmt *fp)
-{
-	char str[STRINGSZ];
-	Prog *p;
-
-	p = va_arg(fp->args, Prog*);
-	if(p->as == ADATA)
-		sprint(str, "(%ld)	%A	%D/%d,%D",
-			p->lineno, p->as, &p->from, p->from.scale, &p->to);
-	else
-	if(p->as == ATEXT)
-		sprint(str, "(%ld)	%A	%D,%d,%D",
-			p->lineno, p->as, &p->from, p->from.scale, &p->to);
-	else
-	if(p->type != D_NONE) {
-		if(p->type >= D_R0 && p->type < D_R0+32)
-			sprint(str, "(%ld)	%A	%D,%R,%D",
-				p->lineno, p->as, &p->from, (int)p->type, &p->to);
-		else
-		if(p->type == D_CONST)
-			sprint(str, "(%ld)	%A	%D,%d,%D",
-				p->lineno, p->as, &p->from, p->offset, &p->to);
-		else
-			sprint(str, "(%ld)	%A	%D,gok(%d),%D",
-				p->lineno, p->as, &p->from, p->type, &p->to);
-	} else
-		sprint(str, "(%ld)	%A	%D,%D",
-			p->lineno, p->as, &p->from, &p->to);
-	return fmtstrcpy(fp, str);
-}
-
-int
-Aconv(Fmt *fp)
-{
-	int i;
-
-	i = va_arg(fp->args, int);
-	return fmtstrcpy(fp, anames[i]);
-}
-
-int
-Xconv(Fmt *fp)
-{
-	char str[20];
-	Index x;
-
-	str[0] = 0;
-	x = va_arg(fp->args, Index);
-	if(x.i0 != D_NONE)
-		sprint(str, "(%R*%d)", x.i0, x.i1);
-	return fmtstrcpy(fp, str);
-}
-
-int
-Dconv(Fmt *fp)
-{
-	char str[40], s[20];
-	Adr *a;
-	int i;
-
-	a = va_arg(fp->args, Adr*);
-	i = a->type;
-	if(i >= D_INDIR) {
-		if(a->offset)
-			sprint(str, "%ld(%R)", a->offset, i-D_INDIR);
-		else
-			sprint(str, "(%R)", i-D_INDIR);
-		goto brk;
-	}
-	switch(i) {
-
-	default:
-		if(a->offset)
-			sprint(str, "$%ld,%R", a->offset, i);
-		else
-			sprint(str, "%R", i);
-		break;
-
-	case D_NONE:
-		str[0] = 0;
-		break;
-
-	case D_BRANCH:
-		sprint(str, "%ld(PC)", a->offset-pc);
-		break;
-
-	case D_EXTERN:
-		sprint(str, "%s+%ld(SB)", a->sym->name, a->offset);
-		break;
-
-	case D_STATIC:
-		sprint(str, "%s<>+%ld(SB)", a->sym->name,
-			a->offset);
-		break;
-
-	case D_AUTO:
-		sprint(str, "%s+%ld(SP)", a->sym->name, a->offset);
-		break;
-
-	case D_PARAM:
-		if(a->sym)
-			sprint(str, "%s+%ld(FP)", a->sym->name, a->offset);
-		else
-			sprint(str, "%ld(FP)", a->offset);
-		break;
-
-	case D_CONST:
-		sprint(str, "$%ld", a->offset);
-		break;
-
-	case D_FCONST:
-		sprint(str, "$(%.17e)", a->dval);
-		break;
-
-	case D_SCONST:
-		sprint(str, "$\"%Z\"", a->sval);
-		break;
-
-	case D_ADDR:
-		a->type = a->index;
-		a->index = D_NONE;
-		sprint(str, "$%D", a);
-		a->index = a->type;
-		a->type = D_ADDR;
-		goto conv;
-	}
-brk:
-	if(a->index != D_NONE) {
-		sprint(s, "%X", (Index){a->index, a->scale});
-		strcat(str, s);
-	}
-conv:
-	return fmtstrcpy(fp, str);
-}
-
-int
-Rconv(Fmt *fp)
-{
-	char str[20];
-	int r;
-
-	r = va_arg(fp->args, int);
-	if(r >= D_R0 && r <= D_R0+31)
-		sprint(str, "R%d", r-D_R0);
-	else
-	if(r == D_NONE)
-		sprint(str, "");
-	else
-		sprint(str, "gok(%d)", r);
-
-	return fmtstrcpy(fp, str);
-}
-
-int
-Zconv(Fmt *fp)
-{
-	int i, c;
-	char str[30], *p, *a;
-
-	a = va_arg(fp->args, char*);
-	p = str;
-	for(i=0; i<sizeof(double); i++) {
-		c = a[i] & 0xff;
-		if(c >= 'a' && c <= 'z' ||
-		   c >= 'A' && c <= 'Z' ||
-		   c >= '0' && c <= '9') {
-			*p++ = c;
-			continue;
-		}
-		*p++ = '\\';
-		switch(c) {
-		default:
-			if(c < 040 || c >= 0177)
-				break;	/* not portable */
-			p[-1] = c;
-			continue;
-		case 0:
-			*p++ = 'z';
-			continue;
-		case '\\':
-		case '"':
-			*p++ = c;
-			continue;
-		case '\n':
-			*p++ = 'n';
-			continue;
-		case '\t':
-			*p++ = 't';
-			continue;
-		}
-		*p++ = (c>>6) + '0';
-		*p++ = ((c>>3) & 7) + '0';
-		*p++ = (c & 7) + '0';
-	}
-	*p = 0;
-	return fmtstrcpy(fp, str);
-}

+ 0 - 15
sys/src/cmd/6c/mkenam

@@ -1,15 +0,0 @@
-ed ../6c/6.out.h <<!
-v/^	A/d
-g/^	A/s//	"/
-g/ .*$/s///
-g/,.*$/s//",/
-$ a
-};
-.
-1i
-char	*anames[] =
-{
-.
-w enam.c
-Q
-!

+ 0 - 22
sys/src/cmd/6c/mkfile

@@ -1,22 +0,0 @@
-</$objtype/mkfile
-
-TARG=6c
-OFILES=\
-	cgen.$O\
-	enam.$O\
-	list.$O\
-	sgen.$O\
-	swt.$O\
-	txt.$O\
-	reg.$O\
-	peep.$O\
-
-HFILES=\
-	gc.h\
-	6.out.h\
-	../cc/cc.h\
-
-LIB=../cc/cc.a$O
-
-BIN=/$objtype/bin
-</sys/src/cmd/mkone

+ 0 - 527
sys/src/cmd/6c/peep.c

@@ -1,527 +0,0 @@
-#include "gc.h"
-
-void
-peep(void)
-{
-	Reg *r, *r1, *r2;
-	Prog *p;
-	int t;
-/*
- * complete R structure
- */
-	t = 0;
-	for(r=firstr; r!=R; r=r1) {
-		r1 = r->link;
-		if(r1 == R)
-			break;
-		p = r->prog->link;
-		while(p != r1->prog)
-		switch(p->as) {
-		default:
-			r2 = rega();
-			r->link = r2;
-			r2->link = r1;
-
-			r2->prog = p;
-			r2->p1 = r;
-			r->s1 = r2;
-			r2->s1 = r1;
-			r1->p1 = r2;
-
-			r = r2;
-			t++;
-
-		case ADATA:
-		case AGLOBL:
-		case ANAME:
-			p = p->link;
-		}
-	}
-
-loop1:
-	t = 0;
-	for(r=firstr; r!=R; r=r->link) {
-		p = r->prog;
-		if(p->as == AMOV)
-		if(regtyp(&p->to))
-		if(regtyp(&p->from)) {
-			if(copyprop(r)) {
-				excise(r);
-				t++;
-			}
-			if(subprop(r) && copyprop(r)) {
-				excise(r);
-				t++;
-			}
-		}
-	}
-	if(t)
-		goto loop1;
-}
-
-void
-excise(Reg *r)
-{
-	Prog *p;
-
-	p = r->prog;
-	p->as = ANOP;
-	p->from = zprog.from;
-	p->to = zprog.to;
-}
-
-Reg*
-uniqp(Reg *r)
-{
-	Reg *r1;
-
-	r1 = r->p1;
-	if(r1 == R) {
-		r1 = r->p2;
-		if(r1 == R || r1->p2link != R)
-			return R;
-	} else
-		if(r->p2 != R)
-			return R;
-	return r1;
-}
-
-Reg*
-uniqs(Reg *r)
-{
-	Reg *r1;
-
-	r1 = r->s1;
-	if(r1 == R) {
-		r1 = r->s2;
-		if(r1 == R)
-			return R;
-	} else
-		if(r->s2 != R)
-			return R;
-	return r1;
-}
-
-int
-regtyp(Adr *a)
-{
-	int t;
-
-	t = a->type;
-	if(t >= D_R0 && t <= D_R0+31)
-		return 1;
-	return 0;
-}
-
-/*
- * the idea is to substitute
- * one register for another
- * from one MOV to another
- *	MOV	a, R0
- *	ADD	b, R0	/ no use of R1
- *	MOV	R0, R1
- * would be converted to
- *	MOV	a, R1
- *	ADD	b, R1
- *	MOV	R1, R0
- * hopefully, then the former or latter MOV
- * will be eliminated by copy propagation.
- */
-int
-subprop(Reg *r0)
-{
-	Prog *p;
-	Adr *v1, *v2;
-	Reg *r;
-	int t;
-
-	p = r0->prog;
-	v1 = &p->from;
-	if(!regtyp(v1))
-		return 0;
-	v2 = &p->to;
-	if(!regtyp(v2))
-		return 0;
-	for(r=uniqp(r0); r!=R; r=uniqp(r)) {
-		if(uniqs(r) == R)
-			break;
-		p = r->prog;
-		switch(p->as) {
-		case ABAL:
-			return 0;
-
-		case AADDI:	/* 3-op */
-		case AADDO:
-		case AAND:
-		case ASUBI:
-		case ASUBO:
-		case AOR:
-		case AXOR:
-		case ASHLI:
-		case ASHRI:
-		case ASHLO:
-		case ASHRO:
-		case AMULI:
-		case AMULO:
-		case ADIVI:
-		case ADIVO:
-		case AREMI:
-		case AREMO:
-			if(p->type != D_NONE)
-				return 0;
-			break;	/* botch */
-			if(p->to.type == v1->type) {
-				if(p->type == D_NONE)
-					p->type = p->to.type;
-				goto gotit;
-			}
-			break;
-
-		case AMOV:
-			if(p->to.type == v1->type)
-				goto gotit;
-			break;
-		}
-		if(copyau(&p->from, v2) ||
-		   copyau(&p->to, v2))
-			break;
-		if(copysub(&p->from, v1, v2, 0) ||
-		   copysub(&p->to, v1, v2, 0))
-			break;
-	}
-	return 0;
-
-gotit:
-	copysub(&p->to, v1, v2, 1);
-	if(debug['P']) {
-		print("gotit: %D->%D\n%P", v1, v2, r->prog);
-		if(p->from.type == v2->type)
-			print(" excise");
-		print("\n");
-	}
-	for(r=uniqs(r); r!=r0; r=uniqs(r)) {
-		p = r->prog;
-		copysub(&p->from, v1, v2, 1);
-		copysub(&p->to, v1, v2, 1);
-		if(debug['P'])
-			print("%P\n", r->prog);
-	}
-	t = v1->type;
-	v1->type = v2->type;
-	v2->type = t;
-	if(debug['P'])
-		print("%P last\n", r->prog);
-	return 1;
-}
-
-/*
- * The idea is to remove redundant copies.
- *	v1->v2	F=0
- *	(use v2	s/v2/v1/)*
- *	set v1	F=1
- *	use v2	return fail
- *	-----------------
- *	v1->v2	F=0
- *	(use v2	s/v2/v1/)*
- *	set v1	F=1
- *	set v2	return success
- */
-int
-copyprop(Reg *r0)
-{
-	Prog *p;
-	Adr *v1, *v2;
-	Reg *r;
-
-	p = r0->prog;
-	v1 = &p->from;
-	v2 = &p->to;
-	if(copyas(v1, v2))
-		return 1;
-	for(r=firstr; r!=R; r=r->link)
-		r->active = 0;
-	return copy1(v1, v2, r0->s1, 0);
-}
-
-int
-copy1(Adr *v1, Adr *v2, Reg *r, int f)
-{
-	int t;
-	Prog *p;
-
-	if(r->active) {
-		if(debug['P'])
-			print("act set; return 1\n");
-		return 1;
-	}
-	r->active = 1;
-	if(debug['P'])
-		print("copy %D->%D f=%d\n", v1, v2, f);
-	for(; r != R; r = r->s1) {
-		p = r->prog;
-		if(debug['P'])
-			print("%P", p);
-		if(!f && uniqp(r) == R) {
-			f = 1;
-			if(debug['P'])
-				print("; merge; f=%d", f);
-		}
-		t = copyu(p, v2, A);
-		switch(t) {
-		case 2:	/* rar, cant split */
-			if(debug['P'])
-				print("; %D rar; return 0\n", v2);
-			return 0;
-
-		case 3:	/* set */
-			if(debug['P'])
-				print("; %D set; return 1\n", v2);
-			return 1;
-
-		case 1:	/* used, substitute */
-		case 4:	/* use and set */
-			if(f) {
-				if(!debug['P'])
-					return 0;
-				if(t == 4)
-					print("; %D used+set and f=%d; return 0\n", v2, f);
-				else
-					print("; %D used and f=%d; return 0\n", v2, f);
-				return 0;
-			}
-			if(copyu(p, v2, v1)) {
-				if(debug['P'])
-					print("; sub fail; return 0\n");
-				return 0;
-			}
-			if(debug['P'])
-				print("; sub %D/%D", v2, v1);
-			if(t == 4) {
-				if(debug['P'])
-					print("; %D used+set; return 1\n", v2);
-				return 1;
-			}
-			break;
-		}
-		if(!f) {
-			t = copyu(p, v1, A);
-			if(!f && (t == 2 || t == 3 || t == 4)) {
-				f = 1;
-				if(debug['P'])
-					print("; %D set and !f; f=%d", v1, f);
-			}
-		}
-		if(debug['P'])
-			print("\n");
-		if(r->s2)
-			if(!copy1(v1, v2, r->s2, f))
-				return 0;
-	}
-	return 1;
-}
-
-/*
- * return
- * 1 if v only used (and substitute),
- * 2 if read-alter-rewrite
- * 3 if set
- * 4 if set and used
- * 0 otherwise (not touched)
- */
-copyu(Prog *p, Adr *v, Adr *s)
-{
-
-	switch(p->as) {
-
-	default:
-print("default -- rar %P\n", p);
-	case ASHLI:
-	case ASHRI:
-	case ASHLO:
-	case ASHRO:
-	case AMULI:
-	case AMULO:
-	case ADIVI:
-	case ADIVO:
-	case AREMI:
-	case AREMO:
-		if(debug['P'])
-			print("unknown op %A\n", p->as);
-		return 2;
-
-	case AMOVA:	/* lhs addr, rhs store */
-		if(copyas(&p->from, v))
-			return 2;
-
-
-	case ANOP:	/* rhs store */
-	case AMOV:
-	case AMOVOB:
-	case AMOVIB:
-	case AMOVOS:
-	case AMOVIS:
-		if(copyas(&p->to, v)) {
-			if(s != A)
-				return copysub(&p->from, v, s, 1);
-			if(copyau(&p->from, v))
-				return 4;
-			return 3;
-		}
-		goto caseread;
-
-
-	case AADDI:	/* rhs rar */
-	case AADDO:
-	case AAND:
-	case ASUBI:
-	case ASUBO:
-	case AOR:
-	case AXOR:
-		if(copyas(&p->to, v))
-			return 2;
-		goto caseread;
-
-	case ACMPI:	/* read only */
-	case ACMPO:
-
-	caseread:
-		if(p->type != D_NONE)
-			return 2;		/* botch */
-		if(s != A) {
-			if(copysub(&p->from, v, s, 1))
-				return 1;
-			return copysub(&p->to, v, s, 1);
-		}
-		if(copyau(&p->from, v))
-			return 1;
-		if(copyau(&p->to, v))
-			return 1;
-		break;
-
-	case AB:	/* no reference */
-	case ABNE:
-	case ABE:
-	case ABL:
-	case ABLE:
-	case ABG:
-	case ABGE:
-		break;
-
-	case ARTS:	/* funny */
-	case ABAL:	/* funny */
-		if(v->type == REGRET)
-			return 2;
-
-		if(s != A) {
-			if(s->type == REGRET)
-				return 2;
-			if(copysub(&p->to, v, s, 1))
-				return 1;
-			return 0;
-		}
-		if(copyau(&p->to, v))
-			return 4;
-		return 3;
-	}
-	return 0;
-}
-
-/*
- * direct reference,
- * could be set/use depending on
- * semantics
- */
-int
-copyas(Adr *a, Adr *v)
-{
-	if(a->type != v->type)
-		return 0;
-	if(regtyp(v))
-		return 1;
-	if(v->type == D_AUTO || v->type == D_PARAM)
-		if(v->offset == a->offset)
-			return 1;
-	return 0;
-}
-
-int
-copyas1(Prog *p, Adr *v)
-{
-	if(p->type != v->type)
-		return 0;
-	if(regtyp(v))
-		return 1;
-	return 0;
-}
-
-/*
- * either direct or indirect
- */
-int
-copyau(Adr *a, Adr *v)
-{
-
-	if(copyas(a, v))
-		return 1;
-	if(regtyp(v)) {
-		if(a->type-D_INDIR == v->type)
-			return 1;
-		if(a->index == v->type)
-			return 1;
-	}
-	return 0;
-}
-
-/*
- * substitute s for v in a
- * return failure to substitute
- */
-int
-copysub(Adr *a, Adr *v, Adr *s, int f)
-{
-	int t;
-
-	if(copyas(a, v)) {
-		t = s->type;
-		if(t >= D_R0 && t <= D_R0+31) {
-			if(f)
-				a->type = t;
-		}
-		return 0;
-	}
-	if(regtyp(v)) {
-		t = v->type;
-		if(a->type == t+D_INDIR) {
-			if(f)
-				a->type = s->type+D_INDIR;
-			return 0;
-		}
-		if(a->index == t) {
-			if(f)
-				a->index = s->type;
-			return 0;
-		}
-		return 0;
-	}
-	return 0;
-}
-
-/*
- * substitute s for v in p
- * return failure to substitute
- */
-int
-copysub1(Prog *p, Adr *v, Adr *s, int f)
-{
-	int t;
-
-	if(copyas1(p, v)) {
-		t = s->type;
-		if(t >= D_R0 && t <= D_R0+31) {
-			if(f)
-				p->type = t;
-		}
-		return 0;
-	}
-	return 0;
-}

+ 0 - 1117
sys/src/cmd/6c/reg.c

@@ -1,1117 +0,0 @@
-#include "gc.h"
-
-Reg*
-rega(void)
-{
-	Reg *r;
-
-	r = freer;
-	if(r == R) {
-		r = alloc(sizeof(*r));
-	} else
-		freer = r->link;
-
-	*r = zreg;
-	return r;
-}
-
-int
-rcmp(void *a1, void *a2)
-{
-	Rgn *p1, *p2;
-	int c1, c2;
-
-	p1 = a1;
-	p2 = a2;
-	c1 = p2->cost;
-	c2 = p1->cost;
-	if(c1 -= c2)
-		return c1;
-	return p2->varno - p1->varno;
-}
-
-void
-regopt(Prog *p)
-{
-	Reg *r, *r1, *r2;
-	Prog *p1;
-	int i, z;
-	long initpc, val, npc;
-	ulong vreg;
-	Bits bit;
-	struct
-	{
-		long	m;
-		long	c;
-		Reg*	p;
-	} log5[6], *lp;
-
-	firstr = R;
-	lastr = R;
-	nvar = 0;
-	regbits = RtoB(REGSP) |
-		RtoB(REGSB) |
-		RtoB(REGZERO) |
-		RtoB(REGRET) |
-		RtoB(REGTMP) |
-		RtoB(REGLINK) |
-		RtoB(REGBAD1) |
-		RtoB(REGBAD2) |
-		RtoB(REGBAD3) |
-		RtoB(REGBAD4) |
-		0;
-	for(z=0; z<BITS; z++) {
-		externs.b[z] = 0;
-		params.b[z] = 0;
-		consts.b[z] = 0;
-		addrs.b[z] = 0;
-	}
-
-	/*
-	 * pass 1
-	 * build aux data structure
-	 * allocate pcs
-	 * find use and set of variables
-	 */
-	val = 5L * 5L * 5L * 5L * 5L;
-	lp = log5;
-	for(i=0; i<5; i++) {
-		lp->m = val;
-		lp->c = 0;
-		lp->p = R;
-		val /= 5L;
-		lp++;
-	}
-	val = 0;
-	for(; p != P; p = p->link) {
-		switch(p->as) {
-		case ADATA:
-		case AGLOBL:
-		case ANAME:
-			continue;
-		}
-
-		r = rega();
-		if(firstr == R) {
-			firstr = r;
-			lastr = r;
-		} else {
-			lastr->link = r;
-			r->p1 = lastr;
-			lastr->s1 = r;
-			lastr = r;
-		}
-		r->prog = p;
-		r->pc = val;
-		val++;
-
-		lp = log5;
-		for(i=0; i<5; i++) {
-			lp->c--;
-			if(lp->c <= 0) {
-				lp->c = lp->m;
-				if(lp->p != R)
-					lp->p->log5 = r;
-				lp->p = r;
-				(lp+1)->c = 0;
-				break;
-			}
-			lp++;
-		}
-
-		r1 = r->p1;
-		if(r1 != R)
-		switch(r1->prog->as) {
-		case ARTS:
-		case AB:
-			r->p1 = R;
-			r1->s1 = R;
-		}
-
-		bit = mkvar(r, &p->from);
-		if(bany(&bit))
-		switch(p->as) {
-		/*
-		 * left side read
-		 */
-		default:
-print("default -- lhs read %P\n", p);
-		case AMOV:
-		case AMOVIB:
-		case AMOVOB:
-		case AMOVIS:
-		case AMOVOS:
-		case ATEXT:
-			for(z=0; z<BITS; z++)
-				r->use1.b[z] |= bit.b[z];
-			break;
-
-		/*
-		 * funny
-		 */
-		case AMOVA:
-			for(z=0; z<BITS; z++)
-				addrs.b[z] |= bit.b[z];
-			break;
-		}
-
-		bit = mkvar(r, &p->to);
-		if(bany(&bit))
-		switch(p->as) {
-		default:
-			diag(Z, "reg: unknown op: %P", p);
-			break;
-
-		/*
-		 * right side read
-		 */
-		case ACMPI:
-		case ACMPO:
-			for(z=0; z<BITS; z++)
-				r->use2.b[z] |= bit.b[z];
-			break;
-
-		/*
-		 * right side write
-		 */
-		case AMOV:
-		case AMOVIB:
-		case AMOVOB:
-		case AMOVIS:
-		case AMOVOS:
-			for(z=0; z<BITS; z++)
-				r->set.b[z] |= bit.b[z];
-			break;
-
-		/*
-		 * right side read+write
-		 */
-		case AADDI:
-		case AADDO:
-		case AAND:
-		case ASUBI:
-		case ASUBO:
-		case AOR:
-		case AXOR:
-			for(z=0; z<BITS; z++) {
-				r->set.b[z] |= bit.b[z];
-				r->use2.b[z] |= bit.b[z];
-			}
-			break;
-
-		/*
-		 * funny
-		 */
-		case ABAL:
-			for(z=0; z<BITS; z++)
-				addrs.b[z] |= bit.b[z];
-			break;
-		}
-	}
-	if(firstr == R)
-		return;
-	initpc = pc - val;
-	npc = val;
-
-	/*
-	 * pass 2
-	 * turn branch references to pointers
-	 * build back pointers
-	 */
-	for(r = firstr; r != R; r = r->link) {
-		p = r->prog;
-		if(p->to.type == D_BRANCH) {
-			val = p->to.offset - initpc;
-			r1 = firstr;
-			while(r1 != R) {
-				r2 = r1->log5;
-				if(r2 != R && val >= r2->pc) {
-					r1 = r2;
-					continue;
-				}
-				if(r1->pc == val)
-					break;
-				r1 = r1->link;
-			}
-			if(r1 == R) {
-				nearln = p->lineno;
-				diag(Z, "ref not found\n%P", p);
-				continue;
-			}
-			if(r1 == r) {
-				nearln = p->lineno;
-				diag(Z, "ref to self\n%P", p);
-				continue;
-			}
-			r->s2 = r1;
-			r->p2link = r1->p2;
-			r1->p2 = r;
-		}
-	}
-	if(debug['R']) {
-		p = firstr->prog;
-		print("\n%L %D\n", p->lineno, &p->from);
-	}
-
-	/*
-	 * pass 2.5
-	 * find looping structure
-	 */
-	for(r = firstr; r != R; r = r->link)
-		r->active = 0;
-	change = 0;
-	loopit(firstr, npc);
-	if(debug['R'] && debug['v']) {
-		print("\nlooping structure:\n");
-		for(r = firstr; r != R; r = r->link) {
-			print("%ld:%P", r->loop, r->prog);
-			for(z=0; z<BITS; z++)
-				bit.b[z] = r->use1.b[z] |
-					   r->use2.b[z] |
-					   r->set.b[z];
-			if(bany(&bit)) {
-				print("\t");
-				if(bany(&r->use1))
-					print(" u1=%B", r->use1);
-				if(bany(&r->use2))
-					print(" u2=%B", r->use2);
-				if(bany(&r->set))
-					print(" st=%B", r->set);
-			}
-			print("\n");
-		}
-	}
-
-	/*
-	 * pass 3
-	 * iterate propagating usage
-	 * 	back until flow graph is complete
-	 */
-loop1:
-	change = 0;
-	for(r = firstr; r != R; r = r->link)
-		r->active = 0;
-	for(r = firstr; r != R; r = r->link)
-		if(r->prog->as == ARTS)
-			prop(r, zbits, zbits);
-loop11:
-	/* pick up unreachable code */
-	i = 0;
-	for(r = firstr; r != R; r = r1) {
-		r1 = r->link;
-		if(r1 && r1->active && !r->active) {
-			prop(r, zbits, zbits);
-			i = 1;
-		}
-	}
-	if(i)
-		goto loop11;
-	if(change)
-		goto loop1;
-
-
-	/*
-	 * pass 4
-	 * iterate propagating register/variable synchrony
-	 * 	forward until graph is complete
-	 */
-loop2:
-	change = 0;
-	for(r = firstr; r != R; r = r->link)
-		r->active = 0;
-	synch(firstr, zbits);
-	if(change)
-		goto loop2;
-
-
-	/*
-	 * pass 5
-	 * isolate regions
-	 * calculate costs (paint1)
-	 */
-	r = firstr;
-	if(r) {
-		for(z=0; z<BITS; z++)
-			bit.b[z] = (r->refahead.b[z] | r->calahead.b[z]) &
-			  ~(externs.b[z] | params.b[z] | addrs.b[z] | consts.b[z]);
-		if(bany(&bit)) {
-			nearln = r->prog->lineno;
-			warn(Z, "used and not set: %B", bit);
-			if(debug['R'] && !debug['w'])
-				print("used and not set: %B\n", bit);
-		}
-	}
-	if(debug['R'] && debug['v'])
-		print("\nprop structure:\n");
-	for(r = firstr; r != R; r = r->link)
-		r->act = zbits;
-	rgp = region;
-	nregion = 0;
-	for(r = firstr; r != R; r = r->link) {
-		if(debug['R'] && debug['v']) {
-			print("%P\t", r->prog);
-			if(bany(&r->set))
-				print("s:%B ", r->set);
-			if(bany(&r->refahead))
-				print("ra:%B ", r->refahead);
-			if(bany(&r->calahead))
-				print("ca:%B ", r->calahead);
-			print("\n");
-		}
-		for(z=0; z<BITS; z++)
-			bit.b[z] = r->set.b[z] &
-			  ~(r->refahead.b[z] | r->calahead.b[z] | addrs.b[z]);
-		if(bany(&bit)) {
-			nearln = r->prog->lineno;
-			warn(Z, "set and not used: %B", bit);
-			if(debug['R'])
-				print("set an not used: %B\n", bit);
-			excise(r);
-		}
-		for(z=0; z<BITS; z++)
-			bit.b[z] = LOAD(r) & ~(r->act.b[z] | addrs.b[z]);
-		while(bany(&bit)) {
-			i = bnum(bit);
-			rgp->enter = r;
-			rgp->varno = i;
-			change = 0;
-			if(debug['R'] && debug['v'])
-				print("\n");
-			paint1(r, i);
-			bit.b[i/32] &= ~(1L<<(i%32));
-			if(change <= 0) {
-				if(debug['R'])
-					print("%L$%d: %B\n",
-						r->prog->lineno, change, blsh(i));
-				continue;
-			}
-			rgp->cost = change;
-			nregion++;
-			if(nregion >= NRGN) {
-				warn(Z, "too many regions");
-				goto brk;
-			}
-			rgp++;
-		}
-	}
-brk:
-	qsort(region, nregion, sizeof(region[0]), rcmp);
-
-	/*
-	 * pass 6
-	 * determine used registers (paint2)
-	 * replace code (paint3)
-	 */
-	rgp = region;
-	for(i=0; i<nregion; i++) {
-		bit = blsh(rgp->varno);
-		vreg = paint2(rgp->enter, rgp->varno);
-		vreg = allreg(vreg, rgp);
-		if(debug['R']) {
-			print("%L$%d %R: %B\n",
-				rgp->enter->prog->lineno,
-				rgp->cost,
-				rgp->regno,
-				bit);
-		}
-		if(rgp->regno != 0)
-			paint3(rgp->enter, rgp->varno, vreg, rgp->regno);
-		rgp++;
-	}
-	/*
-	 * pass 7
-	 * peep-hole on basic block
-	 */
-	if(!debug['R'] || debug['P'])
-		peep();
-
-	/*
-	 * pass 8
-	 * recalculate pc
-	 */
-	val = initpc;
-	for(r = firstr; r != R; r = r1) {
-		r->pc = val;
-		p = r->prog;
-		p1 = P;
-		r1 = r->link;
-		if(r1 != R)
-			p1 = r1->prog;
-		for(; p != p1; p = p->link) {
-			switch(p->as) {
-			default:
-				val++;
-				break;
-
-			case ANOP:
-			case ADATA:
-			case AGLOBL:
-			case ANAME:
-				break;
-			}
-		}
-	}
-	pc = val;
-
-	/*
-	 * fix up branches
-	 */
-	if(debug['R'])
-		if(bany(&addrs))
-			print("addrs: %B\n", addrs);
-
-	r1 = 0; /* set */
-	for(r = firstr; r != R; r = r->link) {
-		p = r->prog;
-		if(p->to.type == D_BRANCH)
-			p->to.offset = r->s2->pc;
-		r1 = r;
-	}
-
-	/*
-	 * last pass
-	 * eliminate nops
-	 * free aux structures
-	 */
-	for(p = firstr->prog; p != P; p = p->link){
-		while(p->link && p->link->as == ANOP)
-			p->link = p->link->link;
-	}
-	if(r1 != R) {
-		r1->link = freer;
-		freer = firstr;
-	}
-}
-
-/*
- * add mov b,rn
- * just after r
- */
-void
-addmove(Reg *r, int bn, int rn, int f)
-{
-	Prog *p, *p1;
-	Adr *a;
-	Var *v;
-
-	p1 = alloc(sizeof(*p1));
-	*p1 = zprog;
-	p = r->prog;
-
-	p1->link = p->link;
-	p->link = p1;
-	p1->lineno = p->lineno;
-
-	v = var + bn;
-
-	a = &p1->to;
-	a->sym = v->sym;
-	a->offset = v->offset;
-	a->etype = v->etype;
-	a->type = v->name;
-
-	switch(v->etype) {
-	default:
-		p1->as = AMOV;
-		break;
-
-	case TCHAR:
-		p1->as = AMOVIB;
-		break;
-
-	case TUCHAR:
-		p1->as = AMOVOB;
-		break;
-
-	case TSHORT:
-		p1->as = AMOVIS;
-		break;
-
-	case TUSHORT:
-		p1->as = AMOVOS;
-		break;
-	}
-
-	p1->from.type = rn;
-	if(!f) {
-		p1->from = *a;
-		*a = zprog.from;
-		a->type = rn;
-	}
-	if(debug['R'])
-		print("%P\t.a%P\n", p, p1);
-}
-
-ulong
-doregbits(int r)
-{
-	ulong b;
-
-	b = 0;
-	if(r >= D_INDIR)
-		r -= D_INDIR;
-	if(r >= D_R0 && r <= D_R0+31)
-		b |= RtoB(r);
-	return b;
-}
-
-Bits
-mkvar(Reg *r, Adr *a)
-{
-	Var *v;
-	int i, t, n, et, z;
-	long o;
-	Bits bit;
-	Sym *s;
-
-	/*
-	 * mark registers used
-	 */
-	t = a->type;
-	r->regu |= doregbits(t);
-	r->regu |= doregbits(a->index);
-
-	switch(t) {
-	default:
-		goto none;
-	case D_ADDR:
-		a->type = a->index;
-		bit = mkvar(r, a);
-		for(z=0; z<BITS; z++)
-			addrs.b[z] |= bit.b[z];
-		a->type = t;
-		goto none;
-	case D_EXTERN:
-	case D_STATIC:
-	case D_PARAM:
-	case D_AUTO:
-		n = t;
-		break;
-	}
-	s = a->sym;
-	if(s == S)
-		goto none;
-	if(s->name[0] == '.')
-		goto none;
-	et = a->etype;
-	o = a->offset;
-	v = var;
-	for(i=0; i<nvar; i++) {
-		if(s == v->sym)
-		if(n == v->name)
-		if(o == v->offset)
-			goto out;
-		v++;
-	}
-	if(nvar >= NVAR) {
-		if(debug['w'] > 1 && s)
-			warn(Z, "variable not optimized: %s", s->name);
-		goto none;
-	}
-	i = nvar;
-	nvar++;
-	v = &var[i];
-	v->sym = s;
-	v->offset = o;
-	v->name = n;
-	v->etype = et;
-	if(debug['R'])
-		print("bit=%2d et=%2d %D\n", i, et, a);
-
-out:
-	bit = blsh(i);
-	if(n == D_EXTERN || n == D_STATIC)
-		for(z=0; z<BITS; z++)
-			externs.b[z] |= bit.b[z];
-	if(n == D_PARAM)
-		for(z=0; z<BITS; z++)
-			params.b[z] |= bit.b[z];
-	if(v->etype != et || !typechlpfd[et])	/* funny punning */
-		for(z=0; z<BITS; z++)
-			addrs.b[z] |= bit.b[z];
-	return bit;
-
-none:
-	return zbits;
-}
-
-void
-prop(Reg *r, Bits ref, Bits cal)
-{
-	Reg *r1, *r2;
-	int z;
-
-	for(r1 = r; r1 != R; r1 = r1->p1) {
-		for(z=0; z<BITS; z++) {
-			ref.b[z] |= r1->refahead.b[z];
-			if(ref.b[z] != r1->refahead.b[z]) {
-				r1->refahead.b[z] = ref.b[z];
-				change++;
-			}
-			cal.b[z] |= r1->calahead.b[z];
-			if(cal.b[z] != r1->calahead.b[z]) {
-				r1->calahead.b[z] = cal.b[z];
-				change++;
-			}
-		}
-		switch(r1->prog->as) {
-		case ABAL:
-			for(z=0; z<BITS; z++) {
-				cal.b[z] |= ref.b[z] | externs.b[z];
-				ref.b[z] = 0;
-			}
-			break;
-
-		case ATEXT:
-			for(z=0; z<BITS; z++) {
-				cal.b[z] = 0;
-				ref.b[z] = 0;
-			}
-			break;
-
-		case ARTS:
-			for(z=0; z<BITS; z++) {
-				cal.b[z] = externs.b[z];
-				ref.b[z] = 0;
-			}
-		}
-		for(z=0; z<BITS; z++) {
-			ref.b[z] = (ref.b[z] & ~r1->set.b[z]) |
-				r1->use1.b[z] | r1->use2.b[z];
-			cal.b[z] &= ~(r1->set.b[z] | r1->use1.b[z] | r1->use2.b[z]);
-			r1->refbehind.b[z] = ref.b[z];
-			r1->calbehind.b[z] = cal.b[z];
-		}
-		if(r1->active)
-			break;
-		r1->active = 1;
-	}
-	for(; r != r1; r = r->p1)
-		for(r2 = r->p2; r2 != R; r2 = r2->p2link)
-			prop(r2, r->refbehind, r->calbehind);
-}
-
-/*
- * find looping structure
- *
- * 1) find reverse postordering
- * 2) find approximate dominators,
- *	the actual dominators if the flow graph is reducible
- *	otherwise, dominators plus some other non-dominators.
- *	See Matthew S. Hecht and Jeffrey D. Ullman,
- *	"Analysis of a Simple Algorithm for Global Data Flow Problems",
- *	Conf.  Record of ACM Symp. on Principles of Prog. Langs, Boston, Massachusetts,
- *	Oct. 1-3, 1973, pp.  207-217.
- * 3) find all nodes with a predecessor dominated by the current node.
- *	such a node is a loop head.
- *	recursively, all preds with a greater rpo number are in the loop
- */
-long
-postorder(Reg *r, Reg **rpo2r, long n)
-{
-	Reg *r1;
-
-	r->rpo = 1;
-	r1 = r->s1;
-	if(r1 && !r1->rpo)
-		n = postorder(r1, rpo2r, n);
-	r1 = r->s2;
-	if(r1 && !r1->rpo)
-		n = postorder(r1, rpo2r, n);
-	rpo2r[n] = r;
-	n++;
-	return n;
-}
-
-long
-rpolca(long *idom, long rpo1, long rpo2)
-{
-	long t;
-
-	if(rpo1 == -1)
-		return rpo2;
-	while(rpo1 != rpo2){
-		if(rpo1 > rpo2){
-			t = rpo2;
-			rpo2 = rpo1;
-			rpo1 = t;
-		}
-		while(rpo1 < rpo2){
-			t = idom[rpo2];
-			if(t >= rpo2)
-				sysfatal("bad idom");
-			rpo2 = t;
-		}
-	}
-	return rpo1;
-}
-
-int
-doms(long *idom, long r, long s)
-{
-	while(s > r)
-		s = idom[s];
-	return s == r;
-}
-
-int
-loophead(long *idom, Reg *r)
-{
-	long src;
-
-	src = r->rpo;
-	if(r->p1 != R && doms(idom, src, r->p1->rpo))
-		return 1;
-	for(r = r->p2; r != R; r = r->p2link)
-		if(doms(idom, src, r->rpo))
-			return 1;
-	return 0;
-}
-
-void
-loopmark(Reg **rpo2r, long head, Reg *r)
-{
-	if(r->rpo < head || r->active == head)
-		return;
-	r->active = head;
-	r->loop += LOOP;
-	if(r->p1 != R)
-		loopmark(rpo2r, head, r->p1);
-	for(r = r->p2; r != R; r = r->p2link)
-		loopmark(rpo2r, head, r);
-}
-
-void
-loopit(Reg *r, long nr)
-{
-	Reg *r1;
-	long i, d, me;
-
-	if(nr > maxnr) {
-		rpo2r = alloc(nr * sizeof(Reg*));
-		idom = alloc(nr * sizeof(long));
-		maxnr = nr;
-	}
-
-	d = postorder(r, rpo2r, 0);
-	if(d > nr)
-		sysfatal("too many reg nodes");
-	nr = d;
-	for(i = 0; i < nr / 2; i++){
-		r1 = rpo2r[i];
-		rpo2r[i] = rpo2r[nr - 1 - i];
-		rpo2r[nr - 1 - i] = r1;
-	}
-	for(i = 0; i < nr; i++)
-		rpo2r[i]->rpo = i;
-
-	idom[0] = 0;
-	for(i = 0; i < nr; i++){
-		r1 = rpo2r[i];
-		me = r1->rpo;
-		d = -1;
-		if(r1->p1 != R && r1->p1->rpo < me)
-			d = r1->p1->rpo;
-		for(r1 = r1->p2; r1 != nil; r1 = r1->p2link)
-			if(r1->rpo < me)
-				d = rpolca(idom, d, r1->rpo);
-		idom[i] = d;
-	}
-
-	for(i = 0; i < nr; i++){
-		r1 = rpo2r[i];
-		r1->loop++;
-		if(r1->p2 != R && loophead(idom, r1))
-			loopmark(rpo2r, i, r1);
-	}
-}
-
-void
-synch(Reg *r, Bits dif)
-{
-	Reg *r1;
-	int z;
-
-	for(r1 = r; r1 != R; r1 = r1->s1) {
-		for(z=0; z<BITS; z++) {
-			dif.b[z] = (dif.b[z] &
-				~(~r1->refbehind.b[z] & r1->refahead.b[z])) |
-					r1->set.b[z] | r1->regdiff.b[z];
-			if(dif.b[z] != r1->regdiff.b[z]) {
-				r1->regdiff.b[z] = dif.b[z];
-				change++;
-			}
-		}
-		if(r1->active)
-			break;
-		r1->active = 1;
-		for(z=0; z<BITS; z++)
-			dif.b[z] &= ~(~r1->calbehind.b[z] & r1->calahead.b[z]);
-		if(r1->s2 != R)
-			synch(r1->s2, dif);
-	}
-}
-
-ulong
-allreg(ulong b, Rgn *r)
-{
-	Var *v;
-	int i;
-
-	v = var + r->varno;
-	r->regno = 0;
-	switch(v->etype) {
-
-	default:
-		diag(Z, "unknown etype %d/%d", bitno(b), v->etype);
-		break;
-
-	case TCHAR:
-	case TUCHAR:
-	case TSHORT:
-	case TUSHORT:
-	case TINT:
-	case TUINT:
-	case TLONG:
-	case TULONG:
-	case TIND:
-	case TARRAY:
-		i = BtoR(~b);
-		if(i && r->cost > 0) {
-			r->regno = i;
-			return RtoB(i);
-		}
-		break;
-
-	case TVLONG:
-	case TDOUBLE:
-	case TFLOAT:
-		break;
-	}
-	return 0;
-}
-
-void
-paint1(Reg *r, int bn)
-{
-	Reg *r1;
-	Prog *p;
-	int z;
-	ulong bb;
-
-	z = bn/32;
-	bb = 1L<<(bn%32);
-	if(r->act.b[z] & bb)
-		return;
-	for(;;) {
-		if(!(r->refbehind.b[z] & bb))
-			break;
-		r1 = r->p1;
-		if(r1 == R)
-			break;
-		if(!(r1->refahead.b[z] & bb))
-			break;
-		if(r1->act.b[z] & bb)
-			break;
-		r = r1;
-	}
-
-	if(LOAD(r) & ~(r->set.b[z]&~(r->use1.b[z]|r->use2.b[z])) & bb) {
-		change -= CLOAD * r->loop;
-		if(debug['R'] && debug['v'])
-			print("%ld%P\tld %B $%d\n", r->loop,
-				r->prog, blsh(bn), change);
-	}
-	for(;;) {
-		r->act.b[z] |= bb;
-		p = r->prog;
-
-		if(r->use1.b[z] & bb) {
-			change += CREF * r->loop;
-			if(debug['R'] && debug['v'])
-				print("%ld%P\tu1 %B $%d\n", r->loop,
-					p, blsh(bn), change);
-		}
-
-		if((r->use2.b[z]|r->set.b[z]) & bb) {
-			change += CREF * r->loop;
-			if(debug['R'] && debug['v'])
-				print("%ld%P\tu2 %B $%d\n", r->loop,
-					p, blsh(bn), change);
-		}
-
-		if(STORE(r) & r->regdiff.b[z] & bb) {
-			change -= CLOAD * r->loop;
-			if(debug['R'] && debug['v'])
-				print("%ld%P\tst %B $%d\n", r->loop,
-					p, blsh(bn), change);
-		}
-
-		if(r->refbehind.b[z] & bb)
-			for(r1 = r->p2; r1 != R; r1 = r1->p2link)
-				if(r1->refahead.b[z] & bb)
-					paint1(r1, bn);
-
-		if(!(r->refahead.b[z] & bb))
-			break;
-		r1 = r->s2;
-		if(r1 != R)
-			if(r1->refbehind.b[z] & bb)
-				paint1(r1, bn);
-		r = r->s1;
-		if(r == R)
-			break;
-		if(r->act.b[z] & bb)
-			break;
-		if(!(r->refbehind.b[z] & bb))
-			break;
-	}
-}
-
-ulong
-paint2(Reg *r, int bn)
-{
-	Reg *r1;
-	int z;
-	ulong bb, vreg;
-
-	z = bn/32;
-	bb = 1L << (bn%32);
-	vreg = regbits;
-	if(!(r->act.b[z] & bb))
-		return vreg;
-	for(;;) {
-		if(!(r->refbehind.b[z] & bb))
-			break;
-		r1 = r->p1;
-		if(r1 == R)
-			break;
-		if(!(r1->refahead.b[z] & bb))
-			break;
-		if(!(r1->act.b[z] & bb))
-			break;
-		r = r1;
-	}
-	for(;;) {
-		r->act.b[z] &= ~bb;
-
-		vreg |= r->regu;
-
-		if(r->refbehind.b[z] & bb)
-			for(r1 = r->p2; r1 != R; r1 = r1->p2link)
-				if(r1->refahead.b[z] & bb)
-					vreg |= paint2(r1, bn);
-
-		if(!(r->refahead.b[z] & bb))
-			break;
-		r1 = r->s2;
-		if(r1 != R)
-			if(r1->refbehind.b[z] & bb)
-				vreg |= paint2(r1, bn);
-		r = r->s1;
-		if(r == R)
-			break;
-		if(!(r->act.b[z] & bb))
-			break;
-		if(!(r->refbehind.b[z] & bb))
-			break;
-	}
-	return vreg;
-}
-
-void
-paint3(Reg *r, int bn, long rb, int rn)
-{
-	Reg *r1;
-	Prog *p;
-	int z;
-	ulong bb;
-
-	z = bn/32;
-	bb = 1L << (bn%32);
-	if(r->act.b[z] & bb)
-		return;
-	for(;;) {
-		if(!(r->refbehind.b[z] & bb))
-			break;
-		r1 = r->p1;
-		if(r1 == R)
-			break;
-		if(!(r1->refahead.b[z] & bb))
-			break;
-		if(r1->act.b[z] & bb)
-			break;
-		r = r1;
-	}
-
-	if(LOAD(r) & ~(r->set.b[z] & ~(r->use1.b[z]|r->use2.b[z])) & bb)
-		addmove(r, bn, rn, 0);
-	for(;;) {
-		r->act.b[z] |= bb;
-		p = r->prog;
-
-		if(r->use1.b[z] & bb) {
-			if(debug['R'])
-				print("%P", p);
-			addreg(&p->from, rn);
-			if(debug['R'])
-				print("\t.c%P\n", p);
-		}
-		if((r->use2.b[z]|r->set.b[z]) & bb) {
-			if(debug['R'])
-				print("%P", p);
-			addreg(&p->to, rn);
-			if(debug['R'])
-				print("\t.c%P\n", p);
-		}
-
-		if(STORE(r) & r->regdiff.b[z] & bb)
-			addmove(r, bn, rn, 1);
-		r->regu |= rb;
-
-		if(r->refbehind.b[z] & bb)
-			for(r1 = r->p2; r1 != R; r1 = r1->p2link)
-				if(r1->refahead.b[z] & bb)
-					paint3(r1, bn, rb, rn);
-
-		if(!(r->refahead.b[z] & bb))
-			break;
-		r1 = r->s2;
-		if(r1 != R)
-			if(r1->refbehind.b[z] & bb)
-				paint3(r1, bn, rb, rn);
-		r = r->s1;
-		if(r == R)
-			break;
-		if(r->act.b[z] & bb)
-			break;
-		if(!(r->refbehind.b[z] & bb))
-			break;
-	}
-}
-
-void
-addreg(Adr *a, int rn)
-{
-
-	a->sym = 0;
-	a->offset = 0;
-	a->type = rn;
-}
-
-long
-RtoB(int r)
-{
-
-	if(r >= D_R0 && r <= D_R0+31)
-		return 1L << r-D_R0;
-	return 0;
-}
-
-BtoR(long b)
-{
-
-	if(b == 0)
-		return 0;
-	return bitno(b) + D_R0;
-}

+ 0 - 149
sys/src/cmd/6c/reg.h

@@ -1,149 +0,0 @@
-typedef	struct	Reg	Reg;
-typedef	struct	Rgn	Rgn;
-typedef	struct	Bits	Bits;
-typedef	struct	Var	Var;
-
-#define	BITS	5
-#define	NVAR	(BITS*sizeof(ulong)*8)
-struct	Bits
-{
-	ulong	b[BITS];
-};
-
-struct	Var
-{
-	long	offset;
-	Sym*	sym;
-	char	type;
-	char	etype;
-};
-
-struct	Reg
-{
-	long	pc;
-	Bits	set;
-	Bits	use1;
-	Bits	use2;
-
-	Bits	refbehind;
-	Bits	refahead;
-	Bits	calbehind;
-	Bits	calahead;
-	Bits	regdiff;
-	Bits	act;
-
-	ulong	regu;
-	long	loop;		/* could be shorter */
-
-	union
-	{
-		Reg*	log5;
-		int	active;
-	};
-	Reg*	p1;
-	Reg*	p2;
-	Reg*	p2link;
-	Reg*	s1;
-	Reg*	s2;
-	Reg*	link;
-	Prog*	prog;
-};
-#define	R	((Reg*)0)
-
-struct	Rgn
-{
-	Reg*	enter;
-	short	costr;
-	short	costa;
-	short	varno;
-	short	regno;
-};
-
-#define	BLOAD(r)	band(bnot(r->refbehind), r->refahead)
-#define	BSTORE(r)	band(bnot(r->calbehind), r->calahead)
-#define	LOAD(r)		(~r->refbehind.b[z] & r->refahead.b[z])
-#define	STORE(r)	(~r->calbehind.b[z] & r->calahead.b[z])
-
-#define	bset(a,n)	((a).b[(n)/32]&(1L<<(n)%32))
-
-#define	CLOAD	8
-#define	CREF	5
-#define	CTEST	2
-#define	CXREF	3
-#define	CINF	1000
-#define	LOOP	3
-
-Bits	externs;
-Bits	params;
-Bits	addrs;
-Bits	zbits;
-ulong	regbits;
-
-#define	B_INDIR	(1<<0)
-#define	B_ADDR	(1<<1)
-int	mvbits;
-int	changer;
-int	changea;
-Reg*	firstr;
-Reg*	lastr;
-Reg	zreg;
-Reg*	freer;
-Rgn	region[NRGN];
-Rgn*	rgp;
-Var	var[NVAR];
-
-void	peep(void);
-void	excise(Reg*);
-Reg*	uniqp(Reg*);
-Reg*	uniqs(Reg*);
-int	findtst(Reg*, Prog*, int);
-int	setcc(Prog*, Prog*);
-int	compat(Adr*, Adr*);
-int	aregind(Adr*);
-int	asize(int);
-int	usedin(int, Adr*);
-Reg*	findccr(Reg*);
-int	setccr(Prog*);
-Reg*	findop(Reg*, int, int, int);
-int	regtyp(int);
-int	anyvar(Adr*);
-int	subprop(Reg*);
-int	copyprop(Reg*);
-int	copy1(Adr*, Adr*, Reg*, int);
-int	copyu(Prog*, Adr*, Adr*);
-int	copyas(Adr*, Adr*);
-int	tasas(Adr*, Adr*);
-int	copyau(Adr*, Adr*);
-int	copysub(Adr*, Adr*, Adr*, Prog*, int);
-
-ulong	RtoB(int);
-ulong	AtoB(int);
-ulong	FtoB(int);
-int	BtoR(ulong);
-int	BtoA(ulong);
-int	BtoF(ulong);
-
-Reg*	rega(void);
-int	rcmp(void*, void*);
-void	regopt(Prog*);
-void	addmove(Reg*, int, int, int);
-Bits	mkvar(Adr*, int);
-void	prop(Reg*, Bits, Bits);
-int	loopit(Reg*);
-void	synch(Reg*, Bits);
-ulong	allreg(ulong, Rgn*);
-void	paint1(Reg*, int);
-ulong	paint2(Reg*, int);
-void	paint3(Reg*, int, ulong, int);
-void	addreg(Adr*, int);
-
-/*
- * bits.c
- */
-Bits	bor(Bits, Bits);
-Bits	band(Bits, Bits);
-Bits	bnot(Bits);
-int	bany(Bits*);
-int	bnum(Bits);
-Bits	blsh(int);
-int	beq(Bits, Bits);

Some files were not shown because too many files changed in this diff