shithub: riscv

Download patch

ref: 986886f2b8ab4a7e1b3d66e99934d8fdab537be9
parent: f7703d6971383c39f981f5676a4e28a6371c3997
author: cinap_lenrek <[email protected]>
date: Wed May 4 12:11:48 EDT 2016

retire the dec alpha port

--- a/alpha/include/ape/float.h
+++ /dev/null
@@ -1,76 +1,0 @@
-#ifndef __FLOAT
-#define __FLOAT
-/* IEEE, default rounding */
-
-#define FLT_ROUNDS	1
-#define FLT_RADIX	2
-
-#define FLT_DIG		6
-#define FLT_EPSILON	1.19209290e-07
-#define FLT_MANT_DIG	24
-#define FLT_MAX		3.40282347e+38
-#define FLT_MAX_10_EXP	38
-#define FLT_MAX_EXP	128
-#define FLT_MIN		1.17549435e-38
-#define FLT_MIN_10_EXP	-37
-#define FLT_MIN_EXP	-125
-
-#define DBL_DIG		15
-#define DBL_EPSILON	2.2204460492503131e-16
-#define DBL_MANT_DIG	53
-#define DBL_MAX		1.797693134862315708145e+308
-#define DBL_MAX_10_EXP	308
-#define DBL_MAX_EXP	1024
-#define DBL_MIN		2.225073858507201383090233e-308
-#define DBL_MIN_10_EXP	-307
-#define DBL_MIN_EXP	-1021
-#define LDBL_MANT_DIG	DBL_MANT_DIG
-#define LDBL_EPSILON	DBL_EPSILON
-#define LDBL_DIG	DBL_DIG
-#define LDBL_MIN_EXP	DBL_MIN_EXP
-#define LDBL_MIN	DBL_MIN
-#define LDBL_MIN_10_EXP	DBL_MIN_10_EXP
-#define LDBL_MAX_EXP	DBL_MAX_EXP
-#define LDBL_MAX	DBL_MAX
-#define LDBL_MAX_10_EXP	DBL_MAX_10_EXP
-
-typedef 	union FPdbleword FPdbleword;
-union FPdbleword
-{
-	double	x;
-	struct {	/* little endian */
-		long lo;
-		long hi;
-	};
-};
-
-#ifdef _RESEARCH_SOURCE
-/* define stuff needed for floating conversion */
-#define IEEE_8087	1
-#define Sudden_Underflow 1
-#endif
-#ifdef _PLAN9_SOURCE
-#define	FPINEX	(1<<30)
-#define	FPOVFL	(1<<19)
-#define	FPUNFL	((1<<29)|(1<<28))
-#define	FPZDIV	(1<<18)
-#define	FPINVAL	(1<<17)
-
-#define	FPRNR	(2<<26)
-#define	FPRZ		(0<<26)
-#define	FPRPINF	(3<<26)
-#define	FPRNINF	(1<<26)
-#define	FPRMASK	(3<<26)
-
-#define	FPPEXT	0
-#define	FPPSGL	0
-#define	FPPDBL	0
-#define	FPPMASK	0
-/* FSR */
-#define	FPAINEX	(1<<24)
-#define	FPAUNFL	(1<<23)
-#define	FPAOVFL	(1<<22)
-#define	FPAZDIV	(1<<21)
-#define	FPAINVAL	(1<<20)
-#endif
-#endif /* __FLOAT */
--- a/alpha/include/ape/math.h
+++ /dev/null
@@ -1,77 +1,0 @@
-#ifndef __MATH
-#define __MATH
-#pragma lib "/$M/lib/ape/libap.a"
-
-/* a HUGE_VAL appropriate for IEEE double-precision */
-/* the correct value, 1.797693134862316e+308, causes a ken overflow */
-#define HUGE_VAL 1.79769313486231e+308
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern double acos(double);
-extern double asin(double);
-extern double atan(double);
-extern double atan2(double, double);
-extern double cos(double);
-extern double sin(double);
-extern double tan(double);
-extern double cosh(double);
-extern double sinh(double);
-extern double tanh(double);
-extern double exp(double);
-extern double frexp(double, int *);
-extern double ldexp(double, int);
-extern double log(double);
-extern double log10(double);
-extern double modf(double, double *);
-extern double pow(double, double);
-extern double sqrt(double);
-extern double ceil(double);
-extern double fabs(double);
-extern double floor(double);
-extern double fmod(double, double);
-extern double NaN(void);
-extern int isNaN(double);
-extern double Inf(int);
-extern int isInf(double, int);
-
-#ifdef _RESEARCH_SOURCE
-/* does >> treat left operand as unsigned ? */
-#define Unsigned_Shifts 1
-#define	M_E		2.7182818284590452354	/* e */
-#define	M_LOG2E		1.4426950408889634074	/* log 2e */
-#define	M_LOG10E	0.43429448190325182765	/* log 10e */
-#define	M_LN2		0.69314718055994530942	/* log e2 */
-#define	M_LN10		2.30258509299404568402	/* log e10 */
-#define	M_PI		3.14159265358979323846	/* pi */
-#define	M_PI_2		1.57079632679489661923	/* pi/2 */
-#define	M_PI_4		0.78539816339744830962	/* pi/4 */
-#define	M_1_PI		0.31830988618379067154	/* 1/pi */
-#define	M_2_PI		0.63661977236758134308	/* 2/pi */
-#define	M_2_SQRTPI	1.12837916709551257390	/* 2/sqrt(pi) */
-#define	M_SQRT2		1.41421356237309504880	/* sqrt(2) */
-#define	M_SQRT1_2	0.70710678118654752440	/* 1/sqrt(2) */
-
-extern double hypot(double, double);
-extern double erf(double);
-extern double erfc(double);
-extern double j0(double);
-extern double y0(double);
-extern double j1(double);
-extern double y1(double);
-extern double jn(int, double);
-extern double yn(int, double);
-
-#endif
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#define isnan(x) isNaN(x)
-#define isinf(x) isInf(x)
-
-#endif /* __MATH */
--- a/alpha/include/ape/stdarg.h
+++ /dev/null
@@ -1,17 +1,0 @@
-#ifndef __STDARG
-#define __STDARG
-
-typedef char *va_list;
-
-#define va_start(list, start) list = (char *)(&(start)+1)
-#define va_end(list)
-#define va_arg(list, mode)\
-	(sizeof(mode)==1?\
-		((mode*)(list += 4))[-1]:\
-	sizeof(mode)==2?\
-		((mode*)(list += 4))[-1]:\
-	sizeof(mode)>4?\
-		((mode*)(list = (char*)((long)(list+7) & ~7) + sizeof(mode)))[-1]:\
-		((mode*)(list += sizeof(mode)))[-1])
-
-#endif /* __STDARG */
--- a/alpha/include/ape/ureg.h
+++ /dev/null
@@ -1,57 +1,0 @@
-#ifndef __UREG_H
-#define __UREG_H
-#if !defined(_PLAN9_SOURCE)
-    This header file is an extension to ANSI/POSIX
-#endif
-
-struct Ureg
-{
-	/* l.s saves 31 64-bit values: */
-	unsigned long long	type;
-	unsigned long long	a0;
-	unsigned long long	a1;
-	unsigned long long	a2;
-
-	unsigned long long	r0;
-	unsigned long long	r1;
-	unsigned long long	r2;
-	unsigned long long	r3;
-	unsigned long long	r4;
-	unsigned long long	r5;
-	unsigned long long	r6;
-	unsigned long long	r7;
-	unsigned long long	r8;
-	unsigned long long	r9;
-	unsigned long long	r10;
-	unsigned long long	r11;
-	unsigned long long	r12;
-	unsigned long long	r13;
-	unsigned long long	r14;
-	unsigned long long	r15;
-
-	unsigned long long	r19;
-	unsigned long long	r20;
-	unsigned long long	r21;
-	unsigned long long	r22;
-	unsigned long long	r23;
-	unsigned long long	r24;
-	unsigned long long	r25;
-	unsigned long long	r26;
-	unsigned long long	r27;
-	unsigned long long	r28;
-	union {
-		unsigned long long	r30;
-		unsigned long long	usp;
-		unsigned long long	sp;
-	};
-
-	/* OSF/1 PALcode frame: */
-	unsigned long long	status;	/* PS */
-	unsigned long long	pc;
-	unsigned long long	r29;		/* GP */
-	unsigned long long	r16;		/* a0 */
-	unsigned long long	r17;		/* a1 */
-	unsigned long long	r18;		/* a2 */
-};
-
-#endif
--- a/alpha/include/u.h
+++ /dev/null
@@ -1,71 +1,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 long		intptr;
-typedef unsigned long	uintptr;
-typedef unsigned long	usize;
-typedef	uint		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;
-
-/* FCR */
-#define	FPINEX	(1<<30)
-#define	FPOVFL	(1<<19)
-#define	FPUNFL	((1<<29)|(1<<28))
-#define	FPZDIV	(1<<18)
-#define	FPINVAL	(1<<17)
-
-#define	FPRNR	(2<<26)
-#define	FPRZ		(0<<26)
-#define	FPRPINF	(3<<26)
-#define	FPRNINF	(1<<26)
-#define	FPRMASK	(3<<26)
-
-#define	FPPEXT	0
-#define	FPPSGL	0
-#define	FPPDBL	0
-#define	FPPMASK	0
-/* FSR */
-#define	FPAINEX	(1<<24)
-#define	FPAUNFL	(1<<23)
-#define	FPAOVFL	(1<<22)
-#define	FPAZDIV	(1<<21)
-#define	FPAINVAL	(1<<20)
-union FPdbleword
-{
-	double	x;
-	struct {	/* little endian */
-		ulong lo;
-		ulong hi;
-	};
-};
-
-/* stdarg */
-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)?\
-		((list += 4), (mode*)list)[-4]:\
-	(sizeof(mode) == 2)?\
-		((list += 4), (mode*)list)[-2]:\
-	sizeof(mode)>4?\
-		((mode*)(list = (char*)((uintptr)(list+7) & ~7) + sizeof(mode)))[-1]:\
-		((list += sizeof(mode)), (mode*)list)[-1])
--- a/alpha/include/ureg.h
+++ /dev/null
@@ -1,49 +1,0 @@
-struct Ureg
-{
-	/* l.s saves 31 64-bit values: */
-	uvlong	type;
-	uvlong	a0;
-	uvlong	a1;
-	uvlong	a2;
-
-	uvlong	r0;
-	uvlong	r1;
-	uvlong	r2;
-	uvlong	r3;
-	uvlong	r4;
-	uvlong	r5;
-	uvlong	r6;
-	uvlong	r7;
-	uvlong	r8;
-	uvlong	r9;
-	uvlong	r10;
-	uvlong	r11;
-	uvlong	r12;
-	uvlong	r13;
-	uvlong	r14;
-	uvlong	r15;
-
-	uvlong	r19;
-	uvlong	r20;
-	uvlong	r21;
-	uvlong	r22;
-	uvlong	r23;
-	uvlong	r24;
-	uvlong	r25;
-	uvlong	r26;
-	uvlong	r27;
-	uvlong	r28;
-	union {
-		uvlong	r30;
-		uvlong	usp;
-		uvlong	sp;
-	};
-
-	/* OSF/1 PALcode frame: */
-	uvlong	status;	/* PS */
-	uvlong	pc;
-	uvlong	r29;		/* GP */
-	uvlong	r16;		/* a0 */
-	uvlong	r17;		/* a1 */
-	uvlong	r18;		/* a2 */
-};
--- a/alpha/mkfile
+++ /dev/null
@@ -1,6 +1,0 @@
-</sys/src/mkfile.proto
-
-CC=7c
-LD=7l
-O=7
-AS=7a
--- a/sys/include/a.out.h
+++ b/sys/include/a.out.h
@@ -25,7 +25,7 @@
 #define	E_MAGIC		_MAGIC(0, 20)		/* arm */
 #define	Q_MAGIC		_MAGIC(0, 21)		/* powerpc */
 #define	N_MAGIC		_MAGIC(0, 22)		/* mips 4000 LE */
-#define	L_MAGIC		_MAGIC(0, 23)		/* dec alpha */
+#define	L_MAGIC		_MAGIC(0, 23)		/* dec alpha (retired) */
 #define	P_MAGIC		_MAGIC(0, 24)		/* mips 3000 LE */
 #define	U_MAGIC		_MAGIC(0, 25)		/* sparc64 */
 #define	S_MAGIC		_MAGIC(HDR_MAGIC, 26)	/* amd64 */
--- a/sys/lib/acid/alpha
+++ /dev/null
@@ -1,205 +1,0 @@
-// Alpha support
-
-defn acidinit()			// Called after all the init modules are loaded
-{
-	bplist = {};
-	bpfmt = 'X';
-
-	srcpath = {
-		"./",
-		"/sys/src/libc/port/",
-		"/sys/src/libc/9sys/",
-		"/sys/src/libc/alpha/"
-	};
-
-	srcfiles = {};		// list of loaded files
-	srctext = {};		// the text of the files
-}
-
-defn stk()			// trace
-{
-	_stk(*PC, *SP, linkreg(0), 0);
-}
-
-defn lstk()			// trace with locals
-{
-	_stk(*PC, *SP, linkreg(0), 1);
-}
-
-defn gpr()			// print general purpose registers
-{
-	print("R0\t", *R0, "\n");
-	print("R1\t", *R1, " R2\t", *R2, " R3\t", *R3, "\n");
-	print("R4\t", *R4, " R5\t", *R5, " R6\t", *R6, "\n");
-	print("R7\t", *R7, " R8\t", *R8, " R9\t", *R9, "\n");
-	print("R10\t", *R10, " R11\t", *R11, " R12\t", *R12, "\n");
-	print("R13\t", *R13, " R14\t", *R14, " R15\t", *R15, "\n");
-	print("R16\t", *R16, " R17\t", *R17, " R18\t", *R18, "\n");
-	print("R19\t", *R19, " R20\t", *R20, " R21\t", *R21, "\n");
-	print("R22\t", *R22, " R23\t", *R23, " R24\t", *R24, "\n");
-	print("R25\t", *R25, " R26\t", *R26, " R27\t", *R27, "\n");
-	print("R28\t", *R28, " R29\t", *R29, " R30\t", *SP\Y, "\n");
-}
-
-defn fpr()
-{
-	print("F0\t",  *fmt(F0, 'G'),  "\tF1\t",  *fmt(F1, 'G'), "\n");
-	print("F2\t",  *fmt(F2, 'G'),  "\tF3\t",  *fmt(F3, 'G'), "\n");
-	print("F4\t",  *fmt(F4, 'G'),  "\tF5\t",  *fmt(F5, 'G'), "\n");
-	print("F6\t",  *fmt(F6, 'G'),  "\tF7\t",  *fmt(F7, 'G'), "\n");
-	print("F8\t",  *fmt(F8, 'G'),  "\tF9\t",  *fmt(F9, 'G'), "\n");
-	print("F10\t", *fmt(F10, 'G'), "\tF11\t", *fmt(F11, 'G'), "\n");
-	print("F12\t", *fmt(F12, 'G'), "\tF13\t", *fmt(F13, 'G'), "\n");
-	print("F14\t", *fmt(F14, 'G'), "\tF15\t", *fmt(F15, 'G'), "\n");
-	print("F16\t", *fmt(F16, 'G'), "\tF17\t", *fmt(F17, 'G'), "\n");
-	print("F18\t", *fmt(F18, 'G'), "\tF19\t", *fmt(F19, 'G'), "\n");
-	print("F20\t", *fmt(F20, 'G'), "\tF21\t", *fmt(F21, 'G'), "\n");
-	print("F22\t", *fmt(F22, 'G'), "\tF23\t", *fmt(F23, 'G'), "\n");
-	print("F24\t", *fmt(F24, 'G'), "\tF25\t", *fmt(F25, 'G'), "\n");
-	print("F26\t", *fmt(F26, 'G'), "\tF27\t", *fmt(F27, 'G'), "\n");
-	print("F28\t", *fmt(F28, 'G'), "\tF29\t", *fmt(F29, 'G'), "\n");
-	print("F30\t", *fmt(F30, 'G'), "\tF31\t", *fmt(F31, 'G'), "\n");
-}
-
-defn spr()				// print special processor registers
-{
-	local pc, link, cause;
-
-	pc = *PC;
-	print("PC\t", pc, " ", fmt(pc, 'a'), "  ");
-	pfl(pc);
-
-	link = *R26;
-	print("SP\t", *SP, "\tLINK\t", link, " ", fmt(link, 'a'), " ");
-	pfl(link);
-
-	cause = *TYPE;
-	print("STATUS\t", *STATUS, "\tTYPE\t", cause, " ", reason(cause), "\n");
-	print("A0\t", *A0, " A1\t", *A1, " A2\t", *A2, "\n");
-}
-
-defn regs()				// print all registers
-{
-	spr();
-	gpr();
-}
-
-defn pstop(pid)
-{
-	local l, pc;
-
-	pc = *PC;
-
-	print(pid,": ", reason(*TYPE), "\t");
-	print(fmt(pc, 'a'), "\t", fmt(pc, 'i'), "\n");
-
-	if notes then {
-		if notes[0] != "sys: breakpoint" then {
-			print("Notes pending:\n");
-			l = notes;
-			while l do {
-				print("\t", head l, "\n");
-				l = tail l;
-			}
-		}
-	}
-}
-
-sizeofUreg = 296;
-aggr Ureg
-{
-	'W' 0 type;
-	'W' 8 a0;
-	'W' 16 a1;
-	'W' 24 a2;
-	'W' 32 r0;
-	'W' 40 r1;
-	'W' 48 r2;
-	'W' 56 r3;
-	'W' 64 r4;
-	'W' 72 r5;
-	'W' 80 r6;
-	'W' 88 r7;
-	'W' 96 r8;
-	'W' 104 r9;
-	'W' 112 r10;
-	'W' 120 r11;
-	'W' 128 r12;
-	'W' 136 r13;
-	'W' 144 r14;
-	'W' 152 r15;
-	'W' 160 r19;
-	'W' 168 r20;
-	'W' 176 r21;
-	'W' 184 r22;
-	'W' 192 r23;
-	'W' 200 r24;
-	'W' 208 r25;
-	'W' 216 r26;
-	'W' 224 r27;
-	'W' 232 r28;
-	{
-	'W' 240 r30;
-	'W' 240 usp;
-	'W' 240 sp;
-	};
-	'W' 248 status;
-	'W' 256 pc;
-	'W' 264 r29;
-	'W' 272 r16;
-	'W' 280 r17;
-	'W' 288 r18;
-};
-
-defn
-Ureg(addr) {
-	complex Ureg addr;
-	print("	type	", addr.type, "\n");
-	print("	a0	", addr.a0, "\n");
-	print("	a1	", addr.a1, "\n");
-	print("	a2	", addr.a2, "\n");
-	print("	r0	", addr.r0, "\n");
-	print("	r1	", addr.r1, "\n");
-	print("	r2	", addr.r2, "\n");
-	print("	r3	", addr.r3, "\n");
-	print("	r4	", addr.r4, "\n");
-	print("	r5	", addr.r5, "\n");
-	print("	r6	", addr.r6, "\n");
-	print("	r7	", addr.r7, "\n");
-	print("	r8	", addr.r8, "\n");
-	print("	r9	", addr.r9, "\n");
-	print("	r10	", addr.r10, "\n");
-	print("	r11	", addr.r11, "\n");
-	print("	r12	", addr.r12, "\n");
-	print("	r13	", addr.r13, "\n");
-	print("	r14	", addr.r14, "\n");
-	print("	r15	", addr.r15, "\n");
-	print("	r19	", addr.r19, "\n");
-	print("	r20	", addr.r20, "\n");
-	print("	r21	", addr.r21, "\n");
-	print("	r22	", addr.r22, "\n");
-	print("	r23	", addr.r23, "\n");
-	print("	r24	", addr.r24, "\n");
-	print("	r25	", addr.r25, "\n");
-	print("	r26	", addr.r26, "\n");
-	print("	r27	", addr.r27, "\n");
-	print("	r28	", addr.r28, "\n");
-	print("_12_ {\n");
-		_12_(addr+240);
-	print("}\n");
-	print("	status	", addr.status, "\n");
-	print("	pc	", addr.pc, "\n");
-	print("	r29	", addr.r29, "\n");
-	print("	r16	", addr.r16, "\n");
-	print("	r17	", addr.r17, "\n");
-	print("	r18	", addr.r18, "\n");
-};
-
-defn linkreg(addr)
-{
-	complex Ureg addr;
-	return addr.r26\X;
-}
-
-print("/sys/lib/acid/alpha");
-
--- a/sys/lib/acid/kernel
+++ b/sys/lib/acid/kernel
@@ -434,10 +434,6 @@
 	if (objtype == "mips" || objtype == "mips2") then {
 		kdir = "ch";
 	}
-	if objtype == "alpha" then {
-		map({"*data", KZERO, 0xffffffff, KZERO});
-		kdir = "alpha";
-	}
 	needacid("proc");
 	needacid("chan");
 	needacid("segment");
--- a/sys/lib/acid/syscall
+++ b/sys/lib/acid/syscall
@@ -160,8 +160,6 @@
 		return { code(*(*PC-4) & 0xffff), code(*SP+4), code(*R1) };
 	if objtype == "arm" then
 		return { code(*(*PC-4) & 0xffff), code(*SP+4), code(*R0) };	// untested
-	if objtype == "alpha" then
-		return { code(*(*PC-4) & 0xffff), code(*SP+4), code(*R0) };	// untested
 }
 
 defn trapoffset() {
@@ -171,7 +169,6 @@
 	if objtype == "mips" then return 8;
 	if objtype == "mips2" then return 8;
 	if objtype == "arm" then return 8;	// untested
-	if objtype == "alpha" then return 8;	// untested
 }	
 
 defn trapreason() {
@@ -181,7 +178,6 @@
 	if objtype == "mips" then return reason(*CAUSE);
 	if objtype == "mips2" then return reason(*CAUSE);
 	if objtype == "arm" then return "unknown trap";	// untested
-	if objtype == "alpha" then return reason(cause);	// untested
 }
 
 
--- a/sys/lib/acid/thread
+++ b/sys/lib/acid/thread
@@ -14,7 +14,7 @@
 
 defn labstk(l)
 {
-	_stk(labpc(l), labsp(l), 0, 0);
+	_stk(labpc(l), labsp(l), 0, 1);
 }
 
 defn lablstk(l)
@@ -250,7 +250,7 @@
 	ign = stkignore;
 	stkignore = {
 		"^/sys/src/libthread/",
-		"^/sys/src/libc/(386|arm|alpha|sparc|power|mips)/"
+		"^/sys/src/libc/(386|arm|sparc|power|mips)/"
 	};
 	setproc(P.pid);
 	Tq = (Tqueue)P.threads;
@@ -315,7 +315,7 @@
 	setproc(P.pid);
 
 	if T.state == Running then{
-		stk();
+		lstk();
 	} else {
 		labstk(T.sched);
 	}
--- a/sys/lib/acid/trump
+++ b/sys/lib/acid/trump
@@ -116,11 +116,11 @@
 }
 
 defn trumpretval() {
-	if objtype=="386" then
+	if objtype=="386" || objtype=="amd64" then
 		return *AX;
 	if objtype=="mips" then
 		return *R1;
-	if objtype=="power" || objtype=="alpha" then
+	if objtype=="power" || objtype=="arm" then
 		return *R0;
 }
 
--- a/sys/lib/acid/truss
+++ b/sys/lib/acid/truss
@@ -160,7 +160,7 @@
 	// translate to ape system calls if we have an ape binary
 	if _addressof("_EXITS") != 0 then
 		pattern = trussapecalls[match(pattern, trusscalls)];
-	if regexp("(seek|_SEEK)", pattern) && (objtype=="amd64" || objtype == "power64" || objtype == "alpha") then
+	if regexp("(seek|_SEEK)", pattern) && (objtype=="amd64" || objtype == "power64") then
 		pattern = "_" + pattern;
 	return _addressof(pattern);
 }
--- a/sys/src/9/alphapc/apc
+++ /dev/null
@@ -1,62 +1,0 @@
-dev
-	root
-	cons
-	arch
-	pnp		pci
-	env
-	pipe
-	proc
-	mnt
-	srv
-	dup
-#	rtc
-	ssl
-	cap
-	kprof
-#	loopback
-
-	ether		netif
-	ip		arp chandial inferno ip ipv6 ipaux iproute netlog nullmedium pktmedium ptclbsum
-
-	draw		screen vga vgax
-	mouse		mouse
-	vga
-
-	sd
-	floppy		dma
-
-	audio		dma
-	uart
-
-link
-	ether2114x	pci
-	ethermedium
-
-misc
-	arch164
-
-	sdata		pci sdscsi
-#	sd53c8xx	pci sdscsi
-
-	uarti8250
-
-	vgargb524	=cur
-	vgas3		+cur
-	vgas3		+cur vgasavage
-	vgatvp3026	=cur
-
-ip
-	tcp
-	udp
-	ipifc
-	icmp
-	icmp6
-
-port
-	int cpuserver = 0;
-
-bootdir
-	/$objtype/bin/paqfs
-	/$objtype/bin/auth/factotum
-	bootfs.paq
-	boot
--- a/sys/src/9/alphapc/apccpu
+++ /dev/null
@@ -1,56 +1,0 @@
-dev
-	root
-	cons
-	arch
-	pnp		pci
-	env
-	pipe
-	proc
-	mnt
-	srv
-	dup
-#	rtc
-	ssl
-	cap
-	kprof
-#	loopback
-
-	ether		netif
-	ip		arp chandial ip ipv6 ipaux iproute netlog nullmedium pktmedium ptclbsum inferno
-
-	sd
-	floppy		dma
-
-	audio		dma
-	uart
-
-link
-	ether2114x	pci
-	ethermedium
-	loopbackmedium
-
-misc
-	arch164
-
-	sdata		pci sdscsi
-#	sd53c8xx	pci sdscsi
-
-	uarti8250
-
-ip
-	tcp
-	udp
-	ipifc
-	icmp
-	icmp6
-	gre
-	ipmux
-
-port
-	int cpuserver = 1;
-
-bootdir
-	/$objtype/bin/paqfs
-	/$objtype/bin/auth/factotum
-	bootfs.paq
-	boot
--- a/sys/src/9/alphapc/arch164.c
+++ /dev/null
@@ -1,363 +1,0 @@
-/*
- *	EB164 and similar
- *	CPU:	21164
- *	Core Logic: 21172 CIA or 21174 PYXIS
-  */
-#include	"u.h"
-#include	"../port/lib.h"
-#include	"mem.h"
-#include	"dat.h"
-#include	"fns.h"
-#include	"io.h"
-
-static ulong *core;
-static ulong *wind;
-
-static ulong windsave[16];
-static ulong coresave[1];
-
-ulong	iobase0;
-ulong	iobase1;
-#define	iobase(p)	(iobase0+(p))
-
-static int
-ident(void)
-{
-	return 0;	/* bug! */
-}
-
-static uvlong* sgmap;
-
-static void
-sginit(void)
-{
-	ulong pa;
-	uvlong *pte;
-
-	sgmap = xspanalloc(BY2PG, BY2PG, 0);
-	memset(sgmap, 0, BY2PG);
-
-	/*
-	 * Prepare scatter-gather map for 0-8MB.
-	 */
-	pte = sgmap;
-	for(pa = 0; pa < 8*1024*1024; pa += BY2PG)
-		*pte++ = ((pa>>PGSHIFT)<<1)|1;
-
-	/*
-	 * Set up a map for ISA DMA accesses to physical memory.
-	 * Addresses presented by an ISA device between ISAWINDOW
-	 * and ISAWINDOW+8MB will be translated to between 0 and
-	 * 0+8MB of physical memory.
-	 */
-	wind[0x400/4] = ISAWINDOW|2|1;		/* window base */
-	wind[0x440/4] = 0x00700000;		/* window mask */
-	wind[0x480/4] = PADDR(sgmap)>>2;	/* <33:10> of sg map */
-
-	wind[0x100/4] = 3;			/* invalidate tlb cache */
-}
-
-static void *
-kmapio(ulong space, ulong offset, int size)
-{
-	return kmapv(((uvlong)space<<32LL)|offset, size);
-}
-
-static void
-coreinit(void)
-{
-	int i;
-
-	core = kmapio(0x87, 0x40000000, 0x10000);
-	wind = kmapio(0x87, 0x60000000, 0x1000);
-
-	iobase0 = (ulong)kmapio(0x89, 0, 0x20000);
-
-	/* hae_io = core[0x440/4];
-	iobase1 = (ulong)kmapio(0x89, hae_io, 0x10000); */
-
-	/* save critical parts of hardware memory mapping */
-	for (i = 4; i < 8; i++) {
-		windsave[4*(i-4)+0] = wind[(i*0x100+0x00)/4];
-		windsave[4*(i-4)+1] = wind[(i*0x100+0x40)/4];
-		windsave[4*(i-4)+2] = wind[(i*0x100+0x80)/4];
-	}
-	coresave[0] = core[0x140/4];
-
-	/* disable windows */
-	wind[0x400/4] = 0;
-	wind[0x500/4] = 0;
-	wind[0x600/4] = 0;
-	wind[0x700/4] = 0;
-
-	sginit();
-
-	/*
-	 * Set up a map for PCI DMA accesses to physical memory.
-	 * Addresses presented by a PCI device between PCIWINDOW
-	 * and PCIWINDOW+1GB will be translated to between 0 and
-	 * 0+1GB of physical memory.
-	 */
-	wind[0x500/4] = PCIWINDOW|1;
-	wind[0x540/4] = 0x3ff00000;
-	wind[0x580/4] = 0;
-
-	/* clear error state */
-	core[0x8200/4] = 0x7ff;
-
-	/* set config: byte/word enable, no monster window, etc. */
-	core[0x140/4] = 0x21;
-
-	/* turn off mcheck on master abort.  now we can probe PCI space. */
-	core[0x8280/4] &= ~(1<<7);
-
-	/* set up interrupts. */
-	i8259init();
-	cserve(52, 4);		/* enable SIO interrupt */
-}
-
-void
-ciaerror(void)
-{
-	print("cia error 0x%luX\n", core[0x8200/4]);
-}
-
-static void
-corehello(void)
-{
-	print("cpu%d: CIA revision %ld; cnfg %lux cntrl %lux\n",
-			0,	/* BUG */
-			core[0x80/4] & 0x7f, core[0x140/4], core[0x100/4]);
-	print("cpu%d: HAE_IO %lux\n", 0, core[0x440/4]);
-	print("\n");
-}
-
-static void
-coredetach(void)
-{
-	int i;
-
-	for (i = 4; i < 8; i++) {
-		wind[(i*0x100+0x00)/4] = windsave[4*(i-4)+0];
-		wind[(i*0x100+0x40)/4] = windsave[4*(i-4)+1];
-		wind[(i*0x100+0x80)/4] = windsave[4*(i-4)+2];
-	}
-	core[0x140/4] = coresave[0];
-/*	for (i = 0; i < 4; i++)
-		if (i != 4)
-			cserve(53, i);		/* disable interrupts */
-}
-
-static Lock	pcicfgl;
-static ulong	pcimap[256];
-
-static void*
-pcicfg2117x(int tbdf, int rno)
-{
-	int space, bus;
-	ulong base;
-
-	bus = BUSBNO(tbdf);
-	lock(&pcicfgl);
-	base = pcimap[bus];
-	if (base == 0) {
-		if(bus)
-			space = 0x8B;
-		else
-			space = 0x8A;
-		pcimap[bus] = base = (ulong)kmapio(space, MKBUS(0, bus, 0, 0), (1<<16));
-	}
-	unlock(&pcicfgl);
-	return (void*)(base + BUSDF(tbdf) + rno);
-}
-
-static void*
-pcimem2117x(int addr, int len)
-{
-	return kmapio(0x88, addr, len);
-}
-
-static int
-intrenable164(Vctl *v)
-{
-	int vec, irq;
-
-	irq = v->irq;
-	if(irq > MaxIrqPIC) {
-		print("intrenable: irq %d out of range\n", v->irq);
-		return -1;
-	}
-	if(BUSTYPE(v->tbdf) == BusPCI) {
-		vec = irq+VectorPCI;
-		cserve(52, irq);
-	}
-	else {
-		vec = irq+VectorPIC;
-		if(i8259enable(irq, v->tbdf, v) == -1)
-			return -1;
-	}
-	return vec;
-}
-
-/*
- *	I have a function pointer in PCArch for every one of these, because on
- *	some Alphas we have to use sparse mode, but on others we can use
- *	MOVB et al.  Additionally, the PC164 documentation threatened us
- *	with the lie that the SIO is in region B, but everything else in region A.
- *	This turned out not to be the case.  Given the cost of this solution, it
- *	may be better just to use sparse mode for I/O space on all platforms.
- */
-int
-inb2117x(int port)
-{
-	mb();
-	return *(uchar*)(iobase(port));
-}
-
-ushort
-ins2117x(int port)
-{
-	mb();
-	return *(ushort*)(iobase(port));
-}
-
-ulong
-inl2117x(int port)
-{
-	mb();
-	return *(ulong*)(iobase(port));
-}
-
-void
-outb2117x(int port, int val)
-{
-	mb();
-	*(uchar*)(iobase(port)) = val;
-	mb();
-}
-
-void
-outs2117x(int port, ushort val)
-{
-	mb();
-	*(ushort*)(iobase(port)) = val;
-	mb();
-}
-
-void
-outl2117x(int port, ulong val)
-{
-	mb();
-	*(ulong*)(iobase(port)) = val;
-	mb();
-}
-
-void
-insb2117x(int port, void *buf, int len)
-{
-	int i;
-	uchar *p, *q;
-
-	p = (uchar*)iobase(port);
-	q = buf;
-	for(i = 0; i < len; i++){
-		mb();
-		*q++ = *p;
-	}
-}
-
-void
-inss2117x(int port, void *buf, int len)
-{
-	int i;
-	ushort *p, *q;
-
-	p = (ushort*)iobase(port);
-	q = buf;
-	for(i = 0; i < len; i++){
-		mb();
-		*q++ = *p;
-	}
-}
-
-void
-insl2117x(int port, void *buf, int len)
-{
-	int i;
-	ulong *p, *q;
-
-	p = (ulong*)iobase(port);
-	q = buf;
-	for(i = 0; i < len; i++){
-		mb();
-		*q++ = *p;
-	}
-}
-
-void
-outsb2117x(int port, void *buf, int len)
-{
-	int i;
-	uchar *p, *q;
-
-	p = (uchar*)iobase(port);
-	q = buf;
-	for(i = 0; i < len; i++){
-		mb();
-		*p = *q++;
-	}
-}
-
-void
-outss2117x(int port, void *buf, int len)
-{
-	int i;
-	ushort *p, *q;
-
-	p = (ushort*)iobase(port);
-	q = buf;
-	for(i = 0; i < len; i++){
-		mb();
-		*p = *q++;
-	}
-}
-
-void
-outsl2117x(int port, void *buf, int len)
-{
-	int i;
-	ulong *p, *q;
-
-	p = (ulong*)iobase(port);
-	q = buf;
-	for(i = 0; i < len; i++){
-		mb();
-		*p = *q++;
-	}
-}
-
-PCArch arch164 = {
-	"EB164",
-	ident,
-	coreinit,
-	corehello,
-	coredetach,
-	pcicfg2117x,
-	pcimem2117x,
-	intrenable164,
-	nil,
-	nil,
-
-	inb2117x,
-	ins2117x,
-	inl2117x,
-	outb2117x,
-	outs2117x,
-	outl2117x,
-	insb2117x,
-	inss2117x,
-	insl2117x,
-	outsb2117x,
-	outss2117x,
-	outsl2117x,
-};
--- a/sys/src/9/alphapc/audio.h
+++ /dev/null
@@ -1,16 +1,0 @@
-enum
-{
-	Bufsize		= 16*1024,	/* 92 ms each */
-	Nbuf		= 16,		/* 1.5 seconds total */
-	Dma		= 5,
-	IrqAUDIO	= 5,
-	SBswab		= 0,
-};
-
-#define seteisadma(a, b)	dmainit(a, Bufsize);
-#define CACHELINESZ		128
-#define UNCACHED(type, v)	(type*)((ulong)(v))
-#define dcflush(a, b)
-
-#define Int0vec
-#define setvec(v, f, a)		intrenable(v, f, a, BUSUNKNOWN, "audio")
--- a/sys/src/9/alphapc/axp.h
+++ /dev/null
@@ -1,71 +1,0 @@
-typedef struct Hwrpb	Hwrpb;
-typedef struct Hwcpu	Hwcpu;
-typedef struct Hwdsr	Hwdsr;
-
-struct Hwrpb
-{
-	uvlong	phys;
-	uvlong	sign;
-	uvlong	rev;
-	uvlong	size;
-	uvlong	cpu0;
-	uvlong	by2pg;
-	uvlong	pabits;
-	uvlong	maxasn;
-	char	ssn[16];
-	uvlong	systype;
-	uvlong	sysvar;
-	uvlong	sysrev;
-	uvlong	ifreq;
-	uvlong	cfreq;
-	uvlong	vptb;
-	uvlong	resv;
-	uvlong	tbhint;
-	uvlong	ncpu;
-	uvlong	cpulen;
-	uvlong	cpuoff;
-	uvlong	nctb;
-	uvlong	ctblen;
-	uvlong	ctboff;
-	uvlong	ccrboff;
-	uvlong	memoff;
-	uvlong	confoff;
-	uvlong	fruoff;
-	uvlong	termsaveva;
-	uvlong	termsavex;
-	uvlong	termrestva;
-	uvlong	termrestx;
-	uvlong	termresetva;
-	uvlong	termresetx;
-	uvlong	sysresv;
-	uvlong	hardresv;
-	uvlong	csum;
-	uvlong	rxrdymsk;
-	uvlong	txrdymsk;
-	uvlong	dsroff;		/* rev 6 or higher */
-};
-
-extern Hwrpb* hwrpb;
-
-struct Hwcpu
-{
-	uvlong	hwpcb[16];
-	uvlong	state;
-	uvlong	palmainlen;
-	uvlong	palscratchlen;
-	uvlong	palmainpa;
-	uvlong	palscratchpa;
-	uvlong	palrev;
-	uvlong	cputype;
-	uvlong	cpuvar;
-	uvlong	cpurev;
-	uvlong	serial[2];
-	/* more crap ... */
-};
-
-struct Hwdsr
-{
-	vlong	smm;
-	uvlong	lurtoff;
-	uvlong	sysnameoff;
-};
--- a/sys/src/9/alphapc/cga.c
+++ /dev/null
@@ -1,113 +1,0 @@
-#include "u.h"
-#include "../port/lib.h"
-#include "mem.h"
-#include "dat.h"
-#include "fns.h"
-#include "../port/error.h"
-#include "io.h"
-
-enum {
-	Width		= 160,
-	Height		= 25,
-
-	Attr		= 0x4f,	/* white on blue */
-};
-
-static ulong	cgabase;
-#define CGASCREENBASE	((uchar*)cgabase)
-
-static int cgapos;
-static int screeninitdone;
-static Lock cgascreenlock;
-
-static uchar
-cgaregr(int index)
-{
-	outb(0x3D4, index);
-	return inb(0x3D4+1) & 0xFF;
-}
-
-static void
-cgaregw(int index, int data)
-{
-	outb(0x3D4, index);
-	outb(0x3D4+1, data);
-}
-
-static void
-movecursor(void)
-{
-	cgaregw(0x0E, (cgapos/2>>8) & 0xFF);
-	cgaregw(0x0F, cgapos/2 & 0xFF);
-	CGASCREENBASE[cgapos+1] = Attr;
-}
-
-static void
-cgascreenputc(int c)
-{
-	int i;
-
-	if(c == '\n'){
-		cgapos = cgapos/Width;
-		cgapos = (cgapos+1)*Width;
-	}
-	else if(c == '\t'){
-		i = 8 - ((cgapos/2)&7);
-		while(i-->0)
-			cgascreenputc(' ');
-	}
-	else if(c == '\b'){
-		if(cgapos >= 2)
-			cgapos -= 2;
-		cgascreenputc(' ');
-		cgapos -= 2;
-	}
-	else{
-		CGASCREENBASE[cgapos++] = c;
-		CGASCREENBASE[cgapos++] = Attr;
-	}
-	if(cgapos >= Width*Height){
-		memmove(CGASCREENBASE, &CGASCREENBASE[Width], Width*(Height-1));
-		for (i = Width*(Height-1); i < Width*Height;) {
-			CGASCREENBASE[i++] = 0x20;
-			CGASCREENBASE[i++] = Attr;
-		}
-		cgapos = Width*(Height-1);
-	}
-	movecursor();
-}
-
-void
-screeninit(void)
-{
-	cgabase = (ulong)arch->pcimem(0xB8000, 0x8000);
-
-	cgapos = cgaregr(0x0E)<<8;
-	cgapos |= cgaregr(0x0F);
-	cgapos *= 2;
-	screeninitdone = 1;
-}
-
-static void
-cgascreenputs(char* s, int n)
-{
-	if(!screeninitdone)
-		return;
-	if(!islo()){
-		/*
-		 * Don't deadlock trying to
-		 * print in an interrupt.
-		 */
-		if(!canlock(&cgascreenlock))
-			return;
-	}
-	else
-		lock(&cgascreenlock);
-
-	while(n-- > 0)
-		cgascreenputc(*s++);
-
-	unlock(&cgascreenlock);
-}
-
-void (*screenputs)(char*, int) = cgascreenputs;
--- a/sys/src/9/alphapc/clock.c
+++ /dev/null
@@ -1,112 +1,0 @@
-#include	"u.h"
-#include	"../port/lib.h"
-#include	"mem.h"
-#include	"dat.h"
-#include	"fns.h"
-#include	"io.h"
-#include	"axp.h"
-#include	"ureg.h"
-
-void
-clockinit(void)
-{
-}
-
-uvlong
-cycletimer(void)
-{
-	ulong pcc;
-	vlong delta;
-
-	pcc = rpcc(nil) & 0xFFFFFFFF;
-	if(m->cpuhz == 0){
-		/*
-		 * pcclast is needed to detect wraparound of
-		 * the cycle timer which is only 32-bits.
-		 * m->cpuhz is set from the info passed from
-		 * the firmware.
-		 * This could be in clockinit if can
-		 * guarantee no wraparound between then and now.
-		 *
-		 * All the clock stuff needs work.
-		 */
-		m->cpuhz = hwrpb->cfreq;
-		m->pcclast = pcc;
-	}
-	delta = pcc - m->pcclast;
-	if(delta < 0)
-		delta += 0x100000000LL;
-	m->pcclast = pcc;
-	m->fastclock += delta;
-
-	return MACHP(0)->fastclock;
-}
-
-uvlong
-fastticks(uvlong* hz)
-{
-	uvlong ticks;
-	int x;
-
-	x = splhi();
-	ticks = cycletimer();
-	splx(x);
-
-	if(hz)
-		*hz = m->cpuhz;
-
-	return ticks;
-}
-
-ulong
-µs(void)
-{
-	return fastticks2us(cycletimer());
-}
-
-/*  
- *  performance measurement ticks.  must be low overhead.
- *  doesn't have to count over a second.
- */
-ulong
-perfticks(void)
-{
-	return rpcc(nil);
-}
-
-void
-timerset(Tval)
-{
-}
-
-void
-microdelay(int us)
-{
-	uvlong eot;
-
-	eot = fastticks(nil) + (m->cpuhz/1000000)*us;
-	while(fastticks(nil) < eot)
-		;
-}
-
-void
-delay(int millisecs)
-{
-	microdelay(millisecs*1000);
-}
-
-void
-clock(Ureg *ureg)
-{
-	static int count;
-
-	cycletimer();
-
-	/* HZ == 100, timer == 1024Hz.  error < 1ms */
-	count += 100;
-	if (count < 1024)
-		return;
-	count -= 1024;
-
-	timerintr(ureg, 0);
-}
--- a/sys/src/9/alphapc/cycintr.c
+++ /dev/null
@@ -1,27 +1,0 @@
-#include "u.h"
-#include "../port/lib.h"
-#include "mem.h"
-#include "dat.h"
-#include "fns.h"
-#include "io.h"
-
-int
-havetimer(void)
-{
-	return 0;
-}
-
-void
-timeradd(Timer *)
-{
-}
-
-void
-timerdel(Timer *)
-{
-}
-
-void
-clockintrsched(void)
-{
-}
--- a/sys/src/9/alphapc/dat.h
+++ /dev/null
@@ -1,265 +1,0 @@
-typedef struct Conf	Conf;
-typedef struct Confmem	Confmem;
-typedef struct FPsave	FPsave;
-typedef struct ISAConf	ISAConf;
-typedef struct Label	Label;
-typedef struct Lock	Lock;
-typedef struct Mach	Mach;
-typedef struct Notsave	Notsave;
-typedef struct Page	Page;
-typedef struct PCArch	PCArch;
-typedef struct PCB	PCB;
-typedef struct Pcidev	Pcidev;
-typedef struct PMMU	PMMU;
-typedef struct Proc	Proc;
-typedef struct Sys	Sys;
-typedef struct Ureg	Ureg;
-typedef struct Vctl	Vctl;
-typedef vlong		Tval;
-
-#define MAXSYSARG	6	/* for mount(fd, mpt, flag, arg, srv) */
-
-/*
- *  parameters for sysproc.c
- */
-#define AOUT_MAGIC	L_MAGIC
-
-/*
- *  machine dependent definitions used by ../port/dat.h
- */
-
-struct Lock
-{
-	ulong	key;			/* semaphore (non-zero = locked) */
-	ulong	sr;
-	ulong	pc;
-	Proc	*p;
-	Mach	*m;
-	ulong	pid;
-	ushort	isilock;
-};
-
-struct Label
-{
-	ulong	sp;
-	ulong	pc;
-};
-
-/*
- * Proc.fpstate
- */
-enum
-{
-	/* floating point states */
-	FPinit,
-	FPactive,
-	FPinactive,
-
-	/* bit or'd with the state */
-	FPillegal= 0x100,
-};
-
-struct	FPsave
-{
-	long	fpreg[2*32];
-	long	dummy;		/* lower bits of FPCR, useless */
-	long	fpstatus;
-};
-
-struct Confmem
-{
-	ulong	base;
-	ulong	npage;
-	ulong	kbase;
-	ulong	klimit;
-};
-
-struct Conf
-{
-	ulong	nmach;		/* processors */
-	ulong	nproc;		/* processes */
-	Confmem	mem[2];
-	ulong	npage;		/* total physical pages of memory */
-	ulong	upages;		/* user page pool */
-	ulong	nimage;		/* number of page cache image headers */
-	ulong	nswap;		/* number of swap pages */
-	int	nswppo;		/* max # of pageouts per segment pass */
-	ulong	copymode;	/* 0 is copy on write, 1 is copy on reference */
-	int	monitor;		/* has display? */
-	ulong	ialloc;		/* bytes available for interrupt time allocation */
-	ulong	pipeqsize;	/* size in bytes of pipe queues */
-};
-
-/*
- *  mmu goo in the Proc structure
- */
-struct PMMU
-{
-	Page	*mmutop;	/* 1st level table */
-	Page	*mmulvl2;	/* 2nd level table */
-	Page	*mmufree;	/* unused page table pages */
-	Page	*mmuused;	/* used page table pages, except for mmustk */
-};
-
-/*
- *  things saved in the Proc structure during a notify
- */
-struct Notsave
-{
-	ulong	UNUSED;
-};
-
-#include "../port/portdat.h"
-
-/*
- *  machine dependent definitions not used by ../port/dat.h
- */
-/*
- * Fake kmap
- */
-typedef	void		KMap;
-#define	VA(k)		((ulong)(k))
-#define	kmap(p)		(KMap*)((p)->pa|KZERO)
-#define	kunmap(k)
-
-/*
- *	Process Control Block, used by PALcode
- */
-struct PCB {
-	uvlong	ksp;
-	uvlong	usp;
-	uvlong	ptbr;
-	ulong	asn;
-	ulong	pcc;
-	uvlong	unique;
-	ulong	fen;
-	ulong	dummy;
-	uvlong	rsrv1;
-	uvlong	rsrv2;
-};
-
-struct Mach
-{
-	/* OFFSETS OF THE FOLLOWING KNOWN BY l.s */
-	int	machno;			/* physical id of processor */
-	ulong	splpc;			/* pc that called splhi() */
-	Proc	*proc;			/* current process on this processor */
-
-	/* ordering from here on irrelevant */
-
-	ulong	ticks;			/* of the clock since boot time */
-	Label	sched;			/* scheduler wakeup */
-	Lock	alarmlock;		/* access to alarm list */
-	void	*alarm;			/* alarms bound to this clock */
-	int	inclockintr;
-
-	Proc*	readied;		/* for runproc */
-	ulong	schedticks;	/* next forced context switch */
-
-	vlong	cpuhz;			/* hwrpb->cfreq */
-	uvlong	cyclefreq;		/* Frequency of user readable cycle counter */
-	ulong	pcclast;
-	uvlong	fastclock;
-	Perf	perf;			/* performance counters */
-
-	int	tlbfault;		/* only used by devproc; no access to tlb */
-	int	tlbpurge;		/* ... */
-	int	pfault;
-	int	cs;
-	int	syscall;
-	int	load;
-	int	intr;
-	int	flushmmu;		/* make current proc flush it's mmu state */
-	int	ilockdepth;
-
-	ulong	spuriousintr;
-	int	lastintr;
-
-	PCB;
-
-	/* MUST BE LAST */
-	int	stack[1];
-};
-
-struct
-{
-	Lock;
-	char	machs[MAXMACH];
-	int	exiting;
-}active;
-
-/*
- *	Implementation-dependant functions (outside of Alpha architecture proper).
- *	Called PCArch because that's what mkdevc calls it (for the PC).
- */
-struct PCArch
-{
-	char*	id;
-	int	(*ident)(void);
-
-	void	(*coreinit)(void);		/* set up core logic, PCI mappings etc */
-	void	(*corehello)(void);		/* identify core logic to user */
-	void	(*coredetach)(void);		/* restore core logic before return to console */
-	void	*(*pcicfg)(int, int);		/* map and point to PCI cfg space */
-	void	*(*pcimem)(int, int);		/* map and point to PCI memory space */
-	int	(*intrenable)(Vctl*);
-	int	(*intrvecno)(int);
-	int	(*intrdisable)(int);
-
-	int	(*_inb)(int);
-	ushort	(*_ins)(int);
-	ulong	(*_inl)(int);
-	void	(*_outb)(int, int);
-	void	(*_outs)(int, ushort);
-	void	(*_outl)(int, ulong);
-	void	(*_insb)(int, void*, int);
-	void	(*_inss)(int, void*, int);
-	void	(*_insl)(int, void*, int);
-	void	(*_outsb)(int, void*, int);
-	void	(*_outss)(int, void*, int);
-	void	(*_outsl)(int, void*, int);
-};
-
-/*
- *  a parsed plan9.ini line
- */
-#define NISAOPT		8
-
-struct ISAConf {
-	char	*type;
-	ulong	port;
-	int	irq;
-	ulong	dma;
-	ulong	mem;
-	ulong	size;
-	ulong	freq;
-
-	int	nopt;
-	char	*opt[NISAOPT];
-};
-
-extern PCArch	*arch;
-
-#define	MACHP(n)	((Mach *)((int)&mach0+n*BY2PG))
-extern Mach		mach0;
-
-extern register Mach	*m;
-extern register Proc	*up;
-
-/*
- *  hardware info about a device
- */
-typedef struct {
-	ulong	port;	
-	int	size;
-} Devport;
-
-struct DevConf
-{
-	ulong	intnum;	/* interrupt number */
-	char	*type;	/* card type, malloced */
-	int	nports;	/* Number of ports */
-	Devport	*ports;	/* The ports themselves */
-};
-
-extern FPsave initfp;
--- a/sys/src/9/alphapc/devarch.c
+++ /dev/null
@@ -1,533 +1,0 @@
-#include "u.h"
-#include "../port/lib.h"
-#include "mem.h"
-#include "dat.h"
-#include "fns.h"
-#include "io.h"
-#include "../port/error.h"
-#include	"axp.h"
-
-typedef struct IOMap IOMap;
-struct IOMap
-{
-	IOMap	*next;
-	char	tag[13];
-	ulong	start;
-	ulong	end;
-};
-
-static struct
-{
-	Lock;
-	IOMap	*m;
-	IOMap	*free;
-	IOMap	maps[32];		// some initial free maps
-
-	QLock	ql;			// lock for reading map
-} iomap;
-
-enum {
-	Qdir = 0,
-	Qioalloc = 1,
-	Qiob,
-	Qiow,
-	Qiol,
-	Qbase,
-
-	Qmax = 16,
-};
-
-typedef long Rdwrfn(Chan*, void*, long, vlong);
-
-static Rdwrfn *readfn[Qmax];
-static Rdwrfn *writefn[Qmax];
-
-static Dirtab archdir[] = {
-	".",	{ Qdir, 0, QTDIR },	0,	0555,
-	"ioalloc",	{ Qioalloc, 0 },	0,	0444,
-	"iob",		{ Qiob, 0 },		0,	0660,
-	"iow",		{ Qiow, 0 },		0,	0660,
-	"iol",		{ Qiol, 0 },		0,	0660,
-};
-Lock archwlock;	/* the lock is only for changing archdir */
-int narchdir = Qbase;
-int (*_pcmspecial)(char *, ISAConf *);
-void (*_pcmspecialclose)(int);
-
-/*
- * Add a file to the #P listing.  Once added, you can't delete it.
- * You can't add a file with the same name as one already there,
- * and you get a pointer to the Dirtab entry so you can do things
- * like change the Qid version.  Changing the Qid path is disallowed.
- */
-Dirtab*
-addarchfile(char *name, int perm, Rdwrfn *rdfn, Rdwrfn *wrfn)
-{
-	int i;
-	Dirtab d;
-	Dirtab *dp;
-
-	memset(&d, 0, sizeof d);
-	strcpy(d.name, name);
-	d.perm = perm;
-
-	lock(&archwlock);
-	if(narchdir >= Qmax){
-		unlock(&archwlock);
-		return nil;
-	}
-
-	for(i=0; i<narchdir; i++)
-		if(strcmp(archdir[i].name, name) == 0){
-			unlock(&archwlock);
-			return nil;
-		}
-
-	d.qid.path = narchdir;
-	archdir[narchdir] = d;
-	readfn[narchdir] = rdfn;
-	writefn[narchdir] = wrfn;
-	dp = &archdir[narchdir++];
-	unlock(&archwlock);
-
-	return dp;
-}
-
-void
-ioinit(void)
-{
-	int i;
-
-	for(i = 0; i < nelem(iomap.maps)-1; i++)
-		iomap.maps[i].next = &iomap.maps[i+1];
-	iomap.maps[i].next = nil;
-	iomap.free = iomap.maps;
-
-	// a dummy entry at 2^17
-	ioalloc(0x20000, 1, 0, "dummy");
-}
-
-//
-//	alloc some io port space and remember who it was
-//	alloced to.  if port < 0, find a free region.
-//
-int
-ioalloc(int port, int size, int align, char *tag)
-{
-	IOMap *m, **l;
-	int i;
-
-	lock(&iomap);
-	if(port < 0){
-		// find a free port above 0x400 and below 0x1000
-		port = 0x400;
-		for(l = &iomap.m; *l; l = &(*l)->next){
-			m = *l;
-			i = m->start - port;
-			if(i > size)
-				break;
-			if(align > 0)
-				port = ((port+align-1)/align)*align;
-			else
-				port = m->end;
-		}
-		if(*l == nil){
-			unlock(&iomap);
-			return -1;
-		}
-	} else {
-		// see if the space clashes with previously allocated ports
-		for(l = &iomap.m; *l; l = &(*l)->next){
-			m = *l;
-			if(m->end <= port)
-				continue;
-			if(m->start >= port+size)
-				break;
-			unlock(&iomap);
-			return -1;
-		}
-	}
-	m = iomap.free;
-	if(m == nil){
-		print("ioalloc: out of maps");
-		unlock(&iomap);
-		return port;
-	}
-	iomap.free = m->next;
-	m->next = *l;
-	m->start = port;
-	m->end = port + size;
-	strncpy(m->tag, tag, sizeof(m->tag));
-	m->tag[sizeof(m->tag)-1] = 0;
-	*l = m;
-
-	archdir[0].qid.vers++;
-
-	unlock(&iomap);
-	return m->start;
-}
-
-void
-iofree(int port)
-{
-	IOMap *m, **l;
-
-	lock(&iomap);
-	for(l = &iomap.m; *l; l = &(*l)->next){
-		if((*l)->start == port){
-			m = *l;
-			*l = m->next;
-			m->next = iomap.free;
-			iomap.free = m;
-			break;
-		}
-		if((*l)->start > port)
-			break;
-	}
-	archdir[0].qid.vers++;
-	unlock(&iomap);
-}
-
-int
-iounused(int start, int end)
-{
-	IOMap *m;
-
-	for(m = iomap.m; m; m = m->next){
-		if(start >= m->start && start < m->end
-		|| start <= m->start && end > m->start)
-			return 0; 
-	}
-	return 1;
-}
-
-static void
-checkport(int start, int end)
-{
-	/* standard vga regs are OK */
-	if(start >= 0x2b0 && end <= 0x2df+1)
-		return;
-	if(start >= 0x3c0 && end <= 0x3da+1)
-		return;
-
-	if(iounused(start, end))
-		return;
-	error(Eperm);
-}
-
-static Chan*
-archattach(char* spec)
-{
-	return devattach('P', spec);
-}
-
-Walkqid*
-archwalk(Chan* c, Chan *nc, char** name, int nname)
-{
-	return devwalk(c, nc, name, nname, archdir, narchdir, devgen);
-}
-
-static int
-archstat(Chan* c, uchar* dp, int n)
-{
-	return devstat(c, dp, n, archdir, narchdir, devgen);
-}
-
-static Chan*
-archopen(Chan* c, int omode)
-{
-	return devopen(c, omode, archdir, nelem(archdir), devgen);
-}
-
-static void
-archclose(Chan*)
-{
-}
-
-enum
-{
-	Linelen= 31,
-};
-
-static long
-archread(Chan *c, void *a, long n, vlong offset)
-{
-	char buf[Linelen+1], *p;
-	int port;
-	ushort *sp;
-	ulong *lp;
-	IOMap *m;
-	Rdwrfn *fn;
-
-	switch((ulong)c->qid.path){
-
-	case Qdir:
-		return devdirread(c, a, n, archdir, nelem(archdir), devgen);
-
-	case Qiob:
-		port = offset;
-		checkport(offset, offset+n);
-		for(p = a; port < offset+n; port++)
-			*p++ = inb(port);
-		return n;
-
-	case Qiow:
-		if((n & 0x01) || (offset & 0x01))
-			error(Ebadarg);
-		checkport(offset, offset+n+1);
-		n /= 2;
-		sp = a;
-		for(port = offset; port < offset+n; port += 2)
-			*sp++ = ins(port);
-		return n*2;
-
-	case Qiol:
-		if((n & 0x03) || (offset & 0x03))
-			error(Ebadarg);
-		checkport(offset, offset+n+3);
-		n /= 4;
-		lp = a;
-		for(port = offset; port < offset+n; port += 4)
-			*lp++ = inl(port);
-		return n*4;
-
-	case Qioalloc:
-		break;
-
-	default:
-		if(c->qid.path < narchdir && (fn = readfn[c->qid.path]))
-			return fn(c, a, n, offset);
-		error(Eperm);
-		break;
-	}
-
-	offset = offset/Linelen;
-	n = n/Linelen;
-	p = a;
-	lock(&iomap);
-	for(m = iomap.m; n > 0 && m != nil; m = m->next){
-		if(offset-- > 0)
-			continue;
-		if(strcmp(m->tag, "dummy") == 0)
-			break;
-		sprint(buf, "%8lux %8lux %-12.12s\n", m->start, m->end-1, m->tag);
-		memmove(p, buf, Linelen);
-		p += Linelen;
-		n--;
-	}
-	unlock(&iomap);
-
-	return p - (char*)a;
-}
-
-static long
-archwrite(Chan *c, void *a, long n, vlong offset)
-{
-	char *p;
-	int port;
-	ushort *sp;
-	ulong *lp;
-	Rdwrfn *fn;
-
-	switch((ulong)c->qid.path){
-
-	case Qiob:
-		p = a;
-		checkport(offset, offset+n);
-		for(port = offset; port < offset+n; port++)
-			outb(port, *p++);
-		return n;
-
-	case Qiow:
-		if((n & 01) || (offset & 01))
-			error(Ebadarg);
-		checkport(offset, offset+n+1);
-		n /= 2;
-		sp = a;
-		for(port = offset; port < offset+n; port += 2)
-			outs(port, *sp++);
-		return n*2;
-
-	case Qiol:
-		if((n & 0x03) || (offset & 0x03))
-			error(Ebadarg);
-		checkport(offset, offset+n+3);
-		n /= 4;
-		lp = a;
-		for(port = offset; port < offset+n; port += 4)
-			outl(port, *lp++);
-		return n*4;
-
-	default:
-		if(c->qid.path < narchdir && (fn = writefn[c->qid.path]))
-			return fn(c, a, n, offset);
-		error(Eperm);
-		break;
-	}
-	return 0;
-}
-
-Dev archdevtab = {
-	'P',
-	"arch",
-
-	devreset,
-	devinit,	
-	devshutdown,
-	archattach,
-	archwalk,
-	archstat,
-	archopen,
-	devcreate,
-	archclose,
-	archread,
-	devbread,
-	archwrite,
-	devbwrite,
-	devremove,
-	devwstat,
-};
-
-PCArch* arch;
-extern PCArch* knownarch[];
-
-PCArch archgeneric = {
-	"generic",				/* id */
-	0,					/* ident */
-
-	0,					/* coreinit */
-	0,					/* coredetach */
-};
-
-static char	*sysnames[] =
-{
-[1]		"Alpha Demo. Unit",
-[2]		"DEC 4000; Cobra",
-[3]		"DEC 7000; Ruby",
-[4]		"DEC 3000/500; Flamingo family (TC)",
-[6]		"DEC 2000/300; Jensen (EISA/ISA)",
-[7]		"DEC 3000/300; Pelican (TC)",
-[8]		"Avalon A12; Avalon Multicomputer",
-[9]		"DEC 2100/A500; Sable",
-[10]		"DEC APXVME/64; AXPvme (VME?)",
-[11]		"DEC AXPPCI/33; NoName (PCI/ISA)",
-[12]		"DEC 21000; TurboLaser (PCI/EISA)",
-[13]		"DEC 2100/A50; Avanti (PCI/ISA)",
-[14]		"DEC MUSTANG; Mustang",
-[15]		"DEC KN20AA; kn20aa (PCI/EISA)",
-[17]		"DEC 1000; Mikasa (PCI/ISA?)",
-[19]		"EB66; EB66 (PCI/ISA?)",		// DEC?
-[20]		"EB64P; EB64+ (PCI/ISA?)",		// DEC?
-[21]		"Alphabook1; Alphabook",
-[22]		"DEC 4100; Rawhide (PCI/EISA)",
-[23]		"DEC EV45/PBP; Lego",
-[24]		"DEC 2100A/A500; Lynx",
-[26]		"DEC AlphaPC 164",	// only supported one: "EB164 (PCI/ISA)"
-[27]		"DEC 1000A; Noritake",
-[28]		"DEC AlphaVME/224; Cortex",
-[30]		"DEC 550; Miata (PCI/ISA)",
-[32]		"DEC EV56/PBP; Takara",
-[33]		"DEC AlphaVME/320; Yukon (VME?)",
-[34]		"DEC 6600; MonetGoldrush",
-// 200 and up is Alpha Processor Inc. machines
-// [201]	"API UP1000; Nautilus",
-};
-
-static char	*cpunames[] =
-{
-[1]		"EV3",
-[2]		"EV4: 21064",
-[3]		"Simulation",
-[4]		"LCA4: 2106[68]",
-[5]		"EV5: 21164",
-[6]		"EV45: 21064A",
-[7]		"21164A",		/* only supported one: EV56 */
-[8]		"EV6: 21264",
-[9]		"PCA256: 21164PC",
-};
-
-void
-cpuidprint(void)
-{
-	int i, maj, min;
-	Hwcpu *cpu;
-	Hwdsr *dsr;
-	char *s;
-
-	print("\n");
-
-	if (hwrpb->rev >= 6) {
-		dsr = (Hwdsr*)((ulong)hwrpb + hwrpb->dsroff);
-
-		s = (char*)dsr + dsr->sysnameoff + 8;
-		print("%s\n", s);
-	}
-	else {
-		s = "<unknown>";
-		if (hwrpb->systype < nelem(sysnames))
-			s = sysnames[hwrpb->systype];
-		print("%s (%llux, %llux, %llux)\n", s, hwrpb->systype, hwrpb->sysvar, hwrpb->sysrev);
-	}
-
-	for (i = 0; i < hwrpb->ncpu; i++) {
-		cpu = (Hwcpu*) ((ulong)hwrpb + hwrpb->cpuoff + i*hwrpb->cpulen);
-		s = "<unknown>";
-		maj = (ulong)cpu->cputype;
-		min = (ulong)(cpu->cputype>>32);
-		if (maj < nelem(cpunames))
-			s = cpunames[maj];
-		print("cpu%d: %s-%d (%d.%d, %llux, %llux)\n",
-			i, s, min, maj, min, cpu->cpuvar, cpu->cpurev);
-	}
-
-	print("\n");
-}
-
-static long
-cputyperead(Chan*, void *a, long n, vlong offset)
-{
-	char str[32], *cputype;
-	ulong mhz, maj;
-	Hwcpu *cpu;
-
-	mhz = (m->cpuhz+999999)/1000000;
-	cpu = (Hwcpu*) ((ulong)hwrpb + hwrpb->cpuoff);	/* NB CPU 0 */
-	cputype = "unknown";
-	maj = (ulong)cpu->cputype;
-	if (maj < nelem(cpunames))
-		cputype = cpunames[maj];
-
-	snprint(str, sizeof(str), "%s %lud\n", cputype, mhz);
-	return readstr(offset, a, n, str);
-}
-
-void
-archinit(void)
-{
-	PCArch **p;
-
-	arch = 0;
-	for(p = knownarch; *p; p++){
-		if((*p)->ident && (*p)->ident() == 0){
-			arch = *p;
-			break;
-		}
-	}
-	if(arch == 0)
-		arch = &archgeneric;
-
-	addarchfile("cputype", 0444, cputyperead, nil);
-}
-
-int
-pcmspecial(char *idstr, ISAConf *isa)
-{
-	return (_pcmspecial  != nil)? _pcmspecial(idstr, isa): -1;
-}
-
-void
-pcmspecialclose(int a)
-{
-	if (_pcmspecialclose != nil)
-		_pcmspecialclose(a);
-}
--- a/sys/src/9/alphapc/devvga.c
+++ /dev/null
@@ -1,407 +1,0 @@
-/*
- * VGA controller
- */
-#include "u.h"
-#include "../port/lib.h"
-#include "mem.h"
-#include "dat.h"
-#include "fns.h"
-#include "io.h"
-#include "../port/error.h"
-
-#define	Image	IMAGE
-#include <draw.h>
-#include <memdraw.h>
-#include <cursor.h>
-#include "screen.h"
-
-extern uchar	*vgabios;
-
-enum {
-	Qdir,
-	Qvgactl,
-	Qvgabios,
-};
-
-static Dirtab vgadir[] = {
-	".",	{ Qdir, 0, QTDIR },		0,	0550,
-	"vgactl",	{ Qvgactl, 0 },		0,	0660,
-	"vgabios",	{ Qvgabios, 0 },		0x10000,	0440,
-};
-
-static void
-vgareset(void)
-{
-	/* reserve the 'standard' vga registers */
-	if(ioalloc(0x2b0, 0x2df-0x2b0+1, 0, "vga") < 0)
-		panic("vga ports already allocated"); 
-	if(ioalloc(0x3c0, 0x3da-0x3c0+1, 0, "vga") < 0)
-		panic("vga ports already allocated"); 
-	conf.monitor = 1;
-}
-
-static Chan*
-vgaattach(char* spec)
-{
-	if(*spec && strcmp(spec, "0"))
-		error(Eio);
-	return devattach('v', spec);
-}
-
-Walkqid*
-vgawalk(Chan* c, Chan *nc, char** name, int nname)
-{
-	return devwalk(c, nc, name, nname, vgadir, nelem(vgadir), devgen);
-}
-
-static int
-vgastat(Chan* c, uchar* dp, int n)
-{
-	return devstat(c, dp, n, vgadir, nelem(vgadir), devgen);
-}
-
-static Chan*
-vgaopen(Chan* c, int omode)
-{
-	return devopen(c, omode, vgadir, nelem(vgadir), devgen);
-}
-
-static void
-vgaclose(Chan*)
-{
-}
-
-static void
-checkport(int start, int end)
-{
-	/* standard vga regs are OK */
-	if(start >= 0x2b0 && end <= 0x2df+1)
-		return;
-	if(start >= 0x3c0 && end <= 0x3da+1)
-		return;
-
-	if(iounused(start, end))
-		return;
-	error(Eperm);
-}
-
-static long
-vgaread(Chan* c, void* a, long n, vlong off)
-{
-	int len;
-	char *p, *s;
-	VGAscr *scr;
-	ulong offset = off;
-	char chbuf[30];
-
-	switch((ulong)c->qid.path){
-
-	case Qdir:
-		return devdirread(c, a, n, vgadir, nelem(vgadir), devgen);
-
-	case Qvgactl:
-		scr = &vgascreen[0];
-
-		p = malloc(READSTR);
-		if(waserror()){
-			free(p);
-			nexterror();
-		}
-
-		len = 0;
-
-		if(scr->dev)
-			s = scr->dev->name;
-		else
-			s = "cga";
-		len += snprint(p+len, READSTR-len, "type %s\n", s);
-
-		if(scr->gscreen) {
-			len += snprint(p+len, READSTR-len, "size %dx%dx%d %s\n",
-				scr->gscreen->r.max.x, scr->gscreen->r.max.y,
-				scr->gscreen->depth, chantostr(chbuf, scr->gscreen->chan));
-
-			if(Dx(scr->gscreen->r) != Dx(physgscreenr) 
-			|| Dy(scr->gscreen->r) != Dy(physgscreenr))
-				len += snprint(p+len, READSTR-len, "actualsize %dx%d\n",
-					physgscreenr.max.x, physgscreenr.max.y);
-		}
-
-		len += snprint(p+len, READSTR-len, "blanktime %lud\n", blanktime);
-		len += snprint(p+len, READSTR-len, "hwaccel %s\n", hwaccel ? "on" : "off");
-		len += snprint(p+len, READSTR-len, "hwblank %s\n", hwblank ? "on" : "off");
-		snprint(p+len, READSTR-len, "addr 0x%lux\n", scr->paddr);
-		n = readstr(offset, a, n, p);
-		poperror();
-		free(p);
-
-		return n;
-
-	case Qvgabios:
-		if(vgabios == nil)
-			error(Egreg);
-		if(offset&0x80000000)
-			offset &= ~0x800E0000;
-		if(offset+n > 0x10000)
-			n = 0x10000-offset;
-		if(n < 0)
-			return 0;
-		memmove(a, vgabios+offset, n);
-		return n;
-
-	default:
-		error(Egreg);
-		break;
-	}
-
-	return 0;
-}
-
-static char Ebusy[] = "vga already configured";
-
-static void
-vgactl(char* a)
-{
-	int align, i, n, size, x, y, z;
-	char *chanstr, *field[6], *p;
-	ulong chan;
-	VGAscr *scr;
-	extern VGAdev *vgadev[];
-	extern VGAcur *vgacur[];
-	Rectangle r;
-
-	n = tokenize(a, field, nelem(field));
-	if(n < 1)
-		error(Ebadarg);
-
-	scr = &vgascreen[0];
-	if(strcmp(field[0], "hwgc") == 0){
-		if(n < 2)
-			error(Ebadarg);
-
-		if(strcmp(field[1], "off") == 0){
-			lock(&cursor);
-			if(scr->cur){
-				if(scr->cur->disable)
-					scr->cur->disable(scr);
-				scr->cur = nil;
-			}
-			unlock(&cursor);
-			return;
-		}
-
-		for(i = 0; vgacur[i]; i++){
-			if(strcmp(field[1], vgacur[i]->name))
-				continue;
-			lock(&cursor);
-			if(scr->cur && scr->cur->disable)
-				scr->cur->disable(scr);
-			scr->cur = vgacur[i];
-			if(scr->cur->enable)
-				scr->cur->enable(scr);
-			unlock(&cursor);
-			return;
-		}
-	}
-	else if(strcmp(field[0], "type") == 0){
-		if(n < 2)
-			error(Ebadarg);
-
-		for(i = 0; vgadev[i]; i++){
-			if(strcmp(field[1], vgadev[i]->name))
-				continue;
-			if(scr->dev && scr->dev->disable)
-				scr->dev->disable(scr);
-			scr->dev = vgadev[i];
-			if(scr->dev->enable)
-				scr->dev->enable(scr);
-			return;
-		}
-	}
-	else if(strcmp(field[0], "size") == 0){
-		if(n < 3)
-			error(Ebadarg);
-		if(drawhasclients())
-			error(Ebusy);
-
-		x = strtoul(field[1], &p, 0);
-		if(x == 0 || x > 2048)
-			error(Ebadarg);
-		if(*p)
-			p++;
-
-		y = strtoul(p, &p, 0);
-		if(y == 0 || y > 2048)
-			error(Ebadarg);
-		if(*p)
-			p++;
-
-		z = strtoul(p, &p, 0);
-
-		chanstr = field[2];
-		if((chan = strtochan(chanstr)) == 0)
-			error("bad channel");
-
-		if(chantodepth(chan) != z)
-			error("depth, channel do not match");
-
-		cursoroff(1);
-		deletescreenimage();
-		if(screensize(x, y, z, chan))
-			error(Egreg);
-		vgascreenwin(scr);
-		cursoron(1);
-		return;
-	}
-	else if(strcmp(field[0], "actualsize") == 0){
-		if(scr->gscreen == nil)
-			error("set the screen size first");
-
-		if(n < 2)
-			error(Ebadarg);
-		x = strtoul(field[1], &p, 0);
-		if(x == 0 || x > 2048)
-			error(Ebadarg);
-		if(*p)
-			p++;
-
-		y = strtoul(p, nil, 0);
-		if(y == 0 || y > 2048)
-			error(Ebadarg);
-
-		if(x > scr->gscreen->r.max.x || y > scr->gscreen->r.max.y)
-			error("physical screen bigger than virtual");
-
-		r = Rect(0,0,x,y);
-		if(!eqrect(r, scr->gscreen->r)){
-			if(scr->cur == nil || scr->cur->doespanning == 0)
-				error("virtual screen not supported");
-		}
-
-		physgscreenr = r;
-		return;
-	}
-	else if(strcmp(field[0], "palettedepth") == 0){
-		if(n < 2)
-			error(Ebadarg);
-
-		x = strtoul(field[1], &p, 0);
-		if(x != 8 && x != 6)
-			error(Ebadarg);
-
-		scr->palettedepth = x;
-		return;
-	}
-	else if(strcmp(field[0], "drawinit") == 0){
-		if(scr && scr->dev && scr->dev->drawinit)
-			scr->dev->drawinit(scr);
-		return;
-	}
-	else if(strcmp(field[0], "linear") == 0){
-		if(n < 2)
-			error(Ebadarg);
-
-		size = strtoul(field[1], 0, 0);
-		if(n < 3)
-			align = 0;
-		else
-			align = strtoul(field[2], 0, 0);
-		if(screenaperture(size, align))
-			error("not enough free address space");
-		return;
-	}
-/*	else if(strcmp(field[0], "memset") == 0){
-		if(n < 4)
-			error(Ebadarg);
-		memset((void*)strtoul(field[1], 0, 0), atoi(field[2]), atoi(field[3]));
-		return;
-	}
-*/
-	else if(strcmp(field[0], "blank") == 0){
-		if(n < 1)
-			error(Ebadarg);
-		drawblankscreen(1);
-		return;
-	}
-	else if(strcmp(field[0], "blanktime") == 0){
-		if(n < 2)
-			error(Ebadarg);
-		blanktime = strtoul(field[1], 0, 0);
-		return;
-	}
-	else if(strcmp(field[0], "hwaccel") == 0){
-		if(n < 2)
-			error(Ebadarg);
-		if(strcmp(field[1], "on") == 0)
-			hwaccel = 1;
-		else if(strcmp(field[1], "off") == 0)
-			hwaccel = 0;
-		return;
-	}
-	else if(strcmp(field[0], "hwblank") == 0){
-		if(n < 2)
-			error(Ebadarg);
-		if(strcmp(field[1], "on") == 0)
-			hwblank = 1;
-		else if(strcmp(field[1], "off") == 0)
-			hwblank = 0;
-		return;
-	}
-
-	error(Ebadarg);
-}
-
-static long
-vgawrite(Chan* c, void* a, long n, vlong off)
-{
-	char *p;
-	ulong offset = off;
-
-	switch((ulong)c->qid.path){
-
-	case Qdir:
-		error(Eperm);
-
-	case Qvgactl:
-		if(offset || n >= READSTR)
-			error(Ebadarg);
-		p = malloc(READSTR);
-		if(waserror()){
-			free(p);
-			nexterror();
-		}
-		memmove(p, a, n);
-		p[n] = 0;
-		vgactl(p);
-		poperror();
-		free(p);
-		return n;
-
-	default:
-		error(Egreg);
-		break;
-	}
-
-	return 0;
-}
-
-Dev vgadevtab = {
-	'v',
-	"vga",
-
-	vgareset,
-	devinit,	
-	devshutdown,
-	vgaattach,
-	vgawalk,
-	vgastat,
-	vgaopen,
-	devcreate,
-	vgaclose,
-	vgaread,
-	devbread,
-	vgawrite,
-	devbwrite,
-	devremove,
-	devwstat,
-};
--- a/sys/src/9/alphapc/dma.c
+++ /dev/null
@@ -1,331 +1,0 @@
-#include	"u.h"
-#include	"../port/lib.h"
-#include	"mem.h"
-#include	"dat.h"
-#include	"fns.h"
-
-#include	"io.h"
-
-typedef struct DMAport	DMAport;
-typedef struct DMA	DMA;
-typedef struct DMAxfer	DMAxfer;
-
-/*
- *  state of a dma transfer
- */
-struct DMAxfer
-{
-	ulong	bpa;		/* bounce buffer physical address */
-	void*	bva;		/* bounce buffer virtual address */
-	int	blen;		/* bounce buffer length */
-	void*	va;		/* virtual address destination/src */
-	long	len;		/* bytes to be transferred */
-	int	isread;
-};
-
-/*
- *  the dma controllers.  the first half of this structure specifies
- *  the I/O ports used by the DMA controllers.
- */
-struct DMAport
-{
-	uchar	addr[4];	/* current address (4 channels) */
-	uchar	count[4];	/* current count (4 channels) */
-	uchar	page[4];	/* page registers (4 channels) */
-	uchar	cmd;		/* command status register */
-	uchar	req;		/* request registers */
-	uchar	sbm;		/* single bit mask register */
-	uchar	mode;		/* mode register */
-	uchar	cbp;		/* clear byte pointer */
-	uchar	mc;		/* master clear */
-	uchar	cmask;		/* clear mask register */
-	uchar	wam;		/* write all mask register bit */
-};
-
-struct DMA
-{
-	DMAport;
-	int	shift;
-	Lock;
-	DMAxfer	x[4];
-};
-
-DMA dma[2] = {
-	{ 0x00, 0x02, 0x04, 0x06,
-	  0x01, 0x03, 0x05, 0x07,
-	  0x87, 0x83, 0x81, 0x82,
-	  0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
-	 0 },
-
-	{ 0xc0, 0xc4, 0xc8, 0xcc,
-	  0xc2, 0xc6, 0xca, 0xce,
-	  0x8f, 0x8b, 0x89, 0x8a,
-	  0xd0, 0xd2, 0xd4, 0xd6, 0xd8, 0xda, 0xdc, 0xde,
-	 1 },
-};
-
-extern int i8237dma;
-static void* i8237bva[2];
-static int i8237used;
-
-/*
- *  DMA must be in the first 16MB.  This gets called early by the
- *  initialisation routines of any devices which require DMA to ensure
- *  the allocated bounce buffers are below the 16MB limit.
- */
-void
-_i8237alloc(void)
-{
-	void* bva;
-
-	if(i8237dma <= 0)
-		return;
-	if(i8237dma > 2)
-		i8237dma = 2;
-
-	bva = xspanalloc(64*1024*i8237dma, BY2PG, 64*1024);
-	if(bva == nil || PADDR(bva)+64*1024*i8237dma > 16*MB){
-		/*
-		 * This will panic with the current
-		 * implementation of xspanalloc().
-		if(bva != nil)
-			xfree(bva);
-		 */
-		return;
-	}
-
-	i8237bva[0] = bva;
-	if(i8237dma == 2)
-		i8237bva[1] = ((uchar*)i8237bva[0])+64*1024;
-}
-
-static void
-dmastatus(DMA *dp, int chan, char c)
-{
-	int a, l, s;
-
-	ilock(dp);
-	outb(dp->cbp, 0);
-	a = inb(dp->addr[chan]);
-	a |= inb(dp->addr[chan])<<8;
-	a |= inb(dp->page[chan])<<16;
-	a |= inb(0x400|dp->page[chan])<<24;
-	outb(dp->cbp, 0);
-	l = inb(dp->count[chan]);
-	l |= inb(dp->count[chan])<<8;
-	s = inb(dp->cmd);
-	iunlock(dp);
-	print("%c: addr %uX len %uX stat %uX\n", c, a, l, s);
-}
-
-int
-dmainit(int chan, int maxtransfer)
-{
-	DMA *dp;
-	DMAxfer *xp;
-	static int once;
-
-	if(once == 0){
-		if(ioalloc(0x00, 0x10, 0, "dma") < 0
-		|| ioalloc(0x80, 0x10, 0, "dma") < 0
-		|| ioalloc(0xd0, 0x10, 0, "dma") < 0)
-			panic("dmainit");
-		outb(dma[0].mc, 0);
-		outb(dma[1].mc, 0);
-		outb(dma[0].cmask, 0);
-		outb(dma[1].cmask, 0);
-		outb(dma[1].mode, 0xC0);
-		once = 1;
-	}
-
-	if(maxtransfer > 64*1024)
-		maxtransfer = 64*1024;
-
-	dp = &dma[(chan>>2)&1];
-	chan = chan & 3;
-	xp = &dp->x[chan];
-	if(xp->bva != nil){
-		if(xp->blen < maxtransfer)
-			return 1;
-		return 0;
-	}
-//dmastatus(dp, chan, 'I');
-
-	if(i8237used >= i8237dma || i8237bva[i8237used] == nil){
-		print("no i8237 DMA bounce buffer < 16MB\n");
-		return 1;
-	}
-	xp->bva = i8237bva[i8237used++];
-	xp->bpa = PADDR(xp->bva);
-	xp->blen = maxtransfer;
-	xp->len = 0;
-	xp->isread = 0;
-
-	return 0;
-}
-
-void
-xdmastatus(int chan)
-{
-	DMA *dp;
-
-	dp = &dma[(chan>>2)&1];
-	chan = chan & 3;
-
-	dmastatus(dp, chan, 'X');
-}
-
-/*
- *  setup a dma transfer.  if the destination is not in kernel
- *  memory, allocate a page for the transfer.
- *
- *  we assume BIOS has set up the command register before we
- *  are booted.
- *
- *  return the updated transfer length (we can't transfer across 64k
- *  boundaries)
- */
-long
-dmasetup(int chan, void *va, long len, int isread)
-{
-	DMA *dp;
-	ulong pa;
-	uchar mode;
-	DMAxfer *xp;
-
-	dp = &dma[(chan>>2)&1];
-	chan = chan & 3;
-	xp = &dp->x[chan];
-//print("va%lux+", va);
-#define tryPCI
-#ifndef PCIWADDR
-#define PCIWADDR(va)	PADDR(va)
-#endif /* PCIWADDR */
-#ifdef notdef
-
-	/*
-	 *  if this isn't kernel memory or crossing 64k boundary or above 16 meg
-	 *  use the bounce buffer.
-	 */
-	pa = PADDR(va);
-	if((((ulong)va)&0xF0000000) != KZERO
-	|| (pa&0xFFFF0000) != ((pa+len)&0xFFFF0000)
-	|| pa >= 16*MB) {
-		if(xp->bva == nil)
-			return -1;
-		if(len > xp->blen)
-			len = xp->blen;
-		if(!isread)
-			memmove(xp->bva, va, len);
-		xp->va = va;
-		xp->len = len;
-		xp->isread = isread;
-		pa = xp->bpa;
-	}
-	else
-		xp->len = 0;
-#endif /* notdef */
-#ifdef tryISA
-	pa = ISAWADDR(va);
-#endif /* tryISA */
-#ifdef tryPCI
-	pa = PCIWADDR(va);
-	if((((ulong)va)&0xF0000000) != KZERO){
-		if(xp->bva == nil)
-			return -1;
-		if(len > xp->blen)
-			len = xp->blen;
-		if(!isread)
-			memmove(xp->bva, va, len);
-		xp->va = va;
-		xp->len = len;
-		xp->isread = isread;
-		pa = PCIWADDR(xp->bva);
-	}
-	else
-		xp->len = 0;
-#endif /* tryPCI */
-
-	/*
-	 * this setup must be atomic
-	 */
-	mode = (isread ? 0x44 : 0x48) | chan;
-	ilock(dp);
-	outb(dp->cbp, 0);		/* set count & address to their first byte */
-	outb(dp->mode, mode);	/* single mode dma (give CPU a chance at mem) */
-	outb(dp->addr[chan], pa>>dp->shift);		/* set address */
-	outb(dp->addr[chan], pa>>(8+dp->shift));
-	outb(dp->page[chan], pa>>16);
-#ifdef tryPCI
-	outb(0x400|dp->page[chan], pa>>24);
-#endif /* tryPCI */
-	outb(dp->cbp, 0);		/* set count & address to their first byte */
-	outb(dp->count[chan], (len>>dp->shift)-1);		/* set count */
-	outb(dp->count[chan], ((len>>dp->shift)-1)>>8);
-	outb(dp->sbm, chan);		/* enable the channel */
-	iunlock(dp);
-//dmastatus(dp, chan, 'S');
-
-	return len;
-}
-
-int
-dmadone(int chan)
-{
-	DMA *dp;
-
-	dp = &dma[(chan>>2)&1];
-	chan = chan & 3;
-
-	return inb(dp->cmd) & (1<<chan);
-}
-
-/*
- *  this must be called after a dma has been completed.
- *
- *  if a page has been allocated for the dma,
- *  copy the data into the actual destination
- *  and free the page.
- */
-void
-dmaend(int chan)
-{
-	DMA *dp;
-	DMAxfer *xp;
-
-	dp = &dma[(chan>>2)&1];
-	chan = chan & 3;
-
-//dmastatus(dp, chan, 'E');
-	/*
-	 *  disable the channel
-	 */
-	ilock(dp);
-	outb(dp->sbm, 4|chan);
-	iunlock(dp);
-
-	xp = &dp->x[chan];
-	if(xp->len == 0 || !xp->isread)
-		return;
-
-	/*
-	 *  copy out of temporary page
-	 */
-	memmove(xp->va, xp->bva, xp->len);
-	xp->len = 0;
-}
-
-/*
-int
-dmacount(int chan)
-{
-	int     retval;
-	DMA     *dp;
- 
-	dp = &dma[(chan>>2)&1];
-	outb(dp->cbp, 0);
-	retval = inb(dp->count[chan]);
-	retval |= inb(dp->count[chan]) << 8;
-	return((retval<<dp->shift)+1);
-}
- */
--- a/sys/src/9/alphapc/etherif.h
+++ /dev/null
@@ -1,41 +1,0 @@
-enum {
-	MaxEther	= 24,
-	Ntypes		= 8,
-};
-
-typedef struct Ether Ether;
-struct Ether {
-	ISAConf;			/* hardware info */
-
-	int	ctlrno;
-	int	tbdf;			/* type+busno+devno+funcno */
-	int	minmtu;
-	int 	maxmtu;
-	uchar	ea[Eaddrlen];
-
-	void	(*attach)(Ether*);	/* filled in by reset routine */
-	void	(*detach)(Ether*);	/* NEW, from ../pc */
-	void	(*transmit)(Ether*);
-	void	(*interrupt)(Ureg*, void*);
-	long	(*ifstat)(Ether*, void*, long, ulong);
-	long 	(*ctl)(Ether*, void*, long); /* custom ctl messages */
-/* START NEW, from ../pc */
-	void	(*power)(Ether*, int);	/* power on/off */
-	void	(*shutdown)(Ether*);	/* shutdown hardware before reboot */
-/* END NEW */
-	void	*ctlr;
-
-	Queue*	oq;
-
-	Netif;
-};
-
-extern Block* etheriq(Ether*, Block*, int);
-extern void addethercard(char*, int(*)(Ether*));
-extern ulong ethercrc(uchar*, int);
-extern int parseether(uchar*, char*);
-
-#define NEXT(x, l)	(((x)+1)%(l))
-#define PREV(x, l)	(((x) == 0) ? (l)-1: (x)-1)
-#define	HOWMANY(x, y)	(((x)+((y)-1))/(y))
-#define ROUNDUP(x, y)	(HOWMANY((x), (y))*(y))
--- a/sys/src/9/alphapc/faultalpha.c
+++ /dev/null
@@ -1,62 +1,0 @@
-#include	"u.h"
-#include	"../port/lib.h"
-#include	"mem.h"
-#include	"dat.h"
-#include	"fns.h"
-#include	"ureg.h"
-#include	"../port/error.h"
-
-/*
- *  find out fault address and type of access.
- *  Call common fault handler.
- */
-void
-faultalpha(Ureg *ur)
-{
-	ulong addr, cause;
-	int read, user;
-	char buf[ERRMAX];
-	uvlong x;
-
-	x = ur->a0&0xffffffff80000000LL;
-	if (x != 0LL && x != 0xffffffff80000000LL)
-		iprint("faultalpha bad addr %llux pc %llux\n", ur->a0, ur->pc);
-
-	addr = (ulong)ur->a0;
-	cause = (ulong)ur->a2;
-	addr &= ~(BY2PG-1);
-	read = (cause !=1);
-	user = (ulong)ur->status&UMODE;
-
-/*	print("fault %s pc=0x%lux addr=0x%lux 0x%lux\n",
-		read? (cause != 0) ? "ifetch" : "read" : "write", (ulong)ur->pc, addr, (ulong)ur->a1); /**/
-
-	if(fault(addr, read) == 0)
-		return;
-
-	if(user){
-		sprint(buf, "sys: trap: fault %s addr=0x%lux",
-			read? (cause != 0) ? "ifetch" : "read" : "write", (ulong)ur->a0);
-		postnote(up, 1, buf, NDebug);
-		return;
-	}
-
-	iprint("kernel %s vaddr=0x%lux\n", read? (cause != 0) ? "ifetch" : "read" : "write", (ulong)ur->a0);
-	if(0)
-		mmudump();
-	dumpregs(ur);
-	_dumpstack(ur);
-	exit(1);
-}
-
-/*
- * called in sysfile.c
- */
-void
-evenaddr(ulong addr)
-{
-	if(addr & 3){
-		postnote(up, 1, "sys: odd address", NDebug);
-		error(Ebadarg);
-	}
-}
--- a/sys/src/9/alphapc/fdc37c93x.c
+++ /dev/null
@@ -1,66 +1,0 @@
-#include "u.h"
-#include "../port/lib.h"
-#include "mem.h"
-#include "dat.h"
-#include "fns.h"
-#include "io.h"
-
-/*
- * SMC FDC37C93x Plug and Play Compatible Ultra I/O Controller.
- */
-enum {					/* I/O Ports */
-	Config		= 0x370,	/* could also be 0x3F0 */
-
-	Index		= 0,
-	Data		= 1,
-};
-
-static int fddregs[] = {
-	0x30,
-	0x60, 0x61,
-	0x70,
-	0x74,
-	0xF0,
-	0xF1,
-	0xF2,
-	0xF4,
-	0xF5,
-	0,
-};
-
-#define OUTB(p, d)	outb(p, d); microdelay(10);
-
-void
-fdc37c93xdump(void)
-{
-	int config, i, x;
-
-	config = Config;
-
-	OUTB(config, 0x55);
-	OUTB(config, 0x55);
-
-	OUTB(config+Index, 0x20);
-	x = inb(config+Data);
-	print("fdc37c93x: Device ID 0x%2.2uX\n", x);
-	OUTB(config+Index, 0x22);
-	x = inb(config+Data);
-	print("fdc37c93x: Power/Control 0x%2.2uX\n", x);
-
-	OUTB(config+Index, 0x07);
-	OUTB(config+Data, 0);
-	for(i = 0; fddregs[i]; i++){
-		OUTB(config+Index, fddregs[i]);
-		x = inb(config+Data);
-		print("FDD%2.2uX: 0x%2.2uX\n", fddregs[i], x);
-	}
-
-	OUTB(config+Index, 0x70);
-	OUTB(config+Data, 0x06);
-	OUTB(config+Index, 0x74);
-	OUTB(config+Data, 0x02);
-	OUTB(config+Index, 0x30);
-	OUTB(config+Data, 0x01);
-
-	OUTB(config, 0xAA);
-}
--- a/sys/src/9/alphapc/floppy.h
+++ /dev/null
@@ -1,181 +1,0 @@
-typedef	struct FController FController;
-typedef	struct FDrive FDrive;
-typedef struct FType FType;
-
-static void floppyintr(Ureg*);
-static int floppyon(FDrive*);
-static void floppyoff(FDrive*);
-static void floppysetdef(FDrive*);
-
-/*
- *  a floppy drive
- */
-struct FDrive
-{
-	FType	*t;		/* floppy type */
-	int	dt;		/* drive type */
-	int	dev;
-
-	ulong	lasttouched;	/* time last touched */
-	int	cyl;		/* current arm position */
-	int	confused;	/* needs to be recalibrated */
-	int	vers;
-	int	maxtries;	/* max read attempts before Eio */
-
-	int	tcyl;		/* target cylinder */
-	int	thead;		/* target head */
-	int	tsec;		/* target sector */
-	long	len;		/* size of xfer */
-
-	uchar	*cache;		/* track cache */
-	int	ccyl;
-	int	chead;
-
-	Rendez	r;		/* waiting here for motor to spin up */
-};
-
-/*
- *  controller for 4 floppys
- */
-struct FController
-{
-	QLock;			/* exclusive access to the contoller */
-
-	int	ndrive;
-	FDrive	*d;		/* the floppy drives */
-	FDrive	*selected;
-	int	rate;		/* current rate selected */
-	uchar	cmd[14];	/* command */
-	int	ncmd;		/* # command bytes */
-	uchar	stat[14];	/* command status */
-	int	nstat;		/* # status bytes */
-	int	confused;	/* controler needs to be reset */
-	Rendez	r;		/* wait here for command termination */
-	int	motor;		/* bit mask of spinning disks */
-	Rendez	kr;		/* for motor watcher */
-};
-
-/*
- *  floppy types (all MFM encoding)
- */
-struct FType
-{
-	char	*name;
-	int	dt;		/* compatible drive type */
-	int	bytes;		/* bytes/sector */
-	int	sectors;	/* sectors/track */
-	int	heads;		/* number of heads */
-	int	steps;		/* steps per cylinder */
-	int	tracks;		/* tracks/disk */
-	int	gpl;		/* intersector gap length for read/write */	
-	int	fgpl;		/* intersector gap length for format */
-	int	rate;		/* rate code */
-
-	/*
-	 *  these depend on previous entries and are set filled in
-	 *  by floppyinit
-	 */
-	int	bcode;		/* coded version of bytes for the controller */
-	long	cap;		/* drive capacity in bytes */
-	long	tsize;		/* track size in bytes */
-};
-/* bits in the registers */
-enum
-{
-	/* status registers a & b */
-	Psra=		0x3f0,
-	Psrb=		0x3f1,
-
-	/* digital output register */
-	Pdor=		0x3f2,
-	Fintena=	0x8,	/* enable floppy interrupt */
-	Fena=		0x4,	/* 0 == reset controller */
-
-	/* main status register */
-	Pmsr=		0x3f4,
-	Fready=		0x80,	/* ready to be touched */
-	Ffrom=		0x40,	/* data from controller */
-	Ffloppybusy=	0x10,	/* operation not over */
-
-	/* data register */
-	Pfdata=		0x3f5,
-	Frecal=		0x07,	/* recalibrate cmd */
-	Fseek=		0x0f,	/* seek cmd */
-	Fsense=		0x08,	/* sense cmd */
-	Fread=		0x66,	/* read cmd */
-	Freadid=	0x4a,	/* read track id */
-	Fspec=		0x03,	/* set hold times */
-	Fwrite=		0x45,	/* write cmd */
-	Fformat=	0x4d,	/* format cmd */
-	Fmulti=		0x80,	/* or'd with Fread or Fwrite for multi-head */
-	Fdumpreg=	0x0e,	/* dump internal registers */
-
-	/* digital input register */
-	Pdir=		0x3F7,	/* disk changed port (read only) */
-	Pdsr=		0x3F7,	/* data rate select port (write only) */
-	Fchange=	0x80,	/* disk has changed */
-
-	/* status 0 byte */
-	Drivemask=	3<<0,
-	Seekend=	1<<5,
-	Codemask=	(3<<6)|(3<<3),
-	Cmdexec=	1<<6,
-
-	/* status 1 byte */
-	Overrun=	0x10,
-};
-
-
-static void
-pcfloppyintr(Ureg *ur, void *a)
-{
-	USED(a);
-
-	floppyintr(ur);
-}
-
-void
-floppysetup0(FController *fl)
-{
-	fl->ndrive = 0;
-	if(ioalloc(Psra, 6, 0, "floppy") < 0)
-		return;
-	if(ioalloc(Pdir, 1, 0, "floppy") < 0){
-		iofree(Psra);
-		return;
-	}
-	fl->ndrive = 1;
-}
-
-void
-floppysetup1(FController *fl)
-{
-	if(fl->ndrive > 0){
-		fl->d[0].dt = 4;
-		floppysetdef(&fl->d[0]);
-	}
-	if(fl->ndrive > 1){
-		fl->d[1].dt = 4;
-		floppysetdef(&fl->d[1]);
-	}
-
-	intrenable(IrqFLOPPY, pcfloppyintr, fl, BUSUNKNOWN, "floppy");
-}
-
-/*
- *  eject disk
- */
-void
-floppyeject(FDrive *dp)
-{
-	floppyon(dp);
-	dp->vers++;
-	floppyoff(dp);
-}
-
-int 
-floppyexec(char *a, long b, int c)
-{
-	USED(a, b, c);
-	return b;
-}
--- a/sys/src/9/alphapc/fns.h
+++ /dev/null
@@ -1,128 +1,0 @@
-#include "../port/portfns.h"
-
-Dirtab*	addarchfile(char*, int, long(*)(Chan*,void*,long,vlong), long(*)(Chan*,void*,long,vlong));
-void	archinit(void);
-void	arginit(void);
-void	arith(void);
-ulong	cankaddr(ulong);
-void	clock(Ureg*);
-void	clockinit(void);
-void	clockintrsched(void);
-#define coherence 	mb
-int	cistrcmp(char*, char*);
-int	cistrncmp(char*, char*, int);
-int	cmpswap(long*, long, long);
-void	cpuidprint(void);
-void	cserve(ulong, ulong);
-#define cycles(x)	do{}while(0)
-void	timeradd(Timer *);
-void	timerdel(Timer *);
-int	dmacount(int);
-int	dmadone(int);
-void	dmaend(int);
-int	dmainit(int, int);
-long	dmasetup(int, void*, long, int);
-void	_dumpstack(Ureg *);
-void	evenaddr(ulong);
-void	fataltrap(Ureg *, char *);
-void	fault0(void);
-void	faultalpha(Ureg*);
-ulong	fcr31(void);
-void	firmware(void);
-void	fpenab(int);
-void	fptrap(Ureg*);
-int	getcfields(char*, char**, int, char*);
-char	*getconf(char*);
-int	havetimer(void);
-int	i8042auxcmd(int);
-void	i8042auxenable(void (*)(int, int));
-void	i8042reset(void);
-void	i8250console(void);
-void	i8250mouse(char*, int(*)(Queue*,int), int);
-void	i8250setmouseputc(char*, int (*)(Queue*, int));
-void	i8259init(void);
-int	i8259enable(int, int, Vctl*);
-#define	idlehands()		/* nothing to do in the runproc */
-void	icflush(void);
-void	illegal0(void);
-void	intr0(void);
-void	intrenable(int, void (*)(Ureg*, void*), void*, int, char*);
-int	intrdisable(int, void (*)(Ureg *, void *), void*, int, char*);
-int	ioalloc(int, int, int, char*);
-void	iofree(int);
-void	ioinit(void);
-int	iounused(int, int);
-int	irqallocread(char*, long, vlong);
-int	isaconfig(char*, int, ISAConf*);
-#define kexit(a)
-#define	kmapinval()
-void	*kmapv(uvlong, int);
-int	kprint(char*, ...);
-void	links(void);
-void	mb(void);
-void 	memholes(void);
-ulong 	meminit(void);
-void	mmudump(void);
-void	mmuinit(void);
-void	mmupark(void);
-#define mtrr(a, b, c)
-ulong	pcibarsize(Pcidev*, int);
-int	pcicfgr8(Pcidev*, int);
-int	pcicfgr16(Pcidev*, int);
-int	pcicfgr32(Pcidev*, int);
-void	pcicfgw8(Pcidev*, int, int);
-void	pcicfgw16(Pcidev*, int, int);
-void	pcicfgw32(Pcidev*, int, int);
-void	pciclrbme(Pcidev*);
-void	pcihinv(Pcidev*);
-Pcidev* pcimatch(Pcidev*, int, int);
-Pcidev* pcimatchtbdf(int);
-void	pcireset(void);
-void	pcisetbme(Pcidev*);
-int	pcmspecial(char*, ISAConf*);
-int	(*_pcmspecial)(char *, ISAConf *);
-void	pcmspecialclose(int);
-void	(*_pcmspecialclose)(int);
-void	prflush(void);
-void	printinit(void);
-#define	procrestore(p)
-void	procsave(Proc*);
-void	procsetup(Proc*);
-void	procfork(Proc*);
-void	restfpregs(FPsave*);
-uvlong	rpcc(uvlong*);
-void	screeninit(void);
-void	(*screenputs)(char*, int);
-void 	setpcb(PCB *);
-PCB	*swpctx(PCB *);
-void	syscall0(void);
-int	tas(ulong*);
-void	tlbflush(int, ulong);
-void	touser(void*);
-void	trapinit(void);
-void	unaligned(void);
-ulong	upaalloc(int, int);
-void	upafree(ulong, int);
-#define	userureg(ur) ((ur)->status & UMODE)
-void*	vmap(ulong, int);
-void	wrent(int, void*);
-void	wrvptptr(uvlong);
-void	vunmap(void*, int);
-
-#define	waserror()	(up->nerrlab++, setlabel(&up->errlab[up->nerrlab-1]))
-#define KADDR(a)	((void*)((ulong)(a)|KZERO))
-#define PADDR(a)	((ulong)(a)&~KZERO)
-
-#define	inb(p)	(arch->_inb)(p)
-#define	ins(p)	(arch->_ins)(p)
-#define	inl(p)	(arch->_inl)(p)
-#define	outb(p, x)	(arch->_outb)((p), (x))
-#define	outs(p, x)	(arch->_outs)((p), (x))
-#define	outl(p, x)	(arch->_outl)((p), (x))
-
-#define	insb(p, buf, len)	(arch->_insb)((p), (buf), (len))
-#define	inss(p, buf, len)	(arch->_inss)((p), (buf), (len))
-#define	insl(p, buf, len)	(arch->_insl)((p), (buf), (len))
-#define	outsb(p, buf, len)	(arch->_outsb)((p), (buf), (len))
-#define	outss(p, buf, len)	(arch->_outss)((p), (buf), (len))
-#define	outsl(p, buf, len)	(arch->_outsl)((p), (buf), (len))
--- a/sys/src/9/alphapc/fptrap.c
+++ /dev/null
@@ -1,46 +1,0 @@
-#include	"u.h"
-#include	"../port/lib.h"
-#include	"mem.h"
-#include	"dat.h"
-#include	"fns.h"
-#include	"ureg.h"
-#include	"io.h"
-#include	"../port/error.h"
-
-char *fpcause[] =
-{
-	"invalid operation",
-	"division by zero",
-	"overflow",
-	"underflow",
-	"inexact operation",
-	"integer overflow",
-};
-char	*fpexcname(Ureg*, ulong, char*);
-
-void
-fptrap(Ureg *ur)
-{
-	char buf[ERRMAX];
-	int i;
-	ulong reason;
-
-	ur->pc &= ~2;
-	reason = (ulong)ur->a0;
-	for (i = 1; i < 6; i++)
-		if (reason & (1<<i)) {
-			sprint(buf, "fp: %s", fpcause[i-1]);
-			goto found;
-		}
-	sprint(buf, "fp: code 0x%lux", reason);
-
-found:
-	fataltrap(ur, buf);
-}
-
-char*
-fpexcname(Ureg *ur, ulong fcr31, char *buf)
-{
-	USED(ur, fcr31, buf);
-	return buf;
-}
--- a/sys/src/9/alphapc/i8259.c
+++ /dev/null
@@ -1,152 +1,0 @@
-#include "u.h"
-#include "../port/lib.h"
-#include "mem.h"
-#include "dat.h"
-#include "fns.h"
-#include "io.h"
-
-/*
- *  8259 interrupt controllers
- */
-enum
-{
-	Int0ctl=	0x20,		/* control port (ICW1, OCW2, OCW3) */
-	Int0aux=	0x21,		/* everything else (ICW2, ICW3, ICW4, OCW1) */
-	Int1ctl=	0xA0,		/* control port */
-	Int1aux=	0xA1,		/* everything else (ICW2, ICW3, ICW4, OCW1) */
-
-	Icw1=		0x10,		/* select bit in ctl register */
-	Ocw2=		0x00,
-	Ocw3=		0x08,
-
-	EOI=		0x20,		/* non-specific end of interrupt */
-
-	Elcr1=		0x4D0,		/* Edge/Level Triggered Register */
-	Elcr2=		0x4D1,
-};
-
-static int int0mask;			/* interrupts enabled for first 8259 */
-static int int1mask;			/* interrupts enabled for second 8259 */
-
-int elcr;				/* mask of level-triggered interrupts */
-
-void
-i8259init(void)
-{
-	int /*elcr1, */ x;
-
-	ioalloc(Int0ctl, 2, 0, "i8259.0");
-	ioalloc(Int1ctl, 2, 0, "i8259.1");
-	int0mask = 0xFF;
-	int1mask = 0xFF;
-
-	/*
-	 *  Set up the first 8259 interrupt processor.
-	 *  Make 8259 interrupts start at CPU vector Int0vec.
-	 *  Set the 8259 as master with edge triggered
-	 *  input with fully nested interrupts.
-	 */
-	outb(Int0ctl, (1<<4)|(0<<3)|(1<<0));	/* ICW1 - master, edge triggered,
-					  	   ICW4 will be sent */
-	outb(Int0aux, VectorPIC);		/* ICW2 - interrupt vector offset */
-	outb(Int0aux, 0x04);			/* ICW3 - have slave on level 2 */
-	outb(Int0aux, 0x01);			/* ICW4 - 8086 mode, not buffered */
-
-	/*
-	 *  Set up the second 8259 interrupt processor.
-	 *  Make 8259 interrupts start at CPU vector VectorPIC+8.
-	 *  Set the 8259 as slave with edge triggered
-	 *  input with fully nested interrupts.
-	 */
-	outb(Int1ctl, (1<<4)|(0<<3)|(1<<0));	/* ICW1 - master, edge triggered,
-					  	   ICW4 will be sent */
-	outb(Int1aux, VectorPIC+8);		/* ICW2 - interrupt vector offset */
-	outb(Int1aux, 0x02);			/* ICW3 - I am a slave on level 2 */
-	outb(Int1aux, 0x01);			/* ICW4 - 8086 mode, not buffered */
-	outb(Int1aux, int1mask);
-
-	/*
-	 *  pass #2 8259 interrupts to #1
-	 */
-	int0mask &= ~0x04;
-	outb(Int0aux, int0mask);
-
-	/*
-	 * Set Ocw3 to return the ISR when ctl read.
-	 * After initialisation status read is set to IRR.
-	 * Read IRR first to possibly deassert an outstanding
-	 * interrupt.
-	 */
-	x = inb(Int0ctl); USED(x);
-	outb(Int0ctl, Ocw3|0x03);
-	x = inb(Int1ctl); USED(x);
-	outb(Int1ctl, Ocw3|0x03);
-
-	/*
-	 * Check for Edge/Level register.
-	 * This check may not work for all chipsets.
-	 */
-/*	elcr1 = inb(Elcr1);
-	outb(Elcr1, 0);
-	if(inb(Elcr1) == 0){
-		outb(Elcr1, 0x20);
-		if(inb(Elcr1) == 0x20)
-			elcr = (inb(Elcr2)<<8)|elcr1;
-	}
-	outb(Elcr1, elcr1);
-	if(elcr)
-		iprint("ELCR: %4.4uX\n", elcr);
-/**/
-}
-
-int
-i8259isr(int v)
-{
-	int isr;
-
-	/*
-	 *  tell the 8259 that we're done with the
-	 *  highest level interrupt (interrupts are still
-	 *  off at this point)
-	 */
-	isr = 0;
-	if(v >= VectorPIC && v <= MaxVectorPIC){
-		isr = inb(Int0ctl);
-		outb(Int0ctl, EOI);
-		if(v >= VectorPIC+8){
-			isr |= inb(Int1ctl)<<8;
-			outb(Int1ctl, EOI);
-		}
-	}
-
-	return isr & (1<<(v-VectorPIC));
-}
-
-int
-i8259enable(int v, int, Vctl* vctl)
-{
-	if(v > MaxIrqPIC){
-		print("i8259enable: vector %d out of range\n", v);
-		return -1;
-	}
-
-	/*
-	 *  enable corresponding interrupt in 8259
-	 */
-	if(v < 8){
-		int0mask &= ~(1<<v);
-		outb(Int0aux, int0mask);
-	}
-	else{
-		int1mask &= ~(1<<(v-8));
-		outb(Int1aux, int1mask);
-	}
-
-	if(elcr & (1<<v))
-		vctl->eoi = i8259isr;
-	else
-		vctl->isr = i8259isr;
-	vctl->isintr = 1;
-
-	return v;
-}
--- a/sys/src/9/alphapc/initcode
+++ /dev/null
@@ -1,47 +1,0 @@
-#include "/sys/src/libc/9syscall/sys.h"
-
-/*
- *  we pass in the argument of the exec parameters as 0(FP)
- */
-
-TEXT	main(SB),$16
-
-	MOVQ	$setSB(SB), R29
-	MOVQ	$boot(SB), R0
-	ADDQ	$24, R30, R1	/* get a pointer to 0(FP) */
-	MOVL	R0, 8(R30)
-	MOVL	R1, 12(R30)
-	JSR	exec(SB)
-
-	MOVQ	$(1<<4), R0
-	MOVL	R0, 8(R30)
-	MOVQ	$RFORK, R0
-	CALL_PAL $0x83
-	MOVQ	$RFORK, R0
-	CALL_PAL $0x83
-	MOVQ	$RFORK, R0
-	CALL_PAL $0x83
-again:
-	ADDL	$1, R1
-	MOVQ	$0, R0	/* print r1 */
-	CALL_PAL $0x83
-	MOVQ	$100000000, R2
-foo:
-	SUBQ	$1, R2
-	BNE	R2, foo
-	MOVQ	$1000, R0
-	MOVL	R0, 8(R30)
-	MOVQ	$SLEEP, R0
-	CALL_PAL $0x83
-	JMP	again
-
-TEXT	exec(SB), $0
-	MOVQ	$EXEC, R0
-	CALL_PAL $0x83
-	RET
-
-DATA	boot+0(SB)/5,$"/boot"
-DATA	boot+5(SB)/5,$"/boot"
-DATA	bootv+0(SB)/4,$boot+6(SB)
-GLOBL	boot+0(SB),$11
-GLOBL	bootv+0(SB),$8
--- a/sys/src/9/alphapc/io.h
+++ /dev/null
@@ -1,176 +1,0 @@
-enum {
-	IrqCLOCK	= 0,
-	IrqKBD		= 1,
-	IrqUART1	= 3,
-	IrqUART0	= 4,
-	IrqPCMCIA	= 5,
-	IrqFLOPPY	= 6,
-	IrqLPT		= 7,
-	IrqIRQ7		= 7,
-	IrqAUX		= 12,		/* PS/2 port */
-	IrqIRQ13	= 13,		/* coprocessor on 386 */
-	IrqATA0		= 14,
-	IrqATA1		= 15,
-	MaxIrqPIC	= 15,
-
-	VectorPIC	= 64,
-	MaxVectorPIC	= VectorPIC+MaxIrqPIC,
-	VectorPCI	= 16,		/* PCI bus (PLD) */
-};
-
-typedef struct Vctl {
-	Vctl*	next;			/* handlers on this vector */
-
-	char	name[KNAMELEN];	/* of driver */
-	int	isintr;			/* interrupt or fault/trap */
-	int	irq;
-	int	tbdf;
-	int	(*isr)(int);		/* get isr bit for this irq */
-	int	(*eoi)(int);		/* eoi */
-
-	void	(*f)(Ureg*, void*);	/* handler to call */
-	void*	a;			/* argument to call it with */
-} Vctl;
-
-enum {
-	BusCBUS		= 0,		/* Corollary CBUS */
-	BusCBUSII,			/* Corollary CBUS II */
-	BusEISA,			/* Extended ISA */
-	BusFUTURE,			/* IEEE Futurebus */
-	BusINTERN,			/* Internal bus */
-	BusISA,				/* Industry Standard Architecture */
-	BusMBI,				/* Multibus I */
-	BusMBII,			/* Multibus II */
-	BusMCA,				/* Micro Channel Architecture */
-	BusMPI,				/* MPI */
-	BusMPSA,			/* MPSA */
-	BusNUBUS,			/* Apple Macintosh NuBus */
-	BusPCI,				/* Peripheral Component Interconnect */
-	BusPCMCIA,			/* PC Memory Card International Association */
-	BusTC,				/* DEC TurboChannel */
-	BusVL,				/* VESA Local bus */
-	BusVME,				/* VMEbus */
-	BusXPRESS,			/* Express System Bus */
-};
-
-#define MKBUS(t,b,d,f)	(((t)<<24)|(((b)&0xFF)<<16)|(((d)&0x1F)<<11)|(((f)&0x07)<<8))
-#define BUSFNO(tbdf)	(((tbdf)>>8)&0x07)
-#define BUSDNO(tbdf)	(((tbdf)>>11)&0x1F)
-#define BUSBNO(tbdf)	(((tbdf)>>16)&0xFF)
-#define BUSTYPE(tbdf)	((tbdf)>>24)
-#define BUSDF(tbdf)		((tbdf)&0x000FF00)
-#define BUSBDF(tbdf)	((tbdf)&0x0FFFF00)
-#define BUSUNKNOWN	(-1)
-
-enum {
-	MaxEISA		= 16,
-	EISAconfig	= 0xC80,
-};
-
-/*
- * PCI support code.
- */
-enum {					/* type 0 and type 1 pre-defined header */
-	PciVID		= 0x00,		/* vendor ID */
-	PciDID		= 0x02,		/* device ID */
-	PciPCR		= 0x04,		/* command */
-	PciPSR		= 0x06,		/* status */
-	PciRID		= 0x08,		/* revision ID */
-	PciCCRp		= 0x09,		/* programming interface class code */
-	PciCCRu		= 0x0A,		/* sub-class code */
-	PciCCRb		= 0x0B,		/* base class code */
-	PciCLS		= 0x0C,		/* cache line size */
-	PciLTR		= 0x0D,		/* latency timer */
-	PciHDT		= 0x0E,		/* header type */
-	PciBST		= 0x0F,		/* BIST */
-
-	PciBAR0		= 0x10,		/* base address */
-	PciBAR1		= 0x14,
-	PciROM		= 0x30,
-
-	PciINTL		= 0x3C,		/* interrupt line */
-	PciINTP		= 0x3D,		/* interrupt pin */
-};
-
-enum {					/* type 0 pre-defined header */
-	PciCIS		= 0x28,		/* cardbus CIS pointer */
-	PciSVID		= 0x2C,		/* subsystem vendor ID */
-	PciSID		= 0x2E,		/* subsystem ID */
-	PciEBAR0	= 0x30,		/* xpansion ROM base address */
-	PciMGNT		= 0x3E,		/* burst period length */
-	PciMLT		= 0x3F,		/* maximum latency between bursts */
-};
-
-enum {					/* type 1 pre-defined header */
-	PciPBN		= 0x18,		/* primary bus number */
-	PciSBN		= 0x19,		/* secondary bus number */
-	PciUBN		= 0x1A,		/* subordinate bus number */
-	PciSLTR		= 0x1B,		/* secondary latency timer */
-	PciIBR		= 0x1C,		/* I/O base */
-	PciILR		= 0x1D,		/* I/O limit */
-	PciSPSR		= 0x1E,		/* secondary status */
-	PciMBR		= 0x20,		/* memory base */
-	PciMLR		= 0x22,		/* memory limit */
-	PciPMBR		= 0x24,		/* prefetchable memory base */
-	PciPMLR		= 0x26,		/* prefetchable memory limit */
-	PciPUBR		= 0x28,		/* prefetchable base upper 32 bits */
-	PciPULR		= 0x2C,		/* prefetchable limit upper 32 bits */
-	PciIUBR		= 0x30,		/* I/O base upper 16 bits */
-	PciIULR		= 0x32,		/* I/O limit upper 16 bits */
-	PciEBAR1	= 0x28,		/* expansion ROM base address */
-	PciBCR		= 0x3E,		/* bridge control register */
-};
-
-typedef struct Pcidev Pcidev;
-typedef struct Pcidev {
-	int	tbdf;			/* type+bus+device+function */
-	ushort	vid;			/* vendor ID */
-	ushort	did;			/* device ID */
-
-	ushort	pcr;
-
-	uchar	rid;
-	uchar	ccrp;
-	uchar	ccru;
-	uchar	ccrb;
-	uchar	cls;
-	uchar	ltr;
-
-	struct {
-		ulong	bar;		/* base address */
-		int	size;
-	} mem[6];
-
-	uchar	intl;			/* interrupt line */
-
-	Pcidev*	list;
-	Pcidev*	link;			/* next device on this bno */
-
-	Pcidev*	bridge;			/* down a bus */
-	struct {
-		ulong	bar;
-		int	size;
-	} ioa, mema;
-
-	int	pmrb;			/* power management register block */
-};
-
-#define PCIWINDOW	0x40000000
-#define PCIWADDR(va)	(PADDR(va)+PCIWINDOW)
-#define ISAWINDOW	0x00800000
-#define ISAWADDR(va)	(PADDR(va)+ISAWINDOW)
-
-/*
- * PCMCIA support code.
- */
-/*
- * Map between ISA memory space and PCMCIA card memory space.
- */
-struct PCMmap {
-	ulong	ca;			/* card address */
-	ulong	cea;			/* card end address */
-	ulong	isa;			/* ISA address */
-	int	len;			/* length of the ISA area */
-	int	attr;			/* attribute memory */
-	int	ref;
-};
--- a/sys/src/9/alphapc/l.s
+++ /dev/null
@@ -1,438 +1,0 @@
-#include "mem.h"
-#include "osf1pal.h"
-
-#define SP	R30
-
-#define	HI_IPL	6			/* use 7 to disable mchecks */
-
-TEXT	_main(SB), $-8
-	MOVQ	$setSB(SB), R29
-	MOVQ	R29, R16
-	CALL_PAL $PALwrkgp
-	MOVQ	$mach0(SB), R(MACH)
-	MOVQ	$(BY2PG-8)(R(MACH)), R30
-	MOVQ	R31, R(USER)
-	MOVQ	R31, 0(R(MACH))
-
-	MOVQ	$edata(SB), R1
-	MOVQ	$end(SB), R2
-clrbss:
-	MOVQ	R31, (R1)
-	ADDQ	$8, R1
-	CMPUGT	R1, R2, R3
-	BEQ	R3, clrbss
-
-	MOVL	R0, bootconf(SB)	/* passed in from boot loader */
-
-_fpinit:
-	MOVQ	$1, R16
-	CALL_PAL $PALwrfen
-
-	MOVQ	initfpcr(SB), R1	/* MOVQ	$0x2800800000000000, R1 */
-	MOVQ	R1, (R30)
-	MOVT	(R30), F1
-	MOVT	F1, FPCR
-
-	MOVT	$0.5, F28
-	ADDT	F28, F28, F29
-	ADDT	F29, F29, F30
-
-	MOVT	F31, F1
-	MOVT	F31, F2
-	MOVT	F31, F3
-	MOVT	F31, F4
-	MOVT	F31, F5
-	MOVT	F31, F6
-	MOVT	F31, F7
-	MOVT	F31, F8
-	MOVT	F31, F9
-	MOVT	F31, F10
-	MOVT	F31, F11
-	MOVT	F31, F12
-	MOVT	F31, F13
-	MOVT	F31, F14
-	MOVT	F31, F15
-	MOVT	F31, F16
-	MOVT	F31, F17
-	MOVT	F31, F18
-	MOVT	F31, F19
-	MOVT	F31, F20
-	MOVT	F31, F21
-	MOVT	F31, F22
-	MOVT	F31, F23
-	MOVT	F31, F24
-	MOVT	F31, F25
-	MOVT	F31, F26
-	MOVT	F31, F27
-
-	JSR	main(SB)
-	MOVQ	$_divq(SB), R31		/* touch _divq etc.; doesn't need to execute */
-	MOVQ	$_divl(SB), R31		/* touch _divl etc.; doesn't need to execute */
-	RET
-
-TEXT	setpcb(SB), $-8
-	MOVQ	R30, (R0)
-	AND	$0x7FFFFFFF, R0, R16	/* make address physical */
-	CALL_PAL $PALswpctx
-	RET
-
-GLOBL	mach0(SB), $(MAXMACH*BY2PG)
-GLOBL	init_ptbr(SB), $8
-
-TEXT	firmware(SB), $-8
-	CALL_PAL $PALhalt
-
-TEXT	xxfirmware(SB), $-8
-	CALL_PAL $PALhalt
-
-TEXT	splhi(SB), $0
-
-	MOVL	R26, 4(R(MACH))		/* save PC in m->splpc */
-	MOVQ	$HI_IPL, R16
-	CALL_PAL $PALswpipl
-	RET
-
-TEXT	spllo(SB), $0
-	MOVQ	R31, R16
-	CALL_PAL $PALswpipl
-	RET
-
-TEXT	splx(SB), $0
-	MOVL	R26, 4(R(MACH))		/* save PC in m->splpc */
-
-TEXT splxpc(SB), $0			/* for iunlock */
-	MOVQ	R0, R16
-	CALL_PAL $PALswpipl
-	RET
-
-TEXT	spldone(SB), $0
-	RET
-
-TEXT	islo(SB), $0
-	CALL_PAL $PALrdps
-	AND	$IPL, R0
-	XOR	$HI_IPL, R0
-	RET
-
-TEXT	mb(SB), $-8
-	MB
-	RET
-
-TEXT	icflush(SB), $-8
-	CALL_PAL $PALimb
-	RET
-
-TEXT	tlbflush(SB), $-8
-	MOVQ	R0, R16
-	MOVL	4(FP), R17
-	CALL_PAL $PALtbi
-	RET
-
-TEXT	swpctx(SB), $-8
-	MOVQ	R0, R16
-	AND	$0x7FFFFFFF, R16	/* make address physical */
-	CALL_PAL $PALswpctx
-	RET
-
-TEXT	wrent(SB), $-8
-	MOVQ	R0, R17
-	MOVL	4(FP), R16
-	CALL_PAL $PALwrent
-	RET
-
-TEXT	wrvptptr(SB), $-8
-	MOVQ	R0, R16
-	CALL_PAL $PALwrvptptr
-	RET
-
-TEXT	cserve(SB), $-8
-	MOVQ	R0, R16
-	MOVL	4(FP), R17
-	CALL_PAL $PALcserve
-	RET
-
-TEXT	setlabel(SB), $-8
-	MOVL	R30, 0(R0)
-	MOVL	R26, 4(R0)
-	MOVQ	$0, R0
-	RET
-
-TEXT	gotolabel(SB), $-8
-	MOVL	0(R0), R30
-	MOVL	4(R0), R26
-	MOVQ	$1, R0
-	RET
-
-TEXT	tas(SB), $-8
-	MOVQ	R0, R1			/* l */
-tas1:
-	MOVLL	(R1), R0		/* l->key */
-	BNE	R0, tas2
-	MOVQ	$1, R2
-	MOVLC	R2, (R1)		/* l->key = 1 */
-	BEQ	R2, tas1		/* write failed, try again? */
-tas2:
-	RET
-
-TEXT	cmpswap(SB), $-8
-	MOVQ	R0, R1	/* p */
-	MOVL	old+4(FP), R2
-	MOVL	new+8(FP), R3
-	MOVLL	(R1), R0
-	CMPEQ	R0, R2, R4
-	BEQ	R4, fail	/* if R0 != [sic] R2, goto fail */
-	MOVQ	R3, R0
-	MOVLC	R0, (R1)
-	RET
-fail:
-	MOVL	$0, R0
-	RET
-	
-TEXT	fpenab(SB), $-8
-	MOVQ	R0, R16
-	CALL_PAL $PALwrfen
-	RET
-
-TEXT rpcc(SB), $0
-	MOVL	R0, R1
-	MOVL	$0, R0
-	WORD	$0x6000C000		/* RPCC R0 */
-	BEQ	R1, _ret
-	MOVQ	R0, (R1)
-_ret:
-	RET
-
-/*
- *	Exception handlers.  The stack frame looks like this:
- *
- *	R30+0:	(unused) link reg storage (R26) (32 bits)
- *	R30+4:	padding for alignment (32 bits)
- *	R30+8:	trap()'s first arg storage (R0) (32 bits -- type Ureg*)
- *	R30+12:	padding for alignment (32 bits)
- *	R30+16:	first 31 fields of Ureg, saved here (31*64 bits)
- *	R30+264:	other 6 fields of Ureg, saved by PALcode (6*64 bits)
- *	R30+312:	previous value of KSP before trap
- */
-
-TEXT	arith(SB), $-8
-	SUBQ	$(4*BY2WD+31*BY2V), R30
-	MOVQ	R0, (4*BY2WD+4*BY2V)(R30)
-	MOVQ	$1, R0
-	JMP	trapcommon
-
-TEXT	illegal0(SB), $-8
-	SUBQ	$(4*BY2WD+31*BY2V), R30
-	MOVQ	R0, (4*BY2WD+4*BY2V)(R30)
-	MOVQ	$2, R0
-	JMP	trapcommon
-
-TEXT	fault0(SB), $-8
-	SUBQ	$(4*BY2WD+31*BY2V), R30
-	MOVQ	R0, (4*BY2WD+4*BY2V)(R30)
-	MOVQ	$4, R0
-	JMP	trapcommon
-
-TEXT	unaligned(SB), $-8
-	SUBQ	$(4*BY2WD+31*BY2V), R30
-	MOVQ	R0, (4*BY2WD+4*BY2V)(R30)
-	MOVQ	$6, R0
-	JMP	trapcommon
-
-TEXT	intr0(SB), $-8
-	SUBQ	$(4*BY2WD+31*BY2V), R30
-	MOVQ	R0, (4*BY2WD+4*BY2V)(R30)
-	MOVQ	$3, R0
-
-trapcommon:
-	MOVQ	R0, (4*BY2WD+0*BY2V)(R30)
-	MOVQ	R16, (4*BY2WD+1*BY2V)(R30)
-	MOVQ	R17, (4*BY2WD+2*BY2V)(R30)
-	MOVQ	R18, (4*BY2WD+3*BY2V)(R30)
-
-	/* R0 already saved, (4*BY2WD+4*BY2V)(R30) */
-	MOVQ	R1, (4*BY2WD+5*BY2V)(R30)
-	MOVQ	R2, (4*BY2WD+6*BY2V)(R30)
-	MOVQ	R3, (4*BY2WD+7*BY2V)(R30)
-	MOVQ	R4, (4*BY2WD+8*BY2V)(R30)
-	MOVQ	R5, (4*BY2WD+9*BY2V)(R30)
-	MOVQ	R6, (4*BY2WD+10*BY2V)(R30)
-	MOVQ	R7, (4*BY2WD+11*BY2V)(R30)
-	MOVQ	R8, (4*BY2WD+12*BY2V)(R30)
-	MOVQ	R9, (4*BY2WD+13*BY2V)(R30)
-	MOVQ	R10, (4*BY2WD+14*BY2V)(R30)
-	MOVQ	R11, (4*BY2WD+15*BY2V)(R30)
-	MOVQ	R12, (4*BY2WD+16*BY2V)(R30)
-	MOVQ	R13, (4*BY2WD+17*BY2V)(R30)
-	MOVQ	R14, (4*BY2WD+18*BY2V)(R30)
-	MOVQ	R15, (4*BY2WD+19*BY2V)(R30)
-	MOVQ	R19, (4*BY2WD+20*BY2V)(R30)
-	MOVQ	R20, (4*BY2WD+21*BY2V)(R30)
-	MOVQ	R21, (4*BY2WD+22*BY2V)(R30)
-	MOVQ	R22, (4*BY2WD+23*BY2V)(R30)
-	MOVQ	R23, (4*BY2WD+24*BY2V)(R30)
-	MOVQ	R24, (4*BY2WD+25*BY2V)(R30)
-	MOVQ	R25, (4*BY2WD+26*BY2V)(R30)
-	MOVQ	R26, (4*BY2WD+27*BY2V)(R30)
-	MOVQ	R27, (4*BY2WD+28*BY2V)(R30)
-	MOVQ	R28, (4*BY2WD+29*BY2V)(R30)
-
-	MOVQ	$HI_IPL, R16
-	CALL_PAL $PALswpipl
-
-	CALL_PAL $PALrdusp
-	MOVQ	R0, (4*BY2WD+30*BY2V)(R30)	/* save USP */
-
-	MOVQ	$mach0(SB), R(MACH)
-	MOVQ	$(4*BY2WD)(R30), R0
-	JSR	trap(SB)
-trapret:
-	MOVQ	(4*BY2WD+30*BY2V)(R30), R16	/* USP */
-	CALL_PAL $PALwrusp			/* ... */
-	MOVQ	(4*BY2WD+4*BY2V)(R30), R0
-	MOVQ	(4*BY2WD+5*BY2V)(R30), R1
-	MOVQ	(4*BY2WD+6*BY2V)(R30), R2
-	MOVQ	(4*BY2WD+7*BY2V)(R30), R3
-	MOVQ	(4*BY2WD+8*BY2V)(R30), R4
-	MOVQ	(4*BY2WD+9*BY2V)(R30), R5
-	MOVQ	(4*BY2WD+10*BY2V)(R30), R6
-	MOVQ	(4*BY2WD+11*BY2V)(R30), R7
-	MOVQ	(4*BY2WD+12*BY2V)(R30), R8
-	MOVQ	(4*BY2WD+13*BY2V)(R30), R9
-	MOVQ	(4*BY2WD+14*BY2V)(R30), R10
-	MOVQ	(4*BY2WD+15*BY2V)(R30), R11
-	MOVQ	(4*BY2WD+16*BY2V)(R30), R12
-	MOVQ	(4*BY2WD+17*BY2V)(R30), R13
-	MOVQ	(4*BY2WD+18*BY2V)(R30), R14
-	MOVQ	(4*BY2WD+19*BY2V)(R30), R15
-	MOVQ	(4*BY2WD+20*BY2V)(R30), R19
-	MOVQ	(4*BY2WD+21*BY2V)(R30), R20
-	MOVQ	(4*BY2WD+22*BY2V)(R30), R21
-	MOVQ	(4*BY2WD+23*BY2V)(R30), R22
-	MOVQ	(4*BY2WD+24*BY2V)(R30), R23
-	MOVQ	(4*BY2WD+25*BY2V)(R30), R24
-	MOVQ	(4*BY2WD+26*BY2V)(R30), R25
-	MOVQ	(4*BY2WD+27*BY2V)(R30), R26
-	MOVQ	(4*BY2WD+28*BY2V)(R30), R27
-	MOVQ	(4*BY2WD+29*BY2V)(R30), R28
-	/* USP already restored from (4*BY2WD+30*BY2V)(R30) */
-	ADDQ	$(4*BY2WD+31*BY2V), R30
-	CALL_PAL $PALrti
-
-TEXT	forkret(SB), $0
-	MOVQ	R31, R0				/* Fake out system call return */
-	JMP	systrapret
-
-TEXT	syscall0(SB), $-8
-	SUBQ	$(4*BY2WD+31*BY2V), R30
-	MOVQ	R0, (4*BY2WD+4*BY2V)(R30)	/* save scallnr in R0 */
-	MOVQ	$HI_IPL, R16
-	CALL_PAL $PALswpipl
-	MOVQ	$mach0(SB), R(MACH)
-	CALL_PAL $PALrdusp
-	MOVQ	R0, (4*BY2WD+30*BY2V)(R30)	/* save USP */
-	MOVQ	R26, (4*BY2WD+27*BY2V)(R30)	/* save last return address */
-	MOVQ	$(4*BY2WD)(R30), R0		/* pass address of Ureg */
-	JSR	syscall(SB)
-systrapret:
-	MOVQ	(4*BY2WD+30*BY2V)(R30), R16	/* USP */
-	CALL_PAL $PALwrusp			/* consider doing this in execregs... */
-	MOVQ	(4*BY2WD+27*BY2V)(R30), R26	/* restore last return address */
-	ADDQ	$(4*BY2WD+31*BY2V), R30
-	CALL_PAL $PALretsys
-
-/*
- * Take first processor into user mode
- * 	- argument is stack pointer to user
- */
-
-TEXT	touser(SB), $-8
-	MOVQ	R0, R16
-	CALL_PAL $PALwrusp			/* set USP to value passed */
-	SUBQ	$(6*BY2V), R30			/* create frame for retsys */
-	MOVQ	$(UTZERO+32), R26		/* header appears in text */
-	MOVQ	R26, (1*BY2V)(R30)		/* PC -- only reg that matters */
-	CALL_PAL $PALretsys
-
-TEXT	rfnote(SB), $0
-	SUBL	$(2*BY2WD), R0, SP
-	JMP	trapret
-
-TEXT	savefpregs(SB), $-8
-	MOVT	F0, 0x00(R0)
-	MOVT	F1, 0x08(R0)
-	MOVT	F2, 0x10(R0)
-	MOVT	F3, 0x18(R0)
-	MOVT	F4, 0x20(R0)
-	MOVT	F5, 0x28(R0)
-	MOVT	F6, 0x30(R0)
-	MOVT	F7, 0x38(R0)
-	MOVT	F8, 0x40(R0)
-	MOVT	F9, 0x48(R0)
-	MOVT	F10, 0x50(R0)
-	MOVT	F11, 0x58(R0)
-	MOVT	F12, 0x60(R0)
-	MOVT	F13, 0x68(R0)
-	MOVT	F14, 0x70(R0)
-	MOVT	F15, 0x78(R0)
-	MOVT	F16, 0x80(R0)
-	MOVT	F17, 0x88(R0)
-	MOVT	F18, 0x90(R0)
-	MOVT	F19, 0x98(R0)
-	MOVT	F20, 0xA0(R0)
-	MOVT	F21, 0xA8(R0)
-	MOVT	F22, 0xB0(R0)
-	MOVT	F23, 0xB8(R0)
-	MOVT	F24, 0xC0(R0)
-	MOVT	F25, 0xC8(R0)
-	MOVT	F26, 0xD0(R0)
-	MOVT	F27, 0xD8(R0)
-	MOVT	F28, 0xE0(R0)
-	MOVT	F29, 0xE8(R0)
-	MOVT	F30, 0xF0(R0)
-	MOVT	F31, 0xF8(R0)
-	MOVT	FPCR, F0
-	MOVT	F0, 0x100(R0)
-
-	MOVQ	$0, R16
-	CALL_PAL $PALwrfen		/* disable */
-	RET
-
-TEXT	restfpregs(SB), $-8
-	MOVQ	$1, R16
-	CALL_PAL $PALwrfen		/* enable */
-
-	MOVT	0x100(R0), F0
-	MOVT	F0, FPCR
-	MOVT	0x00(R0), F0
-	MOVT	0x08(R0), F1
-	MOVT	0x10(R0), F2
-	MOVT	0x18(R0), F3
-	MOVT	0x20(R0), F4
-	MOVT	0x28(R0), F5
-	MOVT	0x30(R0), F6
-	MOVT	0x38(R0), F7
-	MOVT	0x40(R0), F8
-	MOVT	0x48(R0), F9
-	MOVT	0x50(R0), F10
-	MOVT	0x58(R0), F11
-	MOVT	0x60(R0), F12
-	MOVT	0x68(R0), F13
-	MOVT	0x70(R0), F14
-	MOVT	0x78(R0), F15
-	MOVT	0x80(R0), F16
-	MOVT	0x88(R0), F17
-	MOVT	0x90(R0), F18
-	MOVT	0x98(R0), F19
-	MOVT	0xA0(R0), F20
-	MOVT	0xA8(R0), F21
-	MOVT	0xB0(R0), F22
-	MOVT	0xB8(R0), F23
-	MOVT	0xC0(R0), F24
-	MOVT	0xC8(R0), F25
-	MOVT	0xD0(R0), F26
-	MOVT	0xD8(R0), F27
-	MOVT	0xE0(R0), F28
-	MOVT	0xE8(R0), F29
-	MOVT	0xF0(R0), F30
-	MOVT	0xF8(R0), F31
-	RET
--- a/sys/src/9/alphapc/main.c
+++ /dev/null
@@ -1,604 +1,0 @@
-#include	"u.h"
-#include	"../port/lib.h"
-#include	"mem.h"
-#include	"dat.h"
-#include	"fns.h"
-#include	"io.h"
-#include	"init.h"
-#include	"pool.h"
-#include	"/sys/src/boot/alphapc/conf.h"
-#include	"axp.h"
-
-char argbuf[128];	/* arguments passed to initcode and /boot */
-
-Hwrpb *hwrpb;
-Bootconf *bootconf;
-Conf	conf;
-FPsave	initfp;
-	/* setfcr(FPPDBL|FPRNR|FPINVAL|FPZDIV|FPOVFL) */
-uvlong initfpcr = (1LL<62)|(1LL<61)|(1LL<60)|(2LL<<58)|(1LL<48);
-
-char bootargs[BOOTARGSLEN];
-char *confname[MAXCONF];
-char *confval[MAXCONF];
-int	nconf;
-
-static void
-options(void)
-{
-	long i, n;
-	char *cp, *line[MAXCONF], *p, *q;
-
-	cp = bootargs;
-	strncpy(cp, bootconf->bootargs, BOOTARGSLEN);
-	cp[BOOTARGSLEN-1] = 0;
-	/* can't print in this routine, see below in main() */
-
-	/*
-	 * Strip out '\r', change '\t' -> ' '.
-	 */
-	p = cp;
-	for(q = cp; *q; q++){
-		if(*q == '\r')
-			continue;
-		if(*q == '\t')
-			*q = ' ';
-		*p++ = *q;
-	}
-	*p = 0;
-
-	n = getfields(cp, line, MAXCONF, 1, "\n");
-	for(i = 0; i < n; i++){
-		if(*line[i] == '#')
-			continue;
-		cp = strchr(line[i], '=');
-		if(cp == nil)
-			continue;
-		*cp++ = '\0';
-		confname[nconf] = line[i];
-		confval[nconf] = cp;
-		nconf++;
-	}
-}
-
-/* debugging only */
-static void
-dumpopts(void)
-{
-	int i;
-
-	print("dumpopts: found /alpha/conf options at %#p\n",
-		bootconf->bootargs);
-	for(i = 0; i < nconf; i++)
-		print("dumpopts: read %s=%s\n", confname[i], confval[i]);
-}
-
-extern void (*i8237alloc)(void);
-
-void
-main(void)
-{
-	hwrpb = (Hwrpb*)0x10000000;
-	hwrpb = (Hwrpb*)(KZERO|hwrpb->phys);
-	arginit();
-	machinit();
-	options();
-	ioinit();
-	clockinit();
-	confinit();
-	archinit();
-	xinit();
-	memholes();
-	if(i8237alloc != nil)
-		i8237alloc();
-	mmuinit();
-	if(arch->coreinit)
-		arch->coreinit();
-	trapinit();
-	screeninit();
-	printinit();
-	/* it's now safe to print */
-	/* dumpopts();			/* DEBUG */
-	i8250console();
-	quotefmtinstall();
-	print("\nPlan 9\n");
-
-	cpuidprint();
-	if(arch->corehello)
-		arch->corehello();
-
-	procinit0();
-	initseg();
-	timersinit();
-	links();
-	chandevreset();
-	pageinit();
-	swapinit();
-	savefpregs(&initfp);
-initfp.fpstatus = 0x68028000;
-	userinit();
-	schedinit();
-}
-
-/* cpu->state bits */
-enum {
-	Cpubootinprog	= 1,	/* boot in progress */
-	Cpucanrestart	= 2,	/* restart possible */
-	Cpuavail	= 4,	/* processor available */
-	Cpuexists 	= 8,	/* processor present */
-	Cpuuserhalted	= 0x10,	/* user halted */
-	Cpuctxtokay	= 0x20,	/* context valid */
-	Cpupalokay	= 0x40,	/* PALcode valid */
-	Cpupalmemokay	= 0x80,	/* PALcode memory valid */
-	Cpupalloaded	= 0x100, /* PALcode loaded */
-	Cpuhaltmask	= 0xff0000, /* halt request mask */
-	Cpuhaltdflt	= 0,
-	Cpuhaltsaveexit = 0x10000,
-	Cpuhaltcoldboot = 0x20000,
-	Cpuhaltwarmboot = 0x30000,
-	Cpuhaltstayhalted = 0x40000,
-	Cpumustbezero = 0xffffffffff000000ULL,	/* 24:63 -- must be zero */
-};
-
-/*
- *  initialize a processor's mach structure.  each processor does this
- *  for itself.
- */
-void
-machinit(void)
-{
-	int n;
-	Hwcpu *cpu;
-
-	icflush();
-	n = m->machno;
-	memset(m, 0, sizeof(Mach));
-	m->machno = n;
-
-	active.exiting = 0;
-	active.machs[0] = 1;
-
-	cpu = (Hwcpu*) ((ulong)hwrpb + hwrpb->cpuoff + n*hwrpb->cpulen);
-	cpu->state &= ~Cpubootinprog;
-	if (0)
-		cpu->state |= Cpuhaltstayhalted;
-}
-
-void
-init0(void)
-{
-	int i;
-	char buf[2*KNAMELEN];
-
-	up->nerrlab = 0;
-
-	spllo();
-
-	/*
-	 * These are o.k. because rootinit is null.
-	 * Then early kproc's will have a root and dot.
-	 */
-	up->slash = namec("#/", Atodir, 0, 0);
-	pathclose(up->slash->path);
-	up->slash->path = newpath("/");
-	up->dot = cclone(up->slash);
-
-	chandevinit();
-
-	if(!waserror()){
-		snprint(buf, sizeof(buf), "alpha %s alphapc", conffile);
-		ksetenv("terminal", buf, 0);
-		ksetenv("cputype", "alpha", 0);
-		if(cpuserver)
-			ksetenv("service", "cpu", 0);
-		else
-			ksetenv("service", "terminal", 0);
-		for(i = 0; i < nconf; i++)
-			if(confname[i]){
-				if(confname[i][0] != '*')
-					ksetenv(confname[i], confval[i], 0);
-				ksetenv(confname[i], confval[i], 1);
-			}
-		poperror();
-	}
-
-	kproc("alarm", alarmkproc, 0);
-	touser((uchar*)(USTKTOP - sizeof(argbuf)));
-}
-
-void
-userinit(void)
-{
-	Proc *p;
-	Segment *s;
-	KMap *k;
-	char **av;
-	Page *pg;
-
-	p = newproc();
-	p->pgrp = newpgrp();
-	p->egrp = smalloc(sizeof(Egrp));
-	p->egrp->ref = 1;
-	p->fgrp = dupfgrp(nil);
-	p->rgrp = newrgrp();
-	p->procmode = 0640;
-
-	kstrdup(&eve, "");
-	kstrdup(&p->text, "*init*");
-	kstrdup(&p->user, eve);
-
-	procsetup(p);
-
-	/*
-	 * Kernel Stack
-	 */
-	p->sched.pc = (ulong)init0;
-	p->sched.sp = (ulong)p->kstack+KSTACK-MAXSYSARG*BY2WD;
-	/*
-	 * User Stack, pass input arguments to boot process
-	 */
-	s = newseg(SG_STACK, USTKTOP-USTKSIZE, USTKSIZE/BY2PG);
-	p->seg[SSEG] = s;
-	pg = newpage(1, 0, USTKTOP-BY2PG);
-	segpage(s, pg);
-	k = kmap(pg);
-	for(av = (char**)argbuf; *av; av++)
-		*av += (USTKTOP - sizeof(argbuf)) - (ulong)argbuf;
-
-	memmove((uchar*)VA(k) + BY2PG - sizeof(argbuf), argbuf, sizeof argbuf);
-	kunmap(k);
-
-	/*
-	 * Text
-	 */
-	s = newseg(SG_TEXT, UTZERO, 1);
-	s->flushme++;
-	p->seg[TSEG] = s;
-	pg = newpage(1, 0, UTZERO);
-	pg->txtflush = ~0;
-	segpage(s, pg);
-	k = kmap(s->map[0]->pages[0]);
-	memmove((uchar*)VA(k), initcode, sizeof initcode);
-	kunmap(k);
-
-	ready(p);
-}
-
-void
-procsetup(Proc *p)
-{
-	p->fpstate = FPinit;
-	fpenab(0);
-}
-
-void
-procfork(Proc *)
-{
-}
-
-void
-procsave(Proc *p)
-{
-	if(p->fpstate == FPactive){
-		if(p->state == Moribund)
-			fpenab(0);
-		else
-			savefpregs(&up->fpsave);
-		p->fpstate = FPinactive;
-	}
-
-	/*
-	 * Switch to the prototype page tables for this processor.
-	 * While this processor is in the scheduler, the process could run
-	 * on another processor and exit, returning the page tables to
-	 * the free list where they could be reallocated and overwritten.
-	 * When this processor eventually has to get an entry from the
-	 * trashed page tables it will crash.
-	 */
-	mmupark();
-}
-
-void
-setupboot(int halt)
-{
-	int n = 0;		// cpu id of primary cpu, not just m->machno
-	Hwcpu *cpu = (Hwcpu*)((ulong)hwrpb + hwrpb->cpuoff + n*hwrpb->cpulen);
-
-	cpu->state &= ~(Cpucanrestart | Cpuhaltmask);
-	cpu->state |= (halt? Cpuhaltstayhalted: Cpuhaltwarmboot);
-}
-
-void
-reboot(void *, void *, ulong)
-{
-}
-
-void
-exit(int)
-{
-	cpushutdown();
-	splhi();
-	if(arch->coredetach)
-		arch->coredetach();
-	setupboot(1);			// set up to halt
-	for (;;)
-		firmware();
-}
-
-void
-confinit(void)
-{
-	ulong ktop, kpages;
-	Bank *b, *eb;
-	extern void _main(void);
-	int userpcnt;
-	char *p;
-
-	if(p = getconf("*kernelpercent"))
-		userpcnt = 100 - strtol(p, 0, 0);
-	else
-		userpcnt = 0;
-
-	/*
-	 * The console firmware divides memory into 1 or more banks.
-	 * FInd the bank with the kernel in it.
-	 */
-	b = bootconf->bank;
-	eb = b+bootconf->nbank;
-	ktop = PGROUND((ulong)end);
-	ktop = PADDR(ktop);
-	while(b < eb) {
-		if(b->min < ktop && ktop < b->max)
-			break;
-		b++;
-	}
-	if(b == eb)
-		panic("confinit");
-
-	/*
-	 * Split the bank of memory into 2 banks to fool the allocator into
-	 * allocating low memory pages from bank 0 for any peripherals
-	 * which only have a 24bit address counter.
-	 */
-	conf.mem[0].npage = (8*1024*1024)/BY2PG;
-	conf.mem[0].base = 0;
-
-	conf.mem[1].npage = (b->max-8*1024*1024)/BY2PG;
-	conf.mem[1].base = 8*1024*1024;
-
-	conf.npage = conf.mem[0].npage+conf.mem[1].npage;
-	conf.upages = (conf.npage*70)/100;
-
-	conf.mem[0].npage -= ktop/BY2PG;
-	conf.mem[0].base += ktop;
-	conf.ialloc = ((conf.npage-conf.upages)/2)*BY2PG;
-
-	/*
-	 * Fix up the bank we found to be the remnant, below the kernel.
-	 * This, and the other banks, will be passed to xhole() later.
-	 * BUG: conf.upages needs to be adjusted, but how?  In practice,
-	 * we only have 1 bank, and the remnant is small.
-	 */
-	b->max = (uvlong)_main & ~(BY2PG-1);
-
-	conf.nmach = 1;
-	conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
-	if(cpuserver)
-		conf.nproc *= 3;
-	if(conf.nproc > 2000)
-		conf.nproc = 2000;
-	conf.nimage = 200;
-	conf.nswap = conf.nproc*80;
-	conf.nswppo = 4096;
-	conf.copymode = 0;			/* copy on write */
-
-	if(cpuserver) {
-		if(userpcnt < 10)
-			userpcnt = 70;
-		kpages = conf.npage - (conf.npage*userpcnt)/100;
-
-		/*
-		 * Hack for the big boys. Only good while physmem < 4GB.
-		 * Give the kernel a max. of 16MB + enough to allocate the
-		 * page pool.
-		 * This is an overestimate as conf.upages < conf.npages.
-		 * The patch of nimage is a band-aid, scanning the whole
-		 * page list in imagereclaim just takes too long.
-		 */
-		if(kpages > (16*MB + conf.npage*sizeof(Page))/BY2PG){
-			kpages = (16*MB + conf.npage*sizeof(Page))/BY2PG;
-			conf.nimage = 2000;
-			kpages += (conf.nproc*KSTACK)/BY2PG;
-		}
-	} else {
-		if(userpcnt < 10) {
-			if(conf.npage*BY2PG < 16*MB)
-				userpcnt = 40;
-			else
-				userpcnt = 60;
-		}
-		kpages = conf.npage - (conf.npage*userpcnt)/100;
-
-		/*
-		 * Make sure terminals with low memory get at least
-		 * 4MB on the first Image chunk allocation.
-		 */
-		if(conf.npage*BY2PG < 16*MB)
-			imagmem->minarena = 4*1024*1024;
-	}
-	conf.upages = conf.npage - kpages;
-	conf.ialloc = (kpages/2)*BY2PG;
-
-	/*
-	 * Guess how much is taken by the large permanent
-	 * datastructures. Mntcache and Mntrpc are not accounted for.
-	 */
-	kpages *= BY2PG;
-	kpages -= conf.upages*sizeof(Page)
-		+ conf.nproc*sizeof(Proc)
-		+ conf.nimage*sizeof(Image)
-		+ conf.nswap
-		+ conf.nswppo*sizeof(Page*);
-	mainmem->maxsize = kpages;
-	if(!cpuserver){
-		/*
-		 * give terminals lots of image memory, too; the dynamic
-		 * allocation will balance the load properly, hopefully.
-		 * be careful with 32-bit overflow.
-		 */
-		imagmem->maxsize = kpages;
-	}
-
-//	conf.monitor = 1;	/* BUG */
-}
-
-void
-memholes(void)
-{
-	Bank *b, *eb;
-
-	b = bootconf->bank;
-	eb = b+bootconf->nbank;
-	while(b < eb) {
-		if(b->min < (1LL<<32) && b->max < (1LL<<32))
-			xhole(b->min, b->max-b->min);
-		b++;
-	}
-}
-
-char *sp;
-
-char *
-pusharg(char *p)
-{
-	int n;
-
-	n = strlen(p)+1;
-	sp -= n;
-	memmove(sp, p, n);
-	return sp;
-}
-
-void
-arginit(void)
-{
-	char **av;
-
-	av = (char**)argbuf;
-	sp = argbuf + sizeof(argbuf);
-	*av++ = pusharg("boot");
-	*av = 0;
-}
-
-char *
-getconf(char *name)
-{
-	int n;
-
-	for(n = 0; n < nconf; n++)
-		if(cistrcmp(confname[n], name) == 0) {
-			return confval[n];
-		}
-	return 0;
-}
-
-int
-isaconfig(char *class, int ctlrno, ISAConf *isa)
-{
-	char cc[32], *p;
-	int i, n;
-
-	snprint(cc, sizeof cc, "%s%d", class, ctlrno);
-	for(n = 0; n < nconf; n++){
-		if(cistrcmp(confname[n], cc) != 0)
-			continue;
-		isa->nopt = tokenize(confval[n], isa->opt, NISAOPT);
-		for(i = 0; i < isa->nopt; i++){
-			p = isa->opt[i];
-			if(cistrncmp(p, "type=", 5) == 0)
-				isa->type = p + 5;
-			else if(cistrncmp(p, "port=", 5) == 0)
-				isa->port = strtoul(p+5, &p, 0);
-			else if(cistrncmp(p, "irq=", 4) == 0)
-				isa->irq = strtoul(p+4, &p, 0);
-			else if(cistrncmp(p, "dma=", 4) == 0)
-				isa->dma = strtoul(p+4, &p, 0);
-			else if(cistrncmp(p, "mem=", 4) == 0)
-				isa->mem = strtoul(p+4, &p, 0);
-			else if(cistrncmp(p, "size=", 5) == 0)
-				isa->size = strtoul(p+5, &p, 0);
-			else if(cistrncmp(p, "freq=", 5) == 0)
-				isa->freq = strtoul(p+5, &p, 0);
-		}
-		return 1;
-	}
-	return 0;
-}
-
-int
-cistrcmp(char *a, char *b)
-{
-	int ac, bc;
-
-	for(;;){
-		ac = *a++;
-		bc = *b++;
-
-		if(ac >= 'A' && ac <= 'Z')
-			ac = 'a' + (ac - 'A');
-		if(bc >= 'A' && bc <= 'Z')
-			bc = 'a' + (bc - 'A');
-		ac -= bc;
-		if(ac)
-			return ac;
-		if(bc == 0)
-			break;
-	}
-	return 0;
-}
-
-int
-cistrncmp(char *a, char *b, int n)
-{
-	unsigned ac, bc;
-
-	while(n > 0){
-		ac = *a++;
-		bc = *b++;
-		n--;
-
-		if(ac >= 'A' && ac <= 'Z')
-			ac = 'a' + (ac - 'A');
-		if(bc >= 'A' && bc <= 'Z')
-			bc = 'a' + (bc - 'A');
-
-		ac -= bc;
-		if(ac)
-			return ac;
-		if(bc == 0)
-			break;
-	}
-
-	return 0;
-}
-
-int
-getcfields(char* lp, char** fields, int n, char* sep)
-{
-	int i;
-
-	for(i = 0; lp && *lp && i < n; i++){
-		while(*lp && strchr(sep, *lp) != 0)
-			*lp++ = 0;
-		if(*lp == 0)
-			break;
-		fields[i] = lp;
-		while(*lp && strchr(sep, *lp) == 0){
-			if(*lp == '\\' && *(lp+1) == '\n')
-				*lp++ = ' ';
-			lp++;
-		}
-	}
-
-	return i;
-}
--- a/sys/src/9/alphapc/mem.h
+++ /dev/null
@@ -1,87 +1,0 @@
-/*
- * Memory and machine-specific definitions.  Used in C and assembler.
- */
-
-/*
- * Sizes
- */
-#define	BI2BY		8			/* bits per byte */
-#define	BI2WD		32			/* bits per word */
-#define	BY2WD		4			/* bytes per word */
-#define BY2V		8			/* bytes per vlong */
-#define	BY2PG		8192			/* bytes per page */
-#define	WD2PG		(BY2PG/BY2WD)		/* words per page */
-#define	PGSHIFT		13			/* log(BY2PG) */
-#define ROUND(s, sz)	(((s)+((sz)-1))&~((sz)-1))
-#define PGROUND(s)	ROUND(s, BY2PG)
-#define BLOCKALIGN	8
-
-#define	BY2PTE		8			/* bytes per pte entry */
-#define	PTE2PG		(BY2PG/BY2PTE)		/* pte entries per page */
-
-#define	MAXMACH		1			/* max # cpus system can run */
-#define	KSTACK		4096			/* Size of kernel stack */
-
-/*
- * Time
- */
-#define	HZ		100			/* clock frequency */
-#define	MS2HZ		(1000/HZ)
-#define	TK2SEC(t)	((t)/HZ)		/* ticks to seconds */
-
-/*
- * Magic registers
- */
-#define	MACH		15		/* R15 is m-> */
-#define	USER		14		/* R14 is up-> */
-
-
-/*
- * Fundamental addresses
- */
-/* XXX MACHADDR, MACHP(n) */
-
-/*
- * MMU
- *
- * A PTE is 64 bits, but a ulong is 32!  Hence we encode
- * the PTEs specially for fault.c, and decode them in putmmu().
- * This means that we can only map the first 2G of physical
- * space via putmmu() - ie only physical memory, not devices.
- */
-#define	PTEVALID	0x3301
-#define	PTEKVALID	0x1101
-#define	PTEASM		0x0010
-#define	PTEGH(s)	((s)<<5)
-#define	PTEWRITE	0
-#define	PTERONLY	0x4
-#define	PTEUNCACHED	0
-#define	PPN(n)		(((n)>>PGSHIFT)<<14)
-#define	FIXPTE(x)	((((uvlong)(x)>>14)<<32)|((x) & 0x3fff))
-#define	PTEPFN(pa)	(((uvlong)(pa)>>PGSHIFT)<<32)
-#define	NCOLOR		1
-#define	getpgcolor(a)	0
-
-#define	PTEMAPMEM	(1024*1024)	
-#define	PTEPERTAB	(PTEMAPMEM/BY2PG)
-#define	SEGMAPSIZE	512
-#define SSEGMAPSIZE	16
-
-/*
- * Address spaces
- */
-#define	UZERO	0			/* base of user address space */
-#define	UTZERO	(UZERO+BY2PG)		/* first address in user text */
-#define	KZERO	0x80000000		/* base of kernel address space */
-#define	KTZERO	(KZERO+0x400000)	/* first address in kernel text */
-#define	USTKTOP	KZERO			/* byte just beyond user stack */
-#define	USTKSIZE	(4*1024*1024)	/* size of user stack */
-
-/*
- * Processor Status (as returned by rdps)
- */
-#define	UMODE	0x8
-#define	IPL	0x7
-
-
-#define isphys(x) (((ulong)x&KZERO)!=0)
--- a/sys/src/9/alphapc/memmove.s
+++ /dev/null
@@ -1,197 +1,0 @@
-#define QUAD	8
-#define ALIGN	64
-#define BLOCK	64
-
-TEXT memmove(SB), $0
-	MOVL	from+4(FP), R7
-	MOVL	n+8(FP), R10
-	MOVQ	R0, R6
-
-	CMPUGE	R7, R0, R5
-	BNE	R5, _forward
-
-	MOVQ	R6, R8			/* end to address */
-	ADDL	R10, R6, R6		/* to+n */
-	ADDL	R10, R7, R7		/* from+n */
-
-	CMPUGE	$ALIGN, R10, R1		/* need at least ALIGN bytes */
-	BNE	R1, _b1tail
-
-_balign:
-	AND	$(ALIGN-1), R6, R1
-	BEQ	R1, _baligned
-
-	MOVBU	-1(R7), R2
-	ADDL	$-1, R6, R6
-	MOVB	R2, (R6)
-	ADDL	$-1, R7, R7
-	JMP	_balign
-	
-_baligned:
-	AND	$(QUAD-1), R7, R1	/* is the source quad-aligned */
-	BNE	R1, _bunaligned
-
-	ADDL	$(BLOCK-1), R8, R9
-_bblock:
-	CMPUGE	R9, R6, R1
-	BNE	R1, _b8tail
-
-	MOVQ	-64(R7), R22
-	MOVQ	-56(R7), R23
-	MOVQ	-48(R7), R24
-	MOVQ	-40(R7), R25
-	MOVQ	-32(R7), R2
-	MOVQ	-24(R7), R3
-	MOVQ	-16(R7), R4
-	MOVQ	-8(R7), R5
-
-	SUBL	$64, R6, R6
-	SUBL	$64, R7, R7
-
-	MOVQ	R22, (R6)
-	MOVQ	R23, 8(R6)
-	MOVQ	R24, 16(R6)
-	MOVQ	R25, 24(R6)
-	MOVQ	R2, 32(R6)
-	MOVQ	R3, 40(R6)
-	MOVQ	R4, 48(R6)
-	MOVQ	R5, 56(R6)
-	JMP	_bblock
-
-_b8tail:
-	ADDL	$(QUAD-1), R8, R9
-_b8block:
-	CMPUGE	R9, R6, R1
-	BNE	R1, _b1tail
-
-	MOVQ	-8(R7), R2
-	SUBL	$8, R6
-	MOVQ	R2, (R6)
-	SUBL	$8, R7
-	JMP	_b8block
-
-_b1tail:
-	CMPUGE	R8, R6, R1
-	BNE	R1, _ret
-
-	MOVBU	-1(R7), R2
-	SUBL	$1, R6, R6
-	MOVB	R2, (R6)
-	SUBL	$1, R7, R7
-	JMP	_b1tail
-_ret:
-	RET
-
-_bunaligned:
-	ADDL	$(16-1), R8, R9
-
-_bu8block:
-	CMPUGE	R9, R6, R1
-	BNE	R1, _b1tail
-
-	MOVQU	-16(R7), R4
-	MOVQU	-8(R7), R3
-	MOVQU	(R7), R2
-	SUBL	$16, R6
-	EXTQH	R7, R2, R2
-	EXTQL	R7, R3, R5
-	OR	R5, R2, R11
-	EXTQH	R7, R3, R3
-	EXTQL	R7, R4, R4
-	OR	R3, R4, R13
-	MOVQ	R11, 8(R6)
-	MOVQ	R13, (R6)
-	SUBL	$16, R7
-	JMP	_bu8block
-
-_forward:
-	ADDL	R10, R6, R8		/* end to address */
-
-	CMPUGE	$ALIGN, R10, R1		/* need at least ALIGN bytes */
-	BNE	R1, _f1tail
-
-_falign:
-	AND	$(ALIGN-1), R6, R1
-	BEQ	R1, _faligned
-
-	MOVBU	(R7), R2
-	ADDL	$1, R6, R6
-	ADDL	$1, R7, R7
-	MOVB	R2, -1(R6)
-	JMP	_falign
-
-_faligned:
-	AND	$(QUAD-1), R7, R1	/* is the source quad-aligned */
-	BNE	R1, _funaligned
-
-	SUBL	$(BLOCK-1), R8, R9
-_fblock:
-	CMPUGT	R9, R6, R1
-	BEQ	R1, _f8tail
-
-	MOVQ	(R7), R2
-	MOVQ	8(R7), R3
-	MOVQ	16(R7), R4
-	MOVQ	24(R7), R5
-	MOVQ	32(R7), R22
-	MOVQ	40(R7), R23
-	MOVQ	48(R7), R24
-	MOVQ	56(R7), R25
-
-	ADDL	$64, R6, R6
-	ADDL	$64, R7, R7
-
-	MOVQ	R2, -64(R6)
-	MOVQ	R3, -56(R6)
-	MOVQ	R4, -48(R6)
-	MOVQ	R5, -40(R6)
-	MOVQ	R22, -32(R6)
-	MOVQ	R23, -24(R6)
-	MOVQ	R24, -16(R6)
-	MOVQ	R25, -8(R6)
-	JMP	_fblock
-
-_f8tail:
-	SUBL	$(QUAD-1), R8, R9
-_f8block:
-	CMPUGT	R9, R6, R1
-	BEQ	R1, _f1tail
-
-	MOVQ	(R7), R2
-	ADDL	$8, R6
-	ADDL	$8, R7
-	MOVQ	R2, -8(R6)
-	JMP	_f8block
-
-_f1tail:
-	CMPUGT	R8, R6, R1
-	BEQ	R1, _fret
-	MOVBU	(R7), R2
-	ADDL	$1, R6, R6
-	ADDL	$1, R7, R7
-	MOVB	R2, -1(R6)
-	JMP	_f1tail
-
-_fret:
-	RET
-
-_funaligned:
-	SUBL	$(16-1), R8, R9
-_fu8block:
-	CMPUGT	R9, R6, R1
-	BEQ	R1, _f1tail
-
-	MOVQU	(R7), R2
-	MOVQU	8(R7), R3
-	MOVQU	16(R7), R4
-	EXTQL	R7, R2, R2
-	EXTQH	R7, R3, R5
-	OR	R5, R2, R11
-	EXTQL	R7, R3, R3
-	MOVQ	R11, (R6)
-	EXTQH	R7, R4, R4
-	OR	R3, R4, R11
-	MOVQ	R11, 8(R6)
-	ADDL	$16, R6
-	ADDL	$16, R7
-	JMP	_fu8block
--- a/sys/src/9/alphapc/memset.s
+++ /dev/null
@@ -1,61 +1,0 @@
-TEXT memset(SB), $0
-	MOVL	R0, R6
-	MOVBU	data+4(FP), R2
-	MOVL	n+8(FP), R10
-
-	ADDL	R10, R0, R8
-
-	CMPUGE	$8, R10, R1		/* need at least 8 bytes */
-	BNE	R1, _1loop
-
-	SLLQ	$8, R2, R1		/* replicate the byte */
-	OR	R1, R2
-	SLLQ	$16, R2, R1
-	OR	R1, R2
-	SLLQ	$32, R2, R1
-	OR	R1, R2
-
-_align:
-	AND	$(8-1), R6, R1
-	BEQ	R1, _aligned
-
-	MOVB	R2, (R6)
-	ADDL	$1, R6, R6
-	JMP	_align
-
-_aligned:
-	SUBL	$(64-1), R8, R9		/* end pointer minus slop */
-_64loop:
-	CMPUGT	R9, R6, R1
-	BEQ	R1, _8tail
-
-	MOVQ	R2, (R6)
-	MOVQ	R2, 8(R6)
-	MOVQ	R2, 16(R6)
-	MOVQ	R2, 24(R6)
-	MOVQ	R2, 32(R6)
-	MOVQ	R2, 40(R6)
-	MOVQ	R2, 48(R6)
-	MOVQ	R2, 56(R6)
-	ADDL	$64, R6, R6
-	JMP	_64loop
-
-_8tail:
-	SUBL	$(8-1), R8, R9
-_8loop:
-	CMPUGT	R9, R6, R1
-	BEQ	R1, _1loop
-
-	MOVQ	R2, (R6)
-	ADDL	$8, R6
-	JMP	_8loop
-
-_1loop:
-	CMPUGT	R8, R6, R1
-	BEQ	R1, _ret
-	MOVB	R2, (R6)
-	ADDL	$1, R6
-	JMP	_1loop
-
-_ret:
-	RET
--- a/sys/src/9/alphapc/mkfile
+++ /dev/null
@@ -1,106 +1,0 @@
-CONF=apc
-CONFLIST=apc apccpu
-
-objtype=alpha
-</$objtype/mkfile
-p=9
-
-DEVS=`{rc ../port/mkdevlist $CONF}
-
-PORT=\
-	alarm.$O\
-	alloc.$O\
-	allocb.$O\
-	auth.$O\
-	cache.$O\
-	chan.$O\
-	dev.$O\
-	fault.$O\
-	log.$O\
-	edf.$O\
-	mul64fract.$O\
-	page.$O\
-	parse.$O\
-	pgrp.$O\
-	portclock.$O\
-	print.$O\
-	proc.$O\
-	qio.$O\
-	qlock.$O\
-	rdb.$O\
-	rebootcmd.$O\
-	segment.$O\
-	swap.$O\
-	sysfile.$O\
-	sysproc.$O\
-	taslock.$O\
-	tod.$O\
-	xalloc.$O\
-	random.$O\
-
-OBJ=\
-	l.$O\
-	cga.$O\
-	clock.$O\
-	faultalpha.$O\
-	fdc37c93x.$O\
-	fptrap.$O\
-	i8259.$O\
-	main.$O\
-	mmu.$O\
-	trap.$O\
-	$CONF.root.$O\
-	$CONF.rootc.$O\
-	$DEVS\
-	$PORT\
-
-LIB=\
-	/$objtype/lib/libmemlayer.a\
-	/$objtype/lib/libmemdraw.a\
-	/$objtype/lib/libdraw.a\
-	/$objtype/lib/libip.a\
-	/$objtype/lib/libc.a\
-	/$objtype/lib/libsec.a\
-
-ETHER=`{echo devether.c ether*.c | sed 's/\.c/.'$O'/g'}
-VGA=`{echo devvga.c screen.c vga*.c | sed 's/\.c/.'$O'/g'}
-SDEV=`{echo devsd.c sd*.c | sed 's/\.c/.'$O'/g'}
-
-loadaddr = 0x80400020
-
-$p$CONF:	$CONF.c $OBJ $LIB
-	$CC $CFLAGS '-DKERNDATE='`{date -n} $CONF.c
-	$LD -o $target -H3 -R8 -T$loadaddr -l $OBJ $CONF.$O $LIB
-	size $target
-
-install:V: $p$CONF
-	cp $p$CONF /$objtype/$p$CONF
-
-<../boot/bootmkfile
-<../port/portmkfile
-<|../port/mkbootrules $CONF
-<../pc/pcmkfile
-
-init.h:	initcode /sys/src/libc/9syscall/sys.h
-	$AS initcode
-	$LD -l -s -R8 -o init.out initcode.$O -lc
-	{echo 'uchar initcode[]={'
-	 xd -r -1x init.out |
-		sed -e 's/^[0-9a-f]+ //' -e 's/ ([0-9a-f][0-9a-f])/0x\1,/g'
-	 echo '};'} > init.h
-
-clock.$O:	/$objtype/include/ureg.h axp.h
-devarch.$O:	axp.h
-faultalpha.$O:	/$objtype/include/ureg.h
-fptrap.$O:	/$objtype/include/ureg.h
-l.$O:		osf1pal.h
-main.$O: 	/$objtype/include/ureg.h errstr.h init.h
-mmu.$O:		/sys/src/boot/alphapc/conf.h
-sd53c8xx.$O:	/$objtype/include/ureg.h ../port/sd.h sd53c8xx.i
-trap.$O:	/$objtype/include/ureg.h ../port/error.h ../port/systab.h
-
-sd53c8xx.i:	../pc/sd53c8xx.n
-	aux/na $prereq > $target
-
-acid:V:
-	$CC -a -w -I. ../port/qio.c>acid
--- a/sys/src/9/alphapc/mmu.c
+++ /dev/null
@@ -1,299 +1,0 @@
-#include	"u.h"
-#include	"../port/lib.h"
-#include	"mem.h"
-#include	"dat.h"
-#include	"fns.h"
-#include	"/sys/src/boot/alphapc/conf.h"
-
-static uvlong	origlvl1;	/* physical address */
-static uvlong	klvl2;	/* physical, as created by boot loader */
-static uchar	*nextio;	/* next virtual address to be allocated by kmapv */
-extern Bootconf *bootconf;
-
-#define LVL2OFF(v)	((((long)(v))>>(2*PGSHIFT-3))&(PTE2PG-1))
-#define LVL3OFF(v)	((((long)(v))>>(PGSHIFT))&(PTE2PG-1))
-
-static void
-setptb(ulong pa)
-{
-	m->ptbr = (uvlong)pa>>PGSHIFT;
-	swpctx(m);
-}
-
-void
-mmuinit(void)
-{
-	uvlong *plvl2;
-
-	/* set PCB to new one in mach structure before stomping on old one */
-	m->usp = 0;
-	m->fen = 1;
-	m->ptbr = bootconf->pcb->ptbr;
-	origlvl1 = (m->ptbr << PGSHIFT);
-	setpcb(m);
-
-	plvl2 = (uvlong*) (KZERO|origlvl1|(BY2PG-8));
-	klvl2 = (*plvl2 >> 32)<<PGSHIFT;
-
-	nextio = (uchar*) (KZERO|bootconf->maxphys);
-}
-
-static void
-mmuptefree(Proc* proc)
-{
-	uvlong *lvl2;
-	Page **last, *page;
-
-	if(proc->mmutop && proc->mmuused){
-		lvl2 = (uvlong*)proc->mmulvl2->va;
-		last = &proc->mmuused;
-		for(page = *last; page; page = page->next){
-			lvl2[page->daddr] = 0;
-			last = &page->next;
-		}
-		*last = proc->mmufree;
-		proc->mmufree = proc->mmuused;
-		proc->mmuused = 0;
-	}
-}
-
-void
-mmuswitch(Proc *proc)
-{
-	if(proc->newtlb){
-		mmuptefree(proc);
-		proc->newtlb = 0;
-	}
-
-	/* tell processor about new page table and flush cached entries */
-	if(proc->mmutop == 0)
-		setptb(origlvl1);
-	else
-		setptb(proc->mmutop->pa);
-	tlbflush(-1, 0);
-	icflush();
-}
-
-/* point to protoype page map */
-void
-mmupark(void)
-{
-	setptb(origlvl1);
-	icflush();
-}
-
-/*
- *  give all page table pages back to the free pool.  This is called in sched()
- *  with palloc locked.
- */
-void
-mmurelease(Proc *proc)
-{
-	Page *page, *next;
-
-	mmupark();
-	mmuptefree(proc);
-	proc->mmuused = 0;
-	if(proc->mmutop) {
-		proc->mmutop->next = proc->mmufree;
-		proc->mmufree = proc->mmutop;
-		proc->mmutop = 0;
-	}
-	if(proc->mmulvl2) {
-		proc->mmulvl2->next = proc->mmufree;
-		proc->mmufree = proc->mmulvl2;
-		proc->mmulvl2 = 0;
-	}
-	for(page = proc->mmufree; page; page = next){
-		next = page->next;
-		if(--page->ref)
-			panic("mmurelease: page->ref %d\n", page->ref);
-		pagechainhead(page);
-	}
-	if(proc->mmufree)
-		pagechaindone();
-	proc->mmufree = 0;
-}
-
-void
-mmunewtop(void)
-{
-	Page *top, *lvl2;
-	uvlong *ppte;
-
-	top = newpage(1, 0, 0);
-	top->va = VA(kmap(top));
-	lvl2 = newpage(1, 0, 0);
-	lvl2->va = VA(kmap(lvl2));
-
-	ppte = (uvlong *)top->va;
-	ppte[0] = PTEPFN(lvl2->pa) | PTEKVALID;
-	ppte[PTE2PG-2] = PTEPFN(top->pa) | PTEKVALID;
-	ppte[PTE2PG-1] = PTEPFN(klvl2) | PTEKVALID;
-
-	up->mmutop = top;
-	up->mmulvl2 = lvl2;
-	setptb(top->pa);
-	tlbflush(-1, 0);
-	icflush();
-}
-
-void
-putmmu(uintptr va, uintptr pa, Page *pg)
-{
-	int lvl2off;
-	uvlong *lvl2, *pt;
-	int s;
-
-	if(up->mmutop == 0)
-		mmunewtop();
-
-	lvl2 = (uvlong*)up->mmulvl2->va;
-	lvl2off = LVL2OFF(va);
-
-	/*
-	 *  if bottom level page table missing, allocate one 
-	 *  and point the top level page at it.
-	 */
-	s = splhi();
-	if(lvl2[lvl2off] == 0){
-		if(up->mmufree == 0){
-			spllo();
-			pg = newpage(1, 0, 0);
-			pg->va = VA(kmap(pg));
-			splhi();
-		} else {
-			pg = up->mmufree;
-			up->mmufree = pg->next;
-			memset((void*)pg->va, 0, BY2PG);
-		}
-		lvl2[lvl2off] = PTEPFN(pg->pa) | PTEVALID;
-		pg->daddr = lvl2off;
-		pg->next = up->mmuused;
-		up->mmuused = pg;
-	}
-
-	/*
-	 *  put in new mmu entry
-	 */
-	pt = (uvlong*)(((lvl2[lvl2off] >> 32)<<PGSHIFT)|KZERO);
-	pt[LVL3OFF(va)] = FIXPTE(pa);
-
-	/* flush cached mmu entries */
-	tlbflush(3, va);
-	icflush();
-	splx(s);
-}
-
-void *
-kmapv(uvlong pa, int size)
-{
-	void *va, *new;
-	int lvl2off, i, npage, offset;
-	uvlong *lvl2, *pt;
-
-	offset = pa&(BY2PG-1);
-	npage = ((size+offset+BY2PG-1)>>PGSHIFT);
-
-	va = nextio+offset;
-	lvl2 = (uvlong*)(KZERO|klvl2);
-	for (i = 0; i < npage; i++) {
-		lvl2off = LVL2OFF(nextio);
-		if (lvl2[lvl2off] == 0) {
-			new = xspanalloc(BY2PG, BY2PG, 0);
-			memset(new, 0, BY2PG);
-			lvl2[lvl2off] = PTEPFN(PADDR(new)) | PTEKVALID | PTEASM;
-		}
-		pt = (uvlong*)(((lvl2[lvl2off] >> 32)<<PGSHIFT)|KZERO);
-		pt[LVL3OFF(nextio)] = PTEPFN(pa) | PTEKVALID | PTEASM;
-		nextio += BY2PG;
-		pa += BY2PG;
-	}
-	return va;
-}
-
-void
-flushmmu(void)
-{
-	int s;
-
-	s = splhi();
-	up->newtlb = 1;
-	mmuswitch(up);
-	splx(s);
-
-}
-
-void*
-vmap(ulong pa, int size)
-{
-	void *va;
-
-	/*
-	 * Viability hack. Only for PCI framebuffers.
-	 */
-	if(pa == 0)
-		return 0;
-	va = kmapv(((uvlong)0x88<<32LL)|pa, size);
-	if(va == nil)
-		return 0;
-	return (void*)va;
-}
-
-void
-vunmap(void*, int)
-{
-	print("vunmap: virtual mapping not freed\n");
-}
-
-void
-mmudump(void)
-{
-	Page *top, *lvl2;
-
-	iprint("ptbr %lux up %#p\n", (ulong)m->ptbr, up);
-	if(up) {
-		top = up->mmutop;
-		if(top != nil)
-			iprint("top %lux top[N-1] %llux\n", top->va, ((uvlong *)top->va)[PTE2PG-1]);
-		lvl2 = up->mmulvl2;
-		if(lvl2 != nil)
-			iprint("lvl2 %lux\n", lvl2->va);
-	}
-}
-
-ulong
-upaalloc(int, int)
-{
-	return 0;
-}
-
-void
-upafree(ulong, int)
-{
-}
-
-void
-checkmmu(uintptr, uintptr)
-{
-}
-
-void
-countpagerefs(ulong*, int)
-{
-}
-
-/*
- * Return the number of bytes that can be accessed via KADDR(pa).
- * If pa is not a valid argument to KADDR, return 0.
- */
-ulong
-cankaddr(ulong pa)
-{
-	ulong kzero;
-
-	kzero = -KZERO;
-	if(pa >= kzero)
-		return 0;
-	return kzero - pa;
-}
--- a/sys/src/9/alphapc/osf1pal.h
+++ /dev/null
@@ -1,78 +1,0 @@
-/*
- * OSF/1 PALcode instructions, in numerical order.
- * Values are from Digital EBSDK and FreeBSD/Alpha.
- */
-
-/* Privilaged PAL functions */
-#define	PALhalt		0x00	/* required per Alpha architecture */
-#define	PALcflush	0x01
-#define	PALdraina	0x02	/* required per Alpha architecture */
-/*
- * ... 0x03 to 0x08 ?
- */
-#define	PALcserve	0x09
-#define	PALswppal	0x0a
-/*
- * ... 0x0b to 0x0c ?
- */
-#define	PALwripir	0x0d
-/*
- * ... 0x0e to 0x0f ?
- */
-#define	PALrdmces	0x10
-#define	PALwrmces	0x11
-/*
- * ... 0x12 to 0x2a ?
- */
-#define	PALwrfen	0x2b
-				/* 0x2c OSF/1 ? */
-#define	PALwrvptptr	0x2d
-/*
- * ... 0x2e to 0x2f ?
- */
-#define	PALswpctx	0x30
-#define	PALwrval	0x31
-#define	PALrdval	0x32
-#define	PALtbi		0x33
-#define	PALwrent	0x34
-#define	PALswpipl	0x35
-#define	PALrdps		0x36
-#define	PALwrkgp	0x37
-#define	PALwrusp	0x38
-#define	PALwrperfmon	0x39
-#define	PALrdusp	0x3a
-				/* 0x3b OSF/1 ? */
-#define	PALwhami	0x3c
-#define	PALretsys	0x3d
-#define	PALwtint	0x3e
-#define	PALrti		0x3f
-
-/* Unprivileged PAL functions */
-#define	PALbpt		0x80
-#define	PALbugchk	0x81
-#define	PALcallsys	0x83
-#define	PALimb		0x86	/* required per Alpha architecture */
-/*
- * ... 0x89 to 0x91 ?
- */
-#define	PALurti		0x92
-/*
- * ... 0x93 to 0x9d ?
- */
-#define	PALrdunique	0x9e
-#define	PALwrunique	0x9f
-/*
- * ... 0xa0 to 0xa9 ?
- */
-#define	PALgentrap	0xaa
-/*
- * ... 0xab to 0xac ?
- */
-#define	PALdbgstop	0xad
-#define	PALclrfen	0xae
-/*
- * ... 0xaf to 0xbd ?
- */
-#define	PALnphalt	0xbe
-#define	PALcopypal	0xbf
-
--- a/sys/src/9/alphapc/pci.c
+++ /dev/null
@@ -1,412 +1,0 @@
-/*
- * PCI support code.
- * To do:
- *	initialise bridge mappings if the PCI BIOS didn't.
- */
-#include "u.h"
-#include "../port/lib.h"
-#include "mem.h"
-#include "dat.h"
-#include "fns.h"
-#include "io.h"
-#include "../port/error.h"
-
-enum {
-	MaxFNO		= 7,
-	MaxUBN		= 255,
-};
-
-enum
-{					/* command register */
-	IOen		= (1<<0),
-	MEMen		= (1<<1),
-	MASen		= (1<<2),
-	MemWrInv	= (1<<4),
-	PErrEn		= (1<<6),
-	SErrEn		= (1<<8),
-};
-
-static Lock pcicfglock;
-static Lock pcicfginitlock;
-static int pcicfgmode = -1;
-static int pcimaxdno;
-static Pcidev* pciroot;
-static Pcidev* pcilist;
-static Pcidev* pcitail;
-
-static int pcicfgrw32(int, int, int, int);
-
-uchar	*vgabios;
-
-static int
-pciscan(int bno, Pcidev** list)
-{
-	ulong v;
-	Pcidev *p, *head, *tail;
-	int dno, fno, i, hdt, l, maxfno, maxubn, rno, sbn, tbdf, ubn;
-
-	maxubn = bno;
-	head = nil;
-	tail = nil;
-	for(dno = 0; dno <= pcimaxdno; dno++){
-		maxfno = 0;
-		for(fno = 0; fno <= maxfno; fno++){
-			/*
-			 * For this possible device, form the
-			 * bus+device+function triplet needed to address it
-			 * and try to read the vendor and device ID.
-			 * If successful, allocate a device struct and
-			 * start to fill it in with some useful information
-			 * from the device's configuration space.
-			 */
-			tbdf = MKBUS(BusPCI, bno, dno, fno);
-			l = pcicfgrw32(tbdf, PciVID, 0, 1);
-			if(l == 0xFFFFFFFF || l == 0)
-				continue;
-/* optional safety checks:
-			if(l == pcicfgrw32(tbdf, PciPCR, 0, 1))
-				continue;
-			if(l != pcicfgrw32(tbdf, PciVID, 0, 1))
-				continue;
-			if(l == pcicfgrw32(tbdf, PciPCR, 0, 1))
-				continue;
-*/
-			p = malloc(sizeof(*p));
-			p->tbdf = tbdf;
-			p->vid = l;
-			p->did = l>>16;
-
-			if(pcilist != nil)
-				pcitail->list = p;
-			else
-				pcilist = p;
-			pcitail = p;
-
-			p->rid = pcicfgr8(p, PciRID);
-			p->ccrp = pcicfgr8(p, PciCCRp);
-			p->ccru = pcicfgr8(p, PciCCRu);
-			p->ccrb = pcicfgr8(p, PciCCRb);
-			p->pcr = pcicfgr32(p, PciPCR);
-
-			p->intl = pcicfgr8(p, PciINTL);
-
-			/*
-			 * If the device is a multi-function device adjust the
-			 * loop count so all possible functions are checked.
-			 */
-			hdt = pcicfgr8(p, PciHDT);
-			if(hdt & 0x80)
-				maxfno = MaxFNO;
-
-			/*
-			 * If appropriate, read the base address registers
-			 * and work out the sizes.
-			 */
-			switch(p->ccrb){
-
-			case 0x03:		/* display controller */
-				if(vgabios == nil) {
-					v = pcicfgr32(p, PciROM);
-					pcicfgw32(p, PciROM, v|1);	/* enable decode */
-					vgabios = kmapv(((uvlong)0x88<<32LL)|(v&~0xffff), 0x10000);
-					// print("VGA BIOS %lux -> %lux\n", v, vgabios);
-				}
-				/* fall through */
-			case 0x01:		/* mass storage controller */
-			case 0x02:		/* network controller */
-			case 0x04:		/* multimedia device */
-			case 0x07:		/* simple communication controllers */
-			case 0x08:		/* base system peripherals */
-			case 0x09:		/* input devices */
-			case 0x0A:		/* docking stations */
-			case 0x0B:		/* processors */
-			case 0x0C:		/* serial bus controllers */
-				if((hdt & 0x7F) != 0)
-					break;
-				rno = PciBAR0 - 4;
-				for(i = 0; i < nelem(p->mem); i++){
-					rno += 4;
-					p->mem[i].bar = pcicfgr32(p, rno);
-					pcicfgw32(p, rno, -1);
-					v = pcicfgr32(p, rno);
-					pcicfgw32(p, rno, p->mem[i].bar);
-					p->mem[i].size = -(v & ~0xF);
-				}
-				break;
-
-			case 0x00:
-			case 0x05:		/* memory controller */
-			case 0x06:		/* bridge device */
-			default:
-				break;
-			}
-
-			if(head != nil)
-				tail->link = p;
-			else
-				head = p;
-			tail = p;
-		}
-	}
-
-	*list = head;
-	for(p = head; p != nil; p = p->link){
-		/*
-		 * Find PCI-PCI bridges and recursively descend the tree.
-		 */
-		if(p->ccrb != 0x06 || p->ccru != 0x04)
-			continue;
-
-		/*
-		 * If the secondary or subordinate bus number is not initialised
-		 * try to do what the PCI BIOS should have done and fill in the
-		 * numbers as the tree is descended. On the way down the subordinate
-		 * bus number is set to the maximum as it's not known how many
-		 * buses are behind this one; the final value is set on the way
-		 * back up.
-		 */
-		sbn = pcicfgr8(p, PciSBN);
-		ubn = pcicfgr8(p, PciUBN);
-		if(sbn == 0 || ubn == 0){
-			sbn = maxubn+1;
-			/*
-			 * Make sure memory, I/O and master enables are off,
-			 * set the primary, secondary and subordinate bus numbers
-			 * and clear the secondary status before attempting to
-			 * scan the secondary bus.
-			 *
-			 * Initialisation of the bridge should be done here.
-			 */
-			pcicfgw32(p, PciPCR, 0xFFFF0000);
-			l = (MaxUBN<<16)|(sbn<<8)|bno;
-			pcicfgw32(p, PciPBN, l);
-			pcicfgw16(p, PciSPSR, 0xFFFF);
-			maxubn = pciscan(sbn, &p->bridge);
-			l = (maxubn<<16)|(sbn<<8)|bno;
-			pcicfgw32(p, PciPBN, l);
-		}
-		else{
-			maxubn = ubn;
-			pciscan(sbn, &p->bridge);
-		}
-	}
-
-	return maxubn;
-}
-
-static void
-pcicfginit(void)
-{
-	char *p;
-
-	lock(&pcicfginitlock);
-	if(pcicfgmode == -1){
-		pcicfgmode = 0;
-		pcimaxdno = 15;		/* was 20; what is correct value??? */
-		if(p = getconf("*pcimaxdno"))
-			pcimaxdno = strtoul(p, 0, 0);
-		pciscan(0, &pciroot);
-	}
-	unlock(&pcicfginitlock);
-}
-
-static int
-pcicfgrw8(int tbdf, int rno, int data, int read)
-{
-	int x;
-	uchar *p;
-
-	if(pcicfgmode == -1)
-		pcicfginit();
-	x = -1;
-	if(BUSDNO(tbdf) > pcimaxdno)
-		return x;
-
-	p = (uchar*)arch->pcicfg(tbdf, rno);
-	if(read)
-		x = *p;
-	else
-		*p = data;
-
-	return x;
-}
-
-int
-pcicfgr8(Pcidev* pcidev, int rno)
-{
-	return pcicfgrw8(pcidev->tbdf, rno, 0, 1);
-}
-
-void
-pcicfgw8(Pcidev* pcidev, int rno, int data)
-{
-	pcicfgrw8(pcidev->tbdf, rno, data, 0);
-}
-
-static int
-pcicfgrw16(int tbdf, int rno, int data, int read)
-{
-	int x;
-	ushort *p;
-
-	if(pcicfgmode == -1)
-		pcicfginit();
-	x = -1;
-	if(BUSDNO(tbdf) > pcimaxdno)
-		return x;
-
-	p = (ushort*)arch->pcicfg(tbdf, rno);
-	if(read)
-		x = *p;
-	else
-		*p = data;
-
-	return x;
-}
-
-int
-pcicfgr16(Pcidev* pcidev, int rno)
-{
-	return pcicfgrw16(pcidev->tbdf, rno, 0, 1);
-}
-
-void
-pcicfgw16(Pcidev* pcidev, int rno, int data)
-{
-	pcicfgrw16(pcidev->tbdf, rno, data, 0);
-}
-
-static int
-pcicfgrw32(int tbdf, int rno, int data, int read)
-{
-	int x;
-	ulong *p;
-
-	if(pcicfgmode == -1)
-		pcicfginit();
-	x = -1;
-	if(BUSDNO(tbdf) > pcimaxdno)
-		return x;
-
-	p = (ulong*)arch->pcicfg(tbdf, rno);
-	if(read)
-		x = *p;
-	else
-		*p = data;
-
-	return x;
-}
-
-int
-pcicfgr32(Pcidev* pcidev, int rno)
-{
-	return pcicfgrw32(pcidev->tbdf, rno, 0, 1);
-}
-
-void
-pcicfgw32(Pcidev* pcidev, int rno, int data)
-{
-	pcicfgrw32(pcidev->tbdf, rno, data, 0);
-}
-
-Pcidev*
-pcimatch(Pcidev* prev, int vid, int did)
-{
-	if(pcicfgmode == -1)
-		pcicfginit();
-
-	if(prev == nil)
-		prev = pcilist;
-	else
-		prev = prev->list;
-
-	while(prev != nil) {
-		if((vid == 0 || prev->vid == vid)
-		&& (did == 0 || prev->did == did))
-			break;
-		prev = prev->list;
-	}
-	return prev;
-}
-
-Pcidev*
-pcimatchtbdf(int tbdf)
-{
-	Pcidev *pcidev;
-
-	if(pcicfgmode == -1)
-		pcicfginit();
-
-	for(pcidev = pcilist; pcidev != nil; pcidev = pcidev->list) {
-		if(pcidev->tbdf == tbdf)
-			break;
-	}
-	return pcidev;
-}
-
-void
-pcihinv(Pcidev* p)
-{
-	int i;
-	Pcidev *t;
-
-	if(pcicfgmode == -1)
-		pcicfginit();
-	if(p == nil) {
-		p = pciroot;
-		print("bus dev type vid  did intl memory\n");
-	}
-	for(t = p; t != nil; t = t->link) {
-		print("%d  %2d/%d %.2ux %.2ux %.2ux %.4ux %.4ux %2d  ",
-			BUSBNO(t->tbdf), BUSDNO(t->tbdf), BUSFNO(t->tbdf),
-			t->ccrb, t->ccru, t->ccrp, t->vid, t->did, t->intl);
-
-		for(i = 0; i < nelem(p->mem); i++) {
-			if(t->mem[i].size == 0)
-				continue;
-			print("%d:%.8lux %d ", i,
-				t->mem[i].bar, t->mem[i].size);
-		}
-		print("\n");
-	}
-	while(p != nil) {
-		if(p->bridge != nil)
-			pcihinv(p->bridge);
-		p = p->link;
-	}
-}
-
-void
-pcireset(void)
-{
-	Pcidev *p;
-	int pcr;
-
-	if(pcicfgmode == -1)
-		pcicfginit();
-
-	for(p = pcilist; p != nil; p = p->list){
-		pcr = pcicfgr16(p, PciPSR);
-		pcicfgw16(p, PciPSR, pcr & ~0x04);
-	}
-}
-
-void
-pcisetbme(Pcidev* p)
-{
-	int pcr;
-
-	pcr = pcicfgr16(p, PciPCR);
-	pcr |= MASen;
-	pcicfgw16(p, PciPCR, pcr);
-}
-
-void
-pciclrbme(Pcidev* p)
-{
-	int pcr;
-
-	pcr = pcicfgr16(p, PciPCR);
-	pcr &= ~MASen;
-	pcicfgw16(p, PciPCR, pcr);
-}
--- a/sys/src/9/alphapc/screen.h
+++ /dev/null
@@ -1,172 +1,0 @@
-typedef struct Cursor Cursor;
-typedef struct Cursorinfo Cursorinfo;
-struct Cursorinfo {
-	Cursor;
-	Lock;
-};
-
-/* devmouse.c */
-extern void mousetrack(int, int, int, int);
-extern void absmousetrack(int, int, int, int);
-extern Point mousexy(void);
-
-extern void mouseaccelerate(int);
-extern int m3mouseputc(Queue*, int);
-extern int m5mouseputc(Queue*, int);
-extern int mouseputc(Queue*, int);
-
-extern Cursorinfo cursor;
-extern Cursor arrow;
-
-/*
- * Generic VGA registers.
- */
-enum {
-	MiscW		= 0x03C2,	/* Miscellaneous Output (W) */
-	MiscR		= 0x03CC,	/* Miscellaneous Output (R) */
-	Status0		= 0x03C2,	/* Input status 0 (R) */
-	Status1		= 0x03DA,	/* Input Status 1 (R) */
-	FeatureR	= 0x03CA,	/* Feature Control (R) */
-	FeatureW	= 0x03DA,	/* Feature Control (W) */
-
-	Seqx		= 0x03C4,	/* Sequencer Index, Data at Seqx+1 */
-	Crtx		= 0x03D4,	/* CRT Controller Index, Data at Crtx+1 */
-	Grx		= 0x03CE,	/* Graphics Controller Index, Data at Grx+1 */
-	Attrx		= 0x03C0,	/* Attribute Controller Index and Data */
-
-	PaddrW		= 0x03C8,	/* Palette Address Register, write */
-	Pdata		= 0x03C9,	/* Palette Data Register */
-	Pixmask		= 0x03C6,	/* Pixel Mask Register */
-	PaddrR		= 0x03C7,	/* Palette Address Register, read */
-	Pstatus		= 0x03C7,	/* DAC Status (RO) */
-
-	Pcolours	= 256,		/* Palette */
-	Pred		= 0,
-	Pgreen		= 1,
-	Pblue		= 2,
-
-	Pblack		= 0x00,
-	Pwhite		= 0xFF,
-};
-
-#define VGAMEM()	PADDR(arch->pcimem(0xA0000, 1<<16))
-
-#define vgai(port)		inb(port)
-#define vgao(port, data)	outb(port, data)
-
-extern int vgaxi(long, uchar);
-extern int vgaxo(long, uchar, uchar);
-
-/*
- */
-typedef struct VGAdev VGAdev;
-typedef struct VGAcur VGAcur;
-typedef struct VGAscr VGAscr;
-
-struct VGAdev {
-	char*	name;
-
-	void	(*enable)(VGAscr*);
-	void	(*disable)(VGAscr*);
-	void	(*page)(VGAscr*, int);
-	void	(*linear)(VGAscr*, int, int);
-	void	(*drawinit)(VGAscr*);
-	int	(*fill)(VGAscr*, Rectangle, ulong);
-	void (*flush)(VGAscr*, Rectangle);
-
-};
-
-struct VGAcur {
-	char*	name;
-
-	void	(*enable)(VGAscr*);
-	void	(*disable)(VGAscr*);
-	void	(*load)(VGAscr*, Cursor*);
-	int	(*move)(VGAscr*, Point);
-
-	int	doespanning;
-};
-
-/*
- */
-struct VGAscr {
-	Lock	devlock;
-	VGAdev*	dev;
-	Pcidev*	pci;
-
-	VGAcur*	cur;
-	ulong	storage;
-	Cursor;
-
-	int	useflush;
-
-	ulong	paddr;		/* frame buffer */
-	void*	vaddr;
-	int	apsize;
-
-	ulong	io;				/* device specific registers */
-	ulong	*mmio;
-	
-	ulong	colormap[Pcolours][3];
-	int	palettedepth;
-
-	Memimage* gscreen;
-	Memdata* gscreendata;
-	Memsubfont* memdefont;
-
-	int	(*fill)(VGAscr*, Rectangle, ulong);
-	int	(*scroll)(VGAscr*, Rectangle, Rectangle);
-	void	(*blank)(VGAscr*, int);
-	ulong	id;	/* internal identifier for driver use */
-};
-
-extern VGAscr vgascreen[];
-
-enum {
-	Backgnd		= 0,	/* black */
-};
-
-/* mouse.c */
-extern void mousectl(Cmdbuf*);
-
-/* screen.c */
-extern int	hwaccel;	/* use hw acceleration; default on */
-extern int	hwblank;	/* use hw blanking; default on */
-extern void	addvgaseg(char*, ulong, ulong);
-extern uchar*	attachscreen(Rectangle*, ulong*, int*, int*, int*);
-extern void	flushmemscreen(Rectangle);
-extern int	cursoron(int);
-extern void	cursoroff(int);
-extern void	setcursor(Cursor*);
-extern int	screensize(int, int, int, ulong);
-extern int	screenaperture(int, int);
-extern Rectangle physgscreenr;	/* actual monitor size */
-extern void	blankscreen(int);
-
-extern VGAcur swcursor;
-extern void swcursorinit(void);
-extern void swcursorhide(void);
-extern void swcursoravoid(Rectangle);
-extern void swcursorunhide(void);
-
-/* devdraw.c */
-extern void	deletescreenimage(void);
-extern int	drawhasclients(void);
-extern ulong	blanktime;
-extern QLock	drawlock;
-
-/* vga.c */
-extern void	vgascreenwin(VGAscr*);
-extern void	vgaimageinit(ulong);
-extern void	vgalinearpciid(VGAscr*, int, int);
-extern void	vgalinearpci(VGAscr*);
-extern void	vgalinearaddr(VGAscr*, ulong, int);
-
-extern void	drawblankscreen(int);
-extern void	vgablank(VGAscr*, int);
-
-extern Lock	vgascreenlock;
-
-#define ishwimage(i)	(vgascreen[0].gscreendata && (i)->data->bdata == vgascreen[0].gscreendata->bdata)
-
-
--- a/sys/src/9/alphapc/sd53c8xx.c
+++ /dev/null
@@ -1,2261 +1,0 @@
-/*
- * NCR/Symbios/LSI Logic 53c8xx driver for Plan 9
- * Nigel Roles ([email protected])
- *
- * 27/5/02	Fixed problems with transfers >= 256 * 512
- *
- * 13/3/01	Fixed microcode to support targets > 7
- *
- * 01/12/00	Removed previous comments. Fixed a small problem in
- *			mismatch recovery for targets with synchronous offsets of >=16
- *			connected to >=875s. Thanks, Jean.
- *
- * Known problems
- *
- * Read/write mismatch recovery may fail on 53c1010s. Really need to get a manual.
- */
-
-#define MAXTARGET	16		/* can be 8 or 16 */
-
-#include "u.h"
-#include "../port/lib.h"
-#include "mem.h"
-#include "dat.h"
-#include "fns.h"
-#include "io.h"
-
-#include "../port/sd.h"
-extern SDifc sd53c8xxifc;
-
-/**********************************/
-/* Portable configuration macros  */
-/**********************************/
-
-//#define BOOTDEBUG
-//#define ASYNC_ONLY
-//#define	INTERNAL_SCLK
-//#define ALWAYS_DO_WDTR
-#define WMR_DEBUG
-
-/**********************************/
-/* CPU specific macros            */
-/**********************************/
-
-#define PRINTPREFIX "sd53c8xx: "
-
-#ifdef BOOTDEBUG
-
-#define KPRINT oprint
-#define IPRINT intrprint
-#define DEBUG(n) 1
-#define IFLUSH() iflush()
-
-#else
-
-static int idebug = 1;
-#define KPRINT	if(0) iprint
-#define IPRINT	if(idebug) iprint
-#define DEBUG(n)	(0)
-#define IFLUSH()
-
-#endif /* BOOTDEBUG */
-
-/*******************************/
-/* General                     */
-/*******************************/
-
-#ifndef DMASEG
-#define DMASEG(x) PCIWADDR(x)
-#define legetl(x) (*(ulong*)(x))
-#define lesetl(x,v) (*(ulong*)(x) = (v))
-#define swabl(a,b,c)
-#else
-#endif /*DMASEG */
-#define DMASEG_TO_KADDR(x) KADDR((x)-PCIWINDOW)
-#define KPTR(x) ((x) == 0 ? 0 : DMASEG_TO_KADDR(x))
-
-#define MEGA 1000000L
-#ifdef INTERNAL_SCLK
-#define	SCLK (33 * MEGA)
-#else
-#define SCLK (40 * MEGA)
-#endif /* INTERNAL_SCLK */
-#define ULTRA_NOCLOCKDOUBLE_SCLK (80 * MEGA)
-
-#define MAXSYNCSCSIRATE (5 * MEGA)
-#define MAXFASTSYNCSCSIRATE (10 * MEGA)
-#define MAXULTRASYNCSCSIRATE (20 * MEGA)
-#define MAXULTRA2SYNCSCSIRATE (40 * MEGA)
-#define MAXASYNCCORERATE (25 * MEGA)
-#define MAXSYNCCORERATE (25 * MEGA)
-#define MAXFASTSYNCCORERATE (50 * MEGA)
-#define MAXULTRASYNCCORERATE (80 * MEGA)
-#define MAXULTRA2SYNCCORERATE (160 * MEGA)
-
-
-#define X_MSG	1
-#define X_MSG_SDTR 1
-#define X_MSG_WDTR 3
-
-struct na_patch {
-	unsigned lwoff;
-	unsigned char type;
-};
-
-typedef struct Ncr {
-	uchar scntl0;	/* 00 */
-	uchar scntl1;
-	uchar scntl2;
-	uchar scntl3;
-
-	uchar scid;	/* 04 */
-	uchar sxfer;
-	uchar sdid;
-	uchar gpreg;
-
-	uchar sfbr;	/* 08 */
-	uchar socl;
-	uchar ssid;
-	uchar sbcl;
-
-	uchar dstat;	/* 0c */
-	uchar sstat0;
-	uchar sstat1;
-	uchar sstat2;
-
-	uchar dsa[4];	/* 10 */
-
-	uchar istat;	/* 14 */
-	uchar istatpad[3];
-
-	uchar ctest0;	/* 18 */
-	uchar ctest1;
-	uchar ctest2;
-	uchar ctest3;
-
-	uchar temp[4];	/* 1c */
-
-	uchar dfifo;	/* 20 */
-	uchar ctest4;
-	uchar ctest5;
-	uchar ctest6;
-
-	uchar dbc[3];	/* 24 */
-	uchar dcmd;	/* 27 */
-
-	uchar dnad[4];	/* 28 */
-	uchar dsp[4];	/* 2c */
-	uchar dsps[4];	/* 30 */
-
-	uchar scratcha[4];	/* 34 */
-
-	uchar dmode;	/* 38 */
-	uchar dien;
-	uchar dwt;
-	uchar dcntl;
-
-	uchar adder[4];	/* 3c */
-
-	uchar sien0;	/* 40 */
-	uchar sien1;
-	uchar sist0;
-	uchar sist1;
-
-	uchar slpar;	/* 44 */
-	uchar slparpad0;
-	uchar macntl;
-	uchar gpcntl;
-
-	uchar stime0;	/* 48 */
-	uchar stime1;
-	uchar respid;
-	uchar respidpad0;
-
-	uchar stest0;	/* 4c */
-	uchar stest1;
-	uchar stest2;
-	uchar stest3;
-
-	uchar sidl;	/* 50 */
-	uchar sidlpad[3];
-
-	uchar sodl;	/* 54 */
-	uchar sodlpad[3];
-
-	uchar sbdl;	/* 58 */
-	uchar sbdlpad[3];
-
-	uchar scratchb[4];	/* 5c */
-} Ncr;
-
-typedef struct Movedata {
-	uchar dbc[4];
-	uchar pa[4];
-} Movedata;
-
-typedef enum NegoState {
-	NeitherDone, WideInit, WideResponse, WideDone,
-	SyncInit, SyncResponse, BothDone
-} NegoState;
-
-typedef enum State {
-	Allocated, Queued, Active, Done
-} State;
-
-typedef struct Dsa {
-	uchar stateb;
-	uchar result;
-	uchar dmablks;
-	uchar flag;	/* setbyte(state,3,...) */
-
-	union {
-		ulong dmancr;		/* For block transfer: NCR order (little-endian) */
-		uchar dmaaddr[4];
-	};
-
-	uchar target;			/* Target */
-	uchar pad0[3];
-
-	uchar lun;			/* Logical Unit Number */
-	uchar pad1[3];
-
-	uchar scntl3;
-	uchar sxfer;
-	uchar pad2[2];
-
-	uchar next[4];			/* chaining for SCRIPT (NCR byte order) */
-	struct Dsa *freechain;		/* chaining for freelist */
-	Rendez;
-	uchar scsi_id_buf[4];
-	Movedata msg_out_buf;
-	Movedata cmd_buf;
-	Movedata data_buf;
-	Movedata status_buf;
-	uchar msg_out[10];		/* enough to include SDTR */
-	uchar status;
-	int p9status;
-	uchar parityerror;
-} Dsa;
-
-typedef enum Feature {
-	BigFifo = 1,			/* 536 byte fifo */
-	BurstOpCodeFetch = 2,		/* burst fetch opcodes */
-	Prefetch = 4,			/* prefetch 8 longwords */
-	LocalRAM = 8,			/* 4K longwords of local RAM */
-	Differential = 16,		/* Differential support */
-	Wide = 32,			/* Wide capable */
-	Ultra = 64,			/* Ultra capable */
-	ClockDouble = 128,		/* Has clock doubler */
-	ClockQuad = 256,		/* Has clock quadrupler (same as Ultra2) */
-	Ultra2 = 256,
-} Feature;
-
-typedef enum Burst {
-	Burst2 = 0,
-	Burst4 = 1,
-	Burst8 = 2,
-	Burst16 = 3,
-	Burst32 = 4,
-	Burst64 = 5,
-	Burst128 = 6
-} Burst;
-
-typedef struct Variant {
-	ushort did;
-	uchar maxrid;			/* maximum allowed revision ID */
-	char *name;
-	Burst burst;			/* codings for max burst */
-	uchar maxsyncoff;		/* max synchronous offset */
-	uchar registers;		/* number of 32 bit registers */
-	unsigned feature;
-} Variant;
-
-static unsigned char cf2[] = { 6, 2, 3, 4, 6, 8, 12, 16 };
-#define NULTRA2SCF (sizeof(cf2)/sizeof(cf2[0]))
-#define NULTRASCF (NULTRA2SCF - 2)
-#define NSCF (NULTRASCF - 1)
-
-typedef struct Controller {
-	Lock;
-	struct {
-		uchar scntl3;
-		uchar stest2;
-	} bios;
-	uchar synctab[NULTRA2SCF - 1][8];/* table of legal tpfs */
-	NegoState s[MAXTARGET];
-	uchar scntl3[MAXTARGET];
-	uchar sxfer[MAXTARGET];
-	uchar cap[MAXTARGET];		/* capabilities byte from Identify */
-	ushort capvalid;		/* bit per target for validity of cap[] */
-	ushort wide;			/* bit per target set if wide negotiated */
-	ulong sclk;			/* clock speed of controller */
-	uchar clockmult;		/* set by synctabinit */
-	uchar ccf;			/* CCF bits */
-	uchar tpf;			/* best tpf value for this controller */
-	uchar feature;			/* requested features */
-	int running;			/* is the script processor running? */
-	int ssm;			/* single step mode */
-	Ncr *n;				/* pointer to registers */
-	Variant *v;			/* pointer to variant type */
-	ulong *script;			/* where the real script is */
-	ulong scriptpa;			/* where the real script is */
-	Pcidev* pcidev;
-	SDev*	sdev;
-
-	struct {
-		Lock;
-		uchar head[4];		/* head of free list (NCR byte order) */
-		Dsa	*freechain;
-	} dsalist;
-
-	QLock q[MAXTARGET];		/* queues for each target */
-} Controller;
-
-#define SYNCOFFMASK(c)		(((c)->v->maxsyncoff * 2) - 1)
-#define SSIDMASK(c)		(((c)->v->feature & Wide) ? 15 : 7)
-
-/* ISTAT */
-enum { Abrt = 0x80, Srst = 0x40, Sigp = 0x20, Sem = 0x10, Con = 0x08, Intf = 0x04, Sip = 0x02, Dip = 0x01 };
-
-/* DSTAT */
-enum { Dfe = 0x80, Mdpe = 0x40, Bf = 0x20, Abrted = 0x10, Ssi = 0x08, Sir = 0x04, Iid = 0x01 };
-
-/* SSTAT */
-enum { DataOut, DataIn, Cmd, Status, ReservedOut, ReservedIn, MessageOut, MessageIn };
-
-static void setmovedata(Movedata*, ulong, ulong);
-static void advancedata(Movedata*, long);
-static int bios_set_differential(Controller *c);
-
-static char *phase[] = {
-	"data out", "data in", "command", "status",
-	"reserved out", "reserved in", "message out", "message in"
-};
-
-#ifdef BOOTDEBUG
-#define DEBUGSIZE 10240
-char debugbuf[DEBUGSIZE];
-char *debuglast;
-
-static void
-intrprint(char *format, ...)
-{
-	if (debuglast == 0)
-		debuglast = debugbuf;
-	debuglast = vseprint(debuglast, debugbuf + (DEBUGSIZE - 1), format, (&format + 1));
-}
-
-static void
-iflush()
-{
-	int s;
-	char *endp;
-	s = splhi();
-	if (debuglast == 0)
-		debuglast = debugbuf;
-	if (debuglast == debugbuf) {
-		splx(s);
-		return;
-	}
-	endp = debuglast;
-	splx(s);
-	screenputs(debugbuf, endp - debugbuf);
-	s = splhi();
-	memmove(debugbuf, endp, debuglast - endp);
-	debuglast -= endp - debugbuf;
-	splx(s);
-}
-
-static void
-oprint(char *format, ...)
-{
-	int s;
-
-	iflush();
-	s = splhi();
-	if (debuglast == 0)
-		debuglast = debugbuf;
-	debuglast = vseprint(debuglast, debugbuf + (DEBUGSIZE - 1), format, (&format + 1));
-	splx(s);
-	iflush();	
-}
-#endif
-
-#include "sd53c8xx.i"
-
-/*
- * We used to use a linked list of Dsas with nil as the terminator,
- * but occasionally the 896 card seems not to notice that the 0
- * is really a 0, and then it tries to reference the Dsa at address 0.
- * To address this, we use a sentinel dsa that links back to itself
- * and has state A_STATE_END.  If the card takes an iteration or
- * two to notice that the state says A_STATE_END, that's no big 
- * deal.  Clearly this isn't the right approach, but I'm just
- * stumped.  Even with this, we occasionally get prints about
- * "WSR set", usually with about the same frequency that the
- * card used to walk past 0. 
- */
-static Dsa *dsaend;
-
-static Dsa*
-dsaallocnew(Controller *c)
-{
-	Dsa *d;
-	
-	/* c->dsalist must be ilocked */
-	d = xalloc(sizeof *d);
-	lesetl(d->next, legetl(c->dsalist.head));
-	lesetl(&d->stateb, A_STATE_FREE);
-	coherence();
-	lesetl(c->dsalist.head, DMASEG(d));
-	coherence();
-	return d;
-}
-
-static Dsa *
-dsaalloc(Controller *c, int target, int lun)
-{
-	Dsa *d;
-
-	ilock(&c->dsalist);
-	if ((d = c->dsalist.freechain) != 0) {
-		if (DEBUG(1))
-			IPRINT(PRINTPREFIX "%d/%d: reused dsa %lux\n", target, lun, (ulong)d);
-	} else {	
-		d = dsaallocnew(c);
-		if (DEBUG(1))
-			IPRINT(PRINTPREFIX "%d/%d: allocated dsa %lux\n", target, lun, (ulong)d);
-	}
-	c->dsalist.freechain = d->freechain;
-	lesetl(&d->stateb, A_STATE_ALLOCATED);
-	iunlock(&c->dsalist);
-	d->target = target;
-	d->lun = lun;
-	return d;
-}
-
-static void
-dsafree(Controller *c, Dsa *d)
-{
-	ilock(&c->dsalist);
-	d->freechain = c->dsalist.freechain;
-	c->dsalist.freechain = d;
-	lesetl(&d->stateb, A_STATE_FREE);
-	iunlock(&c->dsalist);
-}
-
-static void
-dsadump(Controller *c)
-{
-	Dsa *d;
-	u32int *a;
-	
-	iprint("dsa controller list: c=%p head=%.8lux\n", c, legetl(c->dsalist.head));
-	for(d=KPTR(legetl(c->dsalist.head)); d != dsaend; d=KPTR(legetl(d->next))){
-		if(d == (void*)-1){
-			iprint("\t dsa %p\n", d);
-			break;
-		}
-		a = (u32int*)d;
-		iprint("\tdsa %p %.8ux %.8ux %.8ux %.8ux %.8ux %.8ux\n", a, a[0], a[1], a[2], a[3], a[4], a[5]);
-	}
-
-/*
-	a = KPTR(c->scriptpa+E_dsa_addr);
-	iprint("dsa_addr: %.8ux %.8ux %.8ux %.8ux %.8ux\n",
-		a[0], a[1], a[2], a[3], a[4]);
-	a = KPTR(c->scriptpa+E_issue_addr);
-	iprint("issue_addr: %.8ux %.8ux %.8ux %.8ux %.8ux\n",
-		a[0], a[1], a[2], a[3], a[4]);
-
-	a = KPTR(c->scriptpa+E_issue_test_begin);
-	e = KPTR(c->scriptpa+E_issue_test_end);
-	iprint("issue_test code (at offset %.8ux):\n", E_issue_test_begin);
-	
-	i = 0;
-	for(; a<e; a++){
-		iprint(" %.8ux", *a);
-		if(++i%8 == 0)
-			iprint("\n");
-	}
-	if(i%8)
-		iprint("\n");
-*/
-}
-
-static Dsa *
-dsafind(Controller *c, uchar target, uchar lun, uchar state)
-{
-	Dsa *d;
-	for (d = KPTR(legetl(c->dsalist.head)); d != dsaend; d = KPTR(legetl(d->next))) {
-		if (d->target != 0xff && d->target != target)
-			continue;
-		if (lun != 0xff && d->lun != lun)
-			continue;
-		if (state != 0xff && d->stateb != state)
-			continue;
-		break;
-	}
-	return d;
-}
-
-static void
-dumpncrregs(Controller *c, int intr)
-{
-	int i;
-	Ncr *n = c->n;
-	int depth = c->v->registers / 4;
-
-	if (intr) {
-		IPRINT("sa = %.8lux\n", c->scriptpa);
-	}
-	else {
-		KPRINT("sa = %.8lux\n", c->scriptpa);
-	}
-	for (i = 0; i < depth; i++) {
-		int j;
-		for (j = 0; j < 4; j++) {
-			int k = j * depth + i;
-			uchar *p;
-
-			/* display little-endian to make 32-bit values readable */
-			p = (uchar*)n+k*4;
-			if (intr) {
-				IPRINT(" %.2x%.2x%.2x%.2x %.2x %.2x", p[3], p[2], p[1], p[0], k * 4, (k * 4) + 0x80);
-			}
-			else {
-				KPRINT(" %.2x%.2x%.2x%.2x %.2x %.2x", p[3], p[2], p[1], p[0], k * 4, (k * 4) + 0x80);
-			}
-			USED(p);
-		}
-		if (intr) {
-			IPRINT("\n");
-		}
-		else {
-			KPRINT("\n");
-		}
-	}
-}	
-
-static int
-chooserate(Controller *c, int tpf, int *scfp, int *xferpp)
-{
-	/* find lowest entry >= tpf */
-	int besttpf = 1000;
-	int bestscfi = 0;
-	int bestxferp = 0;
-	int scf, xferp;
-	int maxscf;
-
-	if (c->v->feature & Ultra2)
-		maxscf = NULTRA2SCF;
-	else if (c->v->feature & Ultra)
-		maxscf = NULTRASCF;
-	else
-		maxscf = NSCF;
-
-	/*
-	 * search large clock factors first since this should
-	 * result in more reliable transfers
-	 */
-	for (scf = maxscf; scf >= 1; scf--) {
-		for (xferp = 0; xferp < 8; xferp++) {
-			unsigned char v = c->synctab[scf - 1][xferp];
-			if (v == 0)
-				continue;
-			if (v >= tpf && v < besttpf) {
-				besttpf = v;
-				bestscfi = scf;
-				bestxferp = xferp;
-			}
-		}
-	}
-	if (besttpf == 1000)
-		return 0;
-	if (scfp)
-		*scfp = bestscfi;
-	if (xferpp)
-		*xferpp = bestxferp;
-	return besttpf;
-}
-
-static void
-synctabinit(Controller *c)
-{
-	int scf;
-	unsigned long scsilimit;
-	int xferp;
-	unsigned long cr, sr;
-	int tpf;
-	int fast;
-	int maxscf;
-
-	if (c->v->feature & Ultra2)
-		maxscf = NULTRA2SCF;
-	else if (c->v->feature & Ultra)
-		maxscf = NULTRASCF;
-	else
-		maxscf = NSCF;
-
-	/*
-	 * for chips with no clock doubler, but Ultra capable (e.g. 860, or interestingly the
-	 * first spin of the 875), assume 80MHz
-	 * otherwise use the internal (33 Mhz) or external (40MHz) default
-	 */
-
-	if ((c->v->feature & Ultra) != 0 && (c->v->feature & (ClockDouble | ClockQuad)) == 0)
-		c->sclk = ULTRA_NOCLOCKDOUBLE_SCLK;
-	else
-		c->sclk = SCLK;
-
-	/*
-	 * otherwise, if the chip is Ultra capable, but has a slow(ish) clock,
-	 * invoke the doubler
-	 */
-
-	if (SCLK <= 40000000) {
-		if (c->v->feature & ClockDouble) {
-			c->sclk *= 2;
-			c->clockmult = 1;
-		}
-		else if (c->v->feature & ClockQuad) {
-			c->sclk *= 4;
-			c->clockmult = 1;
-		}
-		else
-			c->clockmult = 0;
-	}
-	else
-		c->clockmult = 0;
-
-	/* derive CCF from sclk */
-	/* woebetide anyone with SCLK < 16.7 or > 80MHz */
-	if (c->sclk <= 25 * MEGA)
-		c->ccf = 1;
-	else if (c->sclk <= 3750000)
-		c->ccf = 2;
-	else if (c->sclk <= 50 * MEGA)
-		c->ccf = 3;
-	else if (c->sclk <= 75 * MEGA)
-		c->ccf = 4;
-	else if ((c->v->feature & ClockDouble) && c->sclk <= 80 * MEGA)
-		c->ccf = 5;
-	else if ((c->v->feature & ClockQuad) && c->sclk <= 120 * MEGA)
-		c->ccf = 6;
-	else if ((c->v->feature & ClockQuad) && c->sclk <= 160 * MEGA)
-		c->ccf = 7;
-
-	for (scf = 1; scf < maxscf; scf++) {
-		/* check for legal core rate */
-		/* round up so we run slower for safety */
-	   	cr = (c->sclk * 2 + cf2[scf] - 1) / cf2[scf];
-		if (cr <= MAXSYNCCORERATE) {
-			scsilimit = MAXSYNCSCSIRATE;
-			fast = 0;
-		}
-		else if (cr <= MAXFASTSYNCCORERATE) {
-			scsilimit = MAXFASTSYNCSCSIRATE;
-			fast = 1;
-		}
-		else if ((c->v->feature & Ultra) && cr <= MAXULTRASYNCCORERATE) {
-			scsilimit = MAXULTRASYNCSCSIRATE;
-			fast = 2;
-		}
-		else if ((c->v->feature & Ultra2) && cr <= MAXULTRA2SYNCCORERATE) {
-			scsilimit = MAXULTRA2SYNCSCSIRATE;
-			fast = 3;
-		}
-		else
-			continue;
-		for (xferp = 11; xferp >= 4; xferp--) {
-			int ok;
-			int tp;
-			/* calculate scsi rate - round up again */
-			/* start from sclk for accuracy */
-			int totaldivide = xferp * cf2[scf];
-			sr = (c->sclk * 2 + totaldivide - 1) / totaldivide;
-			if (sr > scsilimit)
-				break;
-			/*
-			 * now work out transfer period
-			 * round down now so that period is pessimistic
-			 */
-			tp = (MEGA * 1000) / sr;
-			/*
-			 * bounds check it
-			 */
-			if (tp < 25 || tp > 255 * 4)
-				continue;
-			/*
-			 * spot stupid special case for Ultra or Ultra2
-			 * while working out factor
-			 */
-			if (tp == 25)
-				tpf = 10;
-			else if (tp == 50)
-				tpf = 12;
-			else if (tp < 52)
-				continue;
-			else
-				tpf = tp / 4;
-			/*
-			 * now check tpf looks sensible
-			 * given core rate
-			 */
-			switch (fast) {
-			case 0:
-				/* scf must be ccf for SCSI 1 */
-				ok = tpf >= 50 && scf == c->ccf;
-				break;
-			case 1:
-				ok = tpf >= 25 && tpf < 50;
-				break;
-			case 2:
-				/*
-				 * must use xferp of 4, or 5 at a pinch
-				 * for an Ultra transfer
-				 */
-				ok = xferp <= 5 && tpf >= 12 && tpf < 25;
-				break;
-			case 3:
-				ok = xferp == 4 && (tpf == 10 || tpf == 11);
-				break;
-			default:
-				ok = 0;
-			}
-			if (!ok)
-				continue;
-			c->synctab[scf - 1][xferp - 4] = tpf;
-		}
-	}
-
-#ifndef NO_ULTRA2
-	if (c->v->feature & Ultra2)
-		tpf = 10;
-	else
-#endif
-	if (c->v->feature & Ultra)
-		tpf = 12;
-	else
-		tpf = 25;
-	for (; tpf < 256; tpf++) {
-		if (chooserate(c, tpf, &scf, &xferp) == tpf) {
-			unsigned tp = tpf == 10 ? 25 : (tpf == 12 ? 50 : tpf * 4);
-			unsigned long khz = (MEGA + tp - 1) / (tp);
-			KPRINT(PRINTPREFIX "tpf=%d scf=%d.%.1d xferp=%d mhz=%ld.%.3ld\n",
-			    tpf, cf2[scf] / 2, (cf2[scf] & 1) ? 5 : 0,
-			    xferp + 4, khz / 1000, khz % 1000);
-			USED(khz);
-			if (c->tpf == 0)
-				c->tpf = tpf;	/* note lowest value for controller */
-		}
-	}
-}
-
-static void
-synctodsa(Dsa *dsa, Controller *c)
-{
-/*
-	KPRINT("synctodsa(dsa=%lux, target=%d, scntl3=%.2lx sxfer=%.2x)\n",
-	    dsa, dsa->target, c->scntl3[dsa->target], c->sxfer[dsa->target]);
-*/
-	dsa->scntl3 = c->scntl3[dsa->target];
-	dsa->sxfer = c->sxfer[dsa->target];
-}
-
-static void
-setsync(Dsa *dsa, Controller *c, int target, uchar ultra, uchar scf, uchar xferp, uchar reqack)
-{
-	c->scntl3[target] =
-	    (c->scntl3[target] & 0x08) | (((scf << 4) | c->ccf | (ultra << 7)) & ~0x08);
-	c->sxfer[target] = (xferp << 5) | reqack;
-	c->s[target] = BothDone;
-	if (dsa) {
-		synctodsa(dsa, c);
-		c->n->scntl3 = c->scntl3[target];
-		c->n->sxfer = c->sxfer[target];
-	}
-}
-
-static void
-setasync(Dsa *dsa, Controller *c, int target)
-{
-	setsync(dsa, c, target, 0, c->ccf, 0, 0);
-}
-
-static void
-setwide(Dsa *dsa, Controller *c, int target, uchar wide)
-{
-	c->scntl3[target] = wide ? (1 << 3) : 0;
-	setasync(dsa, c, target);
-	c->s[target] = WideDone;
-}
-
-static int
-buildsdtrmsg(uchar *buf, uchar tpf, uchar offset)
-{
-	*buf++ = X_MSG;
-	*buf++ = 3;
-	*buf++ = X_MSG_SDTR;
-	*buf++ = tpf;
-	*buf = offset;
-	return 5;
-}
-
-static int
-buildwdtrmsg(uchar *buf, uchar expo)
-{
-	*buf++ = X_MSG;
-	*buf++ = 2;
-	*buf++ = X_MSG_WDTR;
-	*buf = expo;
-	return 4;
-}
-
-static void
-start(Controller *c, long entry)
-{
-	ulong p;
-
-	if (c->running)
-		panic(PRINTPREFIX "start called while running");
-	c->running = 1;
-	p = c->scriptpa + entry;
-	lesetl(c->n->dsp, p);
-	coherence();
-	if (c->ssm)
-		c->n->dcntl |= 0x4;		/* start DMA in SSI mode */
-}
-
-static void
-ncrcontinue(Controller *c)
-{
-	if (c->running)
-		panic(PRINTPREFIX "ncrcontinue called while running");
-	/* set the start DMA bit to continue execution */
-	c->running = 1;
-	coherence();
-	c->n->dcntl |= 0x4;
-}
-
-static void
-softreset(Controller *c)
-{
-	Ncr *n = c->n;
-
-	n->istat = Srst;		/* software reset */
-	n->istat = 0;
-	/* general initialisation */
-	n->scid = (1 << 6) | 7;		/* respond to reselect, ID 7 */
-	n->respid = 1 << 7;		/* response ID = 7 */
-
-#ifdef INTERNAL_SCLK
-	n->stest1 = 0x80;		/* disable external scsi clock */
-#else
-	n->stest1 = 0x00;
-#endif
-
-	n->stime0 = 0xdd;		/* about 0.5 second timeout on each device */
-	n->scntl0 |= 0x8;		/* Enable parity checking */
-
-	/* continued setup */
-	n->sien0 = 0x8f;
-	n->sien1 = 0x04;
-	n->dien = 0x7d;
-	n->stest3 = 0x80;		/* TolerANT enable */
-	c->running = 0;
-
-	if (c->v->feature & BigFifo)
-		n->ctest5 = (1 << 5);
-	n->dmode = c->v->burst << 6;	/* set burst length bits */
-	if (c->v->burst & 4)
-		n->ctest5 |= (1 << 2);	/* including overflow into ctest5 bit 2 */
-	if (c->v->feature & Prefetch)
-		n->dcntl |= (1 << 5);	/* prefetch enable */
-	else if (c->v->feature & BurstOpCodeFetch)
-		n->dmode |= (1 << 1);	/* burst opcode fetch */
-	if (c->v->feature & Differential) {
-		/* chip capable */
-		if ((c->feature & Differential) || bios_set_differential(c)) {
-			/* user enabled, or some evidence bios set differential */
-			if (n->sstat2 & (1 << 2))
-				print(PRINTPREFIX "can't go differential; wrong cable\n");
-			else {
-				n->stest2 = (1 << 5);
-				print(PRINTPREFIX "differential mode set\n");
-			}
-		}
-	}
-	if (c->clockmult) {
-		n->stest1 |= (1 << 3);	/* power up doubler */
-		delay(2);
-		n->stest3 |= (1 << 5);	/* stop clock */
-		n->stest1 |= (1 << 2);	/* enable doubler */
-		n->stest3 &= ~(1 << 5);	/* start clock */
-		/* pray */
-	}
-}
-
-static void
-msgsm(Dsa *dsa, Controller *c, int msg, int *cont, int *wakeme)
-{
-	uchar histpf, hisreqack;
-	int tpf;
-	int scf, xferp;
-	int len;
-
-	Ncr *n = c->n;
-
-	switch (c->s[dsa->target]) {
-	case SyncInit:
-		switch (msg) {
-		case A_SIR_MSG_SDTR:
-			/* reply to my SDTR */
-			histpf = n->scratcha[2];
-			hisreqack = n->scratcha[3];
-			KPRINT(PRINTPREFIX "%d: SDTN response %d %d\n",
-			    dsa->target, histpf, hisreqack);
-
-			if (hisreqack == 0)
-				setasync(dsa, c, dsa->target);
-			else {
-				/* hisreqack should be <= c->v->maxsyncoff */
-				tpf = chooserate(c, histpf, &scf, &xferp);
-				KPRINT(PRINTPREFIX "%d: SDTN: using %d %d\n",
-				    dsa->target, tpf, hisreqack);
-				setsync(dsa, c, dsa->target, tpf < 25, scf, xferp, hisreqack);
-			}
-			*cont = -2;
-			return;
-		case A_SIR_EV_PHASE_SWITCH_AFTER_ID:
-			/* target ignored ATN for message after IDENTIFY - not SCSI-II */
-			KPRINT(PRINTPREFIX "%d: illegal phase switch after ID message - SCSI-1 device?\n", dsa->target);
-			KPRINT(PRINTPREFIX "%d: SDTN: async\n", dsa->target);
-			setasync(dsa, c, dsa->target);
-			*cont = E_to_decisions;
-			return;
-		case A_SIR_MSG_REJECT:
-			/* rejection of my SDTR */
-			KPRINT(PRINTPREFIX "%d: SDTN: rejected SDTR\n", dsa->target);
-		//async:
-			KPRINT(PRINTPREFIX "%d: SDTN: async\n", dsa->target);
-			setasync(dsa, c, dsa->target);
-			*cont = -2;
-			return;
-		}
-		break;
-	case WideInit:
-		switch (msg) {
-		case A_SIR_MSG_WDTR:
-			/* reply to my WDTR */
-			KPRINT(PRINTPREFIX "%d: WDTN: response %d\n",
-			    dsa->target, n->scratcha[2]);
-			setwide(dsa, c, dsa->target, n->scratcha[2]);
-			*cont = -2;
-			return;
-		case A_SIR_EV_PHASE_SWITCH_AFTER_ID:
-			/* target ignored ATN for message after IDENTIFY - not SCSI-II */
-			KPRINT(PRINTPREFIX "%d: illegal phase switch after ID message - SCSI-1 device?\n", dsa->target);
-			setwide(dsa, c, dsa->target, 0);
-			*cont = E_to_decisions;
-			return;
-		case A_SIR_MSG_REJECT:
-			/* rejection of my SDTR */
-			KPRINT(PRINTPREFIX "%d: WDTN: rejected WDTR\n", dsa->target);
-			setwide(dsa, c, dsa->target, 0);
-			*cont = -2;
-			return;
-		}
-		break;
-
-	case NeitherDone:
-	case WideDone:
-	case BothDone:
-		switch (msg) {
-		case A_SIR_MSG_WDTR: {
-			uchar hiswide, mywide;
-			hiswide = n->scratcha[2];
-			mywide = (c->v->feature & Wide) != 0;
-			KPRINT(PRINTPREFIX "%d: WDTN: target init %d\n",
-			    dsa->target, hiswide);
-			if (hiswide < mywide)
-				mywide = hiswide;
-			KPRINT(PRINTPREFIX "%d: WDTN: responding %d\n",
-			    dsa->target, mywide);
-			setwide(dsa, c, dsa->target, mywide);
-			len = buildwdtrmsg(dsa->msg_out, mywide);
-			setmovedata(&dsa->msg_out_buf, DMASEG(dsa->msg_out), len);
-			*cont = E_response;
-			c->s[dsa->target] = WideResponse;
-			return;
-		}
-		case A_SIR_MSG_SDTR:
-#ifdef ASYNC_ONLY
-			*cont = E_reject;
-			return;
-#else
-			/* target decides to renegotiate */
-			histpf = n->scratcha[2];
-			hisreqack = n->scratcha[3];
-			KPRINT(PRINTPREFIX "%d: SDTN: target init %d %d\n",
-			    dsa->target, histpf, hisreqack);
-			if (hisreqack == 0) {
-				/* he wants asynchronous */
-				setasync(dsa, c, dsa->target);
-				tpf = 0;
-			}
-			else {
-				/* he wants synchronous */
-				tpf = chooserate(c, histpf, &scf, &xferp);
-				if (hisreqack > c->v->maxsyncoff)
-					hisreqack = c->v->maxsyncoff;
-				KPRINT(PRINTPREFIX "%d: using %d %d\n",
-				    dsa->target, tpf, hisreqack);
-				setsync(dsa, c, dsa->target, tpf < 25, scf, xferp, hisreqack);
-			}
-			/* build my SDTR message */
-			len = buildsdtrmsg(dsa->msg_out, tpf, hisreqack);
-			setmovedata(&dsa->msg_out_buf, DMASEG(dsa->msg_out), len);
-			*cont = E_response;
-			c->s[dsa->target] = SyncResponse;
-			return;
-#endif
-		}
-		break;
-	case WideResponse:
-		switch (msg) {
-		case A_SIR_EV_RESPONSE_OK:
-			c->s[dsa->target] = WideDone;
-			KPRINT(PRINTPREFIX "%d: WDTN: response accepted\n", dsa->target);
-			*cont = -2;
-			return;
-		case A_SIR_MSG_REJECT:
-			setwide(dsa, c, dsa->target, 0);
-			KPRINT(PRINTPREFIX "%d: WDTN: response REJECTed\n", dsa->target);
-			*cont = -2;
-			return;
-		}
-		break;
-	case SyncResponse:
-		switch (msg) {
-		case A_SIR_EV_RESPONSE_OK:
-			c->s[dsa->target] = BothDone;
-			KPRINT(PRINTPREFIX "%d: SDTN: response accepted (%s)\n",
-			    dsa->target, phase[n->sstat1 & 7]);
-			*cont = -2;
-			return;	/* chf */
-		case A_SIR_MSG_REJECT:
-			setasync(dsa, c, dsa->target);
-			KPRINT(PRINTPREFIX "%d: SDTN: response REJECTed\n", dsa->target);
-			*cont = -2;
-			return;
-		}
-		break;
-	}
-	KPRINT(PRINTPREFIX "%d: msgsm: state %d msg %d\n",
-	    dsa->target, c->s[dsa->target], msg);
-	*wakeme = 1;
-	return;
-}
-
-static void
-calcblockdma(Dsa *d, ulong base, ulong count)
-{
-	ulong blocks;
-	if (DEBUG(3))
-		blocks = 0;
-	else {
-		blocks = count / A_BSIZE;
-		if (blocks > 255)
-			blocks = 255;
-	}
-	d->dmablks = blocks;
-	d->dmaaddr[0] = base;
-	d->dmaaddr[1] = base >> 8;
-	d->dmaaddr[2] = base >> 16;
-	d->dmaaddr[3] = base >> 24;
-	setmovedata(&d->data_buf, base + blocks * A_BSIZE, count - blocks * A_BSIZE);
-	d->flag = legetl(d->data_buf.dbc) == 0;
-}
-
-static ulong
-read_mismatch_recover(Controller *c, Ncr *n, Dsa *dsa)
-{
-	ulong dbc;
-	uchar dfifo = n->dfifo;
-	int inchip;
-
-	dbc = (n->dbc[2]<<16)|(n->dbc[1]<<8)|n->dbc[0];
-	if (n->ctest5 & (1 << 5))
-		inchip = ((dfifo | ((n->ctest5 & 3) << 8)) - (dbc & 0x3ff)) & 0x3ff;
-	else
-		inchip = ((dfifo & 0x7f) - (dbc & 0x7f)) & 0x7f;
-	if (inchip) {
-		IPRINT(PRINTPREFIX "%d/%d: read_mismatch_recover: DMA FIFO = %d\n",
-		    dsa->target, dsa->lun, inchip);
-	}
-	if (n->sxfer & SYNCOFFMASK(c)) {
-		/* SCSI FIFO */
-		uchar fifo = n->sstat1 >> 4;
-		if (c->v->maxsyncoff > 8)
-			fifo |= (n->sstat2 & (1 << 4));
-		if (fifo) {
-			inchip += fifo;
-			IPRINT(PRINTPREFIX "%d/%d: read_mismatch_recover: SCSI FIFO = %d\n",
-			    dsa->target, dsa->lun, fifo);
-		}
-	}
-	else {
-		if (n->sstat0 & (1 << 7)) {
-			inchip++;
-			IPRINT(PRINTPREFIX "%d/%d: read_mismatch_recover: SIDL full\n",
-			    dsa->target, dsa->lun);
-		}
-		if (n->sstat2 & (1 << 7)) {
-			inchip++;
-			IPRINT(PRINTPREFIX "%d/%d: read_mismatch_recover: SIDL msb full\n",
-			    dsa->target, dsa->lun);
-		}
-	}
-	USED(inchip);
-	return dbc;
-}
-
-static ulong
-write_mismatch_recover(Controller *c, Ncr *n, Dsa *dsa)
-{
-	ulong dbc;
-	uchar dfifo = n->dfifo;
-	int inchip;
-
-	dbc = (n->dbc[2]<<16)|(n->dbc[1]<<8)|n->dbc[0];
-	USED(dsa);
-	if (n->ctest5 & (1 << 5))
-		inchip = ((dfifo | ((n->ctest5 & 3) << 8)) - (dbc & 0x3ff)) & 0x3ff;
-	else
-		inchip = ((dfifo & 0x7f) - (dbc & 0x7f)) & 0x7f;
-#ifdef WMR_DEBUG
-	if (inchip) {
-		IPRINT(PRINTPREFIX "%d/%d: write_mismatch_recover: DMA FIFO = %d\n",
-		    dsa->target, dsa->lun, inchip);
-	}
-#endif
-	if (n->sstat0 & (1 << 5)) {
-		inchip++;
-#ifdef WMR_DEBUG
-		IPRINT(PRINTPREFIX "%d/%d: write_mismatch_recover: SODL full\n", dsa->target, dsa->lun);
-#endif
-	}
-	if (n->sstat2 & (1 << 5)) {
-		inchip++;
-#ifdef WMR_DEBUG
-		IPRINT(PRINTPREFIX "%d/%d: write_mismatch_recover: SODL msb full\n", dsa->target, dsa->lun);
-#endif
-	}
-	if (n->sxfer & SYNCOFFMASK(c)) {
-		/* synchronous SODR */
-		if (n->sstat0 & (1 << 6)) {
-			inchip++;
-#ifdef WMR_DEBUG
-			IPRINT(PRINTPREFIX "%d/%d: write_mismatch_recover: SODR full\n",
-			    dsa->target, dsa->lun);
-#endif
-		}
-		if (n->sstat2 & (1 << 6)) {
-			inchip++;
-#ifdef WMR_DEBUG
-			IPRINT(PRINTPREFIX "%d/%d: write_mismatch_recover: SODR msb full\n",
-			    dsa->target, dsa->lun);
-#endif
-		}
-	}
-	/* clear the dma fifo */
-	n->ctest3 |= (1 << 2);
-	/* wait till done */
-	while ((n->dstat & Dfe) == 0)
-		;
-	return dbc + inchip;
-}
-
-static void
-sd53c8xxinterrupt(Ureg *ur, void *a)
-{
-	uchar istat;
-	ushort sist;
-	uchar dstat;
-	int wakeme = 0;
-	int cont = -1;
-	Dsa *dsa;
-	ulong dsapa;
-	Controller *c = a;
-	Ncr *n = c->n;
-
-	USED(ur);
-	if (DEBUG(1)) {
-		IPRINT(PRINTPREFIX "int\n");
-	}
-	ilock(c);
-	istat = n->istat;
-	if (istat & Intf) {
-		Dsa *d;
-		int wokesomething = 0;
-		if (DEBUG(1)) {
-			IPRINT(PRINTPREFIX "Intfly\n");
-		}
-		n->istat = Intf;
-		/* search for structures in A_STATE_DONE */
-		for (d = KPTR(legetl(c->dsalist.head)); d != dsaend; d = KPTR(legetl(d->next))) {
-			if (d->stateb == A_STATE_DONE) {
-				d->p9status = d->status;
-				if (DEBUG(1)) {
-					IPRINT(PRINTPREFIX "waking up dsa %lux\n", (ulong)d);
-				}
-				wakeup(d);
-				wokesomething = 1;
-			}
-		}
-		if (!wokesomething) {
-			IPRINT(PRINTPREFIX "nothing to wake up\n");
-		}
-	}
-
-	if ((istat & (Sip | Dip)) == 0) {
-		if (DEBUG(1)) {
-			IPRINT(PRINTPREFIX "int end %x\n", istat);
-		}
-		iunlock(c);
-		return;
-	}
-
-	sist = (n->sist1<<8)|n->sist0;	/* BUG? can two-byte read be inconsistent? */
-	dstat = n->dstat;
-	dsapa = legetl(n->dsa);
-
-	/*
-	 * Can't compute dsa until we know that dsapa is valid.
-	 */
-	if(dsapa < -KZERO)
-		dsa = (Dsa*)DMASEG_TO_KADDR(dsapa);
-	else{
-		dsa = nil;
-		/*
-		 * happens at startup on some cards but we 
-		 * don't actually deref dsa because none of the
-		 * flags we are about are set.
-		 * still, print in case that changes and we're
-		 * about to dereference nil.
-		 */
-		iprint("sd53c8xxinterrupt: dsa=%.8lux istat=%ux sist=%ux dstat=%ux\n", dsapa, istat, sist, dstat);
-	}
-
-	c->running = 0;
-	if (istat & Sip) {
-		if (DEBUG(1)) {
-			IPRINT("sist = %.4x\n", sist);
-		}
-		if (sist & 0x80) {
-			ulong addr;
-			ulong sa;
-			ulong dbc;
-			ulong tbc;
-			int dmablks;
-			ulong dmaaddr;
-
-			addr = legetl(n->dsp);
-			sa = addr - c->scriptpa;
-			if (DEBUG(1) || DEBUG(2)) {
-				IPRINT(PRINTPREFIX "%d/%d: Phase Mismatch sa=%.8lux\n",
-				    dsa->target, dsa->lun, sa);
-			}
-			/*
-			 * now recover
-			 */
-			if (sa == E_data_in_mismatch) {
-				/*
-				 * though this is a failure in the residue, there may have been blocks
-				 * as well. if so, dmablks will not have been zeroed, since the state
-				 * was not saved by the microcode. 
-				 */
-				dbc = read_mismatch_recover(c, n, dsa);
-				tbc = legetl(dsa->data_buf.dbc) - dbc;
-				dsa->dmablks = 0;
-				n->scratcha[2] = 0;
-				advancedata(&dsa->data_buf, tbc);
-				if (DEBUG(1) || DEBUG(2)) {
-					IPRINT(PRINTPREFIX "%d/%d: transferred = %ld residue = %ld\n",
-					    dsa->target, dsa->lun, tbc, legetl(dsa->data_buf.dbc));
-				}
-				cont = E_data_mismatch_recover;
-			}
-			else if (sa == E_data_in_block_mismatch) {
-				dbc = read_mismatch_recover(c, n, dsa);
-				tbc = A_BSIZE - dbc;
-				/* recover current state from registers */
-				dmablks = n->scratcha[2];
-				dmaaddr = legetl(n->scratchb);
-				/* we have got to dmaaddr + tbc */
-				/* we have dmablks * A_BSIZE - tbc + residue left to do */
-				/* so remaining transfer is */
-				IPRINT("in_block_mismatch: dmaaddr = 0x%lux tbc=%lud dmablks=%d\n",
-				    dmaaddr, tbc, dmablks);
-				calcblockdma(dsa, dmaaddr + tbc,
-				    dmablks * A_BSIZE - tbc + legetl(dsa->data_buf.dbc));
-				/* copy changes into scratch registers */
-				IPRINT("recalc: dmablks %d dmaaddr 0x%lx pa 0x%lx dbc %ld\n",
-				    dsa->dmablks, legetl(dsa->dmaaddr),
-				    legetl(dsa->data_buf.pa), legetl(dsa->data_buf.dbc));
-				n->scratcha[2] = dsa->dmablks;
-				lesetl(n->scratchb, dsa->dmancr);
-				cont = E_data_block_mismatch_recover;
-			}
-			else if (sa == E_data_out_mismatch) {
-				dbc = write_mismatch_recover(c, n, dsa);
-				tbc = legetl(dsa->data_buf.dbc) - dbc;
-				dsa->dmablks = 0;
-				n->scratcha[2] = 0;
-				advancedata(&dsa->data_buf, tbc);
-				if (DEBUG(1) || DEBUG(2)) {
-					IPRINT(PRINTPREFIX "%d/%d: transferred = %ld residue = %ld\n",
-					    dsa->target, dsa->lun, tbc, legetl(dsa->data_buf.dbc));
-				}
-				cont = E_data_mismatch_recover;
-			}
-			else if (sa == E_data_out_block_mismatch) {
-				dbc = write_mismatch_recover(c, n, dsa);
-				tbc = legetl(dsa->data_buf.dbc) - dbc;
-				/* recover current state from registers */
-				dmablks = n->scratcha[2];
-				dmaaddr = legetl(n->scratchb);
-				/* we have got to dmaaddr + tbc */
-				/* we have dmablks blocks - tbc + residue left to do */
-				/* so remaining transfer is */
-				IPRINT("out_block_mismatch: dmaaddr = %lux tbc=%lud dmablks=%d\n",
-				    dmaaddr, tbc, dmablks);
-				calcblockdma(dsa, dmaaddr + tbc,
-				    dmablks * A_BSIZE - tbc + legetl(dsa->data_buf.dbc));
-				/* copy changes into scratch registers */
-				n->scratcha[2] = dsa->dmablks;
-				lesetl(n->scratchb, dsa->dmancr);
-				cont = E_data_block_mismatch_recover;
-			}
-			else if (sa == E_id_out_mismatch) {
-				/*
-				 * target switched phases while attention held during
-				 * message out. The possibilities are:
-				 * 1. It didn't like the last message. This is indicated
-				 *    by the new phase being message_in. Use script to recover
-				 *
-				 * 2. It's not SCSI-II compliant. The new phase will be other
-				 *    than message_in. We should also indicate that the device
-				 *    is asynchronous, if it's the SDTR that got ignored
-				 * 
-				 * For now, if the phase switch is not to message_in, and
-				 * and it happens after IDENTIFY and before SDTR, we
-				 * notify the negotiation state machine.
-				 */
-				ulong lim = legetl(dsa->msg_out_buf.dbc);
-				uchar p = n->sstat1 & 7;
-				dbc = write_mismatch_recover(c, n, dsa);
-				tbc = lim - dbc;
-				IPRINT(PRINTPREFIX "%d/%d: msg_out_mismatch: %lud/%lud sent, phase %s\n",
-				    dsa->target, dsa->lun, tbc, lim, phase[p]);
-				if (p != MessageIn && tbc == 1) {
-					msgsm(dsa, c, A_SIR_EV_PHASE_SWITCH_AFTER_ID, &cont, &wakeme);
-				}
-				else
-					cont = E_id_out_mismatch_recover;
-			}
-			else if (sa == E_cmd_out_mismatch) {
-				/*
-				 * probably the command count is longer than the device wants ...
-				 */
-				ulong lim = legetl(dsa->cmd_buf.dbc);
-				uchar p = n->sstat1 & 7;
-				dbc = write_mismatch_recover(c, n, dsa);
-				tbc = lim - dbc;
-				IPRINT(PRINTPREFIX "%d/%d: cmd_out_mismatch: %lud/%lud sent, phase %s\n",
-				    dsa->target, dsa->lun, tbc, lim, phase[p]);
-				USED(p, tbc);
-				cont = E_to_decisions;
-			}
-			else {
-				IPRINT(PRINTPREFIX "%d/%d: ma sa=%.8lux wanted=%s got=%s\n",
-				    dsa->target, dsa->lun, sa,
-				    phase[n->dcmd & 7],
-				    phase[n->sstat1 & 7]);
-				dumpncrregs(c, 1);
-				dsa->p9status = SDeio;	/* chf */
-				wakeme = 1;
-			}
-		}
-		/*else*/ if (sist & 0x400) {
-			if (DEBUG(0)) {
-				IPRINT(PRINTPREFIX "%d/%d Sto\n", dsa->target, dsa->lun);
-			}
-			dsa->p9status = SDtimeout;
-			dsa->stateb = A_STATE_DONE;
-			coherence();
-			softreset(c);
-			cont = E_issue_check;
-			wakeme = 1;
-		}
-		if (sist & 0x1) {
-			IPRINT(PRINTPREFIX "%d/%d: parity error\n", dsa->target, dsa->lun);
-			dsa->parityerror = 1;
-		}
-		if (sist & 0x4) {
-			IPRINT(PRINTPREFIX "%d/%d: unexpected disconnect\n",
-			    dsa->target, dsa->lun);
-			dumpncrregs(c, 1);
-			//wakeme = 1;
-			dsa->p9status = SDeio;
-		}
-	}
-	if (istat & Dip) {
-		if (DEBUG(1)) {
-			IPRINT("dstat = %.2x\n", dstat);
-		}
-		/*else*/ if (dstat & Ssi) {
-			ulong w = legetl(n->dsp) - c->scriptpa;
-			IPRINT("[%lux]", w);
-			USED(w);
-			cont = -2;	/* restart */
-		}
-		if (dstat & Sir) {
-			switch (legetl(n->dsps)) {
-			case A_SIR_MSG_IO_COMPLETE:
-				dsa->p9status = dsa->status;
-				wakeme = 1;
-				break;
-			case A_SIR_MSG_SDTR:
-			case A_SIR_MSG_WDTR:
-			case A_SIR_MSG_REJECT:
-			case A_SIR_EV_RESPONSE_OK:
-				msgsm(dsa, c, legetl(n->dsps), &cont, &wakeme);
-				break;
-			case A_SIR_MSG_IGNORE_WIDE_RESIDUE:
-				/* back up one in the data transfer */
-				IPRINT(PRINTPREFIX "%d/%d: ignore wide residue %d, WSR = %d\n",
-				    dsa->target, dsa->lun, n->scratcha[1], n->scntl2 & 1);
-				if (dsa->flag == 2) {
-					IPRINT(PRINTPREFIX "%d/%d: transfer over; residue ignored\n",
-					    dsa->target, dsa->lun);
-				}
-				else {
-					calcblockdma(dsa, legetl(dsa->dmaaddr) - 1,
-					    dsa->dmablks * A_BSIZE + legetl(dsa->data_buf.dbc) + 1);
-				}
-				cont = -2;
-				break;
-			case A_SIR_ERROR_NOT_MSG_IN_AFTER_RESELECT:
-				IPRINT(PRINTPREFIX "%d: not msg_in after reselect (%s)",
-				    n->ssid & SSIDMASK(c), phase[n->sstat1 & 7]);
-				dsa = dsafind(c, n->ssid & SSIDMASK(c), -1, A_STATE_DISCONNECTED);
-				dumpncrregs(c, 1);
-				wakeme = 1;
-				break;
-			case A_SIR_NOTIFY_LOAD_STATE:
-				IPRINT(PRINTPREFIX ": load_state dsa=%p\n", dsa);
-				if (dsa == (void*)KZERO || dsa == (void*)-1) {
-					dsadump(c);
-					dumpncrregs(c, 1);
-					panic("bad dsa in load_state");
-				}
-				cont = -2;
-				break;
-			case A_SIR_NOTIFY_MSG_IN:
-				IPRINT(PRINTPREFIX "%d/%d: msg_in %d\n",
-				    dsa->target, dsa->lun, n->sfbr);
-				cont = -2;
-				break;
-			case A_SIR_NOTIFY_DISC:
-				IPRINT(PRINTPREFIX "%d/%d: disconnect:", dsa->target, dsa->lun);
-				goto dsadump;
-			case A_SIR_NOTIFY_STATUS:
-				IPRINT(PRINTPREFIX "%d/%d: status\n", dsa->target, dsa->lun);
-				cont = -2;
-				break;
-			case A_SIR_NOTIFY_COMMAND:
-				IPRINT(PRINTPREFIX "%d/%d: commands\n", dsa->target, dsa->lun);
-				cont = -2;
-				break;
-			case A_SIR_NOTIFY_DATA_IN:
-				IPRINT(PRINTPREFIX "%d/%d: data in a %lx b %lx\n",
-				    dsa->target, dsa->lun, legetl(n->scratcha), legetl(n->scratchb));
-				cont = -2;
-				break;
-			case A_SIR_NOTIFY_BLOCK_DATA_IN:
-				IPRINT(PRINTPREFIX "%d/%d: block data in: a2 %x b %lx\n",
-				    dsa->target, dsa->lun, n->scratcha[2], legetl(n->scratchb));
-				cont = -2;
-				break;
-			case A_SIR_NOTIFY_DATA_OUT:
-				IPRINT(PRINTPREFIX "%d/%d: data out\n", dsa->target, dsa->lun);
-				cont = -2;
-				break;
-			case A_SIR_NOTIFY_DUMP:
-				IPRINT(PRINTPREFIX "%d/%d: dump\n", dsa->target, dsa->lun);
-				dumpncrregs(c, 1);
-				cont = -2;
-				break;
-			case A_SIR_NOTIFY_DUMP2:
-				IPRINT(PRINTPREFIX "%d/%d: dump2:", dsa->target, dsa->lun);
-				IPRINT(" sa %lux", legetl(n->dsp) - c->scriptpa);
-				IPRINT(" dsa %lux", legetl(n->dsa));
-				IPRINT(" sfbr %ux", n->sfbr);
-				IPRINT(" a %lux", legetl(n->scratcha));
-				IPRINT(" b %lux", legetl(n->scratchb));
-				IPRINT(" ssid %ux", n->ssid);
-				IPRINT("\n");
-				cont = -2;
-				break;
-			case A_SIR_NOTIFY_WAIT_RESELECT:
-				IPRINT(PRINTPREFIX "wait reselect\n");
-				cont = -2;
-				break;
-			case A_SIR_NOTIFY_RESELECT:
-				IPRINT(PRINTPREFIX "reselect: ssid %.2x sfbr %.2x at %ld\n",
-				    n->ssid, n->sfbr, TK2MS(m->ticks));
-				cont = -2;
-				break;
-			case A_SIR_NOTIFY_ISSUE:
-				IPRINT(PRINTPREFIX "%d/%d: issue dsa=%p end=%p:", dsa->target, dsa->lun, dsa, dsaend);
-			dsadump:
-				IPRINT(" tgt=%d", dsa->target);
-				IPRINT(" time=%ld", TK2MS(m->ticks));
-				IPRINT("\n");
-				cont = -2;
-				break;
-			case A_SIR_NOTIFY_ISSUE_CHECK:
-				IPRINT(PRINTPREFIX "issue check\n");
-				cont = -2;
-				break;
-			case A_SIR_NOTIFY_SIGP:
-				IPRINT(PRINTPREFIX "responded to SIGP\n");
-				cont = -2;
-				break;
-			case A_SIR_NOTIFY_DUMP_NEXT_CODE: {
-				ulong *dsp = c->script + (legetl(n->dsp)-c->scriptpa)/4;
-				int x;
-				IPRINT(PRINTPREFIX "code at %lux", dsp - c->script);
-				for (x = 0; x < 6; x++) {
-					IPRINT(" %.8lux", dsp[x]);
-				}
-				IPRINT("\n");
-				USED(dsp);
-				cont = -2;
-				break;
-			}
-			case A_SIR_NOTIFY_WSR:
-				IPRINT(PRINTPREFIX "%d/%d: WSR set\n", dsa->target, dsa->lun);
-				cont = -2;
-				break;
-			case A_SIR_NOTIFY_LOAD_SYNC:
-				IPRINT(PRINTPREFIX "%d/%d: scntl=%.2x sxfer=%.2x\n",
-				    dsa->target, dsa->lun, n->scntl3, n->sxfer);
-				cont = -2;
-				break;
-			case A_SIR_NOTIFY_RESELECTED_ON_SELECT:
-				if (DEBUG(2)) {
-					IPRINT(PRINTPREFIX "%d/%d: reselected during select\n",
- 					    dsa->target, dsa->lun);
-				}
-				cont = -2;
-				break;
-			case A_error_reselected:		/* dsa isn't valid here */
-				iprint(PRINTPREFIX "reselection error\n");
-				dumpncrregs(c, 1);
-				for (dsa = KPTR(legetl(c->dsalist.head)); dsa != dsaend; dsa = KPTR(legetl(dsa->next))) {
-					IPRINT(PRINTPREFIX "dsa target %d lun %d state %d\n", dsa->target, dsa->lun, dsa->stateb);
-				}
-				break;
-			default:
-				IPRINT(PRINTPREFIX "%d/%d: script error %ld\n",
-					dsa->target, dsa->lun, legetl(n->dsps));
-				dumpncrregs(c, 1);
-				wakeme = 1;
-			}
-		}
-		/*else*/ if (dstat & Iid) {
-			int i, target, lun;
-			ulong addr, dbc, *v;
-			
-			addr = legetl(n->dsp);
-			if(dsa){
-				target = dsa->target;
-				lun = dsa->lun;
-			}else{
-				target = -1;
-				lun = -1;
-			}
-			dbc = (n->dbc[2]<<16)|(n->dbc[1]<<8)|n->dbc[0];
-
-		//	if(dsa == nil)
-				idebug++;
-			IPRINT(PRINTPREFIX "%d/%d: Iid pa=%.8lux sa=%.8lux dbc=%lux\n",
-			    target, lun,
-			    addr, addr - c->scriptpa, dbc);
-			addr = (ulong)c->script + addr - c->scriptpa;
-			addr -= 64;
-			addr &= ~63;
-			v = (ulong*)addr;
-			for(i=0; i<8; i++){
-				IPRINT("%.8lux: %.8lux %.8lux %.8lux %.8lux\n", 
-					addr, v[0], v[1], v[2], v[3]);
-				addr += 4*4;
-				v += 4;
-			}
-			USED(addr, dbc);
-			if(dsa == nil){
-				dsadump(c);
-				dumpncrregs(c, 1);
-				panic("bad dsa");
-			}
-			dsa->p9status = SDeio;
-			wakeme = 1;
-		}
-		/*else*/ if (dstat & Bf) {
-			IPRINT(PRINTPREFIX "%d/%d: Bus Fault\n", dsa->target, dsa->lun);
-			dumpncrregs(c, 1);
-			dsa->p9status = SDeio;
-			wakeme = 1;
-		}
-	}
-	if (cont == -2)
-		ncrcontinue(c);
-	else if (cont >= 0)
-		start(c, cont);
-	if (wakeme){
-		if(dsa->p9status == SDnostatus)
-			dsa->p9status = SDeio;
-		wakeup(dsa);
-	}
-	iunlock(c);
-	if (DEBUG(1)) {
-		IPRINT(PRINTPREFIX "int end 1\n");
-	}
-}
-
-static int
-done(void *arg)
-{
-	return ((Dsa *)arg)->p9status != SDnostatus;
-}
-
-static void
-setmovedata(Movedata *d, ulong pa, ulong bc)
-{
-	d->pa[0] = pa;
-	d->pa[1] = pa>>8;
-	d->pa[2] = pa>>16;
-	d->pa[3] = pa>>24;
-	d->dbc[0] = bc;
-	d->dbc[1] = bc>>8;
-	d->dbc[2] = bc>>16;
-	d->dbc[3] = bc>>24;
-}
-
-static void
-advancedata(Movedata *d, long v)
-{
-	lesetl(d->pa, legetl(d->pa) + v);
-	lesetl(d->dbc, legetl(d->dbc) - v);
-}
-
-static void
-dumpwritedata(uchar *data, int datalen)
-{
-	int i;
-	uchar *bp;
-	if (!DEBUG(0)){
-		USED(data, datalen);
-		return;
-	}
-
-	if (datalen) {
-		KPRINT(PRINTPREFIX "write:");
-		for (i = 0, bp = data; i < 50 && i < datalen; i++, bp++) {
-			KPRINT("%.2ux", *bp);
-		}
-		if (i < datalen) {
-			KPRINT("...");
-		}
-		KPRINT("\n");
-	}
-}
-
-static void
-dumpreaddata(uchar *data, int datalen)
-{
-	int i;
-	uchar *bp;
-	if (!DEBUG(0)){
-		USED(data, datalen);
-		return;
-	}
-
-	if (datalen) {
-		KPRINT(PRINTPREFIX "read:");
-		for (i = 0, bp = data; i < 50 && i < datalen; i++, bp++) {
-			KPRINT("%.2ux", *bp);
-		}
-		if (i < datalen) {
-			KPRINT("...");
-		}
-		KPRINT("\n");
-	}
-}
-
-static void
-busreset(Controller *c)
-{
-	int x, ntarget;
-
-	/* bus reset */
-	c->n->scntl1 |= (1 << 3);
-	delay(500);
-	c->n->scntl1 &= ~(1 << 3);
-	if(!(c->v->feature & Wide))
-		ntarget = 8;
-	else
-		ntarget = MAXTARGET;
-	for (x = 0; x < ntarget; x++) {
-		setwide(0, c, x, 0);
-#ifndef ASYNC_ONLY
-		c->s[x] = NeitherDone;
-#endif
-	}
-	c->capvalid = 0;
-}
-
-static void
-reset(Controller *c)
-{
-	/* should wakeup all pending tasks */
-	softreset(c);
-	busreset(c);
-}
-
-static int
-sd53c8xxrio(SDreq* r)
-{
-	Dsa *d;
-	uchar *bp;
-	Controller *c;
-	uchar target_expo, my_expo;
-	int bc, check, i, status, target;
-
-	if((target = r->unit->subno) == 0x07)
-		return r->status = SDtimeout;	/* assign */
-
-	c = r->unit->dev->ctlr;
-
-	check = 0;
-	d = dsaalloc(c, target, r->lun);
-
-	qlock(&c->q[target]);			/* obtain access to target */
-docheck:
-	/* load the transfer control stuff */
-	d->scsi_id_buf[0] = 0;
-	d->scsi_id_buf[1] = c->sxfer[target];
-	d->scsi_id_buf[2] = target;
-	d->scsi_id_buf[3] = c->scntl3[target];
-	synctodsa(d, c);
-
-	bc = 0;
-
-	d->msg_out[bc] = 0x80 | r->lun;
-
-#ifndef NO_DISCONNECT
-	d->msg_out[bc] |= (1 << 6);
-#endif
-	bc++;
-
-	/* work out what to do about negotiation */
-	switch (c->s[target]) {
-	default:
-		KPRINT(PRINTPREFIX "%d: strange nego state %d\n", target, c->s[target]);
-		c->s[target] = NeitherDone;
-		/* fall through */
-	case NeitherDone:
-		if ((c->capvalid & (1 << target)) == 0)
-			break;
-		target_expo = (c->cap[target] >> 5) & 3;
-		my_expo = (c->v->feature & Wide) != 0;
-		if (target_expo < my_expo)
-			my_expo = target_expo;
-#ifdef ALWAYS_DO_WDTR
-		bc += buildwdtrmsg(d->msg_out + bc, my_expo);
-		KPRINT(PRINTPREFIX "%d: WDTN: initiating expo %d\n", target, my_expo);
-		c->s[target] = WideInit;
-		break;
-#else
-		if (my_expo) {
-			bc += buildwdtrmsg(d->msg_out + bc, (c->v->feature & Wide) ? 1 : 0);
-			KPRINT(PRINTPREFIX "%d: WDTN: initiating expo %d\n", target, my_expo);
-			c->s[target] = WideInit;
-			break;
-		}
-		KPRINT(PRINTPREFIX "%d: WDTN: narrow\n", target);
-		/* fall through */
-#endif
-	case WideDone:
-		if (c->cap[target] & (1 << 4)) {
-			KPRINT(PRINTPREFIX "%d: SDTN: initiating %d %d\n", target, c->tpf, c->v->maxsyncoff);
-			bc += buildsdtrmsg(d->msg_out + bc, c->tpf, c->v->maxsyncoff);
-			c->s[target] = SyncInit;
-			break;
-		}
-		KPRINT(PRINTPREFIX "%d: SDTN: async only\n", target);
-		c->s[target] = BothDone;
-		break;
-
-	case BothDone:
-		break;
-	}
-
-	setmovedata(&d->msg_out_buf, DMASEG(d->msg_out), bc);
-	setmovedata(&d->cmd_buf, DMASEG(r->cmd), r->clen);
-	calcblockdma(d, r->data ? DMASEG(r->data) : 0, r->dlen);
-
-	if (DEBUG(0)) {
-		KPRINT(PRINTPREFIX "%d/%d: exec: ", target, r->lun);
-		for (bp = r->cmd; bp < &r->cmd[r->clen]; bp++) {
-			KPRINT("%.2ux", *bp);
-		}
-		KPRINT("\n");
-		if (!r->write) {
-			KPRINT(PRINTPREFIX "%d/%d: exec: limit=(%d)%ld\n",
-			  target, r->lun, d->dmablks, legetl(d->data_buf.dbc));
-		}
-		else
-			dumpwritedata(r->data, r->dlen);
-	}
-
-	setmovedata(&d->status_buf, DMASEG(&d->status), 1);	
-
-	d->p9status = SDnostatus;
-	d->parityerror = 0;
-	coherence();
-	d->stateb = A_STATE_ISSUE;		/* start operation */
-	coherence();
-
-	ilock(c);
-	if (c->ssm)
-		c->n->dcntl |= 0x10;		/* single step */
-	if (c->running) {
-		c->n->istat = Sigp;
-	}
-	else {
-		start(c, E_issue_check);
-	}
-	iunlock(c);
-
-	while(waserror())
-		;
-	tsleep(d, done, d, 600 * 1000);
-	poperror();
-
-	if (!done(d)) {
-		KPRINT(PRINTPREFIX "%d/%d: exec: Timed out\n", target, r->lun);
-		dumpncrregs(c, 0);
-		dsafree(c, d);
-		reset(c);
-		qunlock(&c->q[target]);
-		r->status = SDtimeout;
-		return r->status = SDtimeout;	/* assign */
-	}
-
-	if((status = d->p9status) == SDeio)
-		c->s[target] = NeitherDone;
-	if (d->parityerror) {
-		status = SDeio;
-	}
-
-	/*
-	 * adjust datalen
-	 */
-	r->rlen = r->dlen;
-	if (DEBUG(0)) {
-		KPRINT(PRINTPREFIX "%d/%d: exec: before rlen adjust: dmablks %d flag %d dbc %lud\n",
-		    target, r->lun, d->dmablks, d->flag, legetl(d->data_buf.dbc));
-	}
-	r->rlen = r->dlen;
-	if (d->flag != 2) {
-		r->rlen -= d->dmablks * A_BSIZE;
-		r->rlen -= legetl(d->data_buf.dbc);
-	}
-	if(!r->write)
-		dumpreaddata(r->data, r->rlen);
-	if (DEBUG(0)) {
-		KPRINT(PRINTPREFIX "%d/%d: exec: p9status=%d status %d rlen %ld\n",
-		    target, r->lun, d->p9status, status, r->rlen);
-	}
-	/*
-	 * spot the identify
-	 */
-	if ((c->capvalid & (1 << target)) == 0
-	 && (status == SDok || status == SDcheck)
-	 && r->cmd[0] == 0x12 && r->dlen >= 8) {
-		c->capvalid |= 1 << target;
-		bp = r->data;
-		c->cap[target] = bp[7];
-		KPRINT(PRINTPREFIX "%d: capabilities %.2x\n", target, bp[7]);
-	}
-	if(!check && status == SDcheck && !(r->flags & SDnosense)){
-		check = 1;
-		r->write = 0;
-		memset(r->cmd, 0, sizeof(r->cmd));
-		r->cmd[0] = 0x03;
-		r->cmd[1] = r->lun<<5;
-		r->cmd[4] = sizeof(r->sense)-1;
-		r->clen = 6;
-		r->data = r->sense;
-		r->dlen = sizeof(r->sense)-1;
-		/*
-		 * Clear out the microcode state
-		 * so the Dsa can be re-used.
-		 */
-		lesetl(&d->stateb, A_STATE_ALLOCATED);
-		coherence();
-		goto docheck;
-	}
-	qunlock(&c->q[target]);
-	dsafree(c, d);
-
-	if(status == SDok && check){
-		status = SDcheck;
-		r->flags |= SDvalidsense;
-	}
-	if(DEBUG(0))
-		KPRINT(PRINTPREFIX "%d: r flags %8.8uX status %d rlen %ld\n",
-			target, r->flags, status, r->rlen);
-	if(r->flags & SDvalidsense){
-		if(!DEBUG(0))
-			KPRINT(PRINTPREFIX "%d: r flags %8.8uX status %d rlen %ld\n",
-				target, r->flags, status, r->rlen);
-		for(i = 0; i < r->rlen; i++)
-			KPRINT(" %2.2uX", r->sense[i]);
-		KPRINT("\n");
-	}
-	return r->status = status;
-}
-
-#define	vpt ((ulong*)VPT)
-#define	VPTX(va)		(((ulong)(va))>>12)
-static void
-cribbios(Controller *c)
-{
-	c->bios.scntl3 = c->n->scntl3;
-	c->bios.stest2 = c->n->stest2;
-	print(PRINTPREFIX "bios scntl3(%.2x) stest2(%.2x)\n", c->bios.scntl3, c->bios.stest2);
-}
-
-static int
-bios_set_differential(Controller *c)
-{
-	/* Concept lifted from FreeBSD - thanks Gerard */
-	/* basically, if clock conversion factors are set, then there is
- 	 * evidence the bios had a go at the chip, and if so, it would
-	 * have set the differential enable bit in stest2
-	 */
-	return (c->bios.scntl3 & 7) != 0 && (c->bios.stest2 & 0x20) != 0;
-}
-
-#define NCR_VID 	0x1000
-#define NCR_810_DID 	0x0001
-#define NCR_820_DID	0x0002	/* don't know enough about this one to support it */
-#define NCR_825_DID	0x0003
-#define NCR_815_DID	0x0004
-#define SYM_810AP_DID	0x0005
-#define SYM_860_DID	0x0006
-#define SYM_896_DID	0x000b
-#define SYM_895_DID	0x000c
-#define SYM_885_DID	0x000d	/* ditto */
-#define SYM_875_DID	0x000f	/* ditto */
-#define SYM_1010_DID	0x0020
-#define SYM_1011_DID	0x0021
-#define SYM_875J_DID	0x008f
-
-static Variant variant[] = {
-{ NCR_810_DID,   0x0f, "NCR53C810",	Burst16,   8, 24, 0 },
-{ NCR_810_DID,   0x1f, "SYM53C810ALV",	Burst16,   8, 24, Prefetch },
-{ NCR_810_DID,   0xff, "SYM53C810A",	Burst16,   8, 24, Prefetch },
-{ SYM_810AP_DID, 0xff, "SYM53C810AP",	Burst16,   8, 24, Prefetch },
-{ NCR_815_DID,   0xff, "NCR53C815",	Burst16,   8, 24, BurstOpCodeFetch },
-{ NCR_825_DID,   0x0f, "NCR53C825",	Burst16,   8, 24, Wide|BurstOpCodeFetch|Differential },
-{ NCR_825_DID,   0xff, "SYM53C825A",	Burst128, 16, 24, Prefetch|LocalRAM|BigFifo|Differential|Wide },
-{ SYM_860_DID,   0x0f, "SYM53C860",	Burst16,   8, 24, Prefetch|Ultra },
-{ SYM_860_DID,   0xff, "SYM53C860LV",	Burst16,   8, 24, Prefetch|Ultra },
-{ SYM_875_DID,   0x01, "SYM53C875r1",	Burst128, 16, 24, Prefetch|LocalRAM|BigFifo|Differential|Wide|Ultra },
-{ SYM_875_DID,   0xff, "SYM53C875",	Burst128, 16, 24, Prefetch|LocalRAM|BigFifo|Differential|Wide|Ultra|ClockDouble },
-{ SYM_875J_DID,   0xff, "SYM53C875j",	Burst128, 16, 24, Prefetch|LocalRAM|BigFifo|Differential|Wide|Ultra|ClockDouble },
-{ SYM_885_DID,   0xff, "SYM53C885",	Burst128, 16, 24, Prefetch|LocalRAM|BigFifo|Wide|Ultra|ClockDouble },
-{ SYM_895_DID,   0xff, "SYM53C895",	Burst128, 16, 24, Prefetch|LocalRAM|BigFifo|Wide|Ultra|Ultra2 },
-{ SYM_896_DID,   0xff, "SYM53C896",	Burst128, 16, 64, Prefetch|LocalRAM|BigFifo|Wide|Ultra|Ultra2 },
-{ SYM_1010_DID,  0xff, "SYM53C1010",	Burst128, 16, 64, Prefetch|LocalRAM|BigFifo|Wide|Ultra|Ultra2 },
-{ SYM_1011_DID,   0xff, "SYM53C1010",	Burst128, 16, 64, Prefetch|LocalRAM|BigFifo|Wide|Ultra|Ultra2 },
-};
-
-static int
-xfunc(Controller *c, enum na_external x, unsigned long *v)
-{
-	switch (x)
-	{
-	case X_scsi_id_buf:
-		*v = offsetof(Dsa, scsi_id_buf[0]); return 1;
-	case X_msg_out_buf:
-		*v = offsetof(Dsa, msg_out_buf); return 1;
-	case X_cmd_buf:
-		*v = offsetof(Dsa, cmd_buf); return 1;
-	case X_data_buf:
-		*v = offsetof(Dsa, data_buf); return 1;
-	case X_status_buf:
-		*v = offsetof(Dsa, status_buf); return 1;
-	case X_dsa_head:
-		*v = DMASEG(&c->dsalist.head[0]); return 1;
-	case X_ssid_mask:
-		*v = SSIDMASK(c); return 1;
-	default:
-		print("xfunc: can't find external %d\n", x);
-		return 0;
-	}
-	return 1;
-}
-
-static int
-na_fixup(Controller *c, ulong pa_reg,
-    struct na_patch *patch, int patches,
-    int (*externval)(Controller*, int, ulong*))
-{
-	int p;
-	int v;
-	ulong *script, pa_script;
-	unsigned long lw, lv;
-
-	script = c->script;
-	pa_script = c->scriptpa;
-	for (p = 0; p < patches; p++) {
-		switch (patch[p].type) {
-		case 1:
-			/* script relative */
-			script[patch[p].lwoff] += pa_script;
-			break;
-		case 2:
-			/* register i/o relative */
-			script[patch[p].lwoff] += pa_reg;
-			break;
-		case 3:
-			/* data external */
-			lw = script[patch[p].lwoff];
-			v = (lw >> 8) & 0xff;
-			if (!(*externval)(c, v, &lv))
-				return 0;
-			v = lv & 0xff;
-			script[patch[p].lwoff] = (lw & 0xffff00ffL) | (v << 8);
-			break;
-		case 4:
-			/* 32 bit external */
-			lw = script[patch[p].lwoff];
-			if (!(*externval)(c, lw, &lv))
-				return 0;
-			script[patch[p].lwoff] = lv;
-			break;
-		case 5:
-			/* 24 bit external */
-			lw = script[patch[p].lwoff];
-			if (!(*externval)(c, lw & 0xffffff, &lv))
-				return 0;
-			script[patch[p].lwoff] = (lw & 0xff000000L) | (lv & 0xffffffL);
-			break;
-		}
-	}
-	return 1;
-}
-
-static SDev*
-sd53c8xxpnp(void)
-{
-	char *cp;
-	Pcidev *p;
-	Variant *v;
-	int ba, nctlr;
-	void *scriptma;
-	Controller *ctlr;
-	SDev *sdev, *head, *tail;
-	ulong regpa, *script, scriptpa;
-	void *regva, *scriptva;
-
-	if(cp = getconf("*maxsd53c8xx"))
-		nctlr = strtoul(cp, 0, 0);
-	else
-		nctlr = 32;
-
-	p = nil;
-	head = tail = nil;
-	while((p = pcimatch(p, NCR_VID, 0)) != nil && nctlr > 0){
-		for(v = variant; v < &variant[nelem(variant)]; v++){
-			if(p->did == v->did && p->rid <= v->maxrid)
-				break;
-		}
-		if(v >= &variant[nelem(variant)]) {
-			print("no match\n");
-			continue;
-		}
-		print(PRINTPREFIX "%s rev. 0x%2.2x intr=%d command=%4.4uX\n",
-			v->name, p->rid, p->intl, p->pcr);
-
-		regpa = p->mem[1].bar;
-		ba = 2;
-		if(regpa & 0x04){
-			if(p->mem[2].bar)
-				continue;
-			ba++;
-		}
-		if(regpa == 0)
-			print("regpa 0\n");
-		regpa &= ~0xF;
-		regva = vmap(regpa, p->mem[1].size);
-		if(regva == 0)
-			continue;
-
-		script = nil;
-		scriptpa = 0;
-		scriptva = nil;
-		scriptma = nil;
-		if((v->feature & LocalRAM) && sizeof(na_script) <= 4096){
-			scriptpa = p->mem[ba].bar;
-			if((scriptpa & 0x04) && p->mem[ba+1].bar){
-				vunmap(regva, p->mem[1].size);
-				continue;
-			}
-			scriptpa &= ~0x0F;
-			scriptva = vmap(scriptpa, p->mem[ba].size);
-			if(scriptva)
-				script = scriptva;
-		}
-		if(scriptpa == 0){
-			/*
-			 * Either the map failed, or this chip does not have
-			 * local RAM. It will need a copy of the microcode.
-			 */
-			scriptma = malloc(sizeof(na_script));
-			if(scriptma == nil){
-				vunmap(regva, p->mem[1].size);
-				continue;
-			}
-			scriptpa = DMASEG(scriptma);
-			script = scriptma;
-		}
-
-		ctlr = malloc(sizeof(Controller));
-		sdev = malloc(sizeof(SDev));
-		if(ctlr == nil || sdev == nil){
-buggery:
-			if(ctlr)
-				free(ctlr);
-			if(sdev)
-				free(sdev);
-			if(scriptma)
-				free(scriptma);
-			else if(scriptva)
-				vunmap(scriptva, p->mem[ba].size);
-			if(regva)
-				vunmap(regva, p->mem[1].size);
-			continue;
-		}
-
-		if(dsaend == nil)
-			dsaend = xalloc(sizeof *dsaend);
-		lesetl(&dsaend->stateb, A_STATE_END);
-	//	lesetl(dsaend->next, DMASEG(dsaend));
-		coherence();
-		lesetl(ctlr->dsalist.head, DMASEG(dsaend));
-		coherence();
-		ctlr->dsalist.freechain = 0;
-
-		ctlr->n = regva;
-		ctlr->v = v;
-		ctlr->script = script;
-		memmove(ctlr->script, na_script, sizeof(na_script));
-
-		/*
-		 * Because we don't yet have an abstraction for the
-		 * addresses as seen from the controller side (and on
-		 * the 386 it doesn't matter), the following three lines
-		 * are different between the 386 and alpha copies of
-		 * this driver.
-		 */
-		USED(scriptpa);
-		ctlr->scriptpa = p->mem[ba].bar & ~0x0F;
-		if(!na_fixup(ctlr, p->mem[1].bar & ~0x0F, na_patches, NA_PATCHES, xfunc)){
-			print("script fixup failed\n");
-			goto buggery;
-		}
-		swabl(ctlr->script, ctlr->script, sizeof(na_script));
-
-		ctlr->pcidev = p;
-
-		sdev->ifc = &sd53c8xxifc;
-		sdev->ctlr = ctlr;
-		sdev->idno = '0';
-		if(!(v->feature & Wide))
-			sdev->nunit = 8;
-		else
-			sdev->nunit = MAXTARGET;
-		ctlr->sdev = sdev;
-		
-		if(head != nil)
-			tail->next = sdev;
-		else
-			head = sdev;
-		tail = sdev;
-
-		nctlr--;
-	}
-
-	return head;
-}
-
-static int
-sd53c8xxenable(SDev* sdev)
-{
-	Pcidev *pcidev;
-	Controller *ctlr;
-	char name[32];
-
-	ctlr = sdev->ctlr;
-	pcidev = ctlr->pcidev;
-
-	pcisetbme(pcidev);
-
-	ilock(ctlr);
-	synctabinit(ctlr);
-	cribbios(ctlr);
-	reset(ctlr);
-	snprint(name, sizeof(name), "%s (%s)", sdev->name, sdev->ifc->name);
-	intrenable(pcidev->intl, sd53c8xxinterrupt, ctlr, pcidev->tbdf, name);
-	iunlock(ctlr);
-
-	return 1;
-}
-
-SDifc sd53c8xxifc = {
-	"53c8xx",			/* name */
-
-	sd53c8xxpnp,			/* pnp */
-	nil,				/* legacy */
-	sd53c8xxenable,			/* enable */
-	nil,				/* disable */
-
-	scsiverify,			/* verify */
-	scsionline,			/* online */
-	sd53c8xxrio,			/* rio */
-	nil,				/* rctl */
-	nil,				/* wctl */
-
-	scsibio,			/* bio */
-	nil,				/* probe */
-	nil,				/* clear */
-	nil,				/* stat */
-};
--- a/sys/src/9/alphapc/sio.c
+++ /dev/null
@@ -1,18 +1,0 @@
-#include "u.h"
-#include "../port/lib.h"
-#include "mem.h"
-#include "dat.h"
-#include "fns.h"
-#include "io.h"
-
-/*
- * 82378ZB Saturn-I/O (SIO) PCI-to-ISA Bus Bridge.
- */
-static Pcidev* siodev;
-
-void
-siodump(void)
-{
-	if(siodev == nil && (siodev = pcimatch(nil, 0x8086, 0x0484)) == nil)
-		return;
-}
--- a/sys/src/9/alphapc/trap.c
+++ /dev/null
@@ -1,902 +1,0 @@
-#include	"u.h"
-#include	"../port/lib.h"
-#include	"mem.h"
-#include	"dat.h"
-#include	"fns.h"
-#include	"ureg.h"
-#include	"io.h"
-#include	"../port/error.h"
-
-void	noted(Ureg*, Ureg**, ulong);
-void	rfnote(Ureg**);
-void	kernfault(Ureg*, int);
-void	illegal(Ureg *);
-void	fen(Ureg *);
-
-char *regname[]={
-	"type",	"a0",		"a1",
-	"a2",		"R0",		"R1",
-	"R2",		"R3",		"R4",
-	"R5",		"R6",		"R7",
-	"R8",		"R9",		"R10",
-	"R11",	"R12",	"R13",
-	"R14",	"R15",	"R19",
-	"R20",	"R21",	"R22",
-	"R23",	"R24",	"R25",
-	"R26",	"R27",	"R28",
-	"R30",	"status",	"PC",
-	"R29",	"R16",	"R17",
-	"R18",
-};
-
-static Lock vctllock;
-static Vctl *vctl[256];
-
-void
-intrenable(int irq, void (*f)(Ureg*, void*), void* a, int tbdf, char *name)
-{
-	int vno;
-	Vctl *v;
-
-	if(f == nil){
-		print("intrenable: nil handler for %d, tbdf 0x%uX for %s\n",
-			irq, tbdf, name);
-		return;
-	}
-
-	v = xalloc(sizeof(Vctl));
-	v->isintr = 1;
-	v->irq = irq;
-	v->tbdf = tbdf;
-	v->f = f;
-	v->a = a;
-	strncpy(v->name, name, KNAMELEN-1);
-	v->name[KNAMELEN-1] = 0;
-
-	ilock(&vctllock);
-	vno = arch->intrenable(v);
-	if(vno == -1){
-		iunlock(&vctllock);
-		print("intrenable: couldn't enable irq %d, tbdf 0x%uX for %s\n",
-			irq, tbdf, v->name);
-		xfree(v);
-		return;
-	}
-	if(vctl[vno]){
-		if(vctl[vno]->isr != v->isr || vctl[vno]->eoi != v->eoi)
-			panic("intrenable: handler: %s %s %#p %#p %#p %#p",
-				vctl[vno]->name, v->name,
-				vctl[vno]->isr, v->isr, vctl[vno]->eoi, v->eoi);
-		v->next = vctl[vno];
-	}
-	vctl[vno] = v;
-	iunlock(&vctllock);
-}
-
-int
-intrdisable(int irq, void (*f)(Ureg *, void *), void *a, int tbdf, char *name)
-{
-	Vctl **pv, *v;
-	int vno;
-
-	/*
-	 * For now, none of this will work with the APIC code,
-	 * there is no mapping between irq and vector as the IRQ
-	 * is pretty meaningless.
-	 */
-	if(arch->intrvecno == nil)
-		return -1;
-	vno = arch->intrvecno(irq);
-	ilock(&vctllock);
-	for(pv = &vctl[vno]; *pv != nil; pv = &((*pv)->next)){
-		if((*pv)->irq != irq)
-			continue;
-		if((*pv)->tbdf != tbdf)
-			continue;
-		if((*pv)->f != f)
-			continue;
-		if((*pv)->a != a)
-			continue;
-		if(strcmp((*pv)->name, name) != 0)
-			continue;
-		break;
-	}
-	assert(*pv != nil);
-
-	v = *pv;
-	*pv = (*pv)->next;	/* Link out the entry */
-	
-	if (vctl[vno] == nil && arch->intrdisable != nil)
-		arch->intrdisable(irq);
-	iunlock(&vctllock);
-	xfree(v);
-	return 0;
-}
-
-int
-irqallocread(char *buf, long n, vlong offset)
-{
-	int vno;
-	Vctl *v;
-	long oldn;
-	char str[11+1+KNAMELEN+1], *p;
-	int m;
-
-	if(n < 0 || offset < 0)
-		error(Ebadarg);
-
-	oldn = n;
-	for(vno=0; vno<nelem(vctl); vno++){
-		for(v=vctl[vno]; v; v=v->next){
-			m = snprint(str, sizeof str, "%11d %11d %.*s\n", vno, v->irq, KNAMELEN, v->name);
-			if(m <= offset)	/* if do not want this, skip entry */
-				offset -= m;
-			else{
-				/* skip offset bytes */
-				m -= offset;
-				p = str+offset;
-				offset = 0;
-
-				/* write at most max(n,m) bytes */
-				if(m > n)
-					m = n;
-				memmove(buf, p, m);
-				n -= m;
-				buf += m;
-
-				if(n == 0)
-					return oldn;
-			}	
-		}
-	}
-	return oldn - n;
-}
-
-typedef struct Mcheck Mcheck;
-struct Mcheck
-{
-	ulong	len;
-	ulong	inprogress;
-	ulong	procoff;
-	ulong	sysoff;
-	ulong	code;
-};
-
-static char *
-smcheck(ulong code)
-{
-	switch (code) {
-	case 0x80: return "tag parity error";
-	case 0x82: return "tag control parity error";
-	case 0x84: return "generic hard error";
-	case 0x86: return "correctable ECC error";
-	case 0x88: return "uncorrectable ECC error";
-	case 0x8a: return "OS-specific PAL bugcheck";
-	case 0x90: return "callsys in kernel mode";
-	case 0x96: return "i-cache read retryable error";
-	case 0x98: return "processor detected hard error";
-
-	case 0x203: return "system detected uncorrectable ECC error";
-	case 0x205: return "parity error detected by CIA";
-	case 0x207: return "non-existent memory error";
-	case 0x209: return "PCI SERR detected";
-	case 0x20b: return "PCI data parity error detected";
-	case 0x20d: return "PCI address parity error detected";
-	case 0x20f: return "PCI master abort error";
-	case 0x211: return "PCI target abort error";
-	case 0x213: return "scatter/gather PTE invalid error";
-	case 0x215: return "flash ROM write error";
-	case 0x217: return "IOA timeout detected";
-	case 0x219: return "IOCHK#, EISA add-in board parity or other catastrophic error";
-	case 0x21b: return "EISA fail-safe timer timeout";
-	case 0x21d: return "EISA bus time-out";
-	case 0x21f: return "EISA software generated NMI";
-	case 0x221: return "unexpected ev5 IRQ[3] interrupt";
-	default: return "unknown mcheck";
-	}
-}
-
-void
-mcheck(Ureg *ur, void *x)
-{
-	Mcheck *m;
-	uvlong *data;
-	int i, col;
-
-	m = x;
-	data = x;
-	iprint("panic: Machine Check @%#p: %s (%lux) len %lud\n",
-			m, smcheck(m->code), m->code, m->len);
-	iprint("proc offset %lux sys offset %lux\n", m->procoff, m->sysoff);
-	for (i = 0, col = 0; i < m->len/8; i++) {
-		iprint("%.3x: %.16llux%s", 8*i, data[i], (col == 2) ? "\n" : "    ");
-		if (col++ == 2)
-			col = 0;
-	}
-	if(col != 2)
-		print("\n");
-	print("\n");
-	dumpregs(ur);
-	prflush();
-	firmware();
-}
-
-void
-intr(Ureg *ur)
-{
-	int i, vno;
-	Vctl *ctl, *v;
-	Mach *mach;
-
-	vno = (ulong)ur->a1>>4;
-	vno -= 0x80;
-	if(vno < nelem(vctl) && (ctl = vctl[vno])){
-		if(ctl->isintr){
-			m->intr++;
-			if(vno >= VectorPIC && vno <= MaxVectorPIC)
-				m->lastintr = vno-VectorPIC;
-		}
-
-		if(ctl->isr)
-			ctl->isr(vno);
-		for(v = ctl; v != nil; v = v->next) {
-			if(v->f)
-				v->f(ur, v->a);
-		}
-
-		if(ctl->eoi)
-			ctl->eoi(vno);
-
-		if(ctl->isintr && up)
-			preempted();
-	}
-	else if(vno >= VectorPIC && vno <= MaxVectorPIC){
-		/*
-		 * An unknown interrupt.
-		 * Check for a default IRQ7. This can happen when
-		 * the IRQ input goes away before the acknowledge.
-		 * In this case, a 'default IRQ7' is generated, but
-		 * the corresponding bit in the ISR isn't set.
-		 * In fact, just ignore all such interrupts.
-		 */
-		iprint("cpu%d: spurious interrupt %d, last %d",
-			m->machno, vno-VectorPIC, m->lastintr);
-		for(i = 0; i < MAXMACH; i++){
-			if(active.machs[i] == 0)
-				continue;
-			mach = MACHP(i);
-			if(m->machno == mach->machno)
-				continue;
-			iprint(": cpu%d: last %d", mach->machno, mach->lastintr);
-		}
-		iprint("\n");
-		m->spuriousintr++;
-		return;
-	}
-	else{
-		dumpregs(ur);
-		print("unknown intr: %d\n", vno); /* */
-	}
-}
-
-void
-trap(Ureg *ur)
-{
-	char buf[ERRMAX];
-	int clockintr, user, x;
-
-	user = ur->status&UMODE;
-
-	if(user){
-		up = m->proc;
-		up->dbgreg = ur;
-	}
-	clockintr = 0;
-	switch ((int)ur->type) {
-	case 1:	/* arith */
-		fptrap(ur);
-		break;
-	case 2:	/* bad instr or FEN */
-		illegal(ur);
-		break;
-
-	case 3:	/* intr */
-		m->intr++;
-		switch ((int)ur->a0) {
-		case 0:	/* interprocessor */
-			panic("interprocessor intr");
-			break;
-		case 1:	/* clock */
-			clockintr = 1;
-			clock(ur);
-			break;
-		case 2:	/* machine check */
-			mcheck(ur, (void*)(KZERO|(ulong)ur->a2));
-			break;
-		case 3:	/* device */
-			intr(ur);
-			break;
-		case 4:	/* perf counter */
-			panic("perf count");
-			break;
-		default:
-			panic("bad intr");
-			break;
-		}
-		break;
-
-	case 4:	/* memory fault */
-		if(up == 0)
-			kernfault(ur, (ulong)ur->a1);
-
-		x = up->insyscall;
-		up->insyscall = 1;
-		spllo();
-		faultalpha(ur);
-		up->insyscall = x;
-		break;
-	case 6:	/* alignment fault */
-		ur->pc -= 4;
-		sprint(buf, "trap: unaligned addr 0x%lux", (ulong)ur->a0);
-		fataltrap(ur, buf);
-		break;
-	default:	/* cannot happen */
-		panic("bad trap type %d", (int)ur->type);
-		break;
-	}
-
-	splhi();
-
-	/* delaysched set because we held a lock or because our quantum ended */
-	if(up && up->delaysched && clockintr){
-		sched();
-		splhi();
-	}
-
-	if(user){
-		if(up->procctl || up->nnote)
-			notify(ur);
-		kexit(ur);
-	}
-}
-
-void
-trapinit(void)
-{
-	splhi();
-	wrent(0, intr0);
-	wrent(1, arith);
-	wrent(2, fault0);
-	wrent(3, illegal0);
-	wrent(4, unaligned);
-	wrent(5, syscall0);
-}
-
-void
-fataltrap(Ureg *ur, char *reason)
-{
-	char buf[ERRMAX];
-
-	if(ur->status&UMODE) {
-		spllo();
-		sprint(buf, "sys: %s", reason);
-		postnote(up, 1, buf, NDebug);
-		return;
-	}
-	print("kernel %s pc=%lux\n", reason, (ulong)ur->pc);
-	dumpregs(ur);
-	dumpstack();
-	if(m->machno == 0)
-		spllo();
-	exit(1);
-}
-
-void
-kernfault(Ureg *ur, int code)
-{
-	Label l;
-	char *s;
-
-	splhi();
-	if (code == 0)
-		s = "read";
-	else if (code == 1)
-		s = "write";
-	else
-		s = "ifetch";
-	print("panic: kfault %s VA=0x%lux\n", s, (ulong)ur->a0);
-	print("u=%#p status=0x%lux pc=0x%lux sp=0x%lux\n",
-			up, (ulong)ur->status, (ulong)ur->pc, (ulong)ur->sp);
-	dumpregs(ur);
-	l.sp = ur->sp;
-	l.pc = ur->pc;
-	dumpstack();
-	exit(1);
-}
-
-void
-dumpregs(Ureg *ur)
-{
-	int i, col;
-	uvlong *l;
-
-	if(up)
-		print("registers for %s %ld\n", up->text, up->pid);
-	else
-		print("registers for kernel\n");
-
-	l = &ur->type;
-	col = 0;
-	for (i = 0; i < sizeof regname/sizeof(char*); i++, l++) {
-		print("%-7s%.16llux%s", regname[i], *l, col == 2 ? "\n" : "     ");
-		if (col++ == 2)
-			col = 0;
-	}
-	print("\n");
-}
-
-
-/*
- * Fill in enough of Ureg to get a stack trace, and call a function.
- * Used by debugging interface rdb.
- */
-static void
-getpcsp(ulong *pc, ulong *sp)
-{
-	*pc = getcallerpc(&pc);
-	*sp = (ulong)&pc-8;
-}
-
-void
-callwithureg(void (*fn)(Ureg*))
-{
-	Ureg ureg;
-
-	getpcsp((ulong*)&ureg.pc, (ulong*)&ureg.sp);
-	ureg.r26 = getcallerpc(&fn);
-	fn(&ureg);
-}
-
-void
-_dumpstack(Ureg *ureg)
-{
-	ulong l, sl, el, v, i, instr, op;
-	extern ulong etext;
-
-	l=(ulong)&l;
-	if(l&4)
-		l += 4;
-	if(up == 0){
-		el = (ulong)m+BY2PG;
-		sl = el-KSTACK;
-	}
-	else{
-		sl = (ulong)up->kstack;
-		el = sl + KSTACK;
-	}
-	if(l > el || l < sl){
-		el = (ulong)m+BY2PG;
-		sl = el-KSTACK;
-	}
-	if(l > el || l < sl)
-		return;
-	print("ktrace /kernel/path %.8lux %.8lux %.8lux\n", (ulong)ureg->pc, (ulong)ureg->sp, (ulong)ureg->r26);
-
-	i = 0;
-	for(; l<el; l+=8){
-		v = *(ulong*)l - 4;
-		if(KTZERO < v && v < (ulong)&etext && (v&3) == 0){
-			/*
-			 * Check for JSR/BSR
-			 */
-			instr = *(ulong*)v;
-			op = (instr>>26);
-			if(op == 26 || op == 52){
-				print("%lux=%lux ", l, v);
-				i++;
-			}
-		}
-		if(i == 4){
-			i = 0;
-			print("\n");
-		}
-	}
-	if(i)
-		print("\n");
-}
-
-void
-dumpstack(void)
-{
-	callwithureg(_dumpstack);
-}
-
-int
-notify(Ureg *ur)
-{
-	int l;
-	ulong sp;
-	Note *n;
-
-	if(up->procctl)
-		procctl();
-	if(up->nnote == 0)
-		return 0;
-
-	if(up->fpstate == FPactive){
-		savefpregs(&up->fpsave);
-		up->fpstate = FPinactive;
-	}
-	up->fpstate |= FPillegal;
-
-	spllo();
-	qlock(&up->debug);
-	up->notepending = 0;
-
-	n = &up->note[0];
-	if(strncmp(n->msg, "sys:", 4) == 0) {
-		l = strlen(n->msg);
-		if(l > ERRMAX-15)	/* " pc=0x12345678\0" */
-			l = ERRMAX-15;
-
-		sprint(n->msg+l, " pc=0x%lux", (ulong)ur->pc);
-	}
-
-	if(n->flag != NUser && (up->notified || up->notify==0)) {
-		qunlock(&up->debug);
-		if(n->flag == NDebug)
-			pprint("suicide: %s\n", n->msg);
-		pexit(n->msg, n->flag!=NDebug);
-	}
-
-	if(up->notified) {
-		qunlock(&up->debug);
-		splhi();
-		return 0;
-	}
-		
-	if(!up->notify) {
-		qunlock(&up->debug);
-		pexit(n->msg, n->flag!=NDebug);
-	}
-	sp = ur->usp & ~(BY2V-1);
-	sp -= sizeof(Ureg);
-
-	if(!okaddr((uintptr)up->notify, BY2WD, 0)
-	|| !okaddr(sp-ERRMAX-6*BY2WD, sizeof(Ureg)+ERRMAX-6*BY2WD, 1)) {
-		qunlock(&up->debug);
-		pprint("suicide: bad address or sp in notify\n");
-		pexit("Suicide", 0);
-	}
-
-	memmove((Ureg*)sp, ur, sizeof(Ureg));
-	*(Ureg**)(sp-BY2WD) = up->ureg;	/* word under Ureg is old up->ureg */
-	up->ureg = (void*)sp;
-	sp -= 2*BY2WD+ERRMAX;
-	memmove((char*)sp, up->note[0].msg, ERRMAX);
-	sp -= 4*BY2WD;
-	*(ulong*)(sp+3*BY2WD) = sp+4*BY2WD;	/* arg 2 is string */
-	ur->r0 = (ulong)up->ureg;		/* arg 1 (R0) is ureg* */
-	*(ulong*)(sp+2*BY2WD) = (ulong)up->ureg;	/* arg 1 0(FP) is ureg* */
-	*(ulong*)(sp+0*BY2WD) = 0;		/* arg 0 is pc */
-	ur->usp = sp;
-	ur->pc = (ulong)up->notify;
-	up->notified = 1;
-	up->nnote--;
-	memmove(&up->lastnote, &up->note[0], sizeof(Note));
-	memmove(&up->note[0], &up->note[1], up->nnote*sizeof(Note));
-
-	qunlock(&up->debug);
-	splhi();
-	return 1;
-}
-
-/*
- * Check that status is OK to return from note.
- */
-int
-validstatus(ulong kstatus, ulong ustatus)
-{
-	if((kstatus & 7) != (ustatus & 7))
-		return 0;
-	if((ustatus&UMODE) != UMODE)
-		return 0;
-	return 1;
-}
-
-/*
- * Return user to state before notify()
- */
-void
-noted(Ureg *kur, Ureg **urp, ulong arg0)
-{
-	Ureg *nur;
-	ulong oureg, sp;
-
-	qlock(&up->debug);
-	if(arg0!=NRSTR && !up->notified) {
-		qunlock(&up->debug);
-		pprint("call to noted() when not notified\n");
-		pexit("Suicide", 0);
-	}
-	up->notified = 0;
-
-	up->fpstate &= ~FPillegal;
-
-	nur = up->ureg;
-
-	oureg = (ulong)nur;
-	if((oureg & (BY2V-1))
-	|| !okaddr(oureg-BY2WD, BY2WD+sizeof(Ureg), 0)){
-		qunlock(&up->debug);
-		pprint("bad ureg in noted or call to noted() when not notified\n");
-		pexit("Suicide", 0);
-	}
-
-	if(!validstatus(kur->status, nur->status)) {
-		qunlock(&up->debug);
-		pprint("bad noted ureg status %lux\n", (ulong)nur->status);
-		pexit("Suicide", 0);
-	}
-
-	memmove(*urp, up->ureg, sizeof(Ureg));
-	switch(arg0) {
-	case NCONT:
-	case NRSTR:
-		if(!okaddr(nur->pc, BY2WD, 0) || !okaddr(nur->usp, BY2WD, 0)){
-			qunlock(&up->debug);
-			pprint("suicide: trap in noted\n");
-			pexit("Suicide", 0);
-		}
-		up->ureg = (Ureg*)(*(ulong*)(oureg-BY2WD));
-		qunlock(&up->debug);
-		splhi();
-		rfnote(urp);
-		break;
-
-	case NSAVE:
-		if(!okaddr(nur->pc, BY2WD, 0) || !okaddr(nur->usp, BY2WD, 0)){
-			qunlock(&up->debug);
-			pprint("suicide: trap in noted\n");
-			pexit("Suicide", 0);
-		}
-		qunlock(&up->debug);
-		sp = oureg-4*BY2WD-ERRMAX;
-		splhi();
-		(*urp)->sp = sp;
-		((ulong*)sp)[1] = oureg;	/* arg 1 0(FP) is ureg* */
-		((ulong*)sp)[0] = 0;			/* arg 0 is pc */
-		(*urp)->r0 = oureg;		/* arg 1 is ureg* */
-		rfnote(urp);
-		break;
-
-	default:
-		up->lastnote.flag = NDebug;
-		/* fall through */
-		
-	case NDFLT:
-		qunlock(&up->debug);
-		if(up->lastnote.flag == NDebug)
-			pprint("suicide: %s\n", up->lastnote.msg);
-		pexit(up->lastnote.msg, up->lastnote.flag!=NDebug);
-	}
-}
-
-#include "../port/systab.h"
-
-long
-syscall(Ureg *aur)
-{
-	int i;
-	char *e;
-	long ret;
-	ulong sp;
-	Ureg *ur;
-	ulong scallnr;
-
-	m->syscall++;
-	up = m->proc;
-	up->insyscall = 1;
-	ur = aur;
-	up->pc = ur->pc;
-	up->dbgreg = aur;
-	ur->type = 5;		/* for debugging */
-
-	scallnr = ur->r0;
-	up->scallnr = ur->r0;
-	spllo();
-
-	sp = ur->sp;
-	up->nerrlab = 0;
-	ret = -1;
-	if(!waserror()) {
-		if(scallnr >= nsyscall || systab[scallnr] == nil){
-			pprint("bad sys call %d pc %lux\n", up->scallnr, (ulong)ur->pc);
-			postnote(up, 1, "sys: bad sys call", NDebug);
-			error(Ebadarg);
-		}
-
-		if(sp & (BY2WD-1)){	/* XXX too weak? */
-			pprint("odd sp in sys call pc %lux sp %lux\n",
-				(ulong)ur->pc, (ulong)ur->sp);
-			postnote(up, 1, "sys: odd stack", NDebug);
-			error(Ebadarg);
-		}
-
-		if(sp<(USTKTOP-BY2PG) || sp>(USTKTOP-sizeof(Sargs)))
-			validaddr(sp, sizeof(Sargs), 0);
-
-		up->s = *((Sargs*)(sp+2*BY2WD));
-		up->psstate = sysctab[scallnr];
-		ret = systab[scallnr]((va_list)up->s.args);
-		poperror();
-	}else{
-		/* failure: save the error buffer for errstr */
-		e = up->syserrstr;
-		up->syserrstr = up->errstr;
-		up->errstr = e;
-	}
-	if(up->nerrlab){
-		print("bad errstack [%uld]: %d extra\n", scallnr, up->nerrlab);
-		for(i = 0; i < NERR; i++)
-			print("sp=%lux pc=%lux\n",
-				up->errlab[i].sp, up->errlab[i].pc);
-		panic("error stack");
-	}
-
-	up->nerrlab = 0;
-	up->psstate = 0;
-	up->insyscall = 0;
-	if(scallnr == NOTED)			/* ugly hack */
-		noted(ur, &aur, *(ulong*)(sp+2*BY2WD));	/* doesn't return */
-
-	if(scallnr!=RFORK && (up->procctl || up->nnote)){
-		ur->r0 = ret;				/* load up for noted() */
-		if(notify(ur))
-			return ur->r0;
-	}
-
-	return ret;
-}
-
-void
-forkchild(Proc *p, Ureg *ur)
-{
-	Ureg *cur;
-
-	p->sched.sp = (ulong)p->kstack+KSTACK-(4*BY2WD+sizeof(Ureg));
-	p->sched.pc = (ulong)forkret;
-
-	cur = (Ureg*)(p->sched.sp+4*BY2WD);
-	memmove(cur, ur, sizeof(Ureg));
-
-	/* Things from bottom of syscall we never got to execute */
-	p->psstate = 0;
-	p->insyscall = 0;
-}
-
-static
-void
-linkproc(void)
-{
-	spllo();
-	up->kpfun(up->kparg);
-	pexit("kproc exiting", 0);
-}
-
-void
-kprocchild(Proc *p, void (*func)(void*), void *arg)
-{
-	p->sched.pc = (ulong)linkproc;
-	p->sched.sp = (ulong)p->kstack+KSTACK;
-
-	p->kpfun = func;
-	p->kparg = arg;
-}
-
-uintptr
-execregs(uintptr entry, ulong ssize, ulong nargs)
-{
-	Ureg *ur;
-	ulong *sp;
-
-	sp = (ulong*)(USTKTOP - ssize);
-	*--sp = nargs;
-
-	ur = (Ureg*)up->dbgreg;
-	ur->usp = (ulong)sp;
-	ur->pc = entry;
-	return USTKTOP-BY2WD;			/* address of user-level clock */
-}
-
-uintptr
-userpc(void)
-{
-	Ureg *ur;
-
-	ur = (Ureg*)up->dbgreg;
-	return ur->pc;
-}
-
-/* This routine must save the values of registers the user is not permitted to write
- * from devproc and then restore the saved values before returning
- */
-void
-setregisters(Ureg *xp, char *pureg, char *uva, int n)
-{
-	ulong status;
-
-	status = xp->status;
-	memmove(pureg, uva, n);
-	xp->status = status;
-}
-
-/* Give enough context in the ureg to produce a kernel stack for
- * a sleeping process
- */
-void
-setkernur(Ureg *xp, Proc *p)
-{
-	xp->pc = p->sched.pc;
-	xp->sp = p->sched.sp;
-	xp->r26 = (ulong)sched;
-}
-
-uintptr
-dbgpc(Proc *p)
-{
-	Ureg *ur;
-
-	ur = p->dbgreg;
-	if(ur == 0)
-		return 0;
-
-	return ur->pc;
-}
-
-void
-illegal(Ureg *ur)
-{
-	switch ((int)ur->a0) {
-	case 0:	/* breakpoint */
-		ur->pc -= 4;
-		fataltrap(ur, "breakpoint");
-		break;
-	case 1:	/* bugchk */
-		fataltrap(ur, "trap: bugchk");
-		break;
-	case 2:	/* gentrap */
-		fataltrap(ur, "trap: gentrap");
-		break;
-	case 3:	/* FEN */
-		fen(ur);
-		break;
-	case 4:	/* opDEC */
-		fataltrap(ur, "trap: illegal instruction");
-		break;
-	default:
-		panic("illegal illegal %d", (int)ur->a0);
-		break;
-	}
-}
-
-void
-fen(Ureg *ur)
-{
-	if(up){
-		switch(up->fpstate){
-		case FPinit:
-			restfpregs(&initfp);
-			up->fpstate = FPactive;
-//print("EI=%lux+", initfp.fpstatus);
-			return;
-
-		case FPinactive:
-			restfpregs(&up->fpsave);
-			up->fpstate = FPactive;
-//print("EIA=%lux+", up->fpsave.fpstatus);
-			return;
-		}
-	}
-	fataltrap(ur, "trap: floating enable");	/* should never happen */
-}
--- a/sys/src/9/mkfile
+++ b/sys/src/9/mkfile
@@ -1,5 +1,4 @@
 ARCH=\
-	alphapc\
 	bcm\
 	bitsy\
 	kw\
--- a/sys/src/ape/lib/9/alpha/getcallerpc.s
+++ /dev/null
@@ -1,4 +1,0 @@
-TEXT	getcallerpc(SB), $-8
-	MOVL	0(SP), R0
-	RET
-
--- a/sys/src/ape/lib/9/alpha/getfcr.s
+++ /dev/null
@@ -1,57 +1,0 @@
-#define	EXCB	WORD	$0x60000400		/* until 7a/7l catch up */
-
-TEXT	getfsr(SB), $8
-	EXCB
-	MOVT	FPCR, F0
-	EXCB
-	MOVT	F0, tmp-8(SP)
-	MOVL	tmp-4(SP), R1
-	MOVQ	$0x01e00000, R2
-	AND		R2, R1, R0
-	RET
-
-TEXT	setfsr(SB), $8
-	MOVQ	$0x01e00000, R2
-	EXCB
-	MOVT	FPCR, F0
-	EXCB
-	MOVT	F0, tmp-8(SP)
-	MOVL	tmp-4(SP), R1
-	ANDNOT	R2, R1, R3
-	AND		R2, R0, R4
-	OR		R3, R4, R5
-	MOVL	R5, tmp-4(SP)
-	MOVT	tmp-8(SP), F0
-	EXCB
-	MOVT	F0, FPCR
-	EXCB
-	RET
-
-TEXT	getfcr(SB), $8
-	EXCB
-	MOVT	FPCR, F0
-	EXCB
-	MOVT	F0, tmp-8(SP)
-	MOVL	tmp-4(SP), R1
-	MOVQ	$0x700c0000, R2
-	AND		R2, R1, R0
-	XOR		R2, R0
-	RET
-
-TEXT	setfcr(SB), $8
-	MOVQ	$0x700c0000, R2
-	XOR		R2, R0
-	EXCB
-	MOVT	FPCR, F0
-	EXCB
-	MOVT	F0, tmp-8(SP)
-	MOVL	tmp-4(SP), R1
-	ANDNOT	R2, R1, R3
-	AND		R2, R0, R4
-	OR		R3, R4, R5
-	MOVL	R5, tmp-4(SP)
-	MOVT	tmp-8(SP), F0
-	EXCB
-	MOVT	F0, FPCR
-	EXCB
-	RET
--- a/sys/src/ape/lib/ap/alpha/_seek.c
+++ /dev/null
@@ -1,12 +1,0 @@
-extern	long	__SEEK(long long*, int, long long, int);
-
-long long
-_SEEK(int fd, long long o, int p)
-{
-	long long l;
-
-	if(__SEEK(&l, fd, o, p) < 0)
-		l = -1;
-	return l;
-}
-
--- a/sys/src/ape/lib/ap/alpha/cycles.c
+++ /dev/null
@@ -1,5 +1,0 @@
-void
-_cycles(unsigned long long *u)
-{
-	*u = 0;
-}
--- a/sys/src/ape/lib/ap/alpha/divl.s
+++ /dev/null
@@ -1,189 +1,0 @@
-/*
- *	ulong
- *	_udiv(ulong num, ulong den)
- *	{
- *		int i;
- *		ulong quo;
- *
- *		if(den == 0)
- *			*(ulong*)-1 = 0;
- *		quo = num;
- *		if(quo > 1<<(32-1))
- *			quo = 1<<(32-1);
- *		for(i=0; den<quo; i++)
- *			den <<= 1;
- *		quo = 0;
- *		for(; i>=0; i--) {
- *			quo <<= 1;
- *			if(num >= den) {
- *				num -= den;
- *				quo |= 1;
- *			}
- *			den >>= 1;
- *		}
- *		return quo::num;
- *	}
- */
-
-#define	NOPROF	1
-
-/*
- * calling sequence:
- *	num: 8(R30)
- *	den: 12(R30)
- * returns
- *	quo: 8(R30)
- *	rem: 12(R30)
- */
-TEXT	_udivmodl(SB), NOPROF, $-8
-
-	MOVQ	$-1, R11
-	SLLQ	$31, R11			/* (1<<31) in canonical form */
-	MOVL	8(R30), R23	/* numerator */
-	MOVL	12(R30), R10	/* denominator */
-	BNE	R10, udm20
-	MOVQ	R31, -1(R31)	/* fault -- divide by zero; todo: use gentrap? */
-udm20:
-	MOVQ	R23, R12
-	BGE	R12, udm34
-	MOVQ	R11, R12
-udm34:
-	MOVQ	R31, R11
-udm38:
-	CMPUGE	R10, R12, R24
-	BNE	R24, udm54
-	SLLL	$1, R10
-	ADDQ	$1, R11
-	JMP	udm38
-udm54:
-	MOVQ	R31, R12
-udm58:
-	BLT	R11, udm8c
-	SLLL		$1, R12
-	CMPUGE	R23, R10, R24
-	BEQ		R24, udm7c
-	SUBL		R10, R23
-	OR		$1, R12
-udm7c:
-	SRLL		$1, R10
-	SUBQ	$1, R11
-	JMP	udm58
-udm8c:
-	MOVL	R12, 8(R30)	/* quotient */
-	MOVL	R23, 12(R30)	/* remainder */
-	RET
-
-/*
- * save working registers
- * and bring in num/den parameters
- */
-TEXT	_unsargl(SB), NOPROF, $-8
-	MOVQ	R10, 24(R30)
-	MOVQ	R11, 32(R30)
-	MOVQ	R12, 40(R30)
-	MOVQ	R23, 48(R30)
-	MOVQ	R24, 56(R30)
-
-	MOVL	R27, 8(R30)
-	MOVL	72(R30), R27
-	MOVL	R27, 12(R30)
-
-	RET
-
-/*
- * save working registers
- * and bring in absolute value
- * of num/den parameters
- */
-TEXT	_absargl(SB), NOPROF, $-8
-	MOVQ	R10, 24(R30)
-	MOVQ	R11, 32(R30)
-	MOVQ	R12, 40(R30)
-	MOVQ	R23, 48(R30)
-	MOVQ	R24, 56(R30)
-
-	MOVL	R27, 64(R30)
-	BGE	R27, ab1
-	SUBL	R27, R31, R27
-ab1:
-	MOVL	R27, 8(R30)	/* numerator */
-
-	MOVL	72(R30), R27
-	BGE	R27, ab2
-	SUBL	R27, R31, R27
-ab2:
-	MOVL	R27, 12(R30)	/* denominator */
-	RET
-
-/*
- * restore registers and
- * return to original caller
- * answer is in R27
- */
-TEXT	_retargl(SB), NOPROF, $-8
-	MOVQ	24(R30), R10
-	MOVQ	32(R30), R11
-	MOVQ	40(R30), R12
-	MOVQ	48(R30), R23
-	MOVQ	56(R30), R24
-	MOVL	0(R30), R26
-
-	ADDQ	$64, R30
-	RET			/* back to main sequence */
-
-TEXT	_divl(SB), NOPROF, $-8
-	SUBQ	$64, R30	/* 5 reg save, 2 parameters, link */
-	MOVL	R26, 0(R30)
-
-	JSR	_absargl(SB)
-	JSR	_udivmodl(SB)
-	MOVL	8(R30), R27
-
-	MOVL	64(R30), R10	/* clean up the sign */
-	MOVL	72(R30), R11
-	XOR	R11, R10
-	BGE	R10, div1
-	SUBL	R27, R31, R27
-div1:
-
-	JSR	_retargl(SB)
-	RET			/* not executed */
-
-TEXT	_divlu(SB), NOPROF, $-8
-	SUBQ	$64, R30	/* 5 reg save, 2 parameters, link */
-	MOVL	R26, 0(R30)
-
-	JSR	_unsargl(SB)
-	JSR	_udivmodl(SB)
-	MOVL	8(R30), R27
-
-	JSR	_retargl(SB)
-	RET			/* not executed */
-
-TEXT	_modl(SB), NOPROF, $-8
-	SUBQ	$64, R30	/* 5 reg save, 2 parameters, link */
-	MOVL	R26, 0(R30)
-
-	JSR	_absargl(SB)
-	JSR	_udivmodl(SB)
-	MOVL	12(R30), R27
-
-	MOVL	64(R30), R10	/* clean up the sign */
-	BGE	R10, div2
-	SUBL	R27, R31, R27
-div2:
-
-	JSR	_retargl(SB)
-	RET			/* not executed */
-
-TEXT	_modlu(SB), NOPROF, $-8
-	SUBQ	$64, R30	/* 5 reg save, 2 parameters, link */
-	MOVL	R26, 0(R30)
-
-	JSR	_unsargl(SB)
-	JSR	_udivmodl(SB)
-	MOVL	12(R30), R27
-
-	JSR	_retargl(SB)
-	RET			/* not executed */
-
--- a/sys/src/ape/lib/ap/alpha/divq.s
+++ /dev/null
@@ -1,191 +1,0 @@
-/*
- *	uvlong
- *	_udiv(uvlong num, uvlong den)
- *	{
- *		int i;
- *		uvlong quo;
- *
- *		if(den == 0)
- *			*(ulong*)-1 = 0;
- *		quo = num;
- *		if(quo > 1<<(64-1))
- *			quo = 1<<(64-1);
- *		for(i=0; den<quo; i++)
- *			den <<= 1;
- *		quo = 0;
- *		for(; i>=0; i--) {
- *			quo <<= 1;
- *			if(num >= den) {
- *				num -= den;
- *				quo |= 1;
- *			}
- *			den >>= 1;
- *		}
- *		return quo::num;
- *	}
- */
-
-#define	NOPROF	1
-
-/*
- * calling sequence:
- *	num: 8(R30)
- *	den: 16(R30)
- * returns
- *	quo: 8(R30)
- *	rem: 16(R30)
- */
-TEXT	_udivmodq(SB), NOPROF, $-8
-
-	MOVQ	$1, R11
-	SLLQ	$63, R11
-	MOVQ	8(R30), R23	/* numerator */
-	MOVQ	16(R30), R10	/* denominator */
-	BNE	R10, udm20
-	MOVQ	R31, -1(R31)	/* fault -- divide by zero; todo: use gentrap? */
-udm20:
-	MOVQ	R23, R12
-	BGE	R12, udm34
-	MOVQ	R11, R12
-udm34:
-	MOVQ	R31, R11
-udm38:
-	CMPUGE	R10, R12, R24
-	BNE	R24, udm54
-	SLLQ	$1, R10
-	ADDQ	$1, R11
-	JMP	udm38
-udm54:
-	MOVQ	R31, R12
-udm58:
-	BLT	R11, udm8c
-	SLLQ	$1, R12
-	CMPUGE	R23, R10, R24
-	BEQ	R24, udm7c
-	SUBQ	R10, R23
-	OR	$1, R12
-udm7c:
-	SRLQ	$1, R10
-	SUBQ	$1, R11
-	JMP	udm58
-udm8c:
-	MOVQ	R12, 8(R30)	/* quotient */
-	MOVQ	R23, 16(R30)	/* remainder */
-	RET
-
-/*
- * save working registers
- * and bring in num/den parameters
- */
-TEXT	_unsargq(SB), NOPROF, $-8
-	MOVQ	R10, 24(R30)
-	MOVQ	R11, 32(R30)
-	MOVQ	R12, 40(R30)
-	MOVQ	R23, 48(R30)
-	MOVQ	R24, 56(R30)
-
-	MOVQ	R27, 8(R30)
-	MOVQ	72(R30), R27
-	MOVQ	R27, 16(R30)
-
-MOVQ	(R30), R10	/* debug */
-	RET
-
-/*
- * save working registers
- * and bring in absolute value
- * of num/den parameters
- */
-TEXT	_absargq(SB), NOPROF, $-8
-	MOVQ	R10, 24(R30)
-	MOVQ	R11, 32(R30)
-	MOVQ	R12, 40(R30)
-	MOVQ	R23, 48(R30)
-	MOVQ	R24, 56(R30)
-
-	MOVQ	R27, 64(R30)
-	BGE	R27, ab1
-	SUBQ	R27, R31, R27
-ab1:
-	MOVQ	R27, 8(R30)	/* numerator */
-
-	MOVQ	72(R30), R27
-	BGE	R27, ab2
-	SUBQ	R27, R31, R27
-ab2:
-	MOVQ	R27, 16(R30)	/* denominator */
-MOVQ	(R30), R10	/* debug */
-	RET
-
-/*
- * restore registers and
- * return to original caller
- * answer is in R27
- */
-TEXT	_retargq(SB), NOPROF, $-8
-	MOVQ	24(R30), R10
-	MOVQ	32(R30), R11
-	MOVQ	40(R30), R12
-	MOVQ	48(R30), R23
-	MOVQ	56(R30), R24
-	MOVL	0(R30), R26
-
-	ADDQ	$64, R30
-	RET			/* back to main sequence */
-
-TEXT	_divq(SB), NOPROF, $-8
-	SUBQ	$64, R30	/* 5 reg save, 2 parameters, link */
-	MOVQ	R26, 0(R30)
-
-	JSR	_absargq(SB)
-	JSR	_udivmodq(SB)
-	MOVQ	8(R30), R27
-
-	MOVQ	64(R30), R10	/* clean up the sign */
-	MOVQ	72(R30), R11
-	XOR	R11, R10
-	BGE	R10, div1
-	SUBQ	R27, R31, R27
-div1:
-
-	JSR	_retargq(SB)
-	RET			/* not executed */
-
-TEXT	_divqu(SB), NOPROF, $-8
-	SUBQ	$64, R30	/* 5 reg save, 2 parameters, link */
-	MOVQ	R26, 0(R30)
-
-	JSR	_unsargq(SB)
-	JSR	_udivmodq(SB)
-	MOVQ	8(R30), R27
-
-	JSR	_retargq(SB)
-	RET			/* not executed */
-
-TEXT	_modq(SB), NOPROF, $-8
-	SUBQ	$64, R30	/* 5 reg save, 2 parameters, link */
-	MOVQ	R26, 0(R30)
-
-	JSR	_absargq(SB)
-	JSR	_udivmodq(SB)
-	MOVQ	16(R30), R27
-
-	MOVQ	64(R30), R10	/* clean up the sign */
-	BGE	R10, div2
-	SUBQ	R27, R31, R27
-div2:
-
-	JSR	_retargq(SB)
-	RET			/* not executed */
-
-TEXT	_modqu(SB), NOPROF, $-8
-	SUBQ	$64, R30	/* 5 reg save, 2 parameters, link */
-	MOVQ	R26, 0(R30)
-
-	JSR	_unsargq(SB)
-	JSR	_udivmodq(SB)
-	MOVQ	16(R30), R27
-
-	JSR	_retargq(SB)
-	RET			/* not executed */
-
--- a/sys/src/ape/lib/ap/alpha/getfcr.s
+++ /dev/null
@@ -1,33 +1,0 @@
-TEXT	getfsr(SB), $8
-	TRAPB
-	MOVT	FPCR, F0
-	TRAPB
-	MOVT	F0, tmp-8(SP)
-	MOVL	tmp-4(SP), R0
-	RET
-
-TEXT	setfsr(SB), $8
-	SLLQ		$32, R0
-	MOVQ	R0, tmp-8(SP)
-	MOVT	tmp-8(SP), F0
-	TRAPB
-	MOVT	F0, FPCR
-	TRAPB
-	RET
-
-TEXT	getfcr(SB), $8
-	TRAPB
-	MOVT	FPCR, F0
-	TRAPB
-	MOVT	F0, tmp-8(SP)
-	MOVL	tmp-4(SP), R0
-	RET
-
-TEXT	setfcr(SB), $8
-	SLLQ		$32, R0
-	MOVQ	R0, tmp-8(SP)
-	MOVT	tmp-8(SP), F0
-	TRAPB
-	MOVT	F0, FPCR
-	TRAPB
-	RET
--- a/sys/src/ape/lib/ap/alpha/lock.c
+++ /dev/null
@@ -1,26 +1,0 @@
-#define _LOCK_EXTENSION
-#include "../plan9/sys9.h"
-#include <lock.h>
-
-int	tas(int*);
-
-void
-lock(Lock *lk)
-{
-	while(tas(&lk->val))
-		_SLEEP(0);
-}
-
-int
-canlock(Lock *lk)
-{
-	if(tas(&lk->val))
-		return 0;
-	return 1;
-}
-
-void
-unlock(Lock *lk)
-{
-	lk->val = 0;
-}
--- a/sys/src/ape/lib/ap/alpha/main9.s
+++ /dev/null
@@ -1,39 +1,0 @@
-#define NPRIVATES	16
-
-GLOBL	_tos(SB), $4
-GLOBL	_errnoloc(SB), $4
-GLOBL	_plan9err(SB), $4
-GLOBL	_privates(SB), $4
-GLOBL	_nprivates(SB), $4
-
-TEXT	_main(SB), 1, $(20+4+128+NPRIVATES*4)
-	MOVQ	$setSB(SB), R29
-
-	/* _tos = arg */
-	MOVL	R0, _tos(SB)
-
-	MOVL	$20(R30), R1
-	MOVL	R1, _errnoloc(SB)
-	ADDL	$4, R1
-	MOVL	R1, _plan9err(SB)
-	ADDL	$128, R1
-	MOVL	R1, _privates(SB)
-	MOVQ	$NPRIVATES, R1
-	MOVL	R1, _nprivates(SB)
-
-	JSR	_envsetup(SB)
-
-	/* main(argc, argv, environ); */
-	MOVL	inargc-4(FP), R0
-	MOVL	$inargv+0(FP), R1
-	MOVL	environ(SB), R2
-	MOVL	R0, 8(R30)
-	MOVL	R1, 12(R30)
-	MOVL	R2, 16(R30)
-	JSR	main(SB)
-loop:
-	MOVL	R0, 8(R30)
-	JSR	exit(SB)
-	MOVQ	$_divq(SB), R31		/* force loading of divq */
-	MOVQ	$_divl(SB), R31			/* force loading of divl */
-	JMP	loop
--- a/sys/src/ape/lib/ap/alpha/main9p.s
+++ /dev/null
@@ -1,56 +1,0 @@
-#define NPRIVATES	16
-
-GLOBL	_tos(SB), $4
-GLOBL	_errnoloc(SB), $4
-GLOBL	_plan9err(SB), $4
-GLOBL	_privates(SB), $4
-GLOBL	_nprivates(SB), $4
-
-TEXT	_mainp(SB), 1, $(20+4+128+NPRIVATES*4)
-	MOVQ	$setSB(SB), R29
-
-	/* _tos = arg */
-	MOVL	R0, _tos(SB)
-
-	MOVL	$20(R30), R1
-	MOVL	R1, _errnoloc(SB)
-	ADDL	$4, R1
-	MOVL	R1, _plan9err(SB)
-	ADDL	$128, R1
-	MOVL	R1, _privates(SB)
-	MOVQ	$NPRIVATES, R1
-	MOVL	R1, _nprivates(SB)
-
-	/* _profmain(); */
-	JSR	_profmain(SB)
-
-	/* _tos->prof.pp = _tos->prof.next; */
-	MOVL	_tos+0(SB), R1
-	MOVL	4(R1), R2
-	MOVL	R2, 0(R1)
-
-	JSR	_envsetup(SB)
-
-	/* main(argc, argv, environ); */
-	MOVL	inargc-4(FP), R0
-	MOVL	$inargv+0(FP), R1
-	MOVL	environ(SB), R2
-	MOVL	R0, 8(R30)
-	MOVL	R1, 12(R30)
-	MOVL	R2, 16(R30)
-	JSR	main(SB)
-loop:
-	MOVL	R0, 8(R30)
-	JSR	exit(SB)
-	MOVQ	$_divq(SB), R31		/* force loading of divq */
-	MOVQ	$_divl(SB), R31		/* force loading of divl */
-	MOVQ	$_profin(SB), R31	/* force loading of profile */
-	JMP	loop
-
-TEXT	_saveret(SB), 1, $0
-TEXT	_savearg(SB), 1, $0
-	RET
-
-TEXT	_callpc(SB), 1, $0
-	MOVL	argp-8(FP), R0
-	RET
--- a/sys/src/ape/lib/ap/alpha/memcpy.c
+++ /dev/null
@@ -1,7 +1,0 @@
-#include <string.h>
-
-void*
-memcpy(void *a1, const void *a2, size_t n)
-{
-	return memmove(a1, a2, n);
-}
--- a/sys/src/ape/lib/ap/alpha/memmove.s
+++ /dev/null
@@ -1,197 +1,0 @@
-#define QUAD	8
-#define ALIGN	64
-#define BLOCK	64
-
-TEXT memmove(SB), $0
-	MOVL	from+4(FP), R7
-	MOVL	n+8(FP), R10
-	MOVQ	R0, R6
-
-	CMPUGE	R7, R0, R5
-	BNE	R5, _forward
-
-	MOVQ	R6, R8			/* end to address */
-	ADDL	R10, R6, R6		/* to+n */
-	ADDL	R10, R7, R7		/* from+n */
-
-	CMPUGE	$ALIGN, R10, R1		/* need at least ALIGN bytes */
-	BNE	R1, _b1tail
-
-_balign:
-	AND	$(ALIGN-1), R6, R1
-	BEQ	R1, _baligned
-
-	MOVBU	-1(R7), R2
-	ADDL	$-1, R6, R6
-	MOVB	R2, (R6)
-	ADDL	$-1, R7, R7
-	JMP	_balign
-	
-_baligned:
-	AND	$(QUAD-1), R7, R1	/* is the source quad-aligned */
-	BNE	R1, _bunaligned
-
-	ADDL	$(BLOCK-1), R8, R9
-_bblock:
-	CMPUGE	R9, R6, R1
-	BNE	R1, _b8tail
-
-	MOVQ	-64(R7), R22
-	MOVQ	-56(R7), R23
-	MOVQ	-48(R7), R24
-	MOVQ	-40(R7), R25
-	MOVQ	-32(R7), R2
-	MOVQ	-24(R7), R3
-	MOVQ	-16(R7), R4
-	MOVQ	-8(R7), R5
-
-	SUBL	$64, R6, R6
-	SUBL	$64, R7, R7
-
-	MOVQ	R22, (R6)
-	MOVQ	R23, 8(R6)
-	MOVQ	R24, 16(R6)
-	MOVQ	R25, 24(R6)
-	MOVQ	R2, 32(R6)
-	MOVQ	R3, 40(R6)
-	MOVQ	R4, 48(R6)
-	MOVQ	R5, 56(R6)
-	JMP	_bblock
-
-_b8tail:
-	ADDL	$(QUAD-1), R8, R9
-_b8block:
-	CMPUGE	R9, R6, R1
-	BNE	R1, _b1tail
-
-	MOVQ	-8(R7), R2
-	SUBL	$8, R6
-	MOVQ	R2, (R6)
-	SUBL	$8, R7
-	JMP	_b8block
-
-_b1tail:
-	CMPUGE	R8, R6, R1
-	BNE	R1, _ret
-
-	MOVBU	-1(R7), R2
-	SUBL	$1, R6, R6
-	MOVB	R2, (R6)
-	SUBL	$1, R7, R7
-	JMP	_b1tail
-_ret:
-	RET
-
-_bunaligned:
-	ADDL	$(16-1), R8, R9
-
-_bu8block:
-	CMPUGE	R9, R6, R1
-	BNE	R1, _b1tail
-
-	MOVQU	-16(R7), R4
-	MOVQU	-8(R7), R3
-	MOVQU	(R7), R2
-	SUBL	$16, R6
-	EXTQH	R7, R2, R2
-	EXTQL	R7, R3, R5
-	OR	R5, R2, R11
-	EXTQH	R7, R3, R3
-	EXTQL	R7, R4, R4
-	OR	R3, R4, R13
-	MOVQ	R11, 8(R6)
-	MOVQ	R13, (R6)
-	SUBL	$16, R7
-	JMP	_bu8block
-
-_forward:
-	ADDL	R10, R6, R8		/* end to address */
-
-	CMPUGE	$ALIGN, R10, R1		/* need at least ALIGN bytes */
-	BNE	R1, _f1tail
-
-_falign:
-	AND	$(ALIGN-1), R6, R1
-	BEQ	R1, _faligned
-
-	MOVBU	(R7), R2
-	ADDL	$1, R6, R6
-	ADDL	$1, R7, R7
-	MOVB	R2, -1(R6)
-	JMP	_falign
-
-_faligned:
-	AND	$(QUAD-1), R7, R1	/* is the source quad-aligned */
-	BNE	R1, _funaligned
-
-	SUBL	$(BLOCK-1), R8, R9
-_fblock:
-	CMPUGT	R9, R6, R1
-	BEQ	R1, _f8tail
-
-	MOVQ	(R7), R2
-	MOVQ	8(R7), R3
-	MOVQ	16(R7), R4
-	MOVQ	24(R7), R5
-	MOVQ	32(R7), R22
-	MOVQ	40(R7), R23
-	MOVQ	48(R7), R24
-	MOVQ	56(R7), R25
-
-	ADDL	$64, R6, R6
-	ADDL	$64, R7, R7
-
-	MOVQ	R2, -64(R6)
-	MOVQ	R3, -56(R6)
-	MOVQ	R4, -48(R6)
-	MOVQ	R5, -40(R6)
-	MOVQ	R22, -32(R6)
-	MOVQ	R23, -24(R6)
-	MOVQ	R24, -16(R6)
-	MOVQ	R25, -8(R6)
-	JMP	_fblock
-
-_f8tail:
-	SUBL	$(QUAD-1), R8, R9
-_f8block:
-	CMPUGT	R9, R6, R1
-	BEQ	R1, _f1tail
-
-	MOVQ	(R7), R2
-	ADDL	$8, R6
-	ADDL	$8, R7
-	MOVQ	R2, -8(R6)
-	JMP	_f8block
-
-_f1tail:
-	CMPUGT	R8, R6, R1
-	BEQ	R1, _fret
-	MOVBU	(R7), R2
-	ADDL	$1, R6, R6
-	ADDL	$1, R7, R7
-	MOVB	R2, -1(R6)
-	JMP	_f1tail
-
-_fret:
-	RET
-
-_funaligned:
-	SUBL	$(16-1), R8, R9
-_fu8block:
-	CMPUGT	R9, R6, R1
-	BEQ	R1, _f1tail
-
-	MOVQU	(R7), R2
-	MOVQU	8(R7), R3
-	MOVQU	16(R7), R4
-	EXTQL	R7, R2, R2
-	EXTQH	R7, R3, R5
-	OR	R5, R2, R11
-	EXTQL	R7, R3, R3
-	MOVQ	R11, (R6)
-	EXTQH	R7, R4, R4
-	OR	R3, R4, R11
-	MOVQ	R11, 8(R6)
-	ADDL	$16, R6
-	ADDL	$16, R7
-	JMP	_fu8block
--- a/sys/src/ape/lib/ap/alpha/memset.s
+++ /dev/null
@@ -1,61 +1,0 @@
-TEXT memset(SB), $0
-	MOVL	R0, R6
-	MOVBU	data+4(FP), R2
-	MOVL	n+8(FP), R10
-
-	ADDL	R10, R0, R8
-
-	CMPUGE	$8, R10, R1		/* need at least 8 bytes */
-	BNE	R1, _1loop
-
-	SLLQ	$8, R2, R1		/* replicate the byte */
-	OR	R1, R2
-	SLLQ	$16, R2, R1
-	OR	R1, R2
-	SLLQ	$32, R2, R1
-	OR	R1, R2
-
-_align:
-	AND	$(8-1), R6, R1
-	BEQ	R1, _aligned
-
-	MOVB	R2, (R6)
-	ADDL	$1, R6, R6
-	JMP	_align
-
-_aligned:
-	SUBL	$(64-1), R8, R9		/* end pointer minus slop */
-_64loop:
-	CMPUGT	R9, R6, R1
-	BEQ	R1, _8tail
-
-	MOVQ	R2, (R6)
-	MOVQ	R2, 8(R6)
-	MOVQ	R2, 16(R6)
-	MOVQ	R2, 24(R6)
-	MOVQ	R2, 32(R6)
-	MOVQ	R2, 40(R6)
-	MOVQ	R2, 48(R6)
-	MOVQ	R2, 56(R6)
-	ADDL	$64, R6, R6
-	JMP	_64loop
-
-_8tail:
-	SUBL	$(8-1), R8, R9
-_8loop:
-	CMPUGT	R9, R6, R1
-	BEQ	R1, _1loop
-
-	MOVQ	R2, (R6)
-	ADDL	$8, R6
-	JMP	_8loop
-
-_1loop:
-	CMPUGT	R8, R6, R1
-	BEQ	R1, _ret
-	MOVB	R2, (R6)
-	ADDL	$1, R6
-	JMP	_1loop
-
-_ret:
-	RET
--- a/sys/src/ape/lib/ap/alpha/mkfile
+++ /dev/null
@@ -1,23 +1,0 @@
-APE=/sys/src/ape
-<$APE/config
-LIB=/$objtype/lib/ape/libap.a
-OFILES=\
-	_seek.$O\
-	cycles.$O\
-	divl.$O\
-	divq.$O\
-	getfcr.$O\
-	lock.$O\
-	main9.$O\
-	main9p.$O\
-	memcpy.$O\
-	memmove.$O\
-	memset.$O\
-	notetramp.$O\
-	setjmp.$O\
-	tas.$O\
-
-</sys/src/cmd/mksyslib
-
-CFLAGS=-c -D_POSIX_SOURCE -D_PLAN9_SOURCE
-
--- a/sys/src/ape/lib/ap/alpha/notetramp.c
+++ /dev/null
@@ -1,72 +1,0 @@
-#include "../plan9/lib.h"
-#include "../plan9/sys9.h"
-#include <signal.h>
-#include <setjmp.h>
-
-/* A stack to hold pcs when signals nest */
-#define MAXSIGSTACK 20
-typedef struct Pcstack Pcstack;
-static struct Pcstack {
-	int sig;
-	void (*hdlr)(int, char*, Ureg*);
-	unsigned long restorepc;
-	Ureg *u;
-} pcstack[MAXSIGSTACK];
-static int nstack = 0;
-
-static void notecont(Ureg*, char*);
-
-void
-_notetramp(int sig, void (*hdlr)(int, char*, Ureg*), Ureg *u)
-{
-	Pcstack *p;
-
-	if(nstack >= MAXSIGSTACK)
-		_NOTED(1);	/* nesting too deep; just do system default */
-	p = &pcstack[nstack];
-	p->restorepc = u->pc;
-	p->sig = sig;
-	p->hdlr = hdlr;
-	p->u = u;
-	nstack++;
-	u->pc = (unsigned long) notecont;
-	_NOTED(2);	/* NSAVE: clear note but hold state */
-}
-
-static void
-notecont(Ureg *u, char *s)
-{
-	Pcstack *p;
-	void(*f)(int, char*, Ureg*);
-
-	p = &pcstack[nstack-1];
-	f = p->hdlr;
-	u->pc = p->restorepc;
-	nstack--;
-	(*f)(p->sig, s, u);
-	_NOTED(3);	/* NRSTR */
-}
-
-#define JMPBUFPC 1
-#define JMPBUFSP 0
-
-extern sigset_t	_psigblocked;
-
-void
-siglongjmp(sigjmp_buf j, int ret)
-{
-	struct Ureg *u;
-
-	if(j[0])
-		_psigblocked = j[1];
-	if(nstack == 0 || pcstack[nstack-1].u->sp > j[2+JMPBUFSP])
-		longjmp(j+2, ret);
-	u = pcstack[nstack-1].u;
-	nstack--;
-	u->r0 = ret;
-	if(ret == 0)
-		u->r0 = 1;
-	u->pc = j[2+JMPBUFPC];
-	u->sp = j[2+JMPBUFSP];
-	_NOTED(3);	/* NRSTR */
-}
--- a/sys/src/ape/lib/ap/alpha/setjmp.s
+++ /dev/null
@@ -1,24 +1,0 @@
-TEXT	setjmp(SB), 1, $-8
-	MOVL	R30, (R0)
-	MOVL	R26, 4(R0)
-	MOVQ	$0, R0
-	RET
-
-TEXT	sigsetjmp(SB), 1, $-8
-	MOVL	savemask+4(FP), R3
-	MOVL	R3, 0(R0)
-	MOVL	$_psigblocked(SB), R3
-	MOVL	R3, 4(R0)
-	MOVL	R30, 8(R0)
-	MOVL	R26, 12(R0)
-	MOVQ	$0, R0
-	RET
-
-TEXT	longjmp(SB), 1, $-8
-	MOVL	r+4(FP), R3
-	BNE	R3, ok		/* ansi: "longjmp(0) => longjmp(1)" */
-	MOVQ	$1, R3		/* bless their pointed heads */
-ok:	MOVL	(R0), R30
-	MOVL	4(R0), R26
-	MOVL	R3, R0
-	RET
--- a/sys/src/ape/lib/ap/alpha/tas.s
+++ /dev/null
@@ -1,10 +1,0 @@
-TEXT	tas(SB), $-8
-	MOVQ	R0, R1			/* l */
-tas1:
-	MOVLL	(R1), R0		/* l->key */
-	BNE	R0, tas2
-	MOVQ	$1, R2
-	MOVLC	R2, (R1)		/* l->key = 1 */
-	BEQ	R2, tas1		/* write failed, try again? */
-tas2:
-	RET
--- a/sys/src/ape/lib/mp/alpha/mkfile
+++ /dev/null
@@ -1,15 +1,0 @@
-APE=/sys/src/ape
-<$APE/config
-
-LIB=/$objtype/lib/ape/libmp.a
-
-HFILES=\
-	/sys/include/ape/mp.h\
-	../../../../libmp/port/dat.h
-
-OFILES=\
-
-UPDATE=mkfile\
-	$HFILES\
-
-</sys/src/cmd/mksyslib
--- a/sys/src/ape/lib/sec/alpha/mkfile
+++ /dev/null
@@ -1,15 +1,0 @@
-APE=/sys/src/ape
-<$APE/config
-
-LIB=/$objtype/lib/ape/libsec.a
-
-OFILES=	\
-
-HFILES=/sys/include/ape/libsec.h
-
-UPDATE=mkfile
-
-</sys/src/cmd/mksyslib
-
-%.$O:	/sys/src/libsec/$objtype/%.s
-	$AS $AFLAGS /sys/src/libsec/$objtype/$stem.s
--- a/sys/src/boot/alphapc/bootp.c
+++ /dev/null
@@ -1,556 +1,0 @@
-#include "u.h"
-#include "lib.h"
-#include "mem.h"
-#include "dat.h"
-#include "fns.h"
-
-#include "ip.h"
-
-uchar broadcast[Eaddrlen] = {
-	0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-};
-
-static ushort tftpport = 5000;
-static int Id = 1;
-static Netaddr myaddr;
-static Netaddr server;
-
-typedef struct {
-	uchar	header[4];
-	uchar	data[Segsize];
-} Tftp;
-static Tftp tftpb;
-
-int
-etherrxpkt(int ctlrno, Etherpkt *pkt, int timo)
-{
-	int n;
-
-	for (;;) {
-		n = devread(ctlrno, (uchar*)pkt, sizeof(*pkt), 0);
-		if (n >= 0)
-			return n;
-		if (timo-- < 0)
-			return -1;
-	}
-}
-
-int
-ethertxpkt(int ctlrno, Etherpkt *pkt, int len, int timo)
-{
-	USED(timo);
-	return devwrite(ctlrno, (uchar*)pkt, len, 0);
-}
-
-static void
-hnputs(uchar *ptr, ushort val)
-{
-	ptr[0] = val>>8;
-	ptr[1] = val;
-}
-
-static void
-hnputl(uchar *ptr, ulong val)
-{
-	ptr[0] = val>>24;
-	ptr[1] = val>>16;
-	ptr[2] = val>>8;
-	ptr[3] = val;
-}
-
-static ulong
-nhgetl(uchar *ptr)
-{
-	return ((ptr[0]<<24) | (ptr[1]<<16) | (ptr[2]<<8) | ptr[3]);
-}
-
-static ushort
-nhgets(uchar *ptr)
-{
-	return ((ptr[0]<<8) | ptr[1]);
-}
-
-static	short	endian	= 1;
-static	char*	aendian	= (char*)&endian;
-#define	LITTLE	*aendian
-
-static ushort
-ptcl_csum(void *a, int len)
-{
-	uchar *addr;
-	ulong t1, t2;
-	ulong losum, hisum, mdsum, x;
-
-	addr = a;
-	losum = 0;
-	hisum = 0;
-	mdsum = 0;
-
-	x = 0;
-	if((ulong)addr & 1) {
-		if(len) {
-			hisum += addr[0];
-			len--;
-			addr++;
-		}
-		x = 1;
-	}
-	while(len >= 16) {
-		t1 = *(ushort*)(addr+0);
-		t2 = *(ushort*)(addr+2);	mdsum += t1;
-		t1 = *(ushort*)(addr+4);	mdsum += t2;
-		t2 = *(ushort*)(addr+6);	mdsum += t1;
-		t1 = *(ushort*)(addr+8);	mdsum += t2;
-		t2 = *(ushort*)(addr+10);	mdsum += t1;
-		t1 = *(ushort*)(addr+12);	mdsum += t2;
-		t2 = *(ushort*)(addr+14);	mdsum += t1;
-		mdsum += t2;
-		len -= 16;
-		addr += 16;
-	}
-	while(len >= 2) {
-		mdsum += *(ushort*)addr;
-		len -= 2;
-		addr += 2;
-	}
-	if(x) {
-		if(len)
-			losum += addr[0];
-		if(LITTLE)
-			losum += mdsum;
-		else
-			hisum += mdsum;
-	} else {
-		if(len)
-			hisum += addr[0];
-		if(LITTLE)
-			hisum += mdsum;
-		else
-			losum += mdsum;
-	}
-
-	losum += hisum >> 8;
-	losum += (hisum & 0xff) << 8;
-	while(hisum = losum>>16)
-		losum = hisum + (losum & 0xffff);
-
-	return ~losum;
-}
-
-static ushort
-ip_csum(uchar *addr)
-{
-	int len;
-	ulong sum = 0;
-
-	len = (addr[0]&0xf)<<2;
-
-	while(len > 0) {
-		sum += addr[0]<<8 | addr[1] ;
-		len -= 2;
-		addr += 2;
-	}
-
-	sum = (sum & 0xffff) + (sum >> 16);
-	sum = (sum & 0xffff) + (sum >> 16);
-	return (sum^0xffff);
-}
-
-static void
-udpsend(int ctlrno, Netaddr *a, void *data, int dlen)
-{
-	Udphdr *uh;
-	Etherhdr *ip;
-	Etherpkt pkt;
-	int len, ptcllen;
-
-
-	uh = (Udphdr*)&pkt;
-
-	memset(uh, 0, sizeof(Etherpkt));
-	memmove(uh->udpcksum+sizeof(uh->udpcksum), data, dlen);
-
-	/*
-	 * UDP portion
-	 */
-	ptcllen = dlen + (UDP_HDRSIZE-UDP_PHDRSIZE);
-	uh->ttl = 0;
-	uh->udpproto = IP_UDPPROTO;
-	uh->frag[0] = 0;
-	uh->frag[1] = 0;
-	hnputs(uh->udpplen, ptcllen);
-	hnputl(uh->udpsrc, myaddr.ip);
-	hnputs(uh->udpsport, myaddr.port);
-	hnputl(uh->udpdst, a->ip);
-	hnputs(uh->udpdport, a->port);
-	hnputs(uh->udplen, ptcllen);
-	uh->udpcksum[0] = 0;
-	uh->udpcksum[1] = 0;
-	dlen = (dlen+1)&~1;
-	hnputs(uh->udpcksum, ptcl_csum(&uh->ttl, dlen+UDP_HDRSIZE));
-
-	/*
-	 * IP portion
-	 */
-	ip = (Etherhdr*)&pkt;
-	len = UDP_EHSIZE+UDP_HDRSIZE+dlen;		/* non-descriptive names */
-	ip->vihl = IP_VER|IP_HLEN;
-	ip->tos = 0;
-	ip->ttl = 255;
-	hnputs(ip->length, len-ETHER_HDR);
-	hnputs(ip->id, Id++);
-	ip->frag[0] = 0;
-	ip->frag[1] = 0;
-	ip->cksum[0] = 0;
-	ip->cksum[1] = 0;
-	hnputs(ip->cksum, ip_csum(&ip->vihl));
-
-	/*
-	 * Ethernet MAC portion
-	 */
-	hnputs(ip->type, ET_IP);
-	memmove(ip->d, a->ea, sizeof(ip->d));
-
-	ethertxpkt(ctlrno, &pkt, len, Timeout);
-}
-
-static void
-nak(int ctlrno, Netaddr *a, int code, char *msg, int report)
-{
-	int n;
-	char buf[128];
-
-	buf[0] = 0;
-	buf[1] = Tftp_ERROR;
-	buf[2] = 0;
-	buf[3] = code;
-	strcpy(buf+4, msg);
-	n = strlen(msg) + 4 + 1;
-	udpsend(ctlrno, a, buf, n);
-	if(report)
-		print("\ntftp: error(%d): %s\n", code, msg);
-}
-
-static int
-udprecv(int ctlrno, Netaddr *a, void *data, int dlen)
-{
-	int n, len;
-	ushort csm;
-	Udphdr *h;
-	ulong addr, timo;
-	Etherpkt pkt;
-	static int rxactive;
-
-	if(rxactive == 0)
-		timo = 1000;
-	else
-		timo = Timeout;
-	timo += msec();
-	while(timo > msec()){
-		n = etherrxpkt(ctlrno, &pkt, timo-msec());
-		if(n <= 0)
-			continue;
-
-		h = (Udphdr*)&pkt;
-		if(nhgets(h->type) != ET_IP)
-			continue;
-
-		if(ip_csum(&h->vihl)) {
-			print("ip chksum error\n");
-			continue;
-		}
-		if(h->vihl != (IP_VER|IP_HLEN)) {
-			print("ip bad vers/hlen\n");
-			continue;
-		}
-
-		if(h->udpproto != IP_UDPPROTO)
-			continue;
-
-		h->ttl = 0;
-		len = nhgets(h->udplen);
-		hnputs(h->udpplen, len);
-
-		if(nhgets(h->udpcksum)) {
-			csm = ptcl_csum(&h->ttl, len+UDP_PHDRSIZE);
-			if(csm != 0) {
-				print("udp chksum error csum #%4lux len %d\n", csm, n);
-				break;
-			}
-		}
-
-		if(a->port != 0 && nhgets(h->udpsport) != a->port)
-			continue;
-		if(myaddr.port != 0 && nhgets(h->udpdport) != myaddr.port)
-			continue;
-
-		addr = nhgetl(h->udpsrc);
-		if(a->ip != Bcastip && addr != a->ip)
-			continue;
-
-		len -= UDP_HDRSIZE-UDP_PHDRSIZE;
-		if(len > dlen) {
-			print("udp: packet too big\n");
-			continue;
-		}
-
-		memmove(data, h->udpcksum+sizeof(h->udpcksum), len);
-		a->ip = addr;
-		a->port = nhgets(h->udpsport);
-		memmove(a->ea, pkt.s, sizeof(a->ea));
-
-		rxactive = 1;
-		return len;
-	}
-
-	return 0;
-}
-
-static int tftpblockno;
-
-static int
-tftpopen(int ctlrno, Netaddr *a, char *name, Tftp *tftp)
-{
-	int i, len, rlen;
-	char buf[Segsize+2];
-
-	buf[0] = 0;
-	buf[1] = Tftp_READ;
-	len = sprint(buf+2, "%s", name) + 2;
-	len += sprint(buf+len+1, "octet") + 2;
-
-	for(i = 0; i < 5; i++){
-		udpsend(ctlrno, a, buf, len);
-		a->port = 0;
-		if((rlen = udprecv(ctlrno, a, tftp, sizeof(Tftp))) < sizeof(tftp->header))
-			continue;
-
-		switch((tftp->header[0]<<8)|tftp->header[1]){
-
-		case Tftp_ERROR:
-			print("tftpopen: error (%d): %s\n",
-				(tftp->header[2]<<8)|tftp->header[3], tftp->data);
-			return -1;
-
-		case Tftp_DATA:
-			tftpblockno = 1;
-			len = (tftp->header[2]<<8)|tftp->header[3];
-			if(len != tftpblockno){
-				print("tftpopen: block error: %d\n", len);
-				nak(ctlrno, a, 1, "block error", 0);
-				return -1;
-			}
-			return rlen-sizeof(tftp->header);
-		}
-	}
-
-	print("tftpopen: failed to connect to server\n");
-	return -1;
-}
-
-static int
-tftpread(int ctlrno, Netaddr *a, Tftp *tftp, int dlen)
-{
-	int blockno, len;
-	uchar buf[4];
-
-	buf[0] = 0;
-	buf[1] = Tftp_ACK;
-	buf[2] = tftpblockno>>8;
-	buf[3] = tftpblockno;
-	tftpblockno++;
-
-	dlen += sizeof(tftp->header);
-
-buggery:
-	udpsend(ctlrno, a, buf, sizeof(buf));
-
-	if((len = udprecv(ctlrno, a, tftp, dlen)) != dlen){
-		print("tftpread: %d != %d\n", len, dlen);
-		nak(ctlrno, a, 2, "short read", 0);
-	}
-
-	blockno = (tftp->header[2]<<8)|tftp->header[3];
-	if(blockno != tftpblockno){
-		print("tftpread: block error: %d, expected %d\n", blockno, tftpblockno);
-
-		if(blockno == tftpblockno-1)
-			goto buggery;
-		nak(ctlrno, a, 1, "block error", 0);
-
-		return -1;
-	}
-
-	return len-sizeof(tftp->header);
-}
-
-// #define	BOOT_MAGIC	L_MAGIC
-#define	BOOT_MAGIC	0x0700e0c3
-
-void
-getether(char *dev, uchar *ea)
-{
-	int i;
-	char *p;
-
-	p = dev;
-	for (i = 0; i < 8; i++) {
-		p = strchr(p, ' ');
-		if (p == 0)
-			panic("no ether addr");
-		p++;
-	}
-	for (i = 0; i < 6; i++) {
-		ea[i] = strtoul(p, &p, 16);
-		if (*p != (i == 5 ? ' ' : '-'))
-			panic("bad ether addr");
-		p++;
-	}
-}
-
-static char inibuf[BOOTARGSLEN];
-
-int
-bootp(char *dev)
-{
-	Bootp req, rep;
-	int i, fd, dlen, segsize, text, data, bss, total;
-	uchar *addr, *p, ea[6];
-	char *cp;
-	ulong entry;
-	Exec *exec;
-	char *filename, confname[32];
-
-	getether(dev, ea);
-	fd = devopen(dev);
-	if (fd < 0)
-		panic("bootp devopen");
-
-	memset(&req, 0, sizeof(req));
-	req.op = Bootrequest;
-	req.htype = 1;			/* ethernet */
-	req.hlen = Eaddrlen;		/* ethernet */
-	memmove(req.chaddr, ea, Eaddrlen);
-
-	myaddr.ip = 0;
-	myaddr.port = BPportsrc;
-	memmove(myaddr.ea, ea, Eaddrlen);
-
-	for(i = 0; i < 10; i++) {
-		server.ip = Bcastip;
-		server.port = BPportdst;
-		memmove(server.ea, broadcast, sizeof(server.ea));
-		udpsend(fd, &server, &req, sizeof(req));
-		if(udprecv(fd, &server, &rep, sizeof(rep)) <= 0)
-			continue;
-		if(memcmp(req.chaddr, rep.chaddr, Eaddrlen))
-			continue;
-		if(rep.htype != 1 || rep.hlen != Eaddrlen)
-			continue;
-		break;
-	}
-	if(i >= 10) {
-		print("bootp timed out\n");
-		return -1;
-	}
-
-	sprint(confname, "/alpha/conf/%d.%d.%d.%d",
-		rep.yiaddr[0],
-		rep.yiaddr[1],
-		rep.yiaddr[2],
-		rep.yiaddr[3]);
-
-	if(rep.sname[0] != '\0')
-		 print("%s ", rep.sname);
-	print("(%d.%d.%d.%d!%d): %s...",
-		rep.siaddr[0],
-		rep.siaddr[1],
-		rep.siaddr[2],
-		rep.siaddr[3],
-		server.port,
-		confname);
-
-	myaddr.ip = nhgetl(rep.yiaddr);
-	myaddr.port = tftpport++;
-	server.ip = nhgetl(rep.siaddr);
-	server.port = TFTPport;
-
-	if((dlen = tftpopen(fd, &server, confname, &tftpb)) < 0)
-		return -1;
-	cp = inibuf;
-	while(dlen > 0) {
-		if(cp-inibuf+dlen > BOOTARGSLEN)
-			panic("conf too large");
-		memmove(cp, tftpb.data, dlen);
-		cp += dlen;
-		if(dlen != Segsize)
-			break;
-		if((dlen = tftpread(fd, &server, &tftpb, sizeof(tftpb.data))) < 0)
-			return -1;
-	}
-	*cp = 0;
-	setconf(inibuf);
-
-	filename = "/alpha/9apc";
-	cp = getconf("bootfile");
-	if(cp != nil)
-		filename = cp;
-
-	print("%s\n", filename);
-	myaddr.port = tftpport++;
-	server.port = TFTPport;
-	if((dlen = tftpopen(fd, &server, filename, &tftpb)) < 0)
-		return -1;
-
-	exec = (Exec*)(tftpb.data);
-	if(dlen < sizeof(Exec) || GLLONG(exec->magic) != BOOT_MAGIC){
-		nak(fd, &server, 0, "bad magic number", 1);
-		return -1;
-	}
-	text = GLLONG(exec->text);
-	data = GLLONG(exec->data);
-	bss = GLLONG(exec->bss);
-	total = text+data+bss;
-	entry = GLLONG(exec->entry);
-	if (!validrgn(entry, entry+total))
-		panic("memory range not available: %lux-%lux\n", entry, entry+total);
-	print("%d", text);
-
-	addr = (uchar*)entry;
-	p = tftpb.data+sizeof(Exec);
-	dlen -= sizeof(Exec);
-	segsize = text;
-	for(;;){
-		if(dlen == 0){
-			if((dlen = tftpread(fd, &server, &tftpb, sizeof(tftpb.data))) < 0)
-				return -1;
-			p = tftpb.data;
-		}
-		if(segsize <= dlen)
-			i = segsize;
-		else
-			i = dlen;
-		memmove(addr, p, i);
-
-		addr += i;
-		p += i;
-		segsize -= i;
-		dlen -= i;
-
-		if(segsize <= 0){
-			if(data == 0)
-				break;
-			print("+%d", data);
-			segsize = data;
-			data = 0;
-//			addr = (uchar*)pground((uvlong)addr);
-		}
-	}
-	nak(fd, &server, 3, "ok", 0);		/* tftpclose */
-	print("+%d=%d\n", bss, total);
-	print("entry: 0x%lux\n", entry);
-
-	kexec(entry);
-
-	return 0;
-}
--- a/sys/src/boot/alphapc/conf.c
+++ /dev/null
@@ -1,75 +1,0 @@
-#include	"u.h"
-#include	"mem.h"
-#include	"dat.h"
-#include	"fns.h"
-#include	"lib.h"
-
-static char *confname[MAXCONF];
-static char *confval[MAXCONF];
-static int nconf;
-static char bootargs[BOOTARGSLEN];
-
-char*
-getconf(char *name)
-{
-	int i;
-
-	for(i = 0; i < nconf; i++)
-		if(strcmp(confname[i], name) == 0)
-			return confval[i];
-	return 0;
-}
-
-void
-setconf(char *buf)
-{
-	char *cp, *line[MAXCONF];
-	int i, n;
-
-	/*
-	 * Keep a pristine copy.
-	 * Should change this to pass the parsed strings
-	 * to the booted programme instead of the raw
-	 * string, then it only gets done once.
-	 */
-	strcpy(bootargs, buf);
-	/* print("boot: stashing /alpha/conf boot args at 0x%lux\n",
-		bootargs);			/* DEBUG */
-	conf.bootargs = bootargs;
-
-	n = getcfields(buf, line, MAXCONF, "\n");
-	for(i = 0; i < n; i++){
-		if(*line[i] == '#')
-			continue;
-		cp = strchr(line[i], '=');
-		if(cp == nil)
-			continue;
-		*cp++ = 0;
-		if(cp - line[i] >= NAMELEN+1)
-			*(line[i]+NAMELEN-1) = 0;
-		confname[nconf] = line[i];
-		confval[nconf] = cp;
-		nconf++;
-	}
-}
-
-int
-getcfields(char* lp, char** fields, int n, char* sep)
-{
-	int i;
-
-	for(i = 0; lp && *lp && i < n; i++){
-		while(*lp && strchr(sep, *lp) != 0)
-			*lp++ = 0;
-		if(*lp == 0)
-			break;
-		fields[i] = lp;
-		while(*lp && strchr(sep, *lp) == 0){
-			if(*lp == '\\' && *(lp+1) == '\n')
-				*lp++ = ' ';
-			lp++;
-		}
-	}
-
-	return i;
-}
--- a/sys/src/boot/alphapc/conf.h
+++ /dev/null
@@ -1,20 +1,0 @@
-typedef struct Bank	Bank;
-typedef struct Bootconf	Bootconf;
-
-struct Bootconf
-{
-	int		nbank;
-	Bank		*bank;
-	PCB		*pcb;
-	uvlong	maxphys;
-	char		*bootargs;
-};
-
-struct Bank
-{
-	uvlong	min;
-	uvlong	max;
-};
-
-#define	BOOTARGSLEN	(4096)
-#define	MAXCONF		32
--- a/sys/src/boot/alphapc/cons.c
+++ /dev/null
@@ -1,243 +1,0 @@
-#include	"u.h"
-#include	"mem.h"
-#include	"dat.h"
-#include	"fns.h"
-#include	"lib.h"
-
-enum {
-	/* prom operations */
-	Promop_getc   = 1,
-	Promop_puts   = 2,
-	Promop_open   = 0x10,
-	Promop_close  = 0x11,
-	Promop_read   = 0x13,
-	Promop_write  = 0x14,
-	Promop_getenv = 0x22,
-
-	/* environment variable indices for getenv */
-	/* auto_action might be 1; it looks that way. */
-	Promenv_booted_dev	= 4,
-	Promenv_booted_file	= 6,
-	Promenv_booted_osflags	= 8,
-	Promenv_tty_dev		= 0xf,
-};
-
-Hwrpb	*hwrpb;
-
-static uvlong	dispatchf;
-static ulong	clk2ms;
-
-void
-consinit(void)
-{
-	Procdesc *p;
-	Hwcrb *crb;
-	Hwdsr *dsr;
-	char *s;
-
-	hwrpb = (Hwrpb*)0x10000000;
-
-	crb = (Hwcrb*)((ulong)hwrpb + hwrpb->crboff);
-	p = (Procdesc*)(crb->dispatchva);
-	dispatchf = p->addr;
-	clk2ms = hwrpb->cfreq/1000;
-
-	print("\nAlpha Plan 9 secondary boot\n");
-	if (hwrpb->rev >= 6) {
-		dsr = (Hwdsr*)((ulong)hwrpb + hwrpb->dsroff);
-		s = (char*)dsr + dsr->sysnameoff + 8;
-		print("%s\n", s);
-	}
-}
-
-uvlong
-dispatch(uvlong r16, uvlong r17, uvlong r18, uvlong r19, uvlong r20)
-{
-	return gendispatch(dispatchf, r16, r17, r18, r19, r20);
-};
-
-int
-devopen(char *s)
-{
-	vlong ret;
-	int n;
-
-	n = strlen(s);
-	ret = dispatch(0x10, (uvlong)s, n, 0, 0);
-	if (ret < 0)
-		return -1;
-	return (int) ret;
-}
-
-int
-devclose(int fd)
-{
-	vlong ret;
-
-	ret = dispatch(0x11, fd, 0, 0, 0);
-	if (ret < 0)
-		return -1;
-	return 0;
-}
-
-int
-devread(int fd, uchar *buf, int len, int blkno)
-{
-	vlong ret;
-
-	ret = dispatch(0x13, fd, len, (uvlong)buf, blkno);
-	if (ret < 0)
-		return -1;
-	return (int) ret;
-}
-
-int
-devwrite(int fd, uchar *buf, int len, int blkno)
-{
-	vlong ret;
-
-	ret = dispatch(0x14, fd, len, (uvlong)buf, blkno);
-	if (ret < 0)
-		return -1;
-	return (int) ret;
-}
-
-void
-dumpenv(void)
-{
-	int id, n;
-	static char buf[256];
-
-	/* old upper bound was 0x100, which blows up on my 164LX. 50 works. */
-	for (id = 1; id < 50; id++) {
-		n = dispatch(Promop_getenv, id, (uvlong)buf, sizeof(buf)-1, 0);
-		if (n == 0)
-			continue;
-		if (n < 0) {
-			print("dispatch failed at id %d\n", id);
-			break;
-		}
-		buf[n] = 0;
-		print("env[0x%x]: %s\n", id, buf);
-	}
-}
-
-char *
-getenv(char *name)
-{
-	int id, n;
-	static char buf[256];
-
-	if (strcmp(name, "booted_dev") == 0)
-		id = Promenv_booted_dev;
-	else
-		return 0;
-	n = dispatch(Promop_getenv, id, (uvlong)buf, sizeof(buf), 0);
-	if (n < 0)
-		return 0;
-	buf[n] = 0;
-	return buf;
-}
-
-void
-putstrn0(char *s, int n)
-{
-	uvlong ret;
-	int cnt;
-
-	for (;;) {
-		ret = dispatch(2, 0, (uvlong)s, n, 0);
-		cnt = (int) ret;
-		s += cnt;
-		n -= cnt;
-		if (n <= 0)
-			break;
-	}
-}
-
-void
-putstrn(char *s, int n)
-{
-	char *p;
-
-	for (;;) {
-		if (n == 0)
-			return;
-		p = memchr(s, '\n', n);
-		if (p == 0) {
-			putstrn0(s, n);
-			return;
-		}
-		putstrn0(s, p-s);
-		putstrn0("\r\n", 2);
-		n -= p-s+1;
-		s = p+1;
-	}
-}
-
-int
-snprint(char *s, int n, char *fmt, ...)
-{
-	va_list arg;
-
-	va_start(arg, fmt);
-	n = doprint(s, s+n, fmt, arg) - s;
-	va_end(arg);
-	return n;
-}
-
-int
-sprint(char *s, char *fmt, ...)
-{
-	int n;
-	va_list arg;
-
-	va_start(arg, fmt);
-	n = doprint(s, s+PRINTSIZE, fmt, arg) - s;
-	va_end(arg);
-	return n;
-}
-
-int
-print(char *fmt, ...)
-{
-	int n;
-	va_list arg;
-	char buf[PRINTSIZE];
-
-	va_start(arg, fmt);
-	n = doprint(buf, buf+sizeof(buf), fmt, arg) - buf;
-	va_end(arg);
-	putstrn(buf, n);
-
-	return n;
-}
-
-void
-panic(char *fmt, ...)
-{
-	int n;
-	va_list arg;
-	char buf[PRINTSIZE];
-
-	strcpy(buf, "panic: ");
-	va_start(arg, fmt);
-	n = doprint(buf+strlen(buf), buf+sizeof(buf), fmt, arg) - buf;
-	va_end(arg);
-	buf[n] = '\n';
-	putstrn(buf, n+1);
-	firmware();
-}
-
-ulong
-msec(void)
-{
-	static ulong last, wrap;
-	ulong cnt;
-
-	cnt = pcc_cnt();
-	if (cnt < last)
-		wrap++;
-	last = cnt;
-	return (((uvlong)wrap << 32) + cnt)/clk2ms;
-}
--- a/sys/src/boot/alphapc/dat.h
+++ /dev/null
@@ -1,169 +1,0 @@
-typedef struct Hwrpb	Hwrpb;
-typedef struct Hwcpu	Hwcpu;
-typedef struct Hwcrb	Hwcrb;
-typedef struct Hwdsr	Hwdsr;
-typedef struct Procdesc	Procdesc;
-typedef struct Memdsc	Memdsc;
-typedef struct Memclust	Memclust;
-typedef struct PCB		PCB;
-
-struct Hwrpb
-{
-	uvlong	phys;
-	uvlong	sign;
-	uvlong	rev;
-	uvlong	size;
-	uvlong	cpu0;
-	uvlong	by2pg;
-	uvlong	pabits;
-	uvlong	maxasn;
-	char		ssn[16];
-	uvlong	systype;
-	uvlong	sysvar;
-	uvlong	sysrev;
-	uvlong	ifreq;
-	uvlong	cfreq;
-	uvlong	vptb;
-	uvlong	resv;
-	uvlong	tbhint;
-	uvlong	ncpu;
-	uvlong	cpulen;
-	uvlong	cpuoff;
-	uvlong	nctb;
-	uvlong	ctblen;
-	uvlong	ctboff;
-	uvlong	crboff;
-	uvlong	memoff;
-	uvlong	confoff;
-	uvlong	fruoff;
-	uvlong	termsaveva;
-	uvlong	termsavex;
-	uvlong	termrestva;
-	uvlong	termrestx;
-	uvlong	termresetva;
-	uvlong	termresetx;
-	uvlong	sysresv;
-	uvlong	hardresv;
-	uvlong	csum;
-	uvlong	rxrdymsk;
-	uvlong	txrdymsk;
-	uvlong	dsroff;		/* rev 6 or higher */
-};
-
-extern Hwrpb* hwrpb;
-
-struct Hwcpu
-{
-	uvlong	hwpcb[16];
-	uvlong	state;
-	uvlong	palmainlen;
-	uvlong	palscratchlen;
-	uvlong	palmainpa;
-	uvlong	palscratchpa;
-	uvlong	palrev;
-	uvlong	cputype;
-	uvlong	cpuvar;
-	uvlong	cpurev;
-	uvlong	serial[2];
-	/* more crap ... */
-};
-
-struct Hwdsr
-{
-	vlong	smm;
-	uvlong	lurtoff;
-	uvlong	sysnameoff;
-};
-
-struct Hwcrb
-{
-	uvlong	dispatchva;
-	uvlong	dispatchpa;
-	uvlong	fixupva;
-	uvlong	fixuppa;
-	/* more, uninteresting crud */
-};
-
-struct Procdesc
-{
-	uvlong	bollocks;
-	uvlong	addr;
-};
-
-struct Memclust
-{
-	uvlong	pfn;
-	uvlong	npages;
-	uvlong	ntest;
-	uvlong	vabitm;
-	uvlong	pabitm;
-	uvlong	csumbitm;
-	uvlong	usage;
-};
-
-struct Memdsc
-{
-	uvlong	csum;
-	uvlong	opt;
-	uvlong	nclust;
-	Memclust	clust[1];
-};
-
-enum
-{
-	PRINTSIZE =	256,
-	MB =		(1024*1024),
-};
-
-#define L_MAGIC		((((4*23)+0)*23)+7)
-
-typedef struct Exec Exec;
-struct	Exec
-{
-	uchar	magic[4];		/* magic number */
-	uchar	text[4];	 	/* size of text segment */
-	uchar	data[4];	 	/* size of initialized data */
-	uchar	bss[4];	  		/* size of uninitialized data */
-	uchar	syms[4];	 	/* size of symbol table */
-	uchar	entry[4];	 	/* entry point */
-	uchar	spsz[4];		/* size of sp/pc offset table */
-	uchar	pcsz[4];		/* size of pc/line number table */
-};
-
-enum {
-	Eaddrlen	= 6,
-	ETHERMINTU	= 60,		/* minimum transmit size */
-	ETHERMAXTU	= 1514,		/* maximum transmit size */
-	ETHERHDRSIZE	= 14,		/* size of an ethernet header */
-
-	MaxEther	= 2,
-};
-
-typedef struct {
-	uchar	d[Eaddrlen];
-	uchar	s[Eaddrlen];
-	uchar	type[2];
-	uchar	data[1500];
-	uchar	crc[4];
-} Etherpkt;
-
-/*
- *	Process Control Block, used by OSF/1 PALcode when we switch to it
- */
-struct PCB {
-	uvlong	ksp;
-	uvlong	usp;
-	uvlong	ptbr;
-	ulong	asn;
-	ulong	pcc;
-	uvlong	unique;
-	ulong	fen;
-	ulong	dummy;
-	uvlong	rsrv1;
-	uvlong	rsrv2;
-};
-
-
-#include	"conf.h"
-
-extern Bootconf	conf;
--- a/sys/src/boot/alphapc/exec.c
+++ /dev/null
@@ -1,40 +1,0 @@
-#include	"u.h"
-#include	"mem.h"
-#include	"dat.h"
-#include	"fns.h"
-#include	"lib.h"
-
-uchar	pcbpage[64*1024+sizeof(PCB)];
-PCB		*pcb;
-
-void	(*kentry)(Bootconf*);
-
-void
-gokernel(void)
-{
-	(*kentry)(&conf);
-}
-
-void
-kexec(ulong entry)
-{
-	uvlong pcbb, paltype;
-
-	pcb = (PCB*)(((ulong)pcbpage+0xffff) & ~0xffff);	/* page align, even on 64K page Alphas */
-	memset(pcb, 0, sizeof(PCB));
-	pcb->ksp = (uvlong)&entry;
-	pcb->ptbr = getptbr();
-	pcb->fen = 1;
-	conf.pcb = pcb;
-	pcbb = paddr((uvlong)pcb);
-	kentry = (void(*)(Bootconf*))entry;
-	paltype = 2;	/* OSF/1 please */
-	switch (swppal(paltype, (uvlong)gokernel, pcbb, hwrpb->vptb, pcb->ksp)) {
-	case 1:
-		panic("unknown PALcode variant");
-	case 2:
-		panic("PALcode variant not loaded");
-	default:
-		panic("weird return status from swppal");
-	}
-}
--- a/sys/src/boot/alphapc/fns.h
+++ /dev/null
@@ -1,37 +1,0 @@
-uvlong	allocate(int);
-int		bootp(char*);
-void		consinit(void);
-int		devopen(char*);
-int		devclose(int);
-int		devread(int, uchar*, int, int);
-int		devwrite(int, uchar*, int, int);
-uvlong	dispatch(uvlong, uvlong, uvlong, uvlong, uvlong);
-void		dumpenv(void);
-void		firmware(void);
-uvlong	gendispatch(uvlong, uvlong, uvlong, uvlong, uvlong, uvlong);
-int		getcfields(char*, char**, int, char*);
-char*	getconf(char*);
-char*	getenv(char*);
-uvlong	getptbr(void);
-void		kexec(ulong);
-uvlong	ldqp(uvlong);
-void		meminit(void);
-void		mmuinit(void);
-ulong	msec(void);
-uvlong	rdv(uvlong);
-uvlong	paddr(uvlong);
-void		panic(char *, ...);
-ulong	pcc_cnt(void);
-uvlong	pground(uvlong);
-void		putstrn(char *, int);
-void		setconf(char*);
-void		stqp(uvlong, uvlong);
-int		swppal(uvlong, uvlong, uvlong, uvlong, uvlong);
-void		tlbflush(void);
-int		validrgn(ulong, ulong);
-void		wrv(uvlong, uvlong);
-
-#define	GSHORT(p)	(((p)[1]<<8)|(p)[0])
-#define	GLONG(p)	((GSHORT(p+2)<<16)|GSHORT(p))
-#define	GLSHORT(p)	(((p)[0]<<8)|(p)[1])
-#define	GLLONG(p)	((GLSHORT(p)<<16)|GLSHORT(p+2))
--- a/sys/src/boot/alphapc/ip.h
+++ /dev/null
@@ -1,98 +1,0 @@
-typedef struct Udphdr Udphdr;
-struct Udphdr
-{
-	uchar	d[6];		/* Ethernet destination */
-	uchar	s[6];		/* Ethernet source */
-	uchar	type[2];	/* Ethernet packet type */
-
-	uchar	vihl;		/* Version and header length */
-	uchar	tos;		/* Type of service */
-	uchar	length[2];	/* packet length */
-	uchar	id[2];		/* Identification */
-	uchar	frag[2];	/* Fragment information */
-
-	/* Udp pseudo ip really starts here */
-	uchar	ttl;	
-	uchar	udpproto;	/* Protocol */
-	uchar	udpplen[2];	/* Header plus data length */
-	uchar	udpsrc[4];	/* Ip source */
-	uchar	udpdst[4];	/* Ip destination */
-	uchar	udpsport[2];	/* Source port */
-	uchar	udpdport[2];	/* Destination port */
-	uchar	udplen[2];	/* data length */
-	uchar	udpcksum[2];	/* Checksum */
-};
-
-typedef struct Etherhdr Etherhdr;
-struct Etherhdr
-{
-	uchar	d[6];
-	uchar	s[6];
-	uchar	type[2];
-
-	/* Now we have the ip fields */
-	uchar	vihl;		/* Version and header length */
-	uchar	tos;		/* Type of service */
-	uchar	length[2];	/* packet length */
-	uchar	id[2];		/* Identification */
-	uchar	frag[2];	/* Fragment information */
-	uchar	ttl;		/* Time to live */
-	uchar	proto;		/* Protocol */
-	uchar	cksum[2];	/* Header checksum */
-	uchar	src[4];		/* Ip source */
-	uchar	dst[4];		/* Ip destination */
-};
-
-enum
-{
-	IP_VER		= 0x40,
-	IP_HLEN		= 0x05,			
- 	UDP_EHSIZE	= 22,
-	UDP_PHDRSIZE	= 12,
-	UDP_HDRSIZE	= 20,
-	ETHER_HDR	= 14,
-	IP_UDPPROTO	= 17,
-	ET_IP		= 0x800,
-	Bcastip		= 0xffffffff,
-	BPportsrc	= 68,
-	BPportdst	= 67,
-	TFTPport	= 69,
-	Timeout		= 5000,	/* milliseconds */
-	Bootrequest 	= 1,
-	Bootreply   	= 2,
-	Tftp_READ	= 1,
-	Tftp_WRITE	= 2,
-	Tftp_DATA	= 3,
-	Tftp_ACK	= 4,
-	Tftp_ERROR	= 5,
-	Segsize		= 512,
-	TFTPSZ		= Segsize+10,
-};
-
-typedef struct Bootp Bootp;
-struct Bootp
-{
-	uchar	op;		/* opcode */
-	uchar	htype;		/* hardware type */
-	uchar	hlen;		/* hardware address len */
-	uchar	hops;		/* hops */
-	uchar	xid[4];		/* a random number */
-	uchar	secs[2];	/* elapsed snce client started booting */
-	uchar	pad[2];
-	uchar	ciaddr[4];	/* client IP address (client tells server) */
-	uchar	yiaddr[4];	/* client IP address (server tells client) */
-	uchar	siaddr[4];	/* server IP address */
-	uchar	giaddr[4];	/* gateway IP address */
-	uchar	chaddr[16];	/* client hardware address */
-	char	sname[64];	/* server host name (optional) */
-	char	file[128];	/* boot file name */
-	char	vend[128];	/* vendor-specific goo */
-};
-
-typedef struct Netaddr Netaddr;
-struct Netaddr
-{
-	ulong	ip;
-	ushort	port;
-	char	ea[Eaddrlen];
-};
--- a/sys/src/boot/alphapc/l.s
+++ /dev/null
@@ -1,101 +1,0 @@
-#include "mem.h"
-#include "vmspal.h"
-
-#define SP		R30
-
-TEXT	_main(SB), $-8
-	MOVQ	$setSB(SB), R29
-	MOVQ	$edata(SB), R1
-	MOVQ	$end(SB), R2
-loop2:
-	MOVQ	R31, (R1)
-	ADDQ	$8, R1
-	CMPUGT	R1, R2, R3
-	BEQ	R3, loop2
-
-	JSR	main(SB)
-
-TEXT	firmware(SB), $-8
-	CALL_PAL $PALhalt
-	MOVQ	$_divq(SB), R31		/* touch _divq etc.; doesn't need to execute */
-	MOVQ	$_divl(SB), R31		/* touch _divl etc.; doesn't need to execute */
-	RET
-
-TEXT	mb(SB), $-8
-	MB
-	RET
-
-TEXT	icflush(SB), $-8
-	CALL_PAL $PALimb
-	RET
-
-TEXT	tlbflush(SB), $-8
-	CALL_PAL $PALmtpr_tbia
-	RET
-
-TEXT	gendispatch(SB), $-8
-	MOVQ	8(FP), R16
-	MOVQ	16(FP), R17
-	MOVQ	24(FP), R18
-	MOVQ	32(FP), R19
-	MOVQ	40(FP), R20
-	MOVQ	R26, R1
-	JSR	(R0)
-	MOVQ	R1, R26
-	RET					/* 7a bug: should be RET (R1) */
-
-TEXT	rdv(SB), $-8
-	MOVQ	(R0), R0
-	RET
-
-TEXT	wrv(SB), $-8
-	MOVQ	8(FP), R1
-	MOVQ	R1, (R0)
-	RET
-
-TEXT	ipl(SB), $-8
-	CALL_PAL $PALmfpr_ipl
-	RET
-
-TEXT	mces(SB), $-8
-	CALL_PAL $PALmfpr_mces
-	RET
-
-TEXT	setipl(SB), $-8
-	MOVQ	R0, R16
-	CALL_PAL $PALmtpr_ipl
-	RET
-
-TEXT	setmces(SB), $-8
-	MOVQ	R0, R16
-	CALL_PAL $PALmtpr_mces
-	RET
-
-TEXT	ldqp(SB), $-8
-	MOVQ	R0, R16
-	CALL_PAL $PALldqp
-	RET
-
-TEXT	stqp(SB), $-8
-	MOVQ	R0, R16
-	MOVQ	8(FP), R17
-	CALL_PAL $PALstqp
-	RET
-
-TEXT	getptbr(SB), $-8
-	CALL_PAL $PALmfpr_ptbr
-	RET
-
-TEXT	swppal(SB), $-8
-	MOVQ	R0, R16			/* which PALcode */
-	MOVQ	8(FP), R17		/* new PC */
-	MOVQ	16(FP), R18		/* PCBB (physical) */
-	MOVQ	24(FP), R19		/* VPTB */
-	MOVQ	32(FP), R20		/* new KSP */
-	CALL_PAL $PALswppal
-	RET
-
-TEXT	pcc_cnt(SB), $-8
-	MOVQ	PCC, R1
-	MOVL	R1, R0
-	RET
--- a/sys/src/boot/alphapc/lib.h
+++ /dev/null
@@ -1,134 +1,0 @@
-/*
- * functions (possibly) linked in, complete, from libc.
- */
-
-/*
- * mem routines
- */
-extern	void	*memccpy(void*, void*, int, long);
-extern	void	*memset(void*, int, long);
-extern	int	memcmp(void*, void*, long);
-extern	void	*memmove(void*, void*, long);
-extern	void	*memchr(void*, int, long);
-
-/*
- * string routines
- */
-extern	char	*strcat(char*, char*);
-extern	char	*strchr(char*, char);
-extern	int	strcmp(char*, char*);
-extern	char	*strcpy(char*, char*);
-extern	char	*strncat(char*, char*, long);
-extern	char	*strncpy(char*, char*, long);
-extern	int	strncmp(char*, char*, long);
-extern	long	strlen(char*);
-extern	int	atoi(char*);
-
-enum
-{
-	UTFmax		= 3,	/* maximum bytes per rune */
-	Runesync	= 0x80,	/* cannot represent part of a UTF sequence */
-	Runeself	= 0x80,	/* rune and UTF sequences are the same (<) */
-	Runeerror	= 0x80,	/* decoding error in UTF */
-};
-
-/*
- * rune routines
- */
-extern	int	runetochar(char*, Rune*);
-extern	int	chartorune(Rune*, char*);
-extern	char*	utfrune(char*, long);
-extern	int	utflen(char*);
-
-extern	int	abs(int);
-
-/*
- * print routines
- */
-typedef
-struct
-{
-	char*	out;		/* pointer to next output */
-	char*	eout;		/* pointer to end */
-	int	f1;
-	int	f2;
-	int	f3;
-	int	chr;
-} Fconv;
-extern	void	strconv(char*, Fconv*);
-extern	int	numbconv(va_list*, Fconv*);
-extern	char	*doprint(char*, char*, char*, va_list);
-extern	int	fmtinstall(int, int (*)(va_list*, Fconv*));
-extern	int	sprint(char*, char*, ...);
-extern	int	snprint(char*, int, char*, ...);
-extern	int	print(char*, ...);
-
-/*
- * one-of-a-kind
- */
-extern	long	strtol(char*, char**, int);
-extern	ulong	strtoul(char*, char**, int);
-extern	vlong	strtovl(char*, char**, int);
-extern	char	etext[];
-extern	char	edata[];
-extern	char	end[];
-
-/*
- * Syscall data structures
- */
-#define	MORDER	0x0003	/* mask for bits defining order of mounting */
-#define	MREPL	0x0000	/* mount replaces object */
-#define	MBEFORE	0x0001	/* mount goes before others in union directory */
-#define	MAFTER	0x0002	/* mount goes after others in union directory */
-#define	MCREATE	0x0004	/* permit creation in mounted directory */
-#define MRECOV	0x0008	/* perform recovery if mount channel is lost */
-#define MCACHE	0x0010	/* cache some data */
-#define	MMASK	0x001F	/* all bits on */
-
-#define	OREAD	0	/* open for read */
-#define	OWRITE	1	/* write */
-#define	ORDWR	2	/* read and write */
-#define	OEXEC	3	/* execute, == read but check execute permission */
-#define	OTRUNC	16	/* or'ed in (except for exec), truncate file first */
-#define	OCEXEC	32	/* or'ed in, close on exec */
-#define	ORCLOSE	64	/* or'ed in, remove on close */
-
-#define	NCONT	0	/* continue after note */
-#define	NDFLT	1	/* terminate after note */
-#define	NSAVE	2	/* clear note but hold state */
-#define	NRSTR	3	/* restore saved state */
-
-typedef struct Qid	Qid;
-typedef struct Dir	Dir;
-typedef struct Waitmsg	Waitmsg;
-
-#define	ERRLEN		64
-#define	DIRLEN		116
-#define	NAMELEN		28
-
-struct Qid
-{
-	ulong	path;
-	ulong	vers;
-};
-
-struct Dir
-{
-	char	name[NAMELEN];
-	char	uid[NAMELEN];
-	char	gid[NAMELEN];
-	Qid	qid;
-	ulong	mode;
-	long	atime;
-	long	mtime;
-	Length;
-	short	type;
-	short	dev;
-};
-
-struct Waitmsg
-{
-	char	pid[12];	/* of loved one */
-	char	time[3*12];	/* of loved one and descendants */
-	char	msg[ERRLEN];
-};
--- a/sys/src/boot/alphapc/main.c
+++ /dev/null
@@ -1,25 +1,0 @@
-#include	"u.h"
-#include	"mem.h"
-#include	"dat.h"
-#include	"fns.h"
-#include	"lib.h"
-
-Bootconf	conf;
-
-void
-main(void)
-{
-	char *dev;
-
-	consinit();
-	meminit();
-	mmuinit();
-
-	dev = getenv("booted_dev");
-	if (dev == 0)
-		panic("get dev name");
-	if (strncmp(dev, "BOOTP", 5) == 0)
-		bootp(dev);
-	else
-		print("boot device %s not supported\n", dev);
-}
--- a/sys/src/boot/alphapc/mem.h
+++ /dev/null
@@ -1,15 +1,0 @@
-/*
- * Memory and machine-specific definitions.  Used in C and assembler.
- */
-
-#define	BI2BY		8			/* bits per byte */
-#define	BI2WD		32			/* bits per word */
-#define	BY2WD		4			/* bytes per word */
-#define BY2V		8			/* bytes per vlong */
-
-#define	KZERO		0x80000000
-
-#define	PTEVALID	0xff01
-#define	PTEKVALID	0x1101
-#define	PTEASM		0x0010
-#define	PTEGH(s)	((s)<<5)
--- a/sys/src/boot/alphapc/memory.c
+++ /dev/null
@@ -1,108 +1,0 @@
-#include	"u.h"
-#include	"mem.h"
-#include	"dat.h"
-#include	"fns.h"
-#include	"lib.h"
-
-static int	debug;
-
-enum {
-	Maxbank = 2,
-};
-
-Bank	bank[Maxbank];
-int	nbank;
-
-void
-meminit(void)
-{
-	Memdsc *mem;
-	Memclust *c;
-	int i;
-	uvlong npage, p0, p1;
-	extern ulong _main[], edata[];
-
-	mem = (Memdsc*)((ulong)hwrpb + hwrpb->memoff);
-	if (debug)
-		print("\nnumber of clusters: %lld\n", mem->nclust);
-	npage = 0;
-	conf.maxphys = 0;
-	for (i = 0; i < mem->nclust; i++) {
-		c = &mem->clust[i];
-		p0 = c->pfn*hwrpb->by2pg;
-		p1 = (c->pfn+c->npages)*hwrpb->by2pg;
-		if (debug) {
-			print("clust%d: %llux-%llux, tested %llud/%llud vabitm %llux usage %llux\n",
-				i, p0, p1, c->ntest, c->npages, c->vabitm, c->usage);
-			if (c->vabitm)
-				print("\tfirst 64 pages: %llux\n", *(uvlong*)c->vabitm);
-		}
-		npage += c->npages;
-		if (p1 > conf.maxphys)
-			conf.maxphys = p1;
-		switch ((ulong)c->usage&3) {
-		case 0:
-			if (nbank >= Maxbank) {
-				print("increase Maxbank; lost %lldMB\n", c->npages*hwrpb->by2pg/MB);
-				break;
-			}
-			bank[nbank].min = p0;
-			bank[nbank].max = p1;
-			nbank++;
-			break;
-		case 2:
-			print("nvram skipped\n");
-			break;
-		}
-	}
-	if (debug)
-		print("\n");
-
-	print("Memory size: %lludMB\n", npage*hwrpb->by2pg/MB);
-	print("\n");
-
-	/* kernel virtual space = 2G.  leave room for kmapio */
-	if (conf.maxphys > 1024*MB) {
-		print("meminit: too much physical memory; only first gigabyte mapped\n\n");
-		conf.maxphys = 1024*MB;
-	}
-
-	conf.nbank = nbank;
-	conf.bank = bank;
-}
-
-int
-validrgn(ulong min, ulong max)
-{
-	int i;
-
-	min &= ~KZERO;
-	max &= ~KZERO;
-	for (i = 0; i < nbank; i++)
-		if (bank[i].min <= min && max <= bank[i].max)
-			return 1;
-	return 0;
-}
-
-uvlong
-allocate(int pages)
-{
-	uvlong top, len;
-	int from, i;
-
-	top = 0;
-	len = pages*hwrpb->by2pg;
-	from = -1;
-	for (i = 0; i < nbank; i++)
-		if (bank[i].max - bank[i].min >= len && bank[i].max > top) {
-			top = bank[i].max;
-			from = i;
-		}
-	if (from < 0)
-		return 0;
-	bank[from].max -= len;
-	conf.bank[from].max = bank[from].max;
-	for (i = 0; i < len>>3; i++)
-		stqp(bank[from].max+8*i, 0);
-	return bank[from].max;
-}
--- a/sys/src/boot/alphapc/mkfile
+++ /dev/null
@@ -1,42 +1,0 @@
-objtype=alpha
-</$objtype/mkfile
-
-TARGET=bootalphapc
-OBJ=\
-	l.$O\
-	main.$O\
-	conf.$O\
-	cons.$O\
-	exec.$O\
-	bootp.$O\
-	memory.$O\
-	mmu.$O\
-	print.$O\
-
-HFILES=\
-	u.h\
-	mem.h\
-	conf.h\
-	dat.h\
-	fns.h\
-	lib.h\
-	ip.h\
-
-loadaddr = 0x20000020
-
-$TARGET:	$OBJ
-	$LD -o $target -l -R8 -H3 -T$loadaddr $prereq -lc
-
-install:V: $TARGET
-	cp $TARGET /$objtype
-
-clean nuke:V:
-	rm -f *.$O $TARGET
-
-%.$O:	%.s
-	$AS $stem.s
-
-%.$O:	%.c
-	$CC $CFLAGS $stem.c
-
-%.$O: $HFILES
--- a/sys/src/boot/alphapc/mmu.c
+++ /dev/null
@@ -1,111 +1,0 @@
-#include	"u.h"
-#include	"mem.h"
-#include	"dat.h"
-#include	"fns.h"
-#include	"lib.h"
-
-static int	debug;
-
-static uvlong	by2pg;		/* hwrpb->by2pg */
-static uvlong	pte2pg;		/* by2pg/8 */
-static uvlong	pgmask;		/* by2pg-1 */
-static uvlong	ptemask;		/* pte2pg-1 */
-static uvlong	pgshift;		/* log2(by2pg) */
-static uvlong	pteshift;		/* log2(pte2pg) = pgshift - 3 */
-
-#define	L1(va)	(((uvlong)(va)>>3*pteshift+3) & (pte2pg-1))
-#define	L2(va)	(((uvlong)(va)>>2*pteshift+3) & (pte2pg-1))
-#define	L3(va)	(((uvlong)(va)>>pgshift) & (pte2pg-1))
-#define	OFF(va)	(((uvlong)(va)) & (by2pg-1))
-
-#define	V1(l1)	(((vlong)l1<<(64-pteshift)) >> 64-(3*pteshift+3))
-#define	V2(l2)	(((uvlong)l2<<(64-pteshift)) >> 64-(2*pteshift+3))
-#define	V3(l3)	(((uvlong)l3<<(64-pteshift)) >> 64-pgshift)
-#define	VA(l1, l2, l3, off)	(V1(l1) | V2(l2) | V3(l3) | (off))
-
-static int
-log2(uvlong x)
-{
-	int i;
-
-	if ((x & (x-1)) == 0)
-		for (i = 0; i < 64; i++)
-			if (x & (1<<i))
-				return i;
-	panic("log2: %llux", x);
-	return -1;
-}
-
-void
-mmuinit(void)
-{
-	int i;
-	uvlong npage, nlvl2, nlvl3;
-	uvlong l1p, l2p, lvl2, lvl3;
-	extern ulong _main[], edata[];
-
-	/* map entire physical memory at KZERO */
-	by2pg = hwrpb->by2pg;
-	pte2pg = (by2pg >> 3);
-	pgmask = by2pg-1;
-	ptemask = pte2pg-1;
-	pgshift = log2(by2pg);
-	pteshift = pgshift-3;
-
-	l1p = (1LL<<3*pteshift+3)|(1LL<<2*pteshift+3)|(1LL<<pgshift);
-	if (rdv(l1p+8*(pte2pg-1)) != 0 || rdv(l1p+8*(pte2pg-2)) != 0)
-		panic("KZERO lvl1 already mapped");
-
-	npage = (conf.maxphys+pgmask)>>pgshift;
-	nlvl3 = (npage+ptemask)>>pteshift;
-	nlvl2 = (nlvl3+ptemask)>>pteshift;
-	if (nlvl2 > 1)
-		panic("meminit: nlvl2");	/* cannot happen, due to virtual space limitation */
-	if (debug)
-		print("nlvl1 %llud nlvl2 %llud nlvl3 %llud npage %llud\n", 1LL, nlvl2, nlvl3, npage);
-
-	lvl2 = allocate(nlvl2+nlvl3);
-	lvl3 = lvl2 + nlvl2*by2pg;
-
-	wrv(l1p+8*(pte2pg-2), rdv(l1p+8)|PTEASM);
-	wrv(l1p+8*(pte2pg-1), (lvl2<<(32-pgshift)) | PTEKVALID | PTEASM);
-
-	l2p = (1LL<<3*pteshift+3)|(1LL<<2*pteshift+3)|((vlong)KZERO >> 2*pteshift)&((1LL<<2*pteshift+3)-1);
-	for (i = 0; i < nlvl3; i++)
-		stqp(lvl2+(l2p&(by2pg-1))+8*i, ((lvl3+i*by2pg)<<(32-pgshift)) | PTEKVALID | PTEASM);
-
-	for (i = 0; i < npage; i++)
-		stqp(lvl3+8*i, ((uvlong)i<<32) | PTEKVALID | PTEASM);
-
-	tlbflush();
-
-	if (debug)
-		print("\n");
-}
-
-uvlong
-paddr(uvlong va)
-{
-	uvlong ptbr, x, pte;
-
-	ptbr = getptbr();
-	pte = ldqp((ptbr<<pgshift)+8*L1(va));
-	if ((pte&PTEKVALID) != PTEKVALID)
-		return 0;
-	x = ((pte>>32)<<pgshift);
-	pte = ldqp(x+8*L2(va));
-	if ((pte&PTEKVALID) != PTEKVALID)
-		return 0;
-	x = ((pte>>32)<<pgshift);
-	pte = ldqp(x+8*L3(va));
-	if ((pte&PTEKVALID) != PTEKVALID)
-		return 0;
-	x = ((pte>>32)<<pgshift);
-	return x;
-}
-
-uvlong
-pground(uvlong x)
-{
-	return (x+pgmask) & ~pgmask;
-}
--- a/sys/src/boot/alphapc/print.c
+++ /dev/null
@@ -1,575 +1,0 @@
-#include	"u.h"
-#include	"lib.h"
-
-enum
-{
-	SIZE	= 1024,
-	IDIGIT	= 30,
-	MAXCONV	= 40,
-	FDIGIT	= 30,
-	FDEFLT	= 6,
-	NONE	= -1000,
-	MAXFMT	= 512,
-
-	FPLUS	= 1<<0,
-	FMINUS	= 1<<1,
-	FSHARP	= 1<<2,
-	FLONG	= 1<<3,
-	FSHORT	= 1<<4,
-	FUNSIGN	= 1<<5,
-	FVLONG	= 1<<6,
-};
-
-int	printcol;
-
-static	int	convcount;
-static	char	fmtindex[MAXFMT];
-
-static	int	noconv(va_list*, Fconv*);
-static	int	flags(va_list*, Fconv*);
-
-static	int	cconv(va_list*, Fconv*);
-static	int	sconv(va_list*, Fconv*);
-static	int	percent(va_list*, Fconv*);
-
-int	numbconv(va_list*, Fconv*);
-
-static
-int	(*fmtconv[MAXCONV])(va_list*, Fconv*) =
-{
-	noconv
-};
-
-static
-void
-initfmt(void)
-{
-	int cc;
-
-	cc = 0;
-	fmtconv[cc] = noconv;
-	cc++;
-
-	fmtconv[cc] = flags;
-	fmtindex['+'] = cc;
-	fmtindex['-'] = cc;
-	fmtindex['#'] = cc;
-	fmtindex['h'] = cc;
-	fmtindex['l'] = cc;
-	fmtindex['u'] = cc;
-	cc++;
-
-	fmtconv[cc] = numbconv;
-	fmtindex['d'] = cc;
-	fmtindex['o'] = cc;
-	fmtindex['x'] = cc;
-	fmtindex['X'] = cc;
-	cc++;
-
-	fmtconv[cc] = cconv;
-	fmtindex['c'] = cc;
-	fmtindex['C'] = cc;
-	cc++;
-
-	fmtconv[cc] = sconv;
-	fmtindex['s'] = cc;
-	fmtindex['S'] = cc;
-	cc++;
-
-	fmtconv[cc] = percent;
-	fmtindex['%'] = cc;
-	cc++;
-
-	convcount = cc;
-}
-
-int
-fmtinstall(int c, int (*f)(va_list*, Fconv*))
-{
-
-	if(convcount == 0)
-		initfmt();
-	if(c < 0 || c >= MAXFMT)
-		return -1;
-	if(convcount >= MAXCONV)
-		return -1;
-	fmtconv[convcount] = f;
-	fmtindex[c] = convcount;
-	convcount++;
-	return 0;
-}
-
-char*
-doprint(char *s, char *es, char *fmt, va_list argp)
-{
-	int n, c;
-	Rune rune;
-	Fconv local;
-
-	local.out = s;
-	local.eout = es-UTFmax-1;
-
-loop:
-	c = *fmt & 0xff;
-	if(c >= Runeself) {
-		n = chartorune(&rune, fmt);
-		fmt += n;
-		c = rune;
-	} else
-		fmt++;
-	switch(c) {
-	case 0:
-		*local.out = 0;
-		return local.out;
-
-	default:
-		printcol++;
-		goto common;
-
-	case '\n':
-		printcol = 0;
-		goto common;
-
-	case '\t':
-		printcol = (printcol+8) & ~7;
-		goto common;
-
-	common:
-		if(local.out < local.eout)
-			if(c >= Runeself) {
-				rune = c;
-				n = runetochar(local.out, &rune);
-				local.out += n;
-			} else
-				*local.out++ = c;
-		goto loop;
-
-	case '%':
-		break;
-	}
-	local.f1 = NONE;
-	local.f2 = NONE;
-	local.f3 = 0;
-
-	/*
-	 * read one of the following
-	 *	1. number, => f1, f2 in order.
-	 *	2. '*' same as number (from args)
-	 *	3. '.' ignored (separates numbers)
-	 *	4. flag => f3
-	 *	5. verb and terminate
-	 */
-l0:
-	c = *fmt & 0xff;
-	if(c >= Runeself) {
-		n = chartorune(&rune, fmt);
-		fmt += n;
-		c = rune;
-	} else
-		fmt++;
-
-l1:
-	if(c == 0) {
-		fmt--;
-		goto loop;
-	}
-	if(c == '.') {
-		if(local.f1 == NONE)
-			local.f1 = 0;
-		local.f2 = 0;
-		goto l0;
-	}
-	if((c >= '1' && c <= '9') ||
-	   (c == '0' && local.f1 != NONE)) {	/* '0' is a digit for f2 */
-		n = 0;
-		while(c >= '0' && c <= '9') {
-			n = n*10 + c-'0';
-			c = *fmt++;
-		}
-		if(local.f1 == NONE)
-			local.f1 = n;
-		else
-			local.f2 = n;
-		goto l1;
-	}
-	if(c == '*') {
-		n = va_arg(argp, int);
-		if(local.f1 == NONE)
-			local.f1 = n;
-		else
-			local.f2 = n;
-		goto l0;
-	}
-	n = 0;
-	if(c >= 0 && c < MAXFMT)
-		n = fmtindex[c];
-	local.chr = c;
-	n = (*fmtconv[n])(&argp, &local);
-	if(n < 0) {
-		local.f3 |= -n;
-		goto l0;
-	}
-	goto loop;
-}
-
-int
-numbconv(va_list *arg, Fconv *fp)
-{
-	char s[IDIGIT];
-	int i, f, n, b, ucase;
-	short h;
-	long v;
-	vlong vl;
-
-	SET(v);
-	SET(vl);
-
-	ucase = 0;
-	b = fp->chr;
-	switch(fp->chr) {
-	case 'u':
-		fp->f3 |= FUNSIGN;
-	case 'd':
-		b = 10;
-		break;
-
-	case 'o':
-		b = 8;
-		break;
-
-	case 'X':
-		ucase = 1;
-	case 'x':
-		b = 16;
-		break;
-	}
-
-	f = 0;
-	switch(fp->f3 & (FVLONG|FLONG|FSHORT|FUNSIGN)) {
-	case FVLONG|FLONG:
-		vl = va_arg(*arg, vlong);
-		break;
-
-	case FUNSIGN|FVLONG|FLONG:
-		vl = va_arg(*arg, uvlong);
-		break;
-
-	case FLONG:
-		v = va_arg(*arg, long);
-		break;
-
-	case FUNSIGN|FLONG:
-		v = va_arg(*arg, ulong);
-		break;
-
-	case FSHORT:
-		h = va_arg(*arg, int);
-		v = h;
-		break;
-
-	case FUNSIGN|FSHORT:
-		h = va_arg(*arg, int);
-		v = (ushort)h;
-		break;
-
-	default:
-		v = va_arg(*arg, int);
-		break;
-
-	case FUNSIGN:
-		v = va_arg(*arg, unsigned);
-		break;
-	}
-	if(fp->f3 & FVLONG) {
-		if(!(fp->f3 & FUNSIGN) && vl < 0) {
-			vl = -vl;
-			f = 1;
-		}
-	} else {
-		if(!(fp->f3 & FUNSIGN) && v < 0) {
-			v = -v;
-			f = 1;
-		}
-	}
-	s[IDIGIT-1] = 0;
-	for(i = IDIGIT-2;; i--) {
-		if(fp->f3 & FVLONG)
-			n = (uvlong)vl % b;
-		else
-			n = (ulong)v % b;
-		n += '0';
-		if(n > '9') {
-			n += 'a' - ('9'+1);
-			if(ucase)
-				n += 'A'-'a';
-		}
-		s[i] = n;
-		if(i < 2)
-			break;
-		if(fp->f3 & FVLONG)
-			vl = (uvlong)vl / b;
-		else
-			v = (ulong)v / b;
-		if(fp->f2 != NONE && i >= IDIGIT-fp->f2)
-			continue;
-		if(fp->f3 & FVLONG) {
-			if(vl <= 0)
-				break;
-			continue;
-		}
-		if(v <= 0)
-			break;
-	}
-
-	if(fp->f3 & FSHARP) {
-		if(b == 8 && s[i] != '0')
-			s[--i] = '0';
-		if(b == 16) {
-			if(ucase)
-				s[--i] = 'X';
-			else
-				s[--i] = 'x';
-			s[--i] = '0';
-		}
-	}
-	if(f)
-		s[--i] = '-';
-	fp->f2 = NONE;
-	strconv(s+i, fp);
-	return 0;
-}
-
-void
-Strconv(Rune *s, Fconv *fp)
-{
-	int n, c, i;
-	Rune rune;
-
-	if(fp->f3 & FMINUS)
-		fp->f1 = -fp->f1;
-	n = 0;
-	if(fp->f1 != NONE && fp->f1 >= 0) {
-		for(; s[n]; n++)
-			;
-		while(n < fp->f1) {
-			if(fp->out < fp->eout)
-				*fp->out++ = ' ';
-			printcol++;
-			n++;
-		}
-	}
-	for(;;) {
-		c = *s++;
-		if(c == 0)
-			break;
-		n++;
-		if(fp->f2 == NONE || fp->f2 > 0) {
-			if(fp->out < fp->eout)
-				if(c >= Runeself) {
-					rune = c;
-					i = runetochar(fp->out, &rune);
-					fp->out += i;
-				} else
-					*fp->out++ = c;
-			if(fp->f2 != NONE)
-				fp->f2--;
-			switch(c) {
-			default:
-				printcol++;
-				break;
-			case '\n':
-				printcol = 0;
-				break;
-			case '\t':
-				printcol = (printcol+8) & ~7;
-				break;
-			}
-		}
-	}
-	if(fp->f1 != NONE && fp->f1 < 0) {
-		fp->f1 = -fp->f1;
-		while(n < fp->f1) {
-			if(fp->out < fp->eout)
-				*fp->out++ = ' ';
-			printcol++;
-			n++;
-		}
-	}
-}
-
-void
-strconv(char *s, Fconv *fp)
-{
-	int n, c, i;
-	Rune rune;
-
-	if(fp->f3 & FMINUS)
-		fp->f1 = -fp->f1;
-	n = 0;
-	if(fp->f1 != NONE && fp->f1 >= 0) {
-		n = utflen(s);
-		while(n < fp->f1) {
-			if(fp->out < fp->eout)
-				*fp->out++ = ' ';
-			printcol++;
-			n++;
-		}
-	}
-	for(;;) {
-		c = *s & 0xff;
-		if(c >= Runeself) {
-			i = chartorune(&rune, s);
-			s += i;
-			c = rune;
-		} else
-			s++;
-		if(c == 0)
-			break;
-		n++;
-		if(fp->f2 == NONE || fp->f2 > 0) {
-			if(fp->out < fp->eout)
-				if(c >= Runeself) {
-					rune = c;
-					i = runetochar(fp->out, &rune);
-					fp->out += i;
-				} else
-					*fp->out++ = c;
-			if(fp->f2 != NONE)
-				fp->f2--;
-			switch(c) {
-			default:
-				printcol++;
-				break;
-			case '\n':
-				printcol = 0;
-				break;
-			case '\t':
-				printcol = (printcol+8) & ~7;
-				break;
-			}
-		}
-	}
-	if(fp->f1 != NONE && fp->f1 < 0) {
-		fp->f1 = -fp->f1;
-		while(n < fp->f1) {
-			if(fp->out < fp->eout)
-				*fp->out++ = ' ';
-			printcol++;
-			n++;
-		}
-	}
-}
-
-static
-int
-noconv(va_list *arg, Fconv *fp)
-{
-	int n;
-	char s[10];
-
-	if(convcount == 0) {
-		initfmt();
-		n = 0;
-		if(fp->chr >= 0 && fp->chr < MAXFMT)
-			n = fmtindex[fp->chr];
-		return (*fmtconv[n])(arg, fp);
-	}
-	s[0] = '*';
-	s[1] = fp->chr;
-	s[2] = '*';
-	s[3] = 0;
-	fp->f1 = 0;
-	fp->f2 = NONE;
-	fp->f3 = 0;
-	strconv(s, fp);
-	return 0;
-}
-
-static
-int
-cconv(va_list *arg, Fconv *fp)
-{
-	char s[10];
-	Rune rune;
-
-	rune = va_arg(*arg, int);
-	if(fp->chr == 'c')
-		rune &= 0xff;
-	s[runetochar(s, &rune)] = 0;
-
-	fp->f2 = NONE;
-	strconv(s, fp);
-	return 0;
-}
-
-static
-int
-sconv(va_list *arg, Fconv *fp)
-{
-	char *s;
-	Rune *r;
-
-	if(fp->chr == 's') {
-		s = va_arg(*arg, char*);
-		if(s == 0)
-			s = "<null>";
-		strconv(s, fp);
-	} else {
-		r = va_arg(*arg, Rune*);
-		if(r == 0)
-			r = L"<null>";
-		Strconv(r, fp);
-	}
-	return 0;
-}
-
-static
-int
-percent(va_list *arg, Fconv *fp)
-{
-
-	USED(arg);
-	if(fp->out < fp->eout)
-		*fp->out++ = '%';
-	printcol++;
-	return 0;
-}
-
-static
-int
-flags(va_list *arg, Fconv *fp)
-{
-	int f;
-
-	USED(arg);
-
-	f = 0;
-	switch(fp->chr) {
-	case '+':
-		f = FPLUS;
-		break;
-
-	case '-':
-		f = FMINUS;
-		break;
-
-	case '#':
-		f = FSHARP;
-		break;
-
-	case 'h':
-		f = FSHORT;
-		break;
-
-	case 'l':
-		f = FLONG;
-		if(fp->f3 & FLONG)
-			f = FVLONG;
-		break;
-
-	case 'u':
-		f = FUNSIGN;
-		break;
-	}
-	return -f;
-}
--- a/sys/src/boot/alphapc/u.h
+++ /dev/null
@@ -1,28 +1,0 @@
-#define nil		((void*)0)
-typedef	unsigned short		ushort;
-typedef	unsigned char		uchar;
-typedef	signed char		schar;
-typedef	unsigned long		ulong;
-typedef	unsigned int	uint;
-typedef	long long			vlong;
-typedef	unsigned long long	uvlong;
-typedef	union Length		Length;
-typedef	ushort			Rune;
-
-union Length
-{
-	vlong	length;
-};
-
-/* stdarg */
-typedef	char*	va_list;
-#define va_start(list, start) list = (char*)(&(start)+1)
-#define va_end(list)
-#define va_arg(list, mode)\
-	(sizeof(mode)==1?\
-		((mode*)(list += 4))[-1]:\
-	sizeof(mode)==2?\
-		((mode*)(list += 4))[-1]:\
-	sizeof(mode)>4?\
-		((mode*)(list = (char*)((long)(list+7) & ~7) + sizeof(mode)))[-1]:\
-		((mode*)(list += sizeof(mode)))[-1])
--- a/sys/src/boot/alphapc/vmspal.h
+++ /dev/null
@@ -1,105 +1,0 @@
-/*
- * VMS PALcode instructions, in numerical order.
- */
-
-#define	PALhalt		0x00	/* required per Alpha architecture */
-#define	PALcflush	0x01
-#define	PALdraina	0x02	/* required per Alpha architecture */
-#define	PALldqp		0x03
-
-#define	PALstqp		0x04
-#define	PALswpctx	0x05
-#define	PALmfpr_asn	0x06
-#define	PALmtpr_asten	0x07
-#define	PALmtpr_astsr	0x08
-#define	PALcserve	0x09
-#define	PALswppal	0x0a
-#define	PALmfpr_fen	0x0b
-#define	PALmtpr_fen	0x0c
-#define	PALmtpr_ipir	0x0d
-#define	PALmfpr_ipl	0x0e
-#define	PALmtpr_ipl	0x0f
-#define	PALmfpr_mces	0x10
-#define	PALmtpr_mces	0x11
-#define	PALmfpr_pcbb	0x12
-#define	PALmfpr_prbr	0x13
-#define	PALmtpr_prbr	0x14
-#define	PALmfpr_ptbr	0x15
-#define	PALmfpr_scbb	0x16
-#define	PALmtpr_scbb	0x17
-#define	PALmtpr_sirr	0x18
-#define	PALmfpr_sisr	0x19
-#define	PALmfpr_tbchk	0x1a
-#define	PALmtpr_tbia	0x1b
-#define	PALmtpr_tbiap	0x1c
-#define	PALmtpr_tbis	0x1d
-#define	PALmfpr_esp	0x1e
-#define	PALmtpr_esp	0x1f
-#define	PALmfpr_ssp	0x20
-#define	PALmtpr_ssp	0x21
-#define	PALmfpr_usp	0x22
-#define	PALmtpr_usp	0x23
-#define	PALmtpr_tbisd	0x24
-#define	PALmtpr_tbisi	0x25
-#define	PALmfpr_asten	0x26
-#define	PALmfpr_astsr	0x27
-				/* where is instruction 0x28 ? */
-#define	PALmfpr_vptb	0x29
-#define	PALmtpr_vptb	0x2a
-#define	PALmtpr_perfmon	0x2b
-				/* where is instruction 0x2c ? */
-				/* where is instruction 0x2d ? */
-#define	PALmtpr_datfx	0x2e
-/*
- * ... 0x2f to 0x3e ??
- */
-#define	PALmfpr_whami	0x3f
-/*
- * ... 0x40 to 0x7f ??
- */
-#define	PALbpt		0x80
-#define	PALbugchk	0x81
-#define	PALchime	0x82
-#define	PALchmk		0x83
-#define	PALchms		0x84
-#define	PALchmu		0x85
-#define	PALimb		0x86	/* required per Alpha architecture */
-#define	PALinsqhil	0x87
-#define	PALinsqtil	0x88
-#define	PALinsqhiq	0x89
-#define	PALinsqtiq	0x8a
-#define	PALinsquel	0x8b
-#define	PALinsqueq	0x8c
-#define	PALinsqueld	0x8d	/* INSQUEL/D */
-#define	PALinsqueqd	0x8e	/* INSQUEQ/D */
-#define	PALprober	0x8f
-#define	PALprobew	0x90
-#define	PALrd_ps	0x91
-#define	PALrei		0x92
-#define	PALremqhil	0x93
-#define	PALremqtil	0x94
-#define	PALremqhiq	0x95
-#define	PALremqtiq	0x96
-#define	PALremquel	0x97
-#define	PALremqueq	0x98
-#define	PALremqueld	0x99	/* REMQUEL/D */
-#define	PALremqueqd	0x9a	/* REMQUEQ/D */
-#define	PALswasten	0x9b
-#define	PALwr_ps_sw	0x9c
-#define	PALrscc		0x9d
-#define	PALread_unq	0x9e
-#define	PALwrite_unq	0x9f
-#define	PALamovrr	0xa0
-#define	PALamovrm	0xa1
-#define	PALinsqhilr	0xa2
-#define	PALinsqtilr	0xa3
-
-#define	PALinsqhiqr	0xa4
-#define	PALinsqtiqr	0xa5
-#define	PALremqhilr	0xa6
-
-#define	PALremqtilr	0xa7
-#define	PALremqhiqr	0xa8
-#define	PALremqtiqr	0xa9
-#define	PALgentrap	0xaa
-
--- a/sys/src/boot/mkfile
+++ b/sys/src/boot/mkfile
@@ -1,7 +1,8 @@
 ARCH=\
-	alphapc\
 	bitsy\
+	efi\
 	pc\
+	zynq\
 
 all:V:
 	for(i in $ARCH)@{
--- a/sys/src/cmd/7a/a.h
+++ /dev/null
@@ -1,208 +1,0 @@
-#include <u.h>
-#include <libc.h>
-#include <bio.h>
-#include "../7c/7.out.h"
-
-#ifndef	EXTERN
-#define	EXTERN	extern
-#endif
-
-#define	MAXALIGN	7
-
-typedef	struct	Sym	Sym;
-typedef	struct	Ref	Ref;
-typedef	struct	Gen	Gen;
-typedef	struct	Io	Io;
-typedef	struct	Hist	Hist;
-
-#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;
-	vlong	value;
-	long	dummy_pad;
-	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
-{
-	Sym*	sym;
-	vlong	offset;
-	long	dummy_pad;
-	short	type;
-	short	reg;
-	short	name;
-	double	dval;
-	char	sval[8];
-};
-
-struct	Hist
-{
-	Hist*	link;
-	char*	name;
-	long	line;
-	vlong	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;
-vlong	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	pinit(char*);
-void	cclean(void);
-int	isreg(Gen*);
-void	outcode(int, Gen*, int, Gen*);
-void	zname(char*, int, int);
-void	zaddr(Gen*, 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	maclin(void);
-void	macprag(void);
-void	macif(int);
-void	macend(void);
-void	outhist(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);
--- a/sys/src/cmd/7a/a.y
+++ /dev/null
@@ -1,537 +1,0 @@
-%{
-#include "a.h"
-%}
-%union
-{
-	Sym	*sym;
-	vlong	lval;
-	double	dval;
-	char	sval[8];
-	Gen	gen;
-}
-%left	'|'
-%left	'^'
-%left	'&'
-%left	'<' '>'
-%left	'+' '-'
-%left	'*' '/' '%'
-%token	<lval>	LTYPE1 LTYPE2 LTYPE3 LTYPE4 LTYPE5
-%token	<lval>	LTYPE6 LTYPE7 LTYPE8 LTYPE9 LTYPEA
-%token	<lval>	LTYPEB LTYPEC LTYPED LTYPEE LTYPEF
-%token	<lval>	LTYPEG LTYPEH LTYPEI LTYPEJ LTYPEK
-%token	<lval>	LCONST LSP LSB LFP LPC LPREG LPCC
-%token	<lval>	LTYPEX LREG LFREG LFPCR LR LP LF
-%token	<dval>	LFCONST
-%token	<sval>	LSCONST
-%token	<sym>	LNAME LLAB LVAR
-%type	<lval>	con expr pointer offset sreg
-%type	<gen>	gen vgen lgen vlgen flgen rel reg freg preg fcreg
-%type	<gen>	imm ximm ireg name oreg imr nireg fgen pcc
-%%
-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
-|	LNAME '=' expr ';'
-	{
-		$1->type = LVAR;
-		$1->value = $3;
-	}
-|	LVAR '=' expr ';'
-	{
-		if($1->value != $3)
-			yyerror("redeclaration of %s", $1->name);
-		$1->value = $3;
-	}
-|	';'
-|	inst ';'
-|	error ';'
-
-inst:
-/*
- * Integer operates
- */
-	LTYPE1 imr ',' sreg ',' reg
-	{
-		outcode($1, &$2, $4, &$6);
-	}
-|	LTYPE1 imr ',' reg
-	{
-		outcode($1, &$2, NREG, &$4);
-	}
-/*
- * floating-type
- */
-|	LTYPE2 freg ',' freg
-	{
-		outcode($1, &$2, NREG, &$4);
-	}
-|	LTYPE3 freg ',' freg
-	{
-		outcode($1, &$2, NREG, &$4);
-	}
-|	LTYPE3 freg ',' LFREG ',' freg
-	{
-		outcode($1, &$2, $4, &$6);
-	}
-/*
- * MOVQ
- */
-|	LTYPE4 vlgen ',' vgen
-	{
-		if(!isreg(&$2) && !isreg(&$4))
-			print("one side must be register\n");
-		outcode($1, &$2, NREG, &$4);
-	}
-/*
- * integer LOAD/STORE, but not MOVQ
- */
-|	LTYPE5 lgen ',' gen
-	{
-		if(!isreg(&$2) && !isreg(&$4))
-			print("one side must be register\n");
-		outcode($1, &$2, NREG, &$4);
-	}
-/*
- * integer LOAD/STORE (only)
- */
-|	LTYPE6 oreg ',' reg
-	{
-		outcode($1, &$2, NREG, &$4);
-	}
-|	LTYPEK reg ',' oreg
-	{
-		outcode($1, &$2, NREG, &$4);
-	}
-/*
- * floating LOAD/STORE
- */
-|	LTYPE7 flgen ',' fgen
-	{
-		if(!isreg(&$2) && !isreg(&$4))
-			print("one side must be register\n");
-		outcode($1, &$2, NREG, &$4);
-	}
-/*
- * JMP/JSR/RET
- */
-|	LTYPE8 comma rel
-	{
-		outcode($1, &nullgen, NREG, &$3);
-	}
-|	LTYPE8 comma nireg
-	{
-		outcode($1, &nullgen, NREG, &$3);
-	}
-|	LTYPE8 sreg ',' nireg
-	{
-		outcode($1, &nullgen, $2, &$4);
-	}
-|	LTYPE9 comma
-	{
-		outcode($1, &nullgen, NREG, &nullgen);
-	}
-/*
- * integer conditional branches
- */
-|	LTYPEA gen ',' rel
-	{
-		if(!isreg(&$2))
-			print("left side must be register\n");
-		outcode($1, &$2, NREG, &$4);
-	}
-/*
- * floating conditional branches
- */
-|	LTYPEB fgen ',' rel
-	{
-		if(!isreg(&$2))
-			print("left side must be register\n");
-		outcode($1, &$2, NREG, &$4);
-	}
-/*
- * TRAPB/MB/REI
- */
-|	LTYPEC comma
-	{
-		outcode($1, &nullgen, NREG, &nullgen);
-	}
-/*
- * FETCH/FETCHM
- */
-|	LTYPED ireg comma
-	{
-		outcode($1, &$2, NREG, &nullgen);
-	}
-/*
- * Call-pal
- */
-|	LTYPEE imm
-	{
-		outcode($1, &$2, NREG, &nullgen);
-	}
-/*
- * TEXT/GLOBL
- */
-|	LTYPEF name ',' imm
-	{
-		outcode($1, &$2, NREG, &$4);
-	}
-|	LTYPEF name ',' con ',' imm
-	{
-		outcode($1, &$2, $4, &$6);
-	}
-/*
- * DATA
- */
-|	LTYPEG name '/' con ',' ximm
-	{
-		outcode($1, &$2, $4, &$6);
-	}
-/*
- * word
- */
-|	LTYPEH comma ximm
-	{
-		outcode($1, &nullgen, NREG, &$3);
-	}
-/*
- * NOP
- */
-|	LTYPEI comma
-	{
-		outcode($1, &nullgen, NREG, &nullgen);
-	}
-|	LTYPEI ',' vgen
-	{
-		outcode($1, &nullgen, NREG, &$3);
-	}
-|	LTYPEI vgen comma
-	{
-		outcode($1, &$2, NREG, &nullgen);
-	}
-
-comma:
-|	','
-
-rel:
-	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;
-	}
-
-vlgen:
-	lgen
-|	preg
-|	pcc
-
-vgen:
-	gen
-|	preg
-
-lgen:
-	gen
-|	ximm
-
-flgen:
-	fgen
-|	ximm
-
-fgen:
-	gen
-|	freg
-|	fcreg
-
-preg:
-	LPREG
-	{
-		$$ = nullgen;
-		$$.type = D_PREG;
-		$$.reg = $1;
-	}
-|	LP '(' con ')'
-	{
-		$$ = nullgen;
-		$$.type = D_PREG;
-		$$.reg = $1+$3;
-	}
-
-fcreg:
-	LFPCR
-	{
-		$$ = nullgen;
-		$$.type = D_FCREG;
-		$$.reg = $1;
-	}
-
-freg:
-	LFREG
-	{
-		$$ = nullgen;
-		$$.type = D_FREG;
-		$$.reg = $1;
-	}
-|	LF '(' con ')'
-	{
-		$$ = nullgen;
-		$$.type = D_FREG;
-		$$.reg = $3;
-	}
-
-pcc:
-	LPCC
-	{
-		$$ = nullgen;
-		$$.type = D_PCC;
-		$$.reg = $1;
-	}
-
-ximm:	'$' con
-	{
-		$$ = nullgen;
-		$$.type = D_CONST;
-		$$.offset = $2;
-	}
-|	'$' oreg
-	{
-		$$ = $2;
-		$$.type = D_CONST;
-	}
-|	'$' LSCONST
-	{
-		$$ = nullgen;
-		$$.type = D_SCONST;
-		memcpy($$.sval, $2, sizeof($$.sval));
-	}
-|	'$' LFCONST
-	{
-		$$ = nullgen;
-		$$.type = D_FCONST;
-		$$.dval = $2;
-	}
-|	'$' '-' LFCONST
-	{
-		$$ = nullgen;
-		$$.type = D_FCONST;
-		$$.dval = -$3;
-	}
-
-nireg:
-	ireg
-|	name
-	{
-		$$ = $1;
-		if($1.name != D_EXTERN && $1.name != D_STATIC) {
-		}
-	}
-
-ireg:
-	'(' sreg ')'
-	{
-		$$ = nullgen;
-		$$.type = D_OREG;
-		$$.reg = $2;
-		$$.offset = 0;
-	}
-
-gen:
-	reg
-|	con
-	{
-		$$ = nullgen;
-		$$.type = D_OREG;
-		$$.offset = $1;
-	}
-|	oreg
-
-oreg:
-	name
-|	name '(' sreg ')'
-	{
-		$$ = $1;
-		$$.type = D_OREG;
-		$$.reg = $3;
-	}
-|	'(' sreg ')'
-	{
-		$$ = nullgen;
-		$$.type = D_OREG;
-		$$.reg = $2;
-		$$.offset = 0;
-	}
-|	con '(' sreg ')'
-	{
-		$$ = nullgen;
-		$$.type = D_OREG;
-		$$.reg = $3;
-		$$.offset = $1;
-	}
-
-imr:
-	reg
-|	imm
-
-imm:	'$' con
-	{
-		$$ = nullgen;
-		$$.type = D_CONST;
-		$$.offset = $2;
-	}
-
-reg:
-	sreg
-	{
-		$$ = nullgen;
-		$$.type = D_REG;
-		$$.reg = $1;
-	}
-
-sreg:
-	LREG
-|	LR '(' con ')'
-	{
-		if($$ < 0 || $$ >= NREG)
-			print("register value out of range\n");
-		$$ = $3;
-	}
-
-name:
-	con '(' pointer ')'
-	{
-		$$ = nullgen;
-		$$.type = D_OREG;
-		$$.name = $3;
-		$$.sym = S;
-		$$.offset = $1;
-	}
-|	LNAME offset '(' pointer ')'
-	{
-		$$ = nullgen;
-		$$.type = D_OREG;
-		$$.name = $4;
-		$$.sym = $1;
-		$$.offset = $2;
-	}
-|	LNAME '<' '>' offset '(' LSB ')'
-	{
-		$$ = nullgen;
-		$$.type = D_OREG;
-		$$.name = 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;
-	}
--- a/sys/src/cmd/7a/lex.c
+++ /dev/null
@@ -1,694 +1,0 @@
-#include <ctype.h>
-#define	EXTERN
-#include "a.h"
-#include "y.tab.h"
-
-void
-main(int argc, char *argv[])
-{
-	char ofile[100], incfile[20], *p;
-	int nout, nproc, status, i, c, of;
-
-	thechar = '7';			/* of 9 */
-	thestring = "alpha";
-	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();
-		if(p)
-			include[ninclude++] = p;
-		break;
-	} ARGEND
-	if(*argv == 0) {
-		print("usage: %ca [-options] file.s\n", thechar);
-		errorexit();
-	}
-	nproc = 3;
-	if(p = getenv("NPROC"))
-		nproc = atol(p);
-	if(argc > 1) {
-		c = 0;
-		nout = 0;
-		for(;;) {
-			while(nout < nproc && argc > 0) {
-				i = fork();
-				if(i < 0) {
-					i = mywait(&status);
-					if(i < 0)
-						errorexit();
-					if(status)
-						c++;
-					nout--;
-					continue;
-				}
-				if(i == 0) {
-					print("%s:\n", *argv);
-					goto child;
-				}
-				nout++;
-				argc--;
-				argv++;
-			}
-			i = mywait(&status);
-			if(i < 0) {
-				if(c)
-					errorexit();
-				exits(0);
-			}
-			if(status)
-				c++;
-			nout--;
-		}
-	}
-
-child:
-	strecpy(ofile, ofile+sizeof ofile, *argv);
-	if(p = strrchr(ofile, '/')) {
-		include[0] = ofile;
-		*p++ = 0;
-	} else
-		p = ofile;
-	if(outfile == 0) {
-		outfile = p;
-		if(p = strrchr(outfile, '.'))
-			if(p[1] == 's' && p[2] == 0)
-				p[0] = 0;
-		p = strrchr(outfile, 0);
-		p[0] = '.';
-		p[1] = thechar;
-		p[2] = 0;
-	}
-	if(0) {
-		strcpy(incfile, "/usr/%include");
-		p = strrchr(incfile, '%');
-		if(p)
-			*p = thechar;
-	} else {
-		strcpy(incfile, "/");
-		strcat(incfile, thestring);
-		strcat(incfile, "/include");
-	}
-	include[ninclude++] = incfile;
-	if(p = getenv("INCLUDE"))
-		include[ninclude-1] = p;	/* */
-	of = mycreat(outfile, 0664);
-	if(of < 0) {
-		yyerror("%ca: cannot create %s", thechar, outfile);
-		errorexit();
-	}
-	Binit(&obuf, of, OWRITE);
-
-	pass = 1;
-	pinit(*argv);
-	for(i=0; i<nDlist; i++)
-		dodefine(Dlist[i]);
-	yyparse();
-	if(nerrors) {
-		cclean();
-		errorexit();
-	}
-
-	pass = 2;
-	outhist();
-	pinit(*argv);
-	for(i=0; i<nDlist; i++)
-		dodefine(Dlist[i]);
-	yyparse();
-	cclean();
-	if(nerrors)
-		errorexit();
-	exits(0);
-}
-
-struct
-{
-	char	*name;
-	ushort	type;
-	ushort	value;
-} itab[] =
-{
-	"SP",		LSP,	D_AUTO,
-	"SB",		LSB,	D_EXTERN,
-	"FP",		LFP,	D_PARAM,
-	"PC",		LPC,	D_BRANCH,
-
-	"R",		LR,	0,
-	"R0",		LREG,	0,
-	"R1",		LREG,	1,
-	"R2",		LREG,	2,
-	"R3",		LREG,	3,
-	"R4",		LREG,	4,
-	"R5",		LREG,	5,
-	"R6",		LREG,	6,
-	"R7",		LREG,	7,
-	"R8",		LREG,	8,
-	"R9",		LREG,	9,
-	"R10",		LREG,	10,
-	"R11",		LREG,	11,
-	"R12",		LREG,	12,
-	"R13",		LREG,	13,
-	"R14",		LREG,	14,
-	"R15",		LREG,	15,
-	"R16",		LREG,	16,
-	"R17",		LREG,	17,
-	"R18",		LREG,	18,
-	"R19",		LREG,	19,
-	"R20",		LREG,	20,
-	"R21",		LREG,	21,
-	"R22",		LREG,	22,
-	"R23",		LREG,	23,
-	"R24",		LREG,	24,
-	"R25",		LREG,	25,
-	"R26",		LREG,	26,
-	"R27",		LREG,	27,
-	"R28",		LREG,	28,
-	"R29",		LREG,	29,
-	"R30",		LREG,	30,
-	"R31",		LREG,	31,
-
-	"P",		LP,	0,
-	"I",		LP,	32,
-	"A",		LP,	64,
-	"IA",		LP,	96,
-	"T",		LP,	128,
-	"IT",		LP,	32+128,
-	"AT",		LP,	64+128,
-	"IAT",		LP,	96+128,
-	"T0",		LPREG,	0+128,
-	"T1",		LPREG,	1+128,
-	"T2",		LPREG,	2+128,
-	"T3",		LPREG,	3+128,
-	"T4",		LPREG,	4+128,
-	"T5",		LPREG,	5+128,
-	"T6",		LPREG,	6+128,
-	"T7",		LPREG,	7+128,
-	"T8",		LPREG,	8+128,
-	"T9",		LPREG,	9+128,
-	"T10",		LPREG,	10+128,
-	"T11",		LPREG,	11+128,
-	"T12",		LPREG,	12+128,
-	"T13",		LPREG,	13+128,
-	"T14",		LPREG,	14+128,
-	"T15",		LPREG,	15+128,
-	"T16",		LPREG,	16+128,
-	"T17",		LPREG,	17+128,
-	"T18",		LPREG,	18+128,
-	"T19",		LPREG,	19+128,
-	"T20",		LPREG,	20+128,
-	"T21",		LPREG,	21+128,
-	"T22",		LPREG,	22+128,
-	"T23",		LPREG,	23+128,
-	"T24",		LPREG,	24+128,
-	"T25",		LPREG,	25+128,
-	"T26",		LPREG,	26+128,
-	"T27",		LPREG,	27+128,
-	"T28",		LPREG,	28+128,
-	"T29",		LPREG,	29+128,
-	"T30",		LPREG,	30+128,
-	"T31",		LPREG,	31+128,
-
-	"F",		LF,	0,
-
-	"F0",		LFREG,	0,
-	"F1",		LFREG,	1,
-	"F2",		LFREG,	2,
-	"F3",		LFREG,	3,
-	"F4",		LFREG,	4,
-	"F5",		LFREG,	5,
-	"F6",		LFREG,	6,
-	"F7",		LFREG,	7,
-	"F8",		LFREG,	8,
-	"F9",		LFREG,	9,
-	"F10",		LFREG,	10,
-	"F11",		LFREG,	11,
-	"F12",		LFREG,	12,
-	"F13",		LFREG,	13,
-	"F14",		LFREG,	14,
-	"F15",		LFREG,	15,
-	"F16",		LFREG,	16,
-	"F17",		LFREG,	17,
-	"F18",		LFREG,	18,
-	"F19",		LFREG,	19,
-	"F20",		LFREG,	20,
-	"F21",		LFREG,	21,
-	"F22",		LFREG,	22,
-	"F23",		LFREG,	23,
-	"F24",		LFREG,	24,
-	"F25",		LFREG,	25,
-	"F26",		LFREG,	26,
-	"F27",		LFREG,	27,
-	"F28",		LFREG,	28,
-	"F29",		LFREG,	29,
-	"F30",		LFREG,	30,
-	"F31",		LFREG,	31,
-
-	"FPCR",		LFPCR,	0,
-	"PCC",		LPCC,	0,
-
-	/* 1: integer operates */
-	"ADDQ",		LTYPE1, AADDQ,
-	"ADDL",		LTYPE1, AADDL,
-	"SUBL",		LTYPE1, ASUBL,
-	"SUBQ",		LTYPE1, ASUBQ,
-	"CMPEQ",	LTYPE1, ACMPEQ,
-	"CMPGT",	LTYPE1, ACMPGT,
-	"CMPGE",	LTYPE1, ACMPGE,
-	"CMPUGT",	LTYPE1, ACMPUGT,
-	"CMPUGE",	LTYPE1, ACMPUGE,
-	"CMPBLE",	LTYPE1, ACMPBLE,
-
-	"AND",		LTYPE1, AAND,
-	"ANDNOT",	LTYPE1, AANDNOT,
-	"OR",		LTYPE1, AOR,
-	"ORNOT",	LTYPE1, AORNOT,
-	"XOR",		LTYPE1, AXOR,
-	"XORNOT",	LTYPE1, AXORNOT,
-
-	"CMOVEQ",	LTYPE1, ACMOVEQ,
-	"CMOVNE",	LTYPE1, ACMOVNE,
-	"CMOVLT",	LTYPE1, ACMOVLT,
-	"CMOVGE",	LTYPE1, ACMOVGE,
-	"CMOVLE",	LTYPE1, ACMOVLE,
-	"CMOVGT",	LTYPE1, ACMOVGT,
-	"CMOVLBS",	LTYPE1, ACMOVLBS,
-	"CMOVLBC",	LTYPE1, ACMOVLBC,
-
-	"MULL",		LTYPE1, AMULL,
-	"MULQ",		LTYPE1, AMULQ,
-	"UMULH",	LTYPE1, AUMULH,
-	"DIVQ",		LTYPE1, ADIVQ,
-	"MODQ",		LTYPE1, AMODQ,
-	"DIVQU",	LTYPE1, ADIVQU,
-	"MODQU",	LTYPE1, AMODQU,
-	"DIVL",		LTYPE1, ADIVL,
-	"MODL",		LTYPE1, AMODL,
-	"DIVLU",	LTYPE1, ADIVLU,
-	"MODLU",	LTYPE1, AMODLU,
-
-	"SLLQ",		LTYPE1, ASLLQ,
-	"SRLQ",		LTYPE1, ASRLQ,
-	"SRAQ",		LTYPE1, ASRAQ,
-
-	"SLLL",		LTYPE1, ASLLL,
-	"SRLL",		LTYPE1, ASRLL,
-	"SRAL",		LTYPE1, ASRAL,
-
-	"EXTBL",	LTYPE1, AEXTBL,
-	"EXTWL",	LTYPE1, AEXTWL,
-	"EXTLL",	LTYPE1, AEXTLL,
-	"EXTQL",	LTYPE1, AEXTQL,
-	"EXTWH",	LTYPE1, AEXTWH,
-	"EXTLH",	LTYPE1, AEXTLH,
-	"EXTQH",	LTYPE1, AEXTQH,
-
-	"INSBL",	LTYPE1, AINSBL,
-	"INSWL",	LTYPE1, AINSWL,
-	"INSLL",	LTYPE1, AINSLL,
-	"INSQL",	LTYPE1, AINSQL,
-	"INSWH",	LTYPE1, AINSWH,
-	"INSLH",	LTYPE1, AINSLH,
-	"INSQH",	LTYPE1, AINSQH,
-
-	"MSKBL",	LTYPE1, AMSKBL,
-	"MSKWL",	LTYPE1, AMSKWL,
-	"MSKLL",	LTYPE1, AMSKLL,
-	"MSKQL",	LTYPE1, AMSKQL,
-	"MSKWH",	LTYPE1, AMSKWH,
-	"MSKLH",	LTYPE1, AMSKLH,
-	"MSKQH",	LTYPE1, AMSKQH,
-
-	"ZAP",		LTYPE1, AZAP,
-	"ZAPNOT",	LTYPE1, AZAPNOT,
-
-	/* 2: floating operates with 2 operands */
-	"CVTQS",	LTYPE2, ACVTQS,
-	"CVTQT",	LTYPE2, ACVTQT,
-	"CVTTS",	LTYPE2, ACVTTS,
-	"CVTTQ",	LTYPE2, ACVTTQ,
-	"CVTLQ",	LTYPE2, ACVTLQ,
-	"CVTQL",	LTYPE2, ACVTQL,
-
-	/* 3: floating operates with 2 or 3 operands */
-	"CPYS",		LTYPE3, ACPYS,
-	"CPYSN",	LTYPE3, ACPYSN,
-	"CPYSE",	LTYPE3, ACPYSE,
-	"ADDS",		LTYPE3, AADDS,
-	"ADDT",		LTYPE3, AADDT,
-	"CMPTEQ",	LTYPE3, ACMPTEQ,
-	"CMPTGT",	LTYPE3, ACMPTGT,
-	"CMPTGE",	LTYPE3, ACMPTGE,
-	"CMPTUN",	LTYPE3, ACMPTUN,
-	"DIVS",		LTYPE3, ADIVS,
-	"DIVT",		LTYPE3, ADIVT,
-	"MULS",		LTYPE3, AMULS,
-	"MULT",		LTYPE3, AMULT,
-	"SUBS",		LTYPE3, ASUBS,
-	"SUBT",		LTYPE3, ASUBT,
-	"FCMOVEQ",	LTYPE3, AFCMOVEQ,
-	"FCMOVNE",	LTYPE3, AFCMOVNE,
-	"FCMOVLT",	LTYPE3, AFCMOVLT,
-	"FCMOVGE",	LTYPE3, AFCMOVGE,
-	"FCMOVLE",	LTYPE3, AFCMOVLE,
-	"FCMOVGT",	LTYPE3, AFCMOVGT,
-
-	/* 4: integer load/store and reg->reg (incl special regs) */
-	"MOVQ",		LTYPE4, AMOVQ,
-
-	/* 5: integer load/store and reg->reg */
-	"MOVL",		LTYPE5, AMOVL,
-	"MOVQU",	LTYPE5, AMOVQU,
-	"MOVB",		LTYPE5, AMOVB,
-	"MOVBU",	LTYPE5, AMOVBU,
-	"MOVW",		LTYPE5, AMOVW,
-	"MOVWU",	LTYPE5, AMOVWU,
-	"MOVLP",	LTYPE5, AMOVLP,
-	"MOVQP",	LTYPE5, AMOVQP,
-
-	/* 6: integer load/store (only) */
-	"MOVA", 	LTYPE6, AMOVA,
-	"MOVAH",	LTYPE6, AMOVAH,
-	"MOVLL",	LTYPE6, AMOVLL,
-	"MOVQL",	LTYPE6, AMOVQL,
-	"MOVLC",	LTYPEK, AMOVLC,
-	"MOVQC",	LTYPEK, AMOVQC,
-
-	/* 7: floating load/store and reg->reg */
-	"MOVS",		LTYPE7, AMOVS,
-	"MOVT",		LTYPE7, AMOVT,
-
-	/* 8,9: jumps */
-	"JMP",		LTYPE8, AJMP,
-	"JSR",		LTYPE8, AJSR,
-	"RET",		LTYPE9, ARET,
-
-	/* A: integer conditional branches */
-	"BEQ",		LTYPEA, ABEQ,
-	"BNE",		LTYPEA, ABNE,
-	"BLT",		LTYPEA, ABLT,
-	"BGE",		LTYPEA, ABGE,
-	"BLE",		LTYPEA, ABLE,
-	"BGT",		LTYPEA, ABGT,
-	"BLBC",		LTYPEA, ABLBC,
-	"BLBS",		LTYPEA, ABLBS,
-
-	/* B: floating conditional branches */
-	"FBEQ",		LTYPEB, AFBEQ,
-	"FBNE",		LTYPEB, AFBNE,
-	"FBLT",		LTYPEB, AFBLT,
-	"FBGE",		LTYPEB, AFBGE,
-	"FBLE",		LTYPEB, AFBLE,
-	"FBGT",		LTYPEB, AFBGT,
-
-	/* C-J: miscellaneous */
-	"TRAPB",	LTYPEC, ATRAPB,
-	"MB",		LTYPEC, AMB,
-	"REI",		LTYPEC, AREI,
-	"END",		LTYPEC, AEND,
-	"FETCH",	LTYPED, AFETCH,
-	"FETCHM",	LTYPED, AFETCHM,
-	"CALL_PAL",	LTYPEE, ACALL_PAL,
-	"TEXT",		LTYPEF, ATEXT,
-	"GLOBL",	LTYPEF, AGLOBL,
-	"DATA",		LTYPEG, ADATA,
-	"WORD",		LTYPEH, AWORD,
-	"NOP",		LTYPEI, ANOP,
-	0
-};
-
-void
-cinit(void)
-{
-	Sym *s;
-	int i;
-
-	nullgen.sym = S;
-	nullgen.offset = 0;
-	nullgen.type = D_NONE;
-	nullgen.name = D_NONE;
-	nullgen.reg = NREG;
-	if(FPCHIP)
-		nullgen.dval = 0;
-	for(i=0; i<sizeof(nullgen.sval); i++)
-		nullgen.sval[i] = 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);
-		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
-syminit(Sym *s)
-{
-
-	s->type = LNAME;
-	s->value = 0;
-}
-
-int
-isreg(Gen *g)
-{
-
-	USED(g);
-	return 1;
-}
-
-void
-cclean(void)
-{
-
-	outcode(AEND, &nullgen, NREG, &nullgen);
-	Bflush(&obuf);
-}
-
-void
-zname(char *n, int t, int s)
-{
-
-	Bputc(&obuf, ANAME);
-	Bputc(&obuf, t);	/* type */
-	Bputc(&obuf, s);	/* sym */
-	while(*n) {
-		Bputc(&obuf, *n);
-		n++;
-	}
-	Bputc(&obuf, 0);
-}
-
-void
-zaddr(Gen *a, int s)
-{
-	vlong l;
-	int i;
-	char *n;
-	Ieee e;
-
-	Bputc(&obuf, a->type);
-	Bputc(&obuf, a->reg);
-	Bputc(&obuf, s);
-	Bputc(&obuf, a->name);
-	switch(a->type) {
-	default:
-		print("unknown type %d\n", a->type);
-		exits("arg");
-
-	case D_NONE:
-	case D_REG:
-	case D_FREG:
-	case D_PREG:
-	case D_FCREG:
-	case D_PCC:
-		break;
-
-	case D_OREG:
-	case D_CONST:
-	case D_BRANCH:
-		l = a->offset;
-		Bputc(&obuf, l);
-		Bputc(&obuf, l>>8);
-		Bputc(&obuf, l>>16);
-		Bputc(&obuf, l>>24);
-		Bputc(&obuf, l>>32);
-		Bputc(&obuf, l>>40);
-		Bputc(&obuf, l>>48);
-		Bputc(&obuf, l>>56);
-		break;
-
-	case D_SCONST:
-		n = a->sval;
-		for(i=0; i<NSNAME; i++) {
-			Bputc(&obuf, *n);
-			n++;
-		}
-		break;
-
-	case D_FCONST:
-		ieeedtod(&e, a->dval);
-		Bputc(&obuf, e.l);
-		Bputc(&obuf, e.l>>8);
-		Bputc(&obuf, e.l>>16);
-		Bputc(&obuf, e.l>>24);
-		Bputc(&obuf, e.h);
-		Bputc(&obuf, e.h>>8);
-		Bputc(&obuf, e.h>>16);
-		Bputc(&obuf, e.h>>24);
-		break;
-	}
-}
-
-void
-outcode(int a, Gen *g1, int reg, Gen *g2)
-{
-	int sf, st, t;
-	Sym *s;
-
-	if(pass == 1)
-		goto out;
-jackpot:
-	sf = 0;
-	s = g1->sym;
-	while(s != S) {
-		sf = s->sym;
-		if(sf < 0 || sf >= NSYM)
-			sf = 0;
-		t = g1->name;
-		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->sym;
-	while(s != S) {
-		st = s->sym;
-		if(st < 0 || st >= NSYM)
-			st = 0;
-		t = g2->name;
-		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, reg);
-	Bputc(&obuf, lineno);
-	Bputc(&obuf, lineno>>8);
-	Bputc(&obuf, lineno>>16);
-	Bputc(&obuf, lineno>>24);
-	zaddr(g1, sf);
-	zaddr(g2, 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, 0);
-		Bputc(&obuf, h->line);
-		Bputc(&obuf, h->line>>8);
-		Bputc(&obuf, h->line>>16);
-		Bputc(&obuf, h->line>>24);
-		zaddr(&nullgen, 0);
-		zaddr(&g, 0);
-	}
-}
-
-#include "../cc/lexbody"
-#include "../cc/macbody"
-#include "../cc/compat"
--- a/sys/src/cmd/7a/mkfile
+++ /dev/null
@@ -1,19 +1,0 @@
-</$objtype/mkfile
-
-TARG=7a
-OFILES=\
-	y.tab.$O\
-	lex.$O\
-
-HFILES=\
-	../7c/7.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
--- a/sys/src/cmd/7c/7.out.h
+++ /dev/null
@@ -1,265 +1,0 @@
-#define	NSNAME	8
-#define	NSYM	50
-#define	NREG	32
-#define NOPROF	(1<<0)
-#define DUPOK	(1<<1)
-
-enum
-{
-	REGRET		= 0,	/* return register and first temp, grows++ */
-	REGARG		= 0,	/* first arg passed in */
-	REGEXT		= 15,	/* first external register, grows-- */
-
-	REGLINK		= 26,	/* subroutine linkage */
-	REGTMP		= 27,	/* used by the loader */
-	REGTMP2		= 28,	/* used by the loader */
-	REGSB		= 29,	/* static pointer */
-	REGSP		= 30,	/* stack pointer */
-	REGZERO		= 31,	/* always zero */
-
-	FREGRET		= 0,
-	FREGEXT		= 27,	/* first external register */
-	FREGHALF	= 28,	/* double */
-	FREGONE		= 29,	/* double */
-	FREGTWO		= 30,	/* double */
-	FREGZERO	= 31,	/* both float and double */
-};
-
-enum	as
-{
-	AXXX,
-	AGOK,
-	ATEXT,
-	ADATA,
-	AGLOBL,
-	AHISTORY,
-	ANAME,
-	AWORD,
-
-	ANOP,
-
-	AMOVL,
-	AMOVLU,
-	AMOVQ,
-	AMOVQU,
-	AMOVS,
-	AMOVT,
-
-	AMOVB,
-	AMOVBU,
-	AMOVW,
-	AMOVWU,
-
-	AMOVA,
-	AMOVAH,
-
-	AMOVLL,
-	AMOVQL,
-	AMOVLC,
-	AMOVQC,
-
-	AMOVQP,
-	AMOVLP,
-
-	AADDL,
-	AADDLV,
-	AADDQ,
-	AADDQV,
-	AS4ADDL,
-	AS4ADDQ,
-	AS8ADDL,
-	AS8ADDQ,
-	AS4SUBL,
-	AS4SUBQ,
-	AS8SUBL,
-	AS8SUBQ,
-	ASUBL,
-	ASUBLV,
-	ASUBQ,
-	ASUBQV,
-
-	ACMPEQ,
-	ACMPGT,
-	ACMPGE,
-	ACMPUGT,
-	ACMPUGE,
-	ACMPBLE,
-
-	AAND,
-	AANDNOT,
-	AOR,
-	AORNOT,
-	AXOR,
-	AXORNOT,
-
-	ACMOVEQ,
-	ACMOVNE,
-	ACMOVLT,
-	ACMOVGE,
-	ACMOVLE,
-	ACMOVGT,
-	ACMOVLBC,
-	ACMOVLBS,
-
-	AMULL,
-	AMULQ,
-	AMULLV,
-	AMULQV,
-	AUMULH,
-	ADIVQ,
-	AMODQ,
-	ADIVQU,
-	AMODQU,
-	ADIVL,
-	AMODL,
-	ADIVLU,
-	AMODLU,
-
-	ASLLQ,
-	ASRLQ,
-	ASRAQ,
-	ASLLL,
-	ASRLL,
-	ASRAL,
-
-	AEXTBL,
-	AEXTWL,
-	AEXTLL,
-	AEXTQL,
-	AEXTWH,
-	AEXTLH,
-	AEXTQH,
-
-	AINSBL,
-	AINSWL,
-	AINSLL,
-	AINSQL,
-	AINSWH,
-	AINSLH,
-	AINSQH,
-
-	AMSKBL,
-	AMSKWL,
-	AMSKLL,
-	AMSKQL,
-	AMSKWH,
-	AMSKLH,
-	AMSKQH,
-
-	AZAP,
-	AZAPNOT,
-
-	AJMP,
-	AJSR,
-	ARET,
-
-	ABR,
-	ABSR,
-
-	ABEQ,
-	ABNE,
-	ABLT,
-	ABGE,
-	ABLE,
-	ABGT,
-	ABLBC,
-	ABLBS,
-
-	AFBEQ,
-	AFBNE,
-	AFBLT,
-	AFBGE,
-	AFBLE,
-	AFBGT,
-
-	ATRAPB,
-	AMB,
-	AFETCH,
-	AFETCHM,
-	ARPCC,
-
-	ACPYS,
-	ACPYSN,
-	ACPYSE,
-	ACVTLQ,
-	ACVTQL,
-	AFCMOVEQ,
-	AFCMOVNE,
-	AFCMOVLT,
-	AFCMOVGE,
-	AFCMOVLE,
-	AFCMOVGT,
-
-	AADDS,
-	AADDT,
-	ACMPTEQ,
-	ACMPTGT,
-	ACMPTGE,
-	ACMPTUN,
-	ACVTQS,
-	ACVTQT,
-	ACVTTS,
-	ACVTTQ,
-	ADIVS,
-	ADIVT,
-	AMULS,
-	AMULT,
-	ASUBS,
-	ASUBT,
-
-	ACALL_PAL,
-	AREI,
-
-	AEND,
-
-	ADYNT,
-	AINIT,
-
-	ASIGNAME,
-
-	ALAST,
-};
-
-/* type/name */
-enum
-{
-	D_GOK	= 0,
-	D_NONE,
-
-/* name */
-	D_EXTERN,
-	D_STATIC,
-	D_AUTO,
-	D_PARAM,
-
-/* type */
-	D_BRANCH,
-	D_OREG,
-	D_CONST,
-	D_FCONST,
-	D_SCONST,
-	D_REG,
-	D_FREG,
-	D_FCREG,
-	D_PREG,
-	D_PCC,
-	D_FILE,
-	D_FILE1,
-};
-
-/*
- * 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 */
-};
--- a/sys/src/cmd/7c/cgen.c
+++ /dev/null
@@ -1,1067 +1,0 @@
-#include "gc.h"
-
-void
-cgen(Node *n, Node *nn)
-{
-	Node *l, *r;
-	Prog *p1;
-	Node nod, nod1, nod2, nod3, nod4;
-	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);
-		gopcode(OAS, &nod, Z, &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(l->op == OBIT)
-			goto bitas;
-		if(l->addable >= INDEXED && l->complex < FNX) {
-			if(nn != Z || r->addable < INDEXED) {
-				regalloc(&nod, r, nn);
-				cgen(r, &nod);
-				gmove(&nod, l);
-				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);
-		gopcode(OAS, &nod, Z, nn);
-		regfree(&nod);
-		break;
-
-	case OADD:
-	case OSUB:
-	case OAND:
-	case OOR:
-	case OXOR:
-	case OLSHR:
-	case OASHL:
-	case OASHR:
-	case OLDIV:
-	case OLMOD:
-	case ODIV:
-	case OMOD:
-	case OMUL:
-	case OLMUL:
-		/*
-		 * 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;
-		}
-
-		if(nn == Z) {
-			nullwarn(l, r);
-			break;
-		}
-/*		if(o == OMUL || o == OLMUL) {
-			if(mulcon(n, nn))
-				break;
-		} */
-		if(l->complex >= r->complex) {
-			regalloc(&nod, l, nn);
-			cgen(l, &nod);
-			regalloc(&nod1, l, Z);		/* note: l used for type, so shifts work! */
-			cgen(r, &nod1);
-			gopcode(o, &nod1, Z, &nod);
-		} else {
-			regalloc(&nod, l, nn);		/* note: l used for type, so shifts work! */
-			cgen(r, &nod);
-			regalloc(&nod1, l, Z);
-			cgen(l, &nod1);
-			gopcode(o, &nod, &nod1, &nod);
-		}
-		gopcode(OAS, &nod, Z, nn);
-		regfree(&nod);
-		regfree(&nod1);
-		break;
-
-	case OASLSHR:
-	case OASASHL:
-	case OASASHR:
-	case OASAND:
-	case OASADD:
-	case OASSUB:
-	case OASXOR:
-	case OASOR:
-	case OASLDIV:
-	case OASLMOD:
-	case OASDIV:
-	case OASMOD:
-	case OASLMUL:
-	case OASMUL:
-		if(l->op == OBIT)
-			goto asbitop;
-		if(r->op == OCONST)
-		if(!typefd[r->type->etype])
-		if(!typefd[n->type->etype]) {
-			if(l->addable < INDEXED)
-				reglcgen(&nod2, l, Z);
-			else
-				nod2 = *l;
-			regalloc(&nod, l, nn);		/* note: l used for type, so shifts work! */
-			gopcode(OAS, &nod2, Z, &nod);
-			gopcode(o, r, Z, &nod);
-			gopcode(OAS, &nod, Z, &nod2);
-	
-			regfree(&nod);
-			if(l->addable < INDEXED)
-				regfree(&nod2);
-			break;
-		}
-
-		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);
-		if(nod1.type->etype != nod.type->etype){
-			regalloc(&nod3, &nod, Z);
-			gmove(&nod1, &nod3);
-			regfree(&nod1);
-			nod1 = nod3;
-		}
-		gopcode(o, &nod1, Z, &nod);
-		gmove(&nod, &nod2);
-		if(nn != Z)
-			gopcode(OAS, &nod, Z, nn);
-		regfree(&nod);
-		regfree(&nod1);
-		if(l->addable < INDEXED)
-			regfree(&nod2);
-		break;
-
-	asbitop:
-		regalloc(&nod4, n, nn);
-		if(l->complex >= r->complex) {
-			bitload(l, &nod, &nod1, &nod2, &nod4);
-			regalloc(&nod3, r, Z);
-			cgen(r, &nod3);
-		} else {
-			regalloc(&nod3, r, Z);
-			cgen(r, &nod3);
-			bitload(l, &nod, &nod1, &nod2, &nod4);
-		}
-		gmove(&nod, &nod4);
-		gopcode(o, &nod3, Z, &nod4);
-		regfree(&nod3);
-		gmove(&nod4, &nod);
-		regfree(&nod4);
-		bitstore(l, &nod, &nod1, &nod2, nn);
-		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);
-			gopcode(OAS, &nod, Z, &nod1);
-			regfree(&nod);
-
-			nod = *n;
-			nod.left = &nod2;
-			nod2 = *l;
-			nod2.left = &nod1;
-			nod2.complex = 1;
-			cgen(&nod, nn);
-
-			return;
-		}
-		if(REGARG != NREG)
-			o = reg[REGARG];
-		gargs(r, &nod, &nod1);
-		if(l->addable < INDEXED) {
-			reglcgen(&nod, l, Z);
-			gopcode(OFUNC, Z, Z, &nod);
-			regfree(&nod);
-		} else
-			gopcode(OFUNC, Z, Z, l);
-		if(REGARG != NREG)
-			if(o != reg[REGARG])
-				reg[REGARG]--;
-		if(nn != Z) {
-			regret(&nod, n);
-			gopcode(OAS, &nod, Z, 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);
-		gopcode(OAS, &nod, Z, 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)) {
-			if(nocast(n->type, nn->type)) {
-				cgen(l, nn);
-				break;
-			}
-		}
-		regalloc(&nod, l, nn);
-		cgen(l, &nod);
-		regalloc(&nod1, n, &nod);
-		gopcode(OAS, &nod, Z, &nod1);
-		gopcode(OAS, &nod1, Z, 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 += (long)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);
-		gopcode(OAS, &nod2, Z, &nod);
-		regalloc(&nod1, l, Z);
-		if(typefd[l->type->etype]) {
-			regalloc(&nod3, l, Z);
-			if(v < 0) {
-				gopcode(OAS, nodfconst(-v), Z, &nod3);
-				gopcode(OSUB, &nod3, &nod, &nod1);
-			} else {
-				gopcode(OAS, nodfconst(v), Z, &nod3);
-				gopcode(OADD, &nod3, &nod, &nod1);
-			}
-			regfree(&nod3);
-		} else
-			gopcode(OADD, nodconst(v), &nod, &nod1);
-		gopcode(OAS, &nod1, Z, &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);
-		gopcode(OAS, &nod2, Z, &nod);
-		if(typefd[l->type->etype]) {
-			regalloc(&nod3, l, Z);
-			if(v < 0) {
-				gopcode(OAS, nodfconst(-v), Z, &nod3);
-				gopcode(OSUB, &nod3, Z, &nod);
-			} else {
-				gopcode(OAS, nodfconst(v), Z, &nod3);
-				gopcode(OADD, &nod3, Z, &nod);
-			}
-			regfree(&nod3);
-		} else
-			gopcode(OADD, nodconst(v), Z, &nod);
-		gopcode(OAS, &nod, Z, &nod2);
-		if(nn && l->op == ONAME)	/* in x=++i, emit USED(i) */
-			gins(ANOP, l, Z);
-
-		regfree(&nod);
-		if(l->addable < INDEXED)
-			regfree(&nod2);
-		break;
-
-	bitinc:
-		if(nn != Z && (o == OPOSTINC || o == OPOSTDEC)) {
-			bitload(l, &nod, &nod1, &nod2, Z);
-			gopcode(OAS, &nod, Z, nn);
-			gopcode(OADD, nodconst(v), Z, &nod);
-			bitstore(l, &nod, &nod1, &nod2, Z);
-			break;
-		}
-		bitload(l, &nod, &nod1, &nod2, nn);
-		gopcode(OADD, nodconst(v), Z, &nod);
-		bitstore(l, &nod, &nod1, &nod2, nn);
-		break;
-	}
-	cursafe = curs;
-	return;
-}
-
-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;
-		}
-		nod = *n;
-		nod.op = OADDR;
-		nod.left = n;
-		nod.right = Z;
-		nod.type = types[TIND];
-		gopcode(OAS, &nod, 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]) {
-			nodreg(&nod1, n, NREG+FREGZERO);
-			gopcode(o, &nod, Z, &nod1);
-		} else
-			gopcode(o, &nod, Z, nodconst(0));
-		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);
-			gopcode(OAS, &nod, Z, &nod1);
-			regfree(&nod);
-			nod = *n;
-			nod.right = &nod1;
-			boolgen(&nod, true, nn);
-			break;
-		}
-		if(bconst(r)) {
-			regalloc(&nod, l, nn);
-			cgen(l, &nod);
-			gopcode(o, &nod, Z, r);
-			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;
-			gopcode(OAS, nodconst(1), Z, nn);
-			gbranch(OGOTO);
-			p2 = p;
-			patch(p1, pc);
-			gopcode(OAS, nodconst(0), Z, 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 += (long)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;
-		}
-		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) {
-		t = nn->type;
-		nn->type = types[TLONG];
-		regialloc(&nod1, nn, Z);
-		lcgen(nn, &nod1);
-		regsalloc(&nod2, nn);
-		nn->type = t;
-
-		gopcode(OAS, &nod1, Z, &nod2);
-		regfree(&nod1);
-
-		nod2.type = typ(TIND, t);
-
-		nod1 = nod2;
-		nod1.op = OIND;
-		nod1.left = &nod2;
-		nod1.right = Z;
-		nod1.complex = 1;
-		nod1.type = t;
-
-		sugen(n, &nod1, w);
-		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(1), 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(OGT, &nod3, Z, nodconst(0));
-	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) {
-		gopcode(OAS, f, Z, &t1);
-		f->xoffset += SZ_LONG;
-	}
-	if(cn != Z)
-		gopcode(OAS, nodconst(cv), Z, cn);
-	if(c > 1) {
-		gopcode(OAS, f, Z, &t2);
-		f->xoffset += SZ_LONG;
-	}
-	if(c > 0) {
-		gopcode(OAS, &t1, Z, t);
-		t->xoffset += SZ_LONG;
-	}
-	if(c > 2) {
-		gopcode(OAS, f, Z, &t1);
-		f->xoffset += SZ_LONG;
-	}
-	if(c > 1) {
-		gopcode(OAS, &t2, Z, t);
-		t->xoffset += SZ_LONG;
-	}
-	if(c > 2) {
-		gopcode(OAS, &t1, Z, t);
-		t->xoffset += SZ_LONG;
-	}
-	regfree(&t1);
-	regfree(&t2);
-}
--- a/sys/src/cmd/7c/enam.c
+++ /dev/null
@@ -1,165 +1,0 @@
-char*	anames[] =
-{
-	"XXX",
-	"GOK",
-	"TEXT",
-	"DATA",
-	"GLOBL",
-	"HISTORY",
-	"NAME",
-	"WORD",
-	"NOP",
-	"MOVL",
-	"MOVLU",
-	"MOVQ",
-	"MOVQU",
-	"MOVS",
-	"MOVT",
-	"MOVB",
-	"MOVBU",
-	"MOVW",
-	"MOVWU",
-	"MOVA",
-	"MOVAH",
-	"MOVLL",
-	"MOVQL",
-	"MOVLC",
-	"MOVQC",
-	"MOVQP",
-	"MOVLP",
-	"ADDL",
-	"ADDLV",
-	"ADDQ",
-	"ADDQV",
-	"S4ADDL",
-	"S4ADDQ",
-	"S8ADDL",
-	"S8ADDQ",
-	"S4SUBL",
-	"S4SUBQ",
-	"S8SUBL",
-	"S8SUBQ",
-	"SUBL",
-	"SUBLV",
-	"SUBQ",
-	"SUBQV",
-	"CMPEQ",
-	"CMPGT",
-	"CMPGE",
-	"CMPUGT",
-	"CMPUGE",
-	"CMPBLE",
-	"AND",
-	"ANDNOT",
-	"OR",
-	"ORNOT",
-	"XOR",
-	"XORNOT",
-	"CMOVEQ",
-	"CMOVNE",
-	"CMOVLT",
-	"CMOVGE",
-	"CMOVLE",
-	"CMOVGT",
-	"CMOVLBC",
-	"CMOVLBS",
-	"MULL",
-	"MULQ",
-	"MULLV",
-	"MULQV",
-	"UMULH",
-	"DIVQ",
-	"MODQ",
-	"DIVQU",
-	"MODQU",
-	"DIVL",
-	"MODL",
-	"DIVLU",
-	"MODLU",
-	"SLLQ",
-	"SRLQ",
-	"SRAQ",
-	"SLLL",
-	"SRLL",
-	"SRAL",
-	"EXTBL",
-	"EXTWL",
-	"EXTLL",
-	"EXTQL",
-	"EXTWH",
-	"EXTLH",
-	"EXTQH",
-	"INSBL",
-	"INSWL",
-	"INSLL",
-	"INSQL",
-	"INSWH",
-	"INSLH",
-	"INSQH",
-	"MSKBL",
-	"MSKWL",
-	"MSKLL",
-	"MSKQL",
-	"MSKWH",
-	"MSKLH",
-	"MSKQH",
-	"ZAP",
-	"ZAPNOT",
-	"JMP",
-	"JSR",
-	"RET",
-	"BR",
-	"BSR",
-	"BEQ",
-	"BNE",
-	"BLT",
-	"BGE",
-	"BLE",
-	"BGT",
-	"BLBC",
-	"BLBS",
-	"FBEQ",
-	"FBNE",
-	"FBLT",
-	"FBGE",
-	"FBLE",
-	"FBGT",
-	"TRAPB",
-	"MB",
-	"FETCH",
-	"FETCHM",
-	"RPCC",
-	"CPYS",
-	"CPYSN",
-	"CPYSE",
-	"CVTLQ",
-	"CVTQL",
-	"FCMOVEQ",
-	"FCMOVNE",
-	"FCMOVLT",
-	"FCMOVGE",
-	"FCMOVLE",
-	"FCMOVGT",
-	"ADDS",
-	"ADDT",
-	"CMPTEQ",
-	"CMPTGT",
-	"CMPTGE",
-	"CMPTUN",
-	"CVTQS",
-	"CVTQT",
-	"CVTTS",
-	"CVTTQ",
-	"DIVS",
-	"DIVT",
-	"MULS",
-	"MULT",
-	"SUBS",
-	"SUBT",
-	"CALL_PAL",
-	"REI",
-	"END",
-	"DYNT",
-	"INIT",
-	"LAST",
-};
--- a/sys/src/cmd/7c/gc.h
+++ /dev/null
@@ -1,343 +1,0 @@
-#include	"../cc/cc.h"
-#include	"../7c/7.out.h"
-
-/*
- * 7c/alpha
- * DEC Alpha
- */
-#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	Multab	Multab;
-typedef	struct	Hintab	Hintab;
-typedef	struct	Bits	Bits;
-typedef	struct	Var	Var;
-typedef	struct	Reg	Reg;
-typedef	struct	Rgn	Rgn;
-
-struct	Adr
-{
-	union
-	{
-		vlong	offset;
-		double	dval;
-		char	sval[NSNAME];
-		Ieee	ieee;
-	};
-	Sym*	sym;
-	char	type;
-	char	reg;
-	char	name;
-	char	etype;
-};
-#define	A	((Adr*)0)
-
-#define	INDEXED	9
-struct	Prog
-{
-	Adr	from;
-	Adr	to;
-	Prog*	link;
-	long	lineno;
-	uchar	as;
-	char	reg;
-};
-#define	P	((Prog*)0)
-
-struct	Case
-{
-	Case*	link;
-	vlong	val;
-	long	label;
-	char	def;
-	char isv;
-};
-#define	C	((Case*)0)
-
-struct	C1
-{
-	vlong	val;
-	long	label;
-};
-
-struct	Multab
-{
-	long	val;
-	char	code[20];
-};
-
-struct	Hintab
-{
-	ushort	val;
-	char	hint[10];
-};
-
-struct	Var
-{
-	vlong	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	600
-struct	Rgn
-{
-	Reg*	enter;
-	short	cost;
-	short	varno;
-	short	regno;
-};
-
-EXTERN long	breakpc;
-EXTERN long	nbreak;
-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 Multab	multab[20];
-EXTERN int	hintabsize;
-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[NREG+NREG];
-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	4
-#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	Bits	zbits;
-
-EXTERN	long	regbits;
-EXTERN	long	exregbits;
-
-EXTERN	int	change;
-EXTERN	int	suppress;
-
-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[];
-extern	Hintab	hintab[];
-
-/*
- * sgen.c
- */
-void	codgen(Node*, Node*);
-void	gen(Node*);
-void	usedset(Node*, int);
-void	noretval(int);
-void	xcom(Node*);
-int	bcomplex(Node*, 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*	nod32const(vlong);
-Node*	nodfconst(double);
-void	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	raddr(Node*, Prog*);
-void	naddr(Node*, Adr*);
-void	gmove(Node*, Node*);
-void	gins(int a, Node*, Node*);
-void	gopcode(int, Node*, Node*, Node*);
-int	samaddr(Node*, Node*);
-void	gbranch(int);
-void	patch(Prog*, long);
-int	bconst(Node*);
-int	sconst(Node*);
-int	bval(vlong);
-int	sval(long);
-void	gpseudo(int, Sym*, Node*);
-
-/*
- * swt.c
- */
-int	swcmp(void*, void*);
-void	doswit(Node*);
-void	swit1(C1*, int, long, Node*);
-void	swit2(C1*, int, long, Node*, Node*);
-void	casf(void);
-void	bitload(Node*, Node*, Node*, Node*, Node*);
-void	bitstore(Node*, Node*, Node*, Node*, Node*);
-long	outstring(char*, long);
-int	vlog(Node*);
-int	mulcon(Node*, Node*);
-Multab*	mulcon0(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	Sconv(Fmt*);
-int	Nconv(Fmt*);
-int	Bconv(Fmt*);
-
-/*
- * reg.c
- */
-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);
-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	regzer(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	copyau1(Prog*, 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);
-
-#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	"S"	char*
--- a/sys/src/cmd/7c/list.c
+++ /dev/null
@@ -1,231 +1,0 @@
-#define EXTERN
-#include "gc.h"
-
-void
-listinit(void)
-{
-
-	fmtinstall('A', Aconv);
-	fmtinstall('P', Pconv);
-	fmtinstall('S', Sconv);
-	fmtinstall('N', Nconv);
-	fmtinstall('B', Bconv);
-	fmtinstall('D', Dconv);
-}
-
-int
-Bconv(Fmt *fp)
-{
-	char str[STRINGSZ], ss[STRINGSZ], *s;
-	Bits bits;
-	int i;
-
-	memset(str, 0, sizeof str);
-	bits = va_arg(fp->args, Bits);
-	while(bany(&bits)) {
-		i = bnum(bits);
-		if(str[0])
-			strncat(str, " ", sizeof str - 1);
-		if(var[i].sym == S) {
-			snprint(ss, sizeof ss, "$%lld", var[i].offset);
-			s = ss;
-		} else
-			s = var[i].sym->name;
-		strncat(str, s, sizeof str - 1);
-		bits.b[i/32] &= ~(1L << (i%32));
-	}
-	return fmtstrcpy(fp, str);
-}
-
-int
-Pconv(Fmt *fp)
-{
-	char str[STRINGSZ];
-	Prog *p;
-	int a;
-
-	p = va_arg(fp->args, Prog*);
-	a = p->as;
-	if(a == ADATA)
-		snprint(str, sizeof str, "	%A	%D/%d,%D", a, &p->from, p->reg, &p->to);
-	else
-	if(p->as == ATEXT)
-		snprint(str, sizeof str, "	%A	%D,%d,%D", a, &p->from, p->reg, &p->to);
-	else
-	if(p->reg == NREG)
-		snprint(str, sizeof str, "	%A	%D,%D", a, &p->from, &p->to);
-	else
-	if(p->from.type != D_FREG)
-		snprint(str, sizeof str, "	%A	%D,R%d,%D", a, &p->from, p->reg, &p->to);
-	else
-		snprint(str, sizeof str, "	%A	%D,F%d,%D", a, &p->from, p->reg, &p->to);
-	return fmtstrcpy(fp, str);
-}
-
-int
-Aconv(Fmt *fp)
-{
-	char *s;
-	int a;
-
-	a = va_arg(fp->args, int);
-	s = "???";
-	if(a >= AXXX && a < ALAST)
-		s = anames[a];
-	return fmtstrcpy(fp, s);
-}
-
-int
-Dconv(Fmt *fp)
-{
-	char str[STRINGSZ];
-	Adr *a;
-
-	a = va_arg(fp->args, Adr*);
-	switch(a->type) {
-
-	default:
-		snprint(str, sizeof str, "GOK-type(%d)", a->type);
-		break;
-
-	case D_NONE:
-		str[0] = 0;
-		if(a->name != D_NONE || a->reg != NREG || a->sym != S)
-			snprint(str, sizeof str, "%N(R%d)(NONE)", a, a->reg);
-		break;
-
-	case D_CONST:
-		if(a->reg != NREG)
-			snprint(str, sizeof str, "$%N(R%d)", a, a->reg);
-		else
-			snprint(str, sizeof str, "$%N", a);
-		break;
-
-	case D_OREG:
-		if(a->reg != NREG)
-			snprint(str, sizeof str, "%N(R%d)", a, a->reg);
-		else
-			snprint(str, sizeof str, "%N", a);
-		break;
-
-	case D_REG:
-		snprint(str, sizeof str, "R%d", a->reg);
-		if(a->name != D_NONE || a->sym != S)
-			snprint(str, sizeof str, "%N(R%d)(REG)", a, a->reg);
-		break;
-
-	case D_FREG:
-		snprint(str, sizeof str, "F%d", a->reg);
-		if(a->name != D_NONE || a->sym != S)
-			snprint(str, sizeof str, "%N(R%d)(REG)", a, a->reg);
-		break;
-
-	case D_FCREG:
-		snprint(str, sizeof str, "FPCR");
-		if(a->reg != 0 || a->name != D_NONE || a->sym != S)
-			snprint(str, sizeof str, "%N(FPCR%d)(REG)", a, a->reg);
-		break;
-
-	case D_BRANCH:
-		snprint(str, sizeof str, "%lld(PC)", a->offset-pc);
-		break;
-
-	case D_FCONST:
-		snprint(str, sizeof str, "$%.17e", a->dval);
-		break;
-
-	case D_SCONST:
-		snprint(str, sizeof str, "$\"%S\"", a->sval);
-		break;
-	}
-	return fmtstrcpy(fp, str);
-}
-
-int
-Sconv(Fmt *fp)
-{
-	int i, c;
-	char str[STRINGSZ], *p, *a;
-
-	a = va_arg(fp->args, char*);
-	p = str;
-	for(i=0; i<NSNAME; i++) {
-		c = a[i] & 0xff;
-		if(c >= 'a' && c <= 'z' ||
-		   c >= 'A' && c <= 'Z' ||
-		   c >= '0' && c <= '9' ||
-		   c == ' ' || c == '%') {
-			*p++ = c;
-			continue;
-		}
-		*p++ = '\\';
-		switch(c) {
-		case 0:
-			*p++ = 'z';
-			continue;
-		case '\\':
-		case '"':
-			*p++ = c;
-			continue;
-		case '\n':
-			*p++ = 'n';
-			continue;
-		case '\t':
-			*p++ = 't';
-			continue;
-		case '\r':
-			*p++ = 'r';
-			continue;
-		case '\f':
-			*p++ = 'f';
-			continue;
-		}
-		*p++ = (c>>6) + '0';
-		*p++ = ((c>>3) & 7) + '0';
-		*p++ = (c & 7) + '0';
-	}
-	*p = 0;
-	return fmtstrcpy(fp, str);
-}
-
-int
-Nconv(Fmt *fp)
-{
-	char str[STRINGSZ];
-	Adr *a;
-	Sym *s;
-
-	a = va_arg(fp->args, Adr*);
-	s = a->sym;
-	if(s == S) {
-		snprint(str, sizeof str, "%lld", a->offset);
-		goto out;
-	}
-	switch(a->name) {
-	default:
-		snprint(str, sizeof str, "GOK-name(%d)", a->name);
-		break;
-
-	case D_NONE:
-		snprint(str, sizeof str, "%lld", a->offset);
-		break;
-
-	case D_EXTERN:
-		snprint(str, sizeof str, "%s+%lld(SB)", s->name, a->offset);
-		break;
-
-	case D_STATIC:
-		snprint(str, sizeof str, "%s<>+%lld(SB)", s->name, a->offset);
-		break;
-
-	case D_AUTO:
-		snprint(str, sizeof str, "%s-%lld(SP)", s->name, -a->offset);
-		break;
-
-	case D_PARAM:
-		snprint(str, sizeof str, "%s+%lld(FP)", s->name, a->offset);
-		break;
-	}
-out:
-	return fmtstrcpy(fp, str);
-}
--- a/sys/src/cmd/7c/machcap.c
+++ /dev/null
@@ -1,9 +1,0 @@
-#include "gc.h"
-
-int
-machcap(Node *n)
-{
-	if(n == Z)	/* test */
-		return 1;
-	return 0;
-}
--- a/sys/src/cmd/7c/mkenam
+++ /dev/null
@@ -1,15 +1,0 @@
-ed - ../7c/7.out.h <<'!'
-v/^	A/d
-,s/^	A/	"/
-g/ .*$/s///
-,s/,*$/",/
-1i
-char*	anames[] =
-{
-.
-$a
-};
-.
-w enam.c
-Q
-!
--- a/sys/src/cmd/7c/mkfile
+++ /dev/null
@@ -1,39 +1,0 @@
-</$objtype/mkfile
-
-TARG=7c
-OFILES=\
-	cgen.$O\
-	enam.$O\
-	list.$O\
-	machcap.$O\
-	peep.$O\
-	pgen.$O\
-	pswt.$O\
-	reg.$O\
-	sgen.$O\
-	swt.$O\
-	txt.$O\
-	mul.$O\
-
-HFILES=\
-	gc.h\
-	7.out.h\
-	../cc/cc.h\
-
-LIB=../cc/cc.a$O
-
-BIN=/$objtype/bin
-</sys/src/cmd/mkone
-
-$LIB:
-	cd ../cc
-	mk install
-	mk clean
-
-%.$O: ../cc/%.c
-	$CC $CFLAGS ../cc/$stem.c
-
-t:V:	$O.out
-	$O.out -S t
-	$LD -o t.out t.$O
-	t.out
--- a/sys/src/cmd/7c/mul.c
+++ /dev/null
@@ -1,608 +1,0 @@
-#include "gc.h"
-
-/*
- * code sequences for multiply by constant.
- * [a-l][0-3]
- *	lsl	$(A-'a'),r0,r1
- * [+][0-7]
- *	add	r0,r1,r2
- * [-][0-7]
- *	sub	r0,r1,r2
- */
-
-static	int	multabp;
-static	long	mulval;
-static	char*	mulcp;
-static	long	valmax;
-static	int	shmax;
-
-static int	docode(char *hp, char *cp, int r0, int r1);
-static int	gen1(int len);
-static int	gen2(int len, long r1);
-static int	gen3(int len, long r0, long r1, int flag);
-enum
-{
-	SR1	= 1<<0,		/* r1 has been shifted */
-	SR0	= 1<<1,		/* r0 has been shifted */
-	UR1	= 1<<2,		/* r1 has not been used */
-	UR0	= 1<<3,		/* r0 has not been used */
-};
-
-Multab*
-mulcon0(long v)
-{
-	int a1, a2, g;
-	Multab *m, *m1;
-	char hint[10];
-
-	if(v < 0)
-		v = -v;
-
-	/*
-	 * look in cache
-	 */
-	m = multab;
-	for(g=0; g<nelem(multab); g++) {
-		if(m->val == v) {
-			if(m->code[0] == 0)
-				return 0;
-			return m;
-		}
-		m++;
-	}
-
-	/*
-	 * select a spot in cache to overwrite
-	 */
-	multabp++;
-	if(multabp < 0 || multabp >= nelem(multab))
-		multabp = 0;
-	m = multab+multabp;
-	m->val = v;
-	mulval = v;
-
-	/*
-	 * look in execption hint table
-	 */
-	a1 = 0;
-	a2 = hintabsize;
-	for(;;) {
-		if(a1 >= a2)
-			goto no;
-		g = (a2 + a1)/2;
-		if(v < hintab[g].val) {
-			a2 = g;
-			continue;
-		}
-		if(v > hintab[g].val) {
-			a1 = g+1;
-			continue;
-		}
-		break;
-	}
-
-	if(docode(hintab[g].hint, m->code, 1, 0))
-		return m;
-	print("multiply table failure %ld\n", v);
-	m->code[0] = 0;
-	return 0;
-
-no:
-	/*
-	 * try to search
-	 */
-	hint[0] = 0;
-	for(g=1; g<=6; g++) {
-		if(g >= 6 && v >= 65535)
-			break;
-		mulcp = hint+g;
-		*mulcp = 0;
-		if(gen1(g)) {
-			if(docode(hint, m->code, 1, 0))
-				return m;
-			print("multiply table failure %ld\n", v);
-			break;
-		}
-	}
-
-	/*
-	 * try a recur followed by a shift
-	 */
-	g = 0;
-	while(!(v & 1)) {
-		g++;
-		v >>= 1;
-	}
-	if(g) {
-		m1 = mulcon0(v);
-		if(m1) {
-			strcpy(m->code, m1->code);
-			sprint(strchr(m->code, 0), "%c0", g+'a');
-			return m;
-		}
-	}
-	m->code[0] = 0;
-	return 0;
-}
-
-static int
-docode(char *hp, char *cp, int r0, int r1)
-{
-	int c, i;
-
-	c = *hp++;
-	*cp = c;
-	cp += 2;
-	switch(c) {
-	default:
-		c -= 'a';
-		if(c < 1 || c >= 30)
-			break;
-		for(i=0; i<4; i++) {
-			switch(i) {
-			case 0:
-				if(docode(hp, cp, r0<<c, r1))
-					goto out;
-				break;
-			case 1:
-				if(docode(hp, cp, r1<<c, r1))
-					goto out;
-				break;
-			case 2:
-				if(docode(hp, cp, r0, r0<<c))
-					goto out;
-				break;
-			case 3:
-				if(docode(hp, cp, r0, r1<<c))
-					goto out;
-				break;
-			}
-		}
-		break;
-
-	case '+':
-		for(i=0; i<8; i++) {
-			cp[-1] = i+'0';
-			switch(i) {
-			case 1:
-				if(docode(hp, cp, r0+r1, r1))
-					goto out;
-				break;
-			case 5:
-				if(docode(hp, cp, r0, r0+r1))
-					goto out;
-				break;
-			}
-		}
-		break;
-
-	case '-':
-		for(i=0; i<8; i++) {
-			cp[-1] = i+'0';
-			switch(i) {
-			case 1:
-				if(docode(hp, cp, r0-r1, r1))
-					goto out;
-				break;
-			case 2:
-				if(docode(hp, cp, r1-r0, r1))
-					goto out;
-				break;
-			case 5:
-				if(docode(hp, cp, r0, r0-r1))
-					goto out;
-				break;
-			case 6:
-				if(docode(hp, cp, r0, r1-r0))
-					goto out;
-				break;
-			}
-		}
-		break;
-
-	case 0:
-		if(r0 == mulval)
-			return 1;
-	}
-	return 0;
-
-out:
-	cp[-1] = i+'0';
-	return 1;
-}
-
-static int
-gen1(int len)
-{
-	int i;
-
-	for(shmax=1; shmax<30; shmax++) {
-		valmax = 1<<shmax;
-		if(valmax >= mulval)
-			break;
-	}
-	if(mulval == 1)
-		return 1;
-
-	len--;
-	for(i=1; i<=shmax; i++)
-		if(gen2(len, 1<<i)) {
-			*--mulcp = 'a'+i;
-			return 1;
-		}
-	return 0;
-}
-
-static int
-gen2(int len, long r1)
-{
-	int i;
-
-	if(len <= 0) {
-		if(r1 == mulval)
-			return 1;
-		return 0;
-	}
-
-	len--;
-	if(len == 0)
-		goto calcr0;
-
-	if(gen3(len, r1, r1+1, UR1)) {
-		i = '+';
-		goto out;
-	}
-	if(gen3(len, r1-1, r1, UR0)) {
-		i = '-';
-		goto out;
-	}
-	if(gen3(len, 1, r1+1, UR1)) {
-		i = '+';
-		goto out;
-	}
-	if(gen3(len, 1, r1-1, UR1)) {
-		i = '-';
-		goto out;
-	}
-
-	return 0;
-
-calcr0:
-	if(mulval == r1+1) {
-		i = '+';
-		goto out;
-	}
-	if(mulval == r1-1) {
-		i = '-';
-		goto out;
-	}
-	return 0;
-
-out:
-	*--mulcp = i;
-	return 1;
-}
-
-static int
-gen3(int len, long r0, long r1, int flag)
-{
-	int i, f1, f2;
-	long x;
-
-	if(r0 <= 0 ||
-	   r0 >= r1 ||
-	   r1 > valmax)
-		return 0;
-
-	len--;
-	if(len == 0)
-		goto calcr0;
-
-	if(!(flag & UR1)) {
-		f1 = UR1|SR1;
-		for(i=1; i<=shmax; i++) {
-			x = r0<<i;
-			if(x > valmax)
-				break;
-			if(gen3(len, r0, x, f1)) {
-				i += 'a';
-				goto out;
-			}
-		}
-	}
-
-	if(!(flag & UR0)) {
-		f1 = UR1|SR1;
-		for(i=1; i<=shmax; i++) {
-			x = r1<<i;
-			if(x > valmax)
-				break;
-			if(gen3(len, r1, x, f1)) {
-				i += 'a';
-				goto out;
-			}
-		}
-	}
-
-	if(!(flag & SR1)) {
-		f1 = UR1|SR1|(flag&UR0);
-		for(i=1; i<=shmax; i++) {
-			x = r1<<i;
-			if(x > valmax)
-				break;
-			if(gen3(len, r0, x, f1)) {
-				i += 'a';
-				goto out;
-			}
-		}
-	}
-
-	if(!(flag & SR0)) {
-		f1 = UR0|SR0|(flag&(SR1|UR1));
-
-		f2 = UR1|SR1;
-		if(flag & UR1)
-			f2 |= UR0;
-		if(flag & SR1)
-			f2 |= SR0;
-
-		for(i=1; i<=shmax; i++) {
-			x = r0<<i;
-			if(x > valmax)
-				break;
-			if(x > r1) {
-				if(gen3(len, r1, x, f2)) {
-					i += 'a';
-					goto out;
-				}
-			} else
-				if(gen3(len, x, r1, f1)) {
-					i += 'a';
-					goto out;
-				}
-		}
-	}
-
-	x = r1+r0;
-	if(gen3(len, r0, x, UR1)) {
-		i = '+';
-		goto out;
-	}
-
-	if(gen3(len, r1, x, UR1)) {
-		i = '+';
-		goto out;
-	}
-
-	x = r1-r0;
-	if(gen3(len, x, r1, UR0)) {
-		i = '-';
-		goto out;
-	}
-
-	if(x > r0) {
-		if(gen3(len, r0, x, UR1)) {
-			i = '-';
-			goto out;
-		}
-	} else
-		if(gen3(len, x, r0, UR0)) {
-			i = '-';
-			goto out;
-		}
-
-	return 0;
-
-calcr0:
-	f1 = flag & (UR0|UR1);
-	if(f1 == UR1) {
-		for(i=1; i<=shmax; i++) {
-			x = r1<<i;
-			if(x >= mulval) {
-				if(x == mulval) {
-					i += 'a';
-					goto out;
-				}
-				break;
-			}
-		}
-	}
-
-	if(mulval == r1+r0) {
-		i = '+';
-		goto out;
-	}
-	if(mulval == r1-r0) {
-		i = '-';
-		goto out;
-	}
-
-	return 0;
-
-out:
-	*--mulcp = i;
-	return 1;
-}
-
-/*
- * hint table has numbers that
- * the search algorithm fails on.
- * <1000:
- *	all numbers
- * <5000:
- * 	÷ by 5
- * <10000:
- * 	÷ by 50
- * <65536:
- * 	÷ by 250
- */
-Hintab	hintab[] =
-{
-	683,	"b++d+e+",
-	687,	"b+e++e-",
-	691,	"b++d+e+",
-	731,	"b++d+e+",
-	811,	"b++d+i+",
-	821,	"b++e+e+",
-	843,	"b+d++e+",
-	851,	"b+f-+e-",
-	853,	"b++e+e+",
-	877,	"c++++g-",
-	933,	"b+c++g-",
-	981,	"c-+e-d+",
-	1375,	"b+c+b+h-",
-	1675,	"d+b++h+",
-	2425,	"c++f-e+",
-	2675,	"c+d++f-",
-	2750,	"b+d-b+h-",
-	2775,	"c-+g-e-",
-	3125,	"b++e+g+",
-	3275,	"b+c+g+e+",
-	3350,	"c++++i+",
-	3475,	"c-+e-f-",
-	3525,	"c-+d+g-",
-	3625,	"c-+e-j+",
-	3675,	"b+d+d+e+",
-	3725,	"b+d-+h+",
-	3925,	"b+d+f-d-",
-	4275,	"b+g++e+",
-	4325,	"b+h-+d+",
-	4425,	"b+b+g-j-",
-	4525,	"b+d-d+f+",
-	4675,	"c++d-g+",
-	4775,	"b+d+b+g-",
-	4825,	"c+c-+i-",
-	4850,	"c++++i-",
-	4925,	"b++e-g-",
-	4975,	"c+f++e-",
-	5500,	"b+g-c+d+",
-	6700,	"d+b++i+",
-	9700,	"d++++j-",
-	11000,	"b+f-c-h-",
-	11750,	"b+d+g+j-",
-	12500,	"b+c+e-k+",
-	13250,	"b+d+e-f+",
-	13750,	"b+h-c-d+",
-	14250,	"b+g-c+e-",
-	14500,	"c+f+j-d-",
-	14750,	"d-g--f+",
-	16750,	"b+e-d-n+",
-	17750,	"c+h-b+e+",
-	18250,	"d+b+h-d+",
-	18750,	"b+g-++f+",
-	19250,	"b+e+b+h+",
-	19750,	"b++h--f-",
-	20250,	"b+e-l-c+",
-	20750,	"c++bi+e-",
-	21250,	"b+i+l+c+",
-	22000,	"b+e+d-g-",
-	22250,	"b+d-h+k-",
-	22750,	"b+d-e-g+",
-	23250,	"b+c+h+e-",
-	23500,	"b+g-c-g-",
-	23750,	"b+g-b+h-",
-	24250,	"c++g+m-",
-	24750,	"b+e+e+j-",
-	25000,	"b++dh+g+",
-	25250,	"b+e+d-g-",
-	25750,	"b+e+b+j+",
-	26250,	"b+h+c+e+",
-	26500,	"b+h+c+g+",
-	26750,	"b+d+e+g-",
-	27250,	"b+e+e+f+",
-	27500,	"c-i-c-d+",
-	27750,	"b+bd++j+",
-	28250,	"d-d-++i-",
-	28500,	"c+c-h-e-",
-	29000,	"b+g-d-f+",
-	29500,	"c+h+++e-",
-	29750,	"b+g+f-c+",
-	30250,	"b+f-g-c+",
-	33500,	"c-f-d-n+",
-	33750,	"b+d-b+j-",
-	34250,	"c+e+++i+",
-	35250,	"e+b+d+k+",
-	35500,	"c+e+d-g-",
-	35750,	"c+i-++e+",
-	36250,	"b+bh-d+e+",
-	36500,	"c+c-h-e-",
-	36750,	"d+e--i+",
-	37250,	"b+g+g+b+",
-	37500,	"b+h-b+f+",
-	37750,	"c+be++j-",
-	38500,	"b+e+b+i+",
-	38750,	"d+i-b+d+",
-	39250,	"b+g-l-+d+",
-	39500,	"b+g-c+g-",
-	39750,	"b+bh-c+f-",
-	40250,	"b+bf+d+g-",
-	40500,	"b+g-c+g+",
-	40750,	"c+b+i-e+",
-	41250,	"d++bf+h+",
-	41500,	"b+j+c+d-",
-	41750,	"c+f+b+h-",
-	42500,	"c+h++g+",
-	42750,	"b+g+d-f-",
-	43250,	"b+l-e+d-",
-	43750,	"c+bd+h+f-",
-	44000,	"b+f+g-d-",
-	44250,	"b+d-g--f+",
-	44500,	"c+e+c+h+",
-	44750,	"b+e+d-h-",
-	45250,	"b++g+j-g+",
-	45500,	"c+d+e-g+",
-	45750,	"b+d-h-e-",
-	46250,	"c+bd++j+",
-	46500,	"b+d-c-j-",
-	46750,	"e-e-b+g-",
-	47000,	"b+c+d-j-",
-	47250,	"b+e+e-g-",
-	47500,	"b+g-c-h-",
-	47750,	"b+f-c+h-",
-	48250,	"d--h+n-",
-	48500,	"b+c-g+m-",
-	48750,	"b+e+e-g+",
-	49500,	"c-f+e+j-",
-	49750,	"c+c+g++f-",
-	50000,	"b+e+e+k+",
-	50250,	"b++i++g+",
-	50500,	"c+g+f-i+",
-	50750,	"b+e+d+k-",
-	51500,	"b+i+c-f+",
-	51750,	"b+bd+g-e-",
-	52250,	"b+d+g-j+",
-	52500,	"c+c+f+g+",
-	52750,	"b+c+e+i+",
-	53000,	"b+i+c+g+",
-	53500,	"c+g+g-n+",
-	53750,	"b+j+d-c+",
-	54250,	"b+d-g-j-",
-	54500,	"c-f+e+f+",
-	54750,	"b+f-+c+g+",
-	55000,	"b+g-d-g-",
-	55250,	"b+e+e+g+",
-	55500,	"b+cd++j+",
-	55750,	"b+bh-d-f-",
-	56250,	"c+d-b+j-",
-	56500,	"c+d+c+i+",
-	56750,	"b+e+d++h-",
-	57000,	"b+d+g-f+",
-	57250,	"b+f-m+d-",
-	57750,	"b+i+c+e-",
-	58000,	"b+e+d+h+",
-	58250,	"c+b+g+g+",
-	58750,	"d-e-j--e+",
-	59000,	"d-i-+e+",
-	59250,	"e--h-m+",
-	59500,	"c+c-h+f-",
-	59750,	"b+bh-e+i-",
-	60250,	"b+bh-e-e-",
-	60500,	"c+c-g-g-",
-	60750,	"b+e-l-e-",
-	61250,	"b+g-g-c+",
-	61750,	"b+g-c+g+",
-	62250,	"f--+c-i-",
-	62750,	"e+f--+g+",
-	64750,	"b+f+d+p-",
-};
-int	hintabsize	= nelem(hintab);
--- a/sys/src/cmd/7c/peep.c
+++ /dev/null
@@ -1,759 +1,0 @@
-#include "gc.h"
-
-void
-peep(void)
-{
-	Reg *r, *r1, *r2;
-	Prog *p, *p1;
-	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 == AMOVQ || /*p->as == AMOVL ||*/ p->as == AMOVS || p->as == AMOVT)
-		if(regtyp(&p->to)) {
-			if(regtyp(&p->from))
-			if(p->from.type == p->to.type) {
-				if(copyprop(r)) {
-					excise(r);
-					t++;
-				} else
-				if(subprop(r) && copyprop(r)) {
-					excise(r);
-					t++;
-				}
-			}
-			if(regzer(&p->from))
-			if(p->to.type == D_REG) {
-				p->from.type = D_REG;
-				p->from.reg = REGZERO;
-				if(copyprop(r)) {
-					excise(r);
-					t++;
-				} else
-				if(subprop(r) && copyprop(r)) {
-					excise(r);
-					t++;
-				}
-			}
-		}
-/*		if(p->as == AMOVL)
-		if(regtyp(&p->to)) {
-			if(regzer(&p->from))
-			if(p->to.type == D_REG) {
-				p->from.type = D_REG;
-				p->from.reg = REGZERO;
-				if(copyprop(r)) {
-					excise(r);
-					t++;
-				} else
-				if(subprop(r) && copyprop(r)) {
-					excise(r);
-					t++;
-				}
-			}
-		} */
-	}
-	if(t)
-		goto loop1;
-	/*
-	 * look for MOVB x,R; MOVB R,R
-	 */
-	for(r=firstr; r!=R; r=r->link) {
-		p = r->prog;
-		switch(p->as) {
-		default:
-			continue;
-		case AMOVW:
-		case AMOVWU:
-		case AMOVB:
-		case AMOVBU:
-			if(p->to.type != D_REG)
-				continue;
-			break;
-		}
-		r1 = r->link;
-		if(r1 == R)
-			continue;
-		p1 = r1->prog;
-		if(p1->as != p->as)
-			continue;
-		if(p1->from.type != D_REG || p1->from.reg != p->to.reg)
-			continue;
-		if(p1->to.type != D_REG || p1->to.reg != p->to.reg)
-			continue;
-		excise(r1);
-	}
-}
-
-void
-excise(Reg *r)
-{
-	Prog *p;
-
-	p = r->prog;
-	p->as = ANOP;
-	p->from = zprog.from;
-	p->to = zprog.to;
-	p->reg = zprog.reg; /**/
-}
-
-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
-regzer(Adr *a)
-{
-
-	if(a->type == D_CONST)
-		if(a->sym == S)
-			if(a->offset == 0)
-				return 1;
-	if(a->type == D_REG)
-		if(a->reg == REGZERO)
-			return 1;
-	return 0;
-}
-
-int
-regtyp(Adr *a)
-{
-
-	if(a->type == D_REG) {
-		if(a->reg != REGZERO)
-			return 1;
-		return 0;
-	}
-	if(a->type == D_FREG)
-		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 AJSR:
-			return 0;
-
-		case AADDQ:
-		case ASUBQ:
-		case AADDL:
-		case ASUBL:
-		case ASLLQ:
-		case ASRLQ:
-		case ASRAQ:
-		case ASLLL:
-		case ASRLL:
-		case ASRAL:
-		case AOR:
-		case AAND:
-		case AXOR:
-		case AMULQ:
-		case ADIVQ:
-		case ADIVQU:
-		case AMODQ:
-		case AMODQU:
-		case ADIVL:
-		case ADIVLU:
-		case AMODL:
-		case AMODLU:
-		case ACMPEQ:
-		case ACMPGT:
-		case ACMPGE:
-		case ACMPUGT:
-		case ACMPUGE:
-		case ACMPBLE:
-		case AMULL:
-		case AUMULH:
-
-		case AADDT:
-		case AADDS:
-		case ASUBT:
-		case ASUBS:
-		case AMULT:
-		case AMULS:
-		case ADIVT:
-		case ADIVS:
-		case ACMPTEQ:
-		case ACMPTGT:
-		case ACMPTGE:
-			if(p->to.type == v1->type)
-			if(p->to.reg == v1->reg) {
-				if(p->reg == NREG)
-					p->reg = p->to.reg;
-				goto gotit;
-			}
-			break;
-
-		case AMOVS:
-		case AMOVT:
-		case AMOVQ:
-		case ACVTQT:
-		case ACVTTQ:
-			if(p->to.type == v1->type)
-			if(p->to.reg == v1->reg)
-				goto gotit;
-			break;
-		}
-		if(copyau(&p->from, v2) ||
-		   copyau1(p, v2) ||
-		   copyau(&p->to, v2))
-			break;
-		if(copysub(&p->from, v1, v2, 0) ||
-		   copysub1(p, 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);
-		copysub1(p, v1, v2, 1);
-		copysub(&p->to, v1, v2, 1);
-		if(debug['P'])
-			print("%P\n", r->prog);
-	}
-	t = v1->reg;
-	v1->reg = v2->reg;
-	v2->reg = 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("; %Drar; return 0\n", v2);
-			return 0;
-
-		case 3:	/* set */
-			if(debug['P'])
-				print("; %Dset; 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("; %Dused+set and f=%d; return 0\n", v2, f);
-				else
-					print("; %Dused 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("; %Dused+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("; %Dset 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:
-		if(debug['P'])
-			print(" (???)");
-		diag(Z, "copyu: unknown op %P", p);
-		return 2;
-
-
-	case ANOP:	/* read, write */
-	case AMOVQ:
-	case AMOVL:
-	case AMOVLU:
-	case AMOVW:
-	case AMOVWU:
-	case AMOVB:
-	case AMOVBU:
-
-	case AMOVS:
-	case AMOVT:
-	case ACVTTQ:
-	case ACVTQT:
-	case ACVTQS:
-	case ACVTTS:
-		if(s != A) {
-			if(copysub(&p->from, v, s, 1))
-				return 1;
-			if(!copyas(&p->to, v))
-				if(copysub(&p->to, v, s, 1))
-					return 1;
-			return 0;
-		}
-		if(copyas(&p->to, v)) {
-			if(copyau(&p->from, v))
-				return 4;
-			return 3;
-		}
-		if(copyau(&p->from, v))
-			return 1;
-		if(copyau(&p->to, v))
-			return 1;
-		return 0;
-
-	case AADDQ:	/* read read write */
-	case ASUBQ:
-	case AADDL:
-	case ASUBL:
-	case ACMPEQ:
-	case ACMPGT:
-	case ACMPGE:
-	case ACMPUGT:
-	case ACMPUGE:
-	case ACMPBLE:
-	case ASLLQ:
-	case ASRLQ:
-	case ASRAQ:
-	case ASLLL:
-	case ASRLL:
-	case ASRAL:
-	case AOR:
-	case AAND:
-	case AXOR:
-	case AMULQ:
-	case AMULL:
-	case AUMULH:
-	case ADIVQ:
-	case ADIVQU:
-	case AMODQ:
-	case AMODQU:
-	case ADIVL:
-	case ADIVLU:
-	case AMODL:
-	case AMODLU:
-
-	case AADDS:
-	case AADDT:
-	case ASUBS:
-	case ASUBT:
-	case AMULS:
-	case AMULT:
-	case ADIVS:
-	case ADIVT:
-	case ACMPTEQ:
-	case ACMPTGT:
-	case ACMPTGE:
-		if(s != A) {
-			if(copysub(&p->from, v, s, 1))
-				return 1;
-			if(copysub1(p, v, s, 1))
-				return 1;
-			if(!copyas(&p->to, v))
-				if(copysub(&p->to, v, s, 1))
-					return 1;
-			return 0;
-		}
-		if(copyas(&p->to, v)) {
-			if(p->reg == NREG)
-				p->reg = p->to.reg;
-			if(copyau(&p->from, v))
-				return 4;
-			if(copyau1(p, v))
-				return 4;
-			return 3;
-		}
-		if(copyau(&p->from, v))
-			return 1;
-		if(copyau1(p, v))
-			return 1;
-		if(copyau(&p->to, v))
-			return 1;
-		return 0;
-
-	case ABEQ:	/* read */
-	case ABNE:
-	case ABLT:
-	case ABGE:
-	case ABLE:
-	case ABGT:
-	case ABLBC:
-	case ABLBS:
-
-	case AFBEQ:
-	case AFBNE:
-	case AFBLT:
-	case AFBGE:
-	case AFBLE:
-	case AFBGT:
-		if(s != A)
-			return copysub(&p->from, v, s, 1);
-		if(copyau(&p->from, v))
-			return 1;
-		return 0;
-
-#ifdef	NOPE
-	case ???:	/* read read */
-		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;
-#endif
-
-	case AJMP:	/* funny */
-		if(s != A) {
-			if(copysub(&p->to, v, s, 1))
-				return 1;
-			return 0;
-		}
-		if(copyau(&p->to, v))
-			return 1;
-		return 0;
-
-	case ARET:	/* funny */
-		if(v->type == D_REG)
-		if(v->reg == REGRET)
-			return 2;
-		if(v->type == D_FREG)
-		if(v->reg == FREGRET)
-			return 2;
-
-	case AJSR:	/* funny */
-		if(v->type == D_REG) {
-			if(v->reg <= REGEXT && v->reg > exregoffset)
-				return 2;
-			if(REGARG != NREG && v->reg == REGARG)
-				return 2;
-		}
-		if(v->type == D_FREG)
-			if(v->reg <= FREGEXT && v->reg > exfregoffset)
-				return 2;
-
-		if(s != A) {
-			if(copysub(&p->to, v, s, 1))
-				return 1;
-			return 0;
-		}
-		if(copyau(&p->to, v))
-			return 4;
-		return 3;
-
-	case ATEXT:	/* funny */
-		if(v->type == D_REG)
-			if(v->reg == REGARG)
-				return 3;
-		return 0;
-	}
-}
-
-int
-a2type(Prog *p)
-{
-
-	switch(p->as) {
-	case AADDQ:
-	case ASUBQ:
-	case ASLLQ:
-	case ASRLQ:
-	case ASRAQ:
-	case ASLLL:
-	case ASRLL:
-	case ASRAL:
-	case AOR:
-	case AAND:
-	case AXOR:
-	case AMULQ:
-	case ADIVQ:
-	case ADIVQU:
-	case AMODQ:
-	case AMODQU:
-	case ADIVL:
-	case ADIVLU:
-	case AMODL:
-	case AMODLU:
-	case AADDL:
-	case ASUBL:
-	case AEXTLL:
-	case ACMPEQ:
-	case ACMPGT:
-	case ACMPGE:
-	case ACMPUGT:
-	case ACMPUGE:
-	case ACMPBLE:
-	case AMULL:
-	case AUMULH:
-		return D_REG;
-
-	case AADDS:
-	case AADDT:
-	case ASUBS:
-	case ASUBT:
-	case AMULS:
-	case AMULT:
-	case ADIVS:
-	case ADIVT:
-	case ACMPTEQ:
-	case ACMPTGT:
-	case ACMPTGE:
-	case ACVTTQ:
-	case ACVTQT:
-		return D_FREG;
-	}
-	return D_NONE;
-}
-
-/*
- * direct reference,
- * could be set/use depending on
- * semantics
- */
-int
-copyas(Adr *a, Adr *v)
-{
-
-	if(regtyp(v))
-		if(a->type == v->type)
-		if(a->reg == v->reg)
-			return 1;
-	return 0;
-}
-
-/*
- * either direct or indirect
- */
-int
-copyau(Adr *a, Adr *v)
-{
-
-	if(copyas(a, v))
-		return 1;
-	if(v->type == D_REG)
-		if(a->type == D_OREG)
-			if(v->reg == a->reg)
-				return 1;
-	return 0;
-}
-
-int
-copyau1(Prog *p, Adr *v)
-{
-
-	if(regtyp(v))
-		if(p->from.type == v->type || p->to.type == v->type)
-		if(p->reg == v->reg) {
-			if(a2type(p) != v->type)
-				print("botch a2type %P\n", p);
-			return 1;
-		}
-	return 0;
-}
-
-/*
- * substitute s for v in a
- * return failure to substitute
- */
-int
-copysub(Adr *a, Adr *v, Adr *s, int f)
-{
-
-	if(f)
-	if(copyau(a, v))
-		a->reg = s->reg;
-	return 0;
-}
-
-int
-copysub1(Prog *p1, Adr *v, Adr *s, int f)
-{
-
-	if(f)
-	if(copyau1(p1, v))
-		p1->reg = s->reg;
-	return 0;
-}
--- a/sys/src/cmd/7c/reg.c
+++ /dev/null
@@ -1,1164 +1,0 @@
-#include "gc.h"
-
-void	addsplits(void);
-
-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 = 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 ARET:
-		case AJMP:
-		case AREI:
-			r->p1 = R;
-			r1->s1 = R;
-		}
-
-		/*
-		 * left side always read
-		 */
-		bit = mkvar(&p->from, p->as==AMOVQ || p->as==AMOVL);
-		for(z=0; z<BITS; z++)
-			r->use1.b[z] |= bit.b[z];
-
-		/*
-		 * right side depends on opcode
-		 */
-		bit = mkvar(&p->to, 0);
-		if(bany(&bit))
-		switch(p->as) {
-		default:
-			diag(Z, "reg: unknown asop: %ud", p->as);
-			break;
-
-		/*
-		 * right side write
-		 */
-		case ANOP:
-		case AMOVB:
-		case AMOVBU:
-		case AMOVW:
-		case AMOVWU:
-		case AMOVL:
-		case AMOVQ:
-		case AMOVS:
-		case AMOVT:
-			for(z=0; z<BITS; z++)
-				r->set.b[z] |= bit.b[z];
-			break;
-
-		/*
-		 * funny
-		 */
-		case AJSR:
-			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);
-
-	/*
-	 * 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 == ARET)
-			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;
-
-	addsplits();
-
-	if(debug['R'] && debug['v']) {
-		print("\nprop 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->set.b[z] |
-					r->refahead.b[z] | r->calahead.b[z] |
-					r->refbehind.b[z] | r->calbehind.b[z] |
-					r->use1.b[z] | r->use2.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);
-				if(bany(&r->refahead))
-					print(" ra=%B", r->refahead);
-				if(bany(&r->calahead))
-					print(" ca=%B", r->calahead);
-				if(bany(&r->refbehind))
-					print(" rb=%B", r->refbehind);
-				if(bany(&r->calbehind))
-					print(" cb=%B", r->calbehind);
-			}
-			print("\n");
-		}
-	}
-
-	/*
-	 * 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);
-		}
-	}
-
-	for(r = firstr; r != R; r = r->link)
-		r->act = zbits;
-	rgp = region;
-	nregion = 0;
-	for(r = firstr; r != R; r = r->link) {
-		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 and 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']) {
-			if(rgp->regno >= NREG)
-				print("%L $%d F%d: %B\n",
-					rgp->enter->prog->lineno,
-					rgp->cost,
-					rgp->regno-NREG,
-					bit);
-			else
-				print("%L $%d R%d: %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;
-	}
-}
-
-void
-addsplits(void)
-{
-	Reg *r, *r1;
-	int z, i;
-	Bits bit;
-
-	for(r = firstr; r != R; r = r->link) {
-		if(r->loop > 1)
-			continue;
-		if(r->prog->as == AJSR)
-			continue;
-		for(r1 = r->p2; r1 != R; r1 = r1->p2link) {
-			if(r1->loop <= 1)
-				continue;
-			for(z=0; z<BITS; z++)
-				bit.b[z] = r1->calbehind.b[z] &
-					(r->refahead.b[z] | r->use1.b[z] | r->use2.b[z]) &
-					~(r->calahead.b[z] & addrs.b[z]);
-			while(bany(&bit)) {
-				i = bnum(bit);
-				bit.b[i/32] &= ~(1L << (i%32));
-			}
-		}
-	}
-}
-
-/*
- * 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->name = v->name;
-	a->offset = v->offset;
-	a->etype = v->etype;
-	a->type = D_OREG;
-	if(a->etype == TARRAY || a->sym == S)
-		a->type = D_CONST;
-
-	p1->as = AMOVL;
-	if(v->etype == TCHAR || v->etype == TUCHAR)		/* TODO: optimise locals? */
-		p1->as = AMOVB;
-	if(v->etype == TSHORT || v->etype == TUSHORT)
-		p1->as = AMOVW;
-	if(v->etype == TVLONG || v->etype == TUVLONG)
-		p1->as = AMOVQ;
-	if(v->etype == TFLOAT)
-		p1->as = AMOVS;
-	if(v->etype == TDOUBLE)
-		p1->as = AMOVT;
-
-	p1->from.type = D_REG;
-	p1->from.reg = rn;
-	if(rn >= NREG) {
-		p1->from.type = D_FREG;
-		p1->from.reg = rn-NREG;
-	}
-	if(!f) {
-		p1->from = *a;
-		*a = zprog.from;
-		a->type = D_REG;
-		a->reg = rn;
-		if(rn >= NREG) {
-			a->type = D_FREG;
-			a->reg = rn-NREG;
-		}
-		if(v->etype == TUCHAR)
-			p1->as = AMOVBU;
-		if(v->etype == TUSHORT)
-			p1->as = AMOVWU;
-	}
-	if(debug['R'])
-		print("%P\t.a%P\n", p, p1);
-}
-
-Bits
-mkvar(Adr *a, int docon)
-{
-	Var *v;
-	int i, t, n, et, z;
-	vlong o;
-	Bits bit;
-	Sym *s;
-
-	t = a->type;
-	if(t == D_REG && a->reg != NREG)
-		regbits |= RtoB(a->reg);
-	if(t == D_FREG && a->reg != NREG)
-		regbits |= FtoB(a->reg);
-	s = a->sym;
-	o = a->offset;
-	et = a->etype;
-	if(s == S) {
-		if(t != D_CONST || !docon || a->reg != NREG)
-			goto none;
-		et = TLONG;
-		if (o > 0x7FFFFFFFLL || o < -0x80000000LL)
-			et = TVLONG;
-	}
-	if(t == D_CONST) {
-		if(s == S && sval(o))
-			goto none;
-	}
-
-	n = a->name;
-	v = var;
-	for(i=0; i<nvar; i++) {
-		if(s == v->sym)
-		if(n == v->name)
-		if(o == v->offset)
-			goto out;
-		v++;
-	}
-	if(s)
-		if(s->name[0] == '.')
-			goto none;
-	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->etype = et;
-	v->name = n;
-	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] && !typev[et]))	/* funny punning? */
-		for(z=0; z<BITS; z++)
-			addrs.b[z] |= bit.b[z];
-	if(t == D_CONST) {
-		if(s == S) {
-			for(z=0; z<BITS; z++)
-				consts.b[z] |= bit.b[z];
-			return bit;
-		}
-		if(et != TARRAY)
-			for(z=0; z<BITS; z++)
-				addrs.b[z] |= bit.b[z];
-		for(z=0; z<BITS; z++)
-			params.b[z] |= bit.b[z];
-		return bit;
-	}
-	if(t == D_OREG)
-		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 AJSR:
-			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 ARET:
-			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)
-				fatal(Z, "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)
-		fatal(Z, "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 TVLONG:
-	case TUVLONG:
-	case TIND:
-	case TARRAY:
-		i = BtoR(~b);
-		if(i && r->cost >= 0) {
-			r->regno = i;
-			return RtoB(i);
-		}
-		break;
-
-	case TDOUBLE:
-	case TFLOAT:
-		i = BtoF(~b);
-		if(i && r->cost >= 0) {
-			r->regno = i+NREG;
-			return FtoB(i);
-		}
-		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(p->as == AMOVL && typechlp[var[bn].etype])
-				p->as = AMOVQ;
-			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(p->as == AMOVL && typechlp[var[bn].etype])
-				p->as = AMOVQ;
-			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->name = D_NONE;
-	a->type = D_REG;
-	a->reg = rn;
-	if(rn >= NREG) {
-		a->type = D_FREG;
-		a->reg = rn-NREG;
-	}
-}
-
-/*
- *	bit	reg
- *	0	R2
- *	1	R3
- *	...	...
- *	10  R12
- *	11  R16
- *	...	...
- *	19	R24
- *	20	R25
- */
-long
-RtoB(int r)
-{
-
-	if(r >= 2 && r <= 12)
-		return 1L << (r-2);
-	if(r >= 16 && r <= 25)
-		return 1L << (r-5);
-	return 0;
-}
-
-BtoR(long b)
-{
-	int r;
-
-	b &= 0x001fffffL;
-	if(b == 0)
-		return 0;
-	r = bitno(b) + 2;
-	if (r >= 13)
-		r += 3;
-	return r;
-}
-
-/*
- *	bit	reg
- *	21	F1
- *	22	F2
- *	...	...
- *	31	F11
- */
-long
-FtoB(int f)
-{
-
-	if(f < 1 || f > 11)
-		return 0;
-	return 1L << (f + 20);
-}
-
-int
-BtoF(long b)
-{
-
-	b &= 0xffe00000L;
-	if(b == 0)
-		return 0;
-	return bitno(b) - 20;
-}
--- a/sys/src/cmd/7c/sgen.c
+++ /dev/null
@@ -1,235 +1,0 @@
-#include "gc.h"
-
-void
-noretval(int n)
-{
-
-	if(n & 1) {
-		gins(ANOP, Z, Z);
-		p->to.type = D_REG;
-		p->to.reg = REGRET;
-	}
-	if(n & 2) {
-		gins(ANOP, Z, Z);
-		p->to.type = D_FREG;
-		p->to.reg = FREGRET;
-	}
-}
-
-/*
- *	calculate addressability as follows
- *		CONST ==> 20		$value
- *		NAME ==> 10		name
- *		REGISTER ==> 11		register
- *		INDREG ==> 12		*[(reg)+offset]
- *		&10 ==> 2		$name
- *		ADD(2, 20) ==> 2	$name+offset
- *		ADD(3, 20) ==> 3	$(reg)+offset
- *		&12 ==> 3		$(reg)+offset
- *		*11 ==> 11		??
- *		*2 ==> 10		name
- *		*3 ==> 12		*(reg)+offset
- *	calculate complexity (number of registers)
- */
-void
-xcom(Node *n)
-{
-	Node *l, *r;
-	int t;
-
-	if(n == Z)
-		return;
-	l = n->left;
-	r = n->right;
-	n->addable = 0;
-	n->complex = 0;
-	switch(n->op) {
-	case OCONST:
-		n->addable = 20;
-		return;
-
-	case OREGISTER:
-		n->addable = 11;
-		return;
-
-	case OINDREG:
-		n->addable = 12;
-		return;
-
-	case ONAME:
-		n->addable = 10;
-		return;
-
-	case OADDR:
-		xcom(l);
-		if(l->addable == 10)
-			n->addable = 2;
-		if(l->addable == 12)
-			n->addable = 3;
-		break;
-
-	case OIND:
-		xcom(l);
-		if(l->addable == 11)
-			n->addable = 12;
-		if(l->addable == 3)
-			n->addable = 12;
-		if(l->addable == 2)
-			n->addable = 10;
-		break;
-
-	case OADD:
-		xcom(l);
-		xcom(r);
-		if(l->addable == 20) {
-			if(r->addable == 2)
-				n->addable = 2;
-			if(r->addable == 3)
-				n->addable = 3;
-		}
-		if(r->addable == 20) {
-			if(l->addable == 2)
-				n->addable = 2;
-			if(l->addable == 3)
-				n->addable = 3;
-		}
-		break;
-
-	case OASLMUL:
-	case OASMUL:
-		xcom(l);
-		xcom(r);
-		t = vlog(r);
-		if(t >= 0) {
-			n->op = OASASHL;
-			r->vconst = t;
-			r->type = types[TINT];
-		}
-		break;
-
-	case OMUL:
-	case OLMUL:
-		xcom(l);
-		xcom(r);
-		t = vlog(r);
-		if(t >= 0) {
-			n->op = OASHL;
-			r->vconst = t;
-			r->type = types[TINT];
-		}
-		t = vlog(l);
-		if(t >= 0) {
-			n->op = OASHL;
-			n->left = r;
-			n->right = l;
-			r = l;
-			l = n->left;
-			r->vconst = t;
-			r->type = types[TINT];
-		}
-		break;
-
-	case OASLDIV:
-		xcom(l);
-		xcom(r);
-		t = vlog(r);
-		if(t >= 0) {
-			n->op = OASLSHR;
-			r->vconst = t;
-			r->type = types[TINT];
-		}
-		break;
-
-	case OLDIV:
-		xcom(l);
-		xcom(r);
-		t = vlog(r);
-		if(t >= 0) {
-			n->op = OLSHR;
-			r->vconst = t;
-			r->type = types[TINT];
-		}
-		break;
-
-	case OASLMOD:
-		xcom(l);
-		xcom(r);
-		t = vlog(r);
-		if(t >= 0) {
-			n->op = OASAND;
-			r->vconst--;
-		}
-		break;
-
-	case OLMOD:
-		xcom(l);
-		xcom(r);
-		t = vlog(r);
-		if(t >= 0) {
-			n->op = OAND;
-			r->vconst--;
-		}
-		break;
-
-	default:
-		if(l != Z)
-			xcom(l);
-		if(r != Z)
-			xcom(r);
-		break;
-	}
-	if(n->addable >= 10)
-		return;
-
-	if(l != Z)
-		n->complex = l->complex;
-	if(r != Z) {
-		if(r->complex == n->complex)
-			n->complex = r->complex+1;
-		else
-		if(r->complex > n->complex)
-			n->complex = r->complex;
-	}
-	if(n->complex == 0)
-		n->complex++;
-
-	switch(n->op) {
-	case OFUNC:
-		n->complex = FNX;
-		break;
-
-	case OEQ:
-	case ONE:
-	case OLE:
-	case OLT:
-	case OGE:
-	case OGT:
-	case OHI:
-	case OHS:
-	case OLO:
-	case OLS:
-		/*
-		 * immediate operators, make const on right
-		 */
-		if(l->op == OCONST) {
-			n->left = r;
-			n->right = l;
-			n->op = invrel[relindex(n->op)];
-		}
-		break;
-
-	case OADD:
-	case OXOR:
-	case OAND:
-	case OOR:
-		/*
-		 * immediate operators, make const on right
-		 */
-		if(l->op == OCONST) {
-			n->left = r;
-			n->right = l;
-		}
-		break;
-	}
-}
-
--- a/sys/src/cmd/7c/swt.c
+++ /dev/null
@@ -1,578 +1,0 @@
-#include "gc.h"
-
-void
-swit1(C1 *q, int nc, long def, Node *n)
-{
-	Node tn;
-	
-	regalloc(&tn, &regnode, Z);
-	swit2(q, nc, def, n, &tn);
-	regfree(&tn);
-}
-
-void
-swit2(C1 *q, int nc, long def, Node *n, Node *tn)
-{
-	C1 *r;
-	int i;
-	Prog *sp;
-
-	if(nc < 5) {
-		for(i=0; i<nc; i++) {
-			if(debug['W'])
-				print("case = %.8llux\n", q->val);
-			if(bval(q->val)) {
-				gopcode(OEQ, n, Z, nodconst(q->val));
-			} else {
-				gopcode(OSUB, nodconst(q->val), n, tn);
-				gopcode(OEQ, tn, Z, nodconst(0));
-			}
-			patch(p, q->label);
-			q++;
-		}
-		gbranch(OGOTO);
-		patch(p, def);
-		return;
-	}
-	i = nc / 2;
-	r = q+i;
-	if(bval(r->val)) {
-		gopcode(OGE, n, Z, nodconst(r->val));
-		sp = p;
-		swit2(q, i, def, n, tn);
-
-		patch(sp, pc);
-		swit2(r, nc-i, def, n, tn);
-	} else {
-		gopcode(OSUB, nodconst(r->val), n, tn);
-		gopcode(OGE, tn, Z, nodconst(0));
-		sp = p;
-		swit2(q, i, def, n, tn);
-
-		patch(sp, pc);
-		swit2(r, nc-i, def, n, tn);
-	}
-/*	if(debug['W'])
-		print("case > %.8llux\n", r->val);
-	gmove(nodconst(r->val), tn);
-	gopcode(OLT, tn, n, Z);
-	sp = p;
-	gopcode(OEQ, n, tn, Z);
-	patch(p, r->label);
-	swit2(q, i, def, n, tn);
-
-	if(debug['W'])
-		print("case < %.8llux\n", r->val);
-	patch(sp, pc);
-	swit2(r+1, nc-i-1, def, n, tn); */
-}
-
-void
-bitload(Node *b, Node *n1, Node *n2, Node *n3, Node *nn)
-{
-	int sh;
-	long v;
-	Node *l;
-
-	/*
-	 * n1 gets adjusted/masked value
-	 * n2 gets address of cell
-	 * n3 gets contents of cell
-	 */
-	l = b->left;
-	if(n2 != Z) {
-		regalloc(n1, l, nn);
-		reglcgen(n2, l, Z);
-		regalloc(n3, l, Z);
-		gopcode(OAS, n2, Z, n3);
-		gopcode(OAS, n3, Z, n1);
-	} else {
-		regalloc(n1, l, nn);
-		cgen(l, n1);
-	}
-	if(b->type->shift == 0 && typeu[b->type->etype]) {
-		v = ~0 + (1L << b->type->nbits);
-		gopcode(OAND, nodconst(v), Z, n1);
-	} else {
-		sh = 32 - b->type->shift - b->type->nbits;
-		if(sh > 0)
-			gopcode(OASHL, nodconst(sh), Z, n1);
-		sh += b->type->shift;
-		if(sh > 0)
-			if(typeu[b->type->etype])
-				gopcode(OLSHR, nodconst(sh), Z, n1);
-			else
-				gopcode(OASHR, nodconst(sh), Z, n1);
-	}
-}
-
-void
-bitstore(Node *b, Node *n1, Node *n2, Node *n3, Node *nn)
-{
-	long v;
-	Node nod, *l;
-	int sh;
-
-	/*
-	 * n1 has adjusted/masked value
-	 * n2 has address of cell
-	 * n3 has contents of cell
-	 */
-	l = b->left;
-	regalloc(&nod, l, Z);
-	v = ~0 + (1L << b->type->nbits);
-	gopcode(OAND, nodconst(v), Z, n1);
-	gopcode(OAS, n1, Z, &nod);
-	if(nn != Z)
-		gopcode(OAS, n1, Z, nn);
-	sh = b->type->shift;
-	if(sh > 0)
-		gopcode(OASHL, nodconst(sh), Z, &nod);
-	v <<= sh;
-	gopcode(OAND, nodconst(~v), Z, n3);
-	gopcode(OOR, n3, Z, &nod);
-	gopcode(OAS, &nod, Z, n2);
-
-	regfree(&nod);
-	regfree(n1);
-	regfree(n2);
-	regfree(n3);
-}
-
-long
-outstring(char *s, long n)
-{
-	long r;
-
-	if(suppress)
-		return nstring;
-	r = nstring;
-	while(n) {
-		string[mnstring] = *s++;
-		mnstring++;
-		nstring++;
-		if(mnstring >= NSNAME) {
-			gpseudo(ADATA, symstring, nodconst(0L));
-			p->from.offset += nstring - NSNAME;
-			p->reg = NSNAME;
-			p->to.type = D_SCONST;
-			memmove(p->to.sval, string, NSNAME);
-			mnstring = 0;
-		}
-		n--;
-	}
-	return r;
-}
-
-int
-mulcon(Node *n, Node *nn)
-{
-	Node *l, *r, nod1, nod2;
-	Multab *m;
-	long v;
-	int o;
-	char code[sizeof(m->code)+2], *p;
-
-	if(typefd[n->type->etype])
-		return 0;
-	l = n->left;
-	r = n->right;
-	if(l->op == OCONST) {
-		l = r;
-		r = n->left;
-	}
-	if(r->op != OCONST)
-		return 0;
-	v = convvtox(r->vconst, n->type->etype);
-	if(v != r->vconst) {
-		if(debug['M'])
-			print("%L multiply conv: %lld\n", n->lineno, r->vconst);
-		return 0;
-	}
-	m = mulcon0(v);
-	if(!m) {
-		if(debug['M'])
-			print("%L multiply table: %lld\n", n->lineno, r->vconst);
-		return 0;
-	}
-	if(debug['M'] && debug['v'])
-		print("%L multiply: %ld\n", n->lineno, v);
-
-	memmove(code, m->code, sizeof(m->code));
-	code[sizeof(m->code)] = 0;
-
-	p = code;
-	if(p[1] == 'i')
-		p += 2;
-	regalloc(&nod1, n, nn);
-	cgen(l, &nod1);
-	if(v < 0)
-		gopcode(OSUB, &nod1, nodconst(0), &nod1);
-	regalloc(&nod2, n, Z);
-
-loop:
-	switch(*p) {
-	case 0:
-		regfree(&nod2);
-		gopcode(OAS, &nod1, Z, nn);
-		regfree(&nod1);
-		return 1;
-	case '+':
-		o = OADD;
-		goto addsub;
-	case '-':
-		o = OSUB;
-	addsub:	/* number is r,n,l */
-		v = p[1] - '0';
-		r = &nod1;
-		if(v&4)
-			r = &nod2;
-		n = &nod1;
-		if(v&2)
-			n = &nod2;
-		l = &nod1;
-		if(v&1)
-			l = &nod2;
-		gopcode(o, l, n, r);
-		break;
-	default: /* op is shiftcount, number is r,l */
-		v = p[1] - '0';
-		r = &nod1;
-		if(v&2)
-			r = &nod2;
-		l = &nod1;
-		if(v&1)
-			l = &nod2;
-		v = *p - 'a';
-		if(v < 0 || v >= 32) {
-			diag(n, "mulcon unknown op: %c%c", p[0], p[1]);
-			break;
-		}
-		gopcode(OASHL, nodconst(v), l, r);
-		break;
-	}
-	p += 2;
-	goto loop;
-}
-
-void
-sextern(Sym *s, Node *a, long o, long w)
-{
-	long e, lw;
-
-	for(e=0; e<w; e+=NSNAME) {
-		lw = NSNAME;
-		if(w-e < lw)
-			lw = w-e;
-		gpseudo(ADATA, s, nodconst(0));
-		p->from.offset += o+e;
-		p->reg = lw;
-		p->to.type = D_SCONST;
-		memmove(p->to.sval, a->cstring+e, lw);
-	}
-}
-
-void
-gextern(Sym *s, Node *a, long o, long w)
-{
-	gpseudo(ADATA, s, a);
-	p->from.offset += o;
-	p->reg = w;
-	if(p->to.type == D_OREG)
-		p->to.type = D_CONST;
-}
-
-void	zname(Biobuf*, char*, int, int);
-char*	zaddr(char*, Adr*, int);
-void	zwrite(Biobuf*, Prog*, int, int);
-void	outhist(Biobuf*);
-
-void
-zwrite(Biobuf *b, Prog *p, int sf, int st)
-{
-	char bf[100], *bp;
-
-	bf[0] = p->as;
-	bf[1] = p->reg;
-	bf[2] = p->lineno;
-	bf[3] = p->lineno>>8;
-	bf[4] = p->lineno>>16;
-	bf[5] = p->lineno>>24;
-	bp = zaddr(bf+6, &p->from, sf);
-	bp = zaddr(bp, &p->to, st);
-	Bwrite(b, bf, bp-bf);
-}
-
-void
-outcode(void)
-{
-	struct { Sym *sym; short type; } h[NSYM];
-	Prog *p;
-	Sym *s;
-	int sf, st, t, sym;
-
-	if(debug['S']) {
-		for(p = firstp; p != P; p = p->link)
-			if(p->as != ADATA && p->as != AGLOBL)
-				pc--;
-		for(p = firstp; p != P; p = p->link) {
-			print("%P\n", p);
-			if(p->as != ADATA && p->as != AGLOBL)
-				pc++;
-		}
-	}
-	outhist(&outbuf);
-	for(sym=0; sym<NSYM; sym++) {
-		h[sym].sym = S;
-		h[sym].type = 0;
-	}
-	sym = 1;
-	for(p = firstp; p != P; p = p->link) {
-	jackpot:
-		sf = 0;
-		s = p->from.sym;
-		while(s != S) {
-			sf = s->sym;
-			if(sf < 0 || sf >= NSYM)
-				sf = 0;
-			t = p->from.name;
-			if(h[sf].type == t)
-			if(h[sf].sym == s)
-				break;
-			zname(&outbuf, 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 = p->to.sym;
-		while(s != S) {
-			st = s->sym;
-			if(st < 0 || st >= NSYM)
-				st = 0;
-			t = p->to.name;
-			if(h[st].type == t)
-			if(h[st].sym == s)
-				break;
-			zname(&outbuf, 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;
-		}
-		zwrite(&outbuf, p, sf, st);
-	}
-	firstp = P;
-	lastp = P;
-}
-
-void
-outhist(Biobuf *b)
-{
-	Hist *h;
-	char *p, *q, *op;
-	Prog pg;
-	int n;
-
-	pg = zprog;
-	pg.as = AHISTORY;
-	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 = utfrune(p, '/');
-			if(q) {
-				n = q-p;
-				if(n == 0)
-					n = 1;	/* leading "/" */
-				q++;
-			} else {
-				n = strlen(p);
-				q = 0;
-			}
-			if(n) {
-				Bputc(b, ANAME);
-				Bputc(b, D_FILE);
-				Bputc(b, 1);
-				Bputc(b, '<');
-				Bwrite(b, p, n);
-				Bputc(b, 0);
-			}
-			p = q;
-			if(p == 0 && op) {
-				p = op;
-				op = 0;
-			}
-		}
-		pg.lineno = h->line;
-		pg.to.type = zprog.to.type;
-		pg.to.offset = h->offset;
-		if(h->offset)
-			pg.to.type = D_CONST;
-
-		zwrite(b, &pg, 0, 0);
-	}
-}
-
-void
-zname(Biobuf *b, char *n, int t, int s)
-{
-	char bf[3];
-
-	bf[0] = ANAME;
-	bf[1] = t;	/* type */
-	bf[2] = s;	/* sym */
-	Bwrite(b, bf, 3);
-	Bwrite(b, n, strlen(n)+1);
-}
-
-char*
-zaddr(char *bp, Adr *a, int s)
-{
-	long l;
-	vlong v;
-	Ieee e;
-
-	bp[0] = a->type;
-	bp[1] = a->reg;
-	bp[2] = s;
-	bp[3] = a->name;
-	bp += 4;
-	switch(a->type) {
-	default:
-		diag(Z, "unknown type %d in zaddr", a->type);
-
-	case D_NONE:
-	case D_REG:
-	case D_FREG:
-	case D_FCREG:
-		break;
-
-	case D_OREG:
-	case D_CONST:
-	case D_BRANCH:
-		v = a->offset;
-		bp[0] = v;
-		bp[1] = v>>8;
-		bp[2] = v>>16;
-		bp[3] = v>>24;
-		bp[4] = v>>32;
-		bp[5] = v>>40;
-		bp[6] = v>>48;
-		bp[7] = v>>56;
-		bp += 8;
-		break;
-
-	case D_SCONST:
-		memmove(bp, a->sval, NSNAME);
-		bp += NSNAME;
-		break;
-
-	case D_FCONST:
-		ieeedtod(&e, a->dval);
-		l = e.l;
-		bp[0] = l;
-		bp[1] = l>>8;
-		bp[2] = l>>16;
-		bp[3] = l>>24;
-		bp += 4;
-		l = e.h;
-		bp[0] = l;
-		bp[1] = l>>8;
-		bp[2] = l>>16;
-		bp[3] = l>>24;
-		bp += 4;
-		break;
-	}
-	return bp;
-}
-
-long
-align(long i, Type *t, int op)
-{
-	long o;
-	Type *v;
-	int w;
-
-	o = i;
-	w = 1;
-	switch(op) {
-	default:
-		diag(Z, "unknown align opcode %d", op);
-		break;
-
-	case Asu2:	/* padding at end of a struct */
-		w = SZ_VLONG;
-		if(packflg)
-			w = packflg;
-		break;
-
-	case Ael1:	/* initial allign of struct element */
-		for(v=t; v->etype==TARRAY; v=v->link)
-			;
-		w = ewidth[v->etype];
-		if(w <= 0 || w >= SZ_VLONG)
-			w = SZ_VLONG;
-		if(packflg)
-			w = packflg;
-		break;
-
-	case Ael2:	/* width of a struct element */
-		o += t->width;
-		break;
-
-	case Aarg0:	/* initial passbyptr argument in arg list */
-		if(typesu[t->etype]) {
-			o = align(o, types[TIND], Aarg1);
-			o = align(o, types[TIND], Aarg2);
-		}
-		break;
-
-	case Aarg1:	/* initial allign of parameter */
-		w = ewidth[t->etype];
-		if(w <= 0 || w >= SZ_VLONG) {
-			w = SZ_VLONG;
-			break;
-		}
-		w = 1;		/* little endian no adjustment */
-		break;
-
-	case Aarg2:	/* width of a parameter */
-		o += t->width;
-		w = SZ_LONG;
-		break;
-
-	case Aaut3:	/* total allign of automatic */
-		o = align(o, t, Ael1);
-		o = align(o, t, Ael2);
-		break;
-	}
-	o = round(o, w);
-	if(debug['A'])
-		print("align %s %ld %T = %ld\n", bnames[op], i, t, o);
-	return o;
-}
-
-long
-maxround(long max, long v)
-{
-	v += SZ_VLONG-1;
-	if(v > max)
-		max = round(v, SZ_VLONG);
-	return max;
-}
--- a/sys/src/cmd/7c/txt.c
+++ /dev/null
@@ -1,1306 +1,0 @@
-#include "gc.h"
-
-void
-ginit(void)
-{
-	Type *t;
-
-	thechar = '7';
-	thestring = "alpha";
-	exregoffset = REGEXT;
-	exfregoffset = FREGEXT;
-	listinit();
-	nstring = 0;
-	mnstring = 0;
-	nrathole = 0;
-	pc = 0;
-	breakpc = -1;
-	continpc = -1;
-	cases = C;
-	firstp = P;
-	lastp = P;
-	tfield = types[TLONG];
-
-	typeword = typechlvp;
-	typecmplx = typesu;
-
-	zprog.link = P;
-	zprog.as = AGOK;
-	zprog.reg = NREG;
-	zprog.from.type = D_NONE;
-	zprog.from.name = D_NONE;
-	zprog.from.reg = NREG;
-	zprog.to = zprog.from;
-
-	regnode.op = OREGISTER;
-	regnode.class = CEXREG;
-	regnode.reg = REGTMP;
-	regnode.complex = 0;
-	regnode.addable = 11;
-	regnode.type = types[TLONG];
-
-	constnode.op = OCONST;
-	constnode.class = CXXX;
-	constnode.complex = 0;
-	constnode.addable = 20;
-	constnode.type = types[TLONG];
-
-	fconstnode.op = OCONST;
-	fconstnode.class = CXXX;
-	fconstnode.complex = 0;
-	fconstnode.addable = 20;
-	fconstnode.type = types[TDOUBLE];
-
-	nodsafe = new(ONAME, Z, Z);
-	nodsafe->sym = slookup(".safe");
-	nodsafe->type = types[TINT];
-	nodsafe->etype = types[TINT]->etype;
-	nodsafe->class = CAUTO;
-	complex(nodsafe);
-
-	t = typ(TARRAY, types[TCHAR]);
-	symrathole = slookup(".rathole");
-	symrathole->class = CGLOBL;
-	symrathole->type = t;
-
-	nodrat = new(ONAME, Z, Z);
-	nodrat->sym = symrathole;
-	nodrat->type = types[TIND];
-	nodrat->etype = TVOID;
-	nodrat->class = CGLOBL;
-	complex(nodrat);
-	nodrat->type = t;
-
-	nodret = new(ONAME, Z, Z);
-	nodret->sym = slookup(".ret");
-	nodret->type = types[TIND];
-	nodret->etype = TIND;
-	nodret->class = CPARAM;
-	nodret = new(OIND, nodret, Z);
-	complex(nodret);
-
-	memset(reg, 0, sizeof(reg));
-	reg[REGZERO] = 1;
-}
-
-void
-gclean(void)
-{
-	int i;
-	Sym *s;
-
-	for(i=0; i<NREG; i++)
-		if(i != REGZERO)
-			if(reg[i])
-				diag(Z, "reg %d left allocated", i);
-	for(i=NREG; i<NREG+NREG; i+=2)
-		if(reg[i])
-			diag(Z, "freg %d left allocated", i-NREG);
-	while(mnstring)
-		outstring("", 1L);
-	symstring->type->width = nstring;
-	symrathole->type->width = nrathole;
-	for(i=0; i<NHASH; i++)
-	for(s = hash[i]; s != S; s = s->link) {
-		if(s->type == T)
-			continue;
-		if(s->type->width == 0)
-			continue;
-		if(s->class != CGLOBL && s->class != CSTATIC)
-			continue;
-		if(s->type == types[TENUM])
-			continue;
-		gpseudo(AGLOBL, s, nodconst(s->type->width));
-	}
-	nextpc();
-	p->as = AEND;
-	outcode();
-}
-
-void
-nextpc(void)
-{
-
-	p = alloc(sizeof(*p));
-	*p = zprog;
-	p->lineno = nearln;
-	pc++;
-	if(firstp == P) {
-		firstp = p;
-		lastp = p;
-		return;
-	}
-	lastp->link = p;
-	lastp = p;
-}
-
-void
-gargs(Node *n, Node *tn1, Node *tn2)
-{
-	long regs;
-	Node fnxargs[20], *fnxp;
-
-	regs = cursafe;
-
-	fnxp = fnxargs;
-	garg1(n, tn1, tn2, 0, &fnxp);	/* compile fns to temps */
-
-	curarg = 0;
-	fnxp = fnxargs;
-	garg1(n, tn1, tn2, 1, &fnxp);	/* compile normal args and temps */
-
-	cursafe = regs;
-}
-
-void
-garg1(Node *n, Node *tn1, Node *tn2, int f, Node **fnxp)
-{
-	Node nod;
-
-	if(n == Z)
-		return;
-	if(n->op == OLIST) {
-		garg1(n->left, tn1, tn2, f, fnxp);
-		garg1(n->right, tn1, tn2, f, fnxp);
-		return;
-	}
-	if(f == 0) {
-		if(n->complex >= FNX) {
-			regsalloc(*fnxp, n);
-			nod = znode;
-			nod.op = OAS;
-			nod.left = *fnxp;
-			nod.right = n;
-			nod.type = n->type;
-			cgen(&nod, Z);
-			(*fnxp)++;
-		}
-		return;
-	}
-	if(typesu[n->type->etype]) {
-		regaalloc(tn2, n);
-		if(n->complex >= FNX) {
-			sugen(*fnxp, tn2, n->type->width);
-			(*fnxp)++;
-		} else
-			sugen(n, tn2, n->type->width);
-		return;
-	}
-	if(REGARG != NREG && curarg == 0 &&
-	   (typechlp[n->type->etype] || typev[n->type->etype])) {
-		regaalloc1(tn1, n);
-		if(n->complex >= FNX) {
-			cgen(*fnxp, tn1);
-			(*fnxp)++;
-		} else
-			cgen(n, tn1);
-		return;
-	}
-	if(vconst(n) == 0) {
-		regaalloc(tn2, n);
-		gopcode(OAS, n, Z, tn2);
-		return;
-	}
-	regalloc(tn1, n, Z);
-	if(n->complex >= FNX) {
-		cgen(*fnxp, tn1);
-		(*fnxp)++;
-	} else
-		cgen(n, tn1);
-	regaalloc(tn2, n);
-	gopcode(OAS, tn1, Z, tn2);
-	regfree(tn1);
-}
-
-Node*
-nodconst(long v)
-{
-	constnode.vconst = v;
-	return &constnode;
-}
-
-Node*
-nodfconst(double d)
-{
-	fconstnode.fconst = d;
-	return &fconstnode;
-}
-
-void
-nodreg(Node *n, Node *nn, int reg)
-{
-	*n = regnode;
-	n->reg = reg;
-	n->type = nn->type;
-	n->lineno = nn->lineno;
-}
-
-void
-regret(Node *n, Node *nn)
-{
-	int r;
-
-	r = REGRET;
-	if(typefd[nn->type->etype])
-		r = FREGRET+NREG;
-	nodreg(n, nn, r);
-	reg[r]++;
-}
-
-void
-regalloc(Node *n, Node *tn, Node *o)
-{
-	int i, j;
-	static int lasti;
-
-	switch(tn->type->etype) {
-	case TCHAR:
-	case TUCHAR:
-	case TSHORT:
-	case TUSHORT:
-	case TINT:
-	case TUINT:
-	case TLONG:
-	case TULONG:
-	case TIND:
-	case TVLONG:
-	case TUVLONG:
-		if(o != Z && o->op == OREGISTER) {
-			i = o->reg;
-			if(i >= 0 && i < NREG - 1)
-				goto out;
-		}
-		j = lasti + REGRET+1;
-		for(i=REGRET+1; i<NREG; i++) {
-			if(j >= NREG)
-				j = REGRET+1;
-			if(reg[j] == 0) {
-				i = j;
-				goto out;
-			}
-			j++;
-		}
-		diag(tn, "out of fixed registers");
-		goto err;
-
-	case TFLOAT:
-	case TDOUBLE:
-		if(o != Z && o->op == OREGISTER) {
-			i = o->reg;
-			if(i >= NREG && i < NREG+NREG)
-				goto out;
-		}
-		j = NREG + 12 + lasti;
-		for(i=NREG; i<NREG+NREG; i++) {
-			if(j >= NREG+NREG)
-				j = NREG;
-			if(reg[j] == 0) {
-				i = j;
-				goto out;
-			}
-			j++;
-		}
-		diag(tn, "out of float registers");
-		goto err;
-	}
-	diag(tn, "unknown type in regalloc: %T", tn->type);
-err:
-	i = -1;
-out:
-	if(i >= 0)
-		reg[i]++;
-	lasti++;
-	if(lasti >= 5)
-		lasti = 0;
-	nodreg(n, tn, i);
-}
-
-void
-regialloc(Node *n, Node *tn, Node *o)
-{
-	Node nod;
-
-	nod = *tn;
-	nod.type = types[TIND];
-	regalloc(n, &nod, o);
-}
-
-void
-regfree(Node *n)
-{
-	int i;
-
-	i = 0;
-	if(n->op != OREGISTER && n->op != OINDREG)
-		goto err;
-	i = n->reg;
-	if(i < 0 || i >= sizeof(reg))
-		goto err;
-	if(reg[i] <= 0)
-		goto err;
-	reg[i]--;
-	return;
-err:
-	diag(n, "error in regfree: %d op %O", i, n->op);
-}
-
-void
-regsalloc(Node *n, Node *nn)
-{
-	cursafe = align(cursafe, nn->type, Aaut3);
-	maxargsafe = maxround(maxargsafe, cursafe+curarg);
-	*n = *nodsafe;
-	n->xoffset = -(stkoff + cursafe);
-	n->type = nn->type;
-	n->etype = nn->type->etype;
-	n->lineno = nn->lineno;
-}
-
-void
-regaalloc1(Node *n, Node *nn)
-{
-	nodreg(n, nn, REGARG);
-	reg[REGARG]++;
-	curarg = align(curarg, nn->type, Aarg1);
-	curarg = align(curarg, nn->type, Aarg2);
-	maxargsafe = maxround(maxargsafe, cursafe+curarg);
-}
-
-void
-regaalloc(Node *n, Node *nn)
-{
-	curarg = align(curarg, nn->type, Aarg1);
-	*n = *nn;
-	n->op = OINDREG;
-	n->reg = REGSP;
-	n->xoffset = curarg + SZ_VLONG;
-	n->complex = 0;
-	n->addable = 20;
-	curarg = align(curarg, nn->type, Aarg2);
-	maxargsafe = maxround(maxargsafe, cursafe+curarg);
-}
-
-void
-regind(Node *n, Node *nn)
-{
-
-	if(n->op != OREGISTER) {
-		diag(n, "regind not OREGISTER");
-		return;
-	}
-	n->op = OINDREG;
-	n->type = nn->type;
-}
-
-void
-raddr(Node *n, Prog *p)
-{
-	Adr a;
-
-	naddr(n, &a);
-	if(a.type == D_CONST && a.offset == 0) {
-		a.type = D_REG;
-		a.reg = 0;
-	}
-	if(a.type != D_REG && a.type != D_FREG) {
-		if(n)
-			diag(n, "bad in raddr: %O", n->op);
-		else
-			diag(n, "bad in raddr: <null>");
-		p->reg = NREG;
-	} else
-		p->reg = a.reg;
-}
-
-void
-naddr(Node *n, Adr *a)
-{
-	vlong v;
-
-	a->type = D_NONE;
-	if(n == Z)
-		return;
-	switch(n->op) {
-	default:
-	bad:
-		diag(n, "bad in naddr: %O", n->op);
-		break;
-
-	case OREGISTER:
-		a->type = D_REG;
-		a->sym = S;
-		a->reg = n->reg;
-		if(a->reg >= NREG) {
-			a->type = D_FREG;
-			a->reg -= NREG;
-		}
-		break;
-
-	case OIND:
-		naddr(n->left, a);
-		if(a->type == D_REG) {
-			a->type = D_OREG;
-			break;
-		}
-		if(a->type == D_CONST) {
-			a->type = D_OREG;
-			break;
-		}
-		goto bad;
-
-	case OINDREG:
-		a->type = D_OREG;
-		a->sym = S;
-		a->offset = n->xoffset;
-		a->reg = n->reg;
-		break;
-
-	case ONAME:
-		a->etype = n->etype;
-		a->type = D_OREG;
-		a->name = D_STATIC;
-		a->sym = n->sym;
-		a->offset = n->xoffset;
-		if(n->class == CSTATIC)
-			break;
-		if(n->class == CEXTERN || n->class == CGLOBL) {
-			a->name = D_EXTERN;
-			break;
-		}
-		if(n->class == CAUTO) {
-			a->name = D_AUTO;
-			break;
-		}
-		if(n->class == CPARAM) {
-			a->name = D_PARAM;
-			break;
-		}
-		goto bad;
-
-	case OCONST:
-		a->sym = S;
-		a->reg = NREG;
-		if(typefd[n->type->etype]) {
-			a->type = D_FCONST;
-			a->dval = n->fconst;
-		} else if(typev[n->type->etype]) {
-			a->type = D_CONST;
-			a->offset = n->vconst;
-		} else {
-			a->type = D_CONST;
-			a->offset = convvtox(n->vconst, TLONG);	/* alpha arithmetic */
-		}
-		break;
-
-	case OADDR:
-		naddr(n->left, a);
-		if(a->type == D_OREG) {
-			a->type = D_CONST;
-			break;
-		}
-		goto bad;
-
-	case OADD:
-		if(n->left->op == OCONST) {
-			naddr(n->left, a);
-			v = a->offset;
-			naddr(n->right, a);
-		} else {
-			naddr(n->right, a);
-			v = a->offset;
-			naddr(n->left, a);
-		}
-		a->offset += v;
-		break;
-
-	}
-}
-
-void
-fop(int as, int f1, int f2, Node *t)
-{
-	Node nod1, nod2, nod3;
-
-	nodreg(&nod1, t, NREG+f1);
-	nodreg(&nod2, t, NREG+f2);
-	regalloc(&nod3, t, t);
-	gopcode(as, &nod1, &nod2, &nod3);
-	gmove(&nod3, t);
-	regfree(&nod3);
-}
-
-void
-gmove(Node *f, Node *t)
-{
-	int ft, tt, a;
-	Node nod;
-	double d;
-
-	ft = f->type->etype;
-	tt = t->type->etype;
-
-	if(ft == TDOUBLE && f->op == OCONST) {
-		d = f->fconst;
-		if(d == 0.0) {
-			a = FREGZERO;
-			goto ffreg;
-		}
-		if(d == 0.5) {
-			a = FREGHALF;
-			goto ffreg;
-		}
-		if(d == 1.0) {
-			a = FREGONE;
-			goto ffreg;
-		}
-		if(d == 2.0) {
-			a = FREGTWO;
-			goto ffreg;
-		}
-		if(d == -.5) {
-			fop(OSUB, FREGHALF, FREGZERO, t);
-			return;
-		}
-		if(d == -1.0) {
-			fop(OSUB, FREGONE, FREGZERO, t);
-			return;
-		}
-		if(d == -2.0) {
-			fop(OSUB, FREGTWO, FREGZERO, t);
-			return;
-		}
-		if(d == 1.5) {
-			fop(OADD, FREGONE, FREGHALF, t);
-			return;
-		}
-		if(d == 2.5) {
-			fop(OADD, FREGTWO, FREGHALF, t);
-			return;
-		}
-		if(d == 3.0) {
-			fop(OADD, FREGTWO, FREGONE, t);
-			return;
-		}
-	}
-	if(ft == TFLOAT && f->op == OCONST) {
-		d = f->fconst;
-		if(d == 0) {
-			a = FREGZERO;
-		ffreg:
-			nodreg(&nod, f, NREG+a);
-			gmove(&nod, t);
-			return;
-		}
-	}
-	/*
-	 * a load --
-	 * put it into a register then
-	 * worry what to do with it.
-	 */
-	if(f->op == ONAME || f->op == OINDREG || f->op == OIND) {
-		switch(ft) {
-		default:
-			a = AMOVL;
-			break;
-		case TVLONG:
-		case TUVLONG:
-			/* todo: optimise freg case? */
-			a = AMOVQ;
-#ifdef is_this_right
-			if(typefd[tt]) {
-				/* special case can load mem to Freg */
-				regalloc(&nod, t, t);
-				gins(AMOVL, f, &nod);
-				a = ACVTQT;
-				if(tt == TFLOAT)
-					a = ACVTQS;
-				gins(a, &nod, &nod);
-				gmove(&nod, t);
-				regfree(&nod);
-				return;
-			}
-#endif is_this_right
-			break;
-		case TFLOAT:
-			a = AMOVS;
-			break;
-		case TDOUBLE:
-			a = AMOVT;
-			break;
-		case TCHAR:
-			a = AMOVB;
-			break;
-		case TUCHAR:
-			a = AMOVBU;
-			break;
-		case TSHORT:
-			a = AMOVW;
-			break;
-		case TUSHORT:
-			a = AMOVWU;
-			break;
-		}
-		if(typechlp[ft] && typeilp[tt])
-			regalloc(&nod, t, t);
-		else
-			regalloc(&nod, f, t);
-		gins(a, f, &nod);
-		gmove(&nod, t);
-		regfree(&nod);
-		return;
-	}
-
-	/*
-	 * a store --
-	 * put it into a register then
-	 * store it.
-	 */
-	if(t->op == ONAME || t->op == OINDREG || t->op == OIND) {
-		switch(tt) {
-		default:
-			a = AMOVL;
-			break;
-		case TUCHAR:
-		case TCHAR:
-			a = AMOVB;
-			break;
-		case TUSHORT:
-		case TSHORT:
-			a = AMOVW;
-			break;
-		case TFLOAT:
-			a = AMOVS;
-			break;
-		case TDOUBLE:
-			a = AMOVT;
-			break;
-		case TVLONG:
-		case TUVLONG:
-			a = AMOVQ;
-			break;
-		}
-		if(!typefd[ft] && vconst(f) == 0) {
-			gins(a, f, t);
-			return;
-		}
-		if(ft == tt)
-			regalloc(&nod, t, f);
-		else
-			regalloc(&nod, t, Z);
-		gmove(f, &nod);
-		gins(a, &nod, t);
-		regfree(&nod);
-		return;
-	}
-
-	/*
-	 * type x type cross table
-	 */
-	a = AGOK;
-	switch(ft) {
-	case TDOUBLE:
-	case TFLOAT:
-		switch(tt) {
-		case TDOUBLE:
-			a = AMOVT;
-			break;
-		case TFLOAT:
-			a = ACVTTS;
-			if(ft == TFLOAT)
-				a = AMOVT;
-			break;
-		case TINT:
-		case TUINT:
-		case TLONG:
-		case TULONG:
-		case TUVLONG:
-		case TVLONG:
-		case TIND:
-		case TSHORT:
-		case TUSHORT:
-		case TCHAR:
-		case TUCHAR:
-			/*warn(Z, "float to fix");	/**/
-			regalloc(&nod, f, Z);	/* should be type float */
-			gins(ACVTTQ, f, &nod);
-			gins(AMOVT, &nod, nodrat);
-			regfree(&nod);
-			gins(AMOVQ, nodrat, t);
-			gmove(t, t);
-			if(nrathole < SZ_VLONG)
-				nrathole = SZ_VLONG;
-			return;
-		}
-		break;
-	case TVLONG:
-	case TUVLONG:
-		switch(tt) {
-		case TDOUBLE:
-		case TFLOAT:
-			goto fxtofl;
-		case TINT:
-		case TUINT:
-		case TLONG:
-		case TULONG:
-		case TIND:
-		case TSHORT:
-		case TUSHORT:
-		case TCHAR:
-		case TUCHAR:
-			a = AMOVL;
-			break;
-		case TVLONG:
-		case TUVLONG:
-			a = AMOVQ;
-			break;
-		}
-		break;
-	case TINT:
-	case TUINT:
-	case TULONG:
-	case TLONG:
-	case TIND:
-		switch(tt) {
-		case TDOUBLE:
-		case TFLOAT:
-			goto fxtofl;
-		case TVLONG:
-		case TUVLONG:
-			if (ft == TULONG || ft == TUINT) {
-				a = AMOVLU;
-				break;
-			}
-		case TINT:
-		case TUINT:
-		case TLONG:
-		case TULONG:
-		case TIND:
-		case TSHORT:
-		case TUSHORT:
-		case TCHAR:
-		case TUCHAR:
-			a = AMOVQ;
-			break;
-		}
-		break;
-	case TSHORT:
-		switch(tt) {
-		case TDOUBLE:
-		case TFLOAT:
-			goto fxtofl;
-		case TINT:
-		case TUINT:
-		case TULONG:
-		case TLONG:
-		case TVLONG:
-		case TUVLONG:
-		case TIND:
-			a = AMOVW;
-			break;
-		case TSHORT:
-		case TUSHORT:
-		case TCHAR:
-		case TUCHAR:
-			a = AMOVQ;
-			break;
-		}
-		break;
-	case TUSHORT:
-		switch(tt) {
-		case TDOUBLE:
-		case TFLOAT:
-			goto fxtofl;
-		case TINT:
-		case TUINT:
-		case TLONG:
-		case TULONG:
-		case TVLONG:
-		case TUVLONG:
-		case TIND:
-			a = AMOVWU;
-			break;
-		case TSHORT:
-		case TUSHORT:
-		case TCHAR:
-		case TUCHAR:
-			a = AMOVQ;
-			break;
-		}
-		break;
-	case TCHAR:
-		switch(tt) {
-		case TDOUBLE:
-		case TFLOAT:
-			goto fxtofl;
-		case TINT:
-		case TUINT:
-		case TLONG:
-		case TULONG:
-		case TVLONG:
-		case TUVLONG:
-		case TIND:
-		case TSHORT:
-		case TUSHORT:
-			a = AMOVB;
-			break;
-		case TCHAR:
-		case TUCHAR:
-			a = AMOVQ;
-			break;
-		}
-		break;
-	case TUCHAR:
-		switch(tt) {
-		case TDOUBLE:
-		case TFLOAT:
-		fxtofl:
-			/*warn(Z, "fix to float");	/**/
-			regalloc(&nod, t, Z);	/* should be type float */
-			gins(AMOVQ, f, nodrat);
-			gins(AMOVT, nodrat, &nod);
-			a = ACVTQT;
-			if(tt == TFLOAT)
-				a = ACVTQS;
-			gins(a, &nod, t);
-			regfree(&nod);
-			if(nrathole < SZ_VLONG)
-				nrathole = SZ_VLONG;
-			return;
-		case TINT:
-		case TUINT:
-		case TLONG:
-		case TULONG:
-		case TVLONG:
-		case TUVLONG:
-		case TIND:
-		case TSHORT:
-		case TUSHORT:
-			a = AMOVBU;
-			break;
-		case TCHAR:
-		case TUCHAR:
-			a = AMOVQ;
-			break;
-		}
-		break;
-	}
-	if(a == AMOVQ || a == AMOVS || a == AMOVT)
-	if(samaddr(f, t))
-		return;
-	gins(a, f, t);
-}
-
-void
-gins(int a, Node *f, Node *t)
-{
-
-	nextpc();
-	p->as = a;
-	if(f != Z)
-		naddr(f, &p->from);
-	if(t != Z)
-		naddr(t, &p->to);
-	if(debug['g'])
-		print("%P\n", p);
-}
-
-void
-gopcode(int o, Node *f1, Node *f2, Node *t)
-{
-	int a, et;
-	Adr ta;
-	Node nod;
-
-	et = TLONG;
-	if(f1 != Z && f1->type != T) {
-		if(f1->op == OCONST && t != Z && t->type != T)
-			et = t->type->etype;
-		else
-			et = f1->type->etype;
-	}
-	a = AGOK;
-	switch(o) {
-	case OAS:
-		gmove(f1, t);
-		return;
-
-	case OASADD:
-	case OADD:
-		a = AADDL;
-		if(et == TFLOAT)
-			a = AADDS;
-		else
-		if(et == TDOUBLE)
-			a = AADDT;
-		else
-		if(et == TVLONG || et == TUVLONG)
-			a = AADDQ;
-		break;
-
-	case OASSUB:
-	case OSUB:
-		a = ASUBL;
-		if(et == TFLOAT)
-			a = ASUBS;
-		else
-		if(et == TDOUBLE)
-			a = ASUBT;
-		else
-		if(et == TVLONG || et == TUVLONG)
-			a = ASUBQ;
-		break;
-
-	case OASOR:
-	case OOR:
-		a = AOR;
-		break;
-
-	case OASAND:
-	case OAND:
-		a = AAND;
-		break;
-
-	case OASXOR:
-	case OXOR:
-		a = AXOR;
-		break;
-
-	case OASLSHR:
-	case OLSHR:
-		a = ASRLL;
-		if(et == TVLONG || et == TUVLONG)
-			a = ASRLQ;
-		break;
-
-	case OASASHR:
-	case OASHR:
-		a = ASRAL;
-		if(et == TVLONG || et == TUVLONG)
-			a = ASRAQ;
-		break;
-
-	case OASASHL:
-	case OASHL:
-		a = ASLLL;
-		if(et == TVLONG || et == TUVLONG)
-			a = ASLLQ;
-		break;
-
-	case OFUNC:
-		a = AJSR;
-		break;
-
-	case OASLMUL:
-	case OLMUL:
-	case OASMUL:
-	case OMUL:
-		a = AMULL;
-		if(et == TFLOAT)
-			a = AMULS;
-		else
-		if(et == TDOUBLE)
-			a = AMULT;
-		else
-		if(et == TVLONG || et == TUVLONG)
-			a = AMULQ;
-		break;
-
-	case OASDIV:
-	case ODIV:
-		a = ADIVL;
-		if(et == TFLOAT)
-			a = ADIVS;
-		else
-		if(et == TDOUBLE)
-			a = ADIVT;
-		else
-		if(et == TVLONG || et == TUVLONG)
-			a = ADIVQ;
-		break;
-
-	case OASMOD:
-	case OMOD:
-		a = AMODL;
-		if(et == TVLONG || et == TUVLONG)
-			a = AMODQ;
-		break;
-
-	case OASLMOD:
-	case OLMOD:
-		a = AMODLU;
-		if(et == TVLONG || et == TUVLONG)
-			a = AMODQU;
-		break;
-
-	case OASLDIV:
-	case OLDIV:
-		a = ADIVLU;
-		if(et == TVLONG || et == TUVLONG)
-			a = ADIVQU;
-		break;
-
-	case OEQ:
-	case ONE:
-		a = ACMPEQ;
-		if(typefd[et])
-			a = ACMPTEQ;
-		else if (vconst(t) == 0) {
-			a = (o == OEQ) ? ABEQ : ABNE;
-			t = Z;
-			break;
-		}
-		goto cmp;
-
-	case OLT:
-	case OGE:
-		a = ACMPGT;
-		if(typefd[et])
-			a = ACMPTGT;
-		else if (vconst(t) == 0) {
-			a = (o == OLT) ? ABLT : ABGE;
-			t = Z;
-			break;
-		}
-		goto cmp;
-
-	case OLE:
-	case OGT:
-		a = ACMPGE;
-		if(typefd[et])
-			a = ACMPTGE;
-		else
-		if(vconst(t) == 0) {
-			a = (o == OLE)? ABLE: ABGT;
-			t = Z;
-			break;
-		}
-		goto cmp;
-
-	case OLO:
-	case OHS:
-		a = ACMPUGT;
-		goto cmp;
-
-	case OLS:
-	case OHI:
-		a = ACMPUGE;
-		goto cmp;
-
-	cmp:
-		nextpc();
-		p->as = a;
-		raddr(f1, p);
-		naddr(t, &p->from);
-		regalloc(&nod, t, Z);
-		naddr(&nod, &p->to);
-		if(debug['g'])
-			print("%P\n", p);
-		if(o == OEQ || o == OLT || o == OLE || o == OLO || o == OLS)
-			a = typefd[et]? AFBNE: ABNE;
-		else
-			a = typefd[et]? AFBEQ: ABEQ;
-		nextpc();
-		p->as = a;
-		naddr(&nod, &p->from);
-		regfree(&nod);
-		if(debug['g'])
-			print("%P\n", p);
-		return;
-	}
-	if(a == AGOK)
-		diag(Z, "bad in gopcode %O", o);
-	nextpc();
-	p->as = a;
-	if(f1 != Z)
-		naddr(f1, &p->from);
-	if(f2 != Z) {
-		naddr(f2, &ta);
-		p->reg = ta.reg;
-		if(ta.type == D_CONST && ta.offset == 0)
-			p->reg = REGZERO;
-	}
-	if(t != Z)
-		naddr(t, &p->to);
-	if(debug['g'])
-		print("%P\n", p);
-}
-
-samaddr(Node *f, Node *t)
-{
-
-	if(f->op != t->op)
-		return 0;
-	switch(f->op) {
-
-	case OREGISTER:
-		if(f->reg != t->reg)
-			break;
-		return 1;
-	}
-	return 0;
-}
-
-void
-gbranch(int o)
-{
-	int a;
-
-	a = AGOK;
-	switch(o) {
-	case ORETURN:
-		a = ARET;
-		break;
-	case OGOTO:
-		a = AJMP;
-		break;
-	}
-	nextpc();
-	if(a == AGOK) {
-		diag(Z, "bad in gbranch %O",  o);
-		nextpc();
-	}
-	p->as = a;
-}
-
-void
-patch(Prog *op, long pc)
-{
-
-	op->to.offset = pc;
-	op->to.type = D_BRANCH;
-}
-
-void
-gpseudo(int a, Sym *s, Node *n)
-{
-
-	nextpc();
-	p->as = a;
-	p->from.type = D_OREG;
-	p->from.sym = s;
-	if(a == ATEXT)
-		p->reg = (profileflg ? 0 : NOPROF);
-	p->from.name = D_EXTERN;
-	if(s->class == CSTATIC)
-		p->from.name = D_STATIC;
-	naddr(n, &p->to);
-	if(a == ADATA || a == AGLOBL)
-		pc--;
-}
-
-int
-sconst(Node *n)
-{
-	vlong vv;
-
-	if(n->op == OCONST) {
-		if(!typefd[n->type->etype]) {
-			vv = n->vconst;
-			if(vv >= -32766LL && vv < 32766LL)
-				return 1;
-		}
-	}
-	return 0;
-}
-
-int
-sval(long v)
-{
-	if(v >= -32766L && v < 32766L)
-		return 1;
-	return 0;
-}
-
-int
-bval(vlong v)
-{
-
-	if(v >= 0LL && v < 256LL)
-		return 1;
-	return 0;
-}
-
-int
-bconst(Node *n)
-{
-	vlong vv;
-
-	if(n->op == OCONST) {
-		if(!typefd[n->type->etype]) {
-			vv = n->vconst;
-			if(vv >= 0LL && vv < 256LL)
-				return 1;
-		}
-	}
-	return 0;
-}
-
-long
-exreg(Type *t)
-{
-	long o;
-
-	if(typechlp[t->etype]) {
-		if(exregoffset <= 12)
-			return 0;
-		o = exregoffset;
-		exregoffset--;
-		return o;
-	}
-	if(typefd[t->etype]) {
-		if(exfregoffset <= 19)
-			return 0;
-		o = exfregoffset + NREG;
-		exfregoffset--;
-		return o;
-	}
-	return 0;
-}
-
-schar	ewidth[NTYPE] =
-{
-	-1,		/* [TXXX] */
-	SZ_CHAR,	/* [TCHAR] */
-	SZ_CHAR,	/* [TUCHAR] */
-	SZ_SHORT,	/* [TSHORT] */
-	SZ_SHORT,	/* [TUSHORT] */
-	SZ_INT,		/* [TINT] */
-	SZ_INT,		/* [TUINT] */
-	SZ_LONG,	/* [TLONG] */
-	SZ_LONG,	/* [TULONG] */
-	SZ_VLONG,	/* [TVLONG] */
-	SZ_VLONG,	/* [TUVLONG] */
-	SZ_FLOAT,	/* [TFLOAT] */
-	SZ_DOUBLE,	/* [TDOUBLE] */
-	SZ_IND,		/* [TIND] */
-	0,		/* [TFUNC] */
-	-1,		/* [TARRAY] */
-	0,		/* [TVOID] */
-	-1,		/* [TSTRUCT] */
-	-1,		/* [TUNION] */
-	SZ_INT,		/* [TENUM] */
-};
-
-long	ncast[NTYPE] =
-{
-	0,				/* [TXXX] */
-	BCHAR|BUCHAR,			/* [TCHAR] */
-	BCHAR|BUCHAR,			/* [TUCHAR] */
-	BSHORT|BUSHORT,			/* [TSHORT] */
-	BSHORT|BUSHORT,			/* [TUSHORT] */
-	BINT|BUINT|BLONG|BULONG|BIND,	/* [TINT] */
-	BINT|BUINT|BLONG|BULONG|BIND,	/* [TUINT] */
-	BINT|BUINT|BLONG|BULONG|BIND,	/* [TLONG] */
-	BINT|BUINT|BLONG|BULONG|BIND,	/* [TULONG] */
-	BVLONG|BUVLONG,			/* [TVLONG] */
-	BVLONG|BUVLONG,			/* [TUVLONG] */
-	BFLOAT,				/* [TFLOAT] */
-	BDOUBLE,			/* [TDOUBLE] */
-	BLONG|BULONG|BIND,		/* [TIND] */
-	0,				/* [TFUNC] */
-	0,				/* [TARRAY] */
-	0,				/* [TVOID] */
-	BSTRUCT,			/* [TSTRUCT] */
-	BUNION,				/* [TUNION] */
-	0,				/* [TENUM] */
-};
--- a/sys/src/cmd/7l/asm.c
+++ /dev/null
@@ -1,1220 +1,0 @@
-#include	"l.h"
-
-#define	LPUT(c)\
-	{\
-		cbp[0] = (c);\
-		cbp[1] = (c)>>8;\
-		cbp[2] = (c)>>16;\
-		cbp[3] = (c)>>24;\
-		cbp += 4;\
-		cbc -= 4;\
-		if(cbc <= 0)\
-			cflush();\
-	}
-
-#define	CPUT(c)\
-	{\
-		cbp[0] = (c);\
-		cbp++;\
-		cbc--;\
-		if(cbc <= 0)\
-			cflush();\
-	}
-
-#define	VLPUT(c)\
-	{\
-		cbp[0] = (c);\
-		cbp[1] = (c)>>8;\
-		cbp[2] = (c)>>16;\
-		cbp[3] = (c)>>24;\
-		cbp[4] = (c)>>32;\
-		cbp[5] = (c)>>40;\
-		cbp[6] = (c)>>48;\
-		cbp[7] = (c)>>56;\
-		cbp += 8;\
-		cbc -= 8;\
-		if(cbc <= 0)\
-			cflush();\
-	}
-#define	LPUTBE(c)\
-	{\
-		cbp[0] = (c)>>24;\
-		cbp[1] = (c)>>16;\
-		cbp[2] = (c)>>8;\
-		cbp[3] = (c);\
-		cbp += 4;\
-		cbc -= 4;\
-		if(cbc <= 0)\
-			cflush();\
-	}
-
-long
-entryvalue(void)
-{
-	char *a;
-	Sym *s;
-
-	a = INITENTRY;
-	if(*a >= '0' && *a <= '9')
-		return atolwhex(a);
-	s = lookup(a, 0);
-	if(s->type == 0)
-		return INITTEXT;
-	if(s->type != STEXT && s->type != SLEAF)
-		diag("entry not text: %s", s->name);
-	return s->value;
-}
-
-void
-asmb(void)
-{
-	Prog *p;
-	vlong t;
-	Optab *o;
-
-	if(debug['v'])
-		Bprint(&bso, "%5.2f asm\n", cputime());
-	Bflush(&bso);
-	seek(cout, HEADR, 0);
-	pc = INITTEXT;
-	for(p = firstp; p != P; p = p->link) {
-		if(p->as == ATEXT) {
-			curtext = p;
-			autosize = p->to.offset + 8;
-		}
-		if(p->pc != pc) {
-			diag("phase error %lux sb %lux",
-				p->pc, pc);
-			if(!debug['a'])
-				prasm(curp);
-			pc = p->pc;
-		}
-		if (p->as == AMOVQ || p->as == AMOVT) {
-			if ((p->from.reg == REGSP) && (p->from.offset&7) != 0
-			|| (p->to.reg == REGSP) && (p->to.offset&7) != 0)
-				diag("bad stack alignment: %P", p);
-			if ((p->from.reg == REGSB) && (p->from.offset&7) != 0
-			|| (p->to.reg == REGSB) && (p->to.offset&7) != 0)
-				diag("bad global alignment: %P", p);
-		}
-		curp = p;
-		o = oplook(p);	/* could probably avoid this call */
-		if(asmout(p, o)) {
-			p = p->link;
-			pc += 4;
-		}
-		pc += o->size;
-	}
-	if(debug['a'])
-		Bprint(&bso, "\n");
-	Bflush(&bso);
-	cflush();
-
-	curtext = P;
-	switch(HEADTYPE) {
-	case 0:
-		seek(cout, rnd(HEADR+textsize, 8192), 0);
-		break;
-	case 1:
-	case 2:
-	case 3:
-		seek(cout, HEADR+textsize, 0);
-		break;
-	}
-	for(t = 0; t < datsize; t += sizeof(buf)-100) {
-		if(datsize-t > sizeof(buf)-100)
-			datblk(t, sizeof(buf)-100);
-		else
-			datblk(t, datsize-t);
-	}
-
-	symsize = 0;
-	lcsize = 0;
-	if(!debug['s']) {
-		if(debug['v'])
-			Bprint(&bso, "%5.2f sym\n", cputime());
-		Bflush(&bso);
-		switch(HEADTYPE) {
-		case 0:
-			seek(cout, rnd(HEADR+textsize, 8192)+datsize, 0);
-			break;
-		case 2:
-		case 1:
-		case 3:
-			seek(cout, HEADR+textsize+datsize, 0);
-			break;
-		}
-		if(!debug['s'])
-			asmsym();
-		if(debug['v'])
-			Bprint(&bso, "%5.2f pc\n", cputime());
-		Bflush(&bso);
-		if(!debug['s'])
-			asmlc();
-		cflush();
-	}
-
-	if(debug['v'])
-		Bprint(&bso, "%5.2f header\n", cputime());
-	Bflush(&bso);
-	seek(cout, 0L, 0);
-	switch(HEADTYPE) {
-	case 0:
-		lput(0x0183L);		/* magic and sections */
-		lput(0L);			/* time and date */
-		vlput(rnd(HEADR+textsize, 8192)+datsize);
-		lput(symsize);			/* nsyms */
-		lput(0x50L|(7L<<16));		/* size of optional hdr and flags */
-		lput(0413|(0x101L<<16));	/* magic and version */
-		lput(-1);			/* pad for alignment */
-
-		vlput(rnd(HEADR+textsize, 8192));		/* sizes */
-		vlput(datsize);
-		vlput(bsssize);
-		vlput(entryvalue());		/* va of entry */
-		vlput(INITTEXT-HEADR);		/* va of base of text */
-		vlput(INITDAT);			/* va of base of data */
-		vlput(INITDAT+datsize);		/* va of base of bss */
-		lput(~0L);			/* gp reg mask */
-		/* dubious stuff starts here */
-		lput(0L);
-		lput(0L);
-		lput(0L);
-		lput(0L);
-		lput(~0L);			/* gp value ?? */
-		break;
-	case 1:
-		lput(0x0183L);		/* magic and sections */
-		lput(0L);			/* time and date */
-		vlput(HEADR+textsize+datsize);
-		lput(symsize);			/* nsyms */
-		lput(0x54L|(7L<<16));		/* size of optional hdr and flags */
-		lput(0407|(0x101L<<16));	/* magic and version */
-		lput(-1);			/* pad for alignment */
-
-		vlput(textsize);		/* sizes */
-		vlput(datsize);
-		vlput(bsssize);
-		vlput(entryvalue());		/* va of entry */
-		vlput(INITTEXT);		/* va of base of text */
-		vlput(INITDAT);			/* va of base of data */
-		vlput(INITDAT+datsize);		/* va of base of bss */
-		lput(~0L);			/* gp reg mask */
-		/* dubious stuff starts here */
-		lput(lcsize);
-		lput(0L);
-		lput(0L);
-		lput(0L);
-		lput(~0L);			/* gp value ?? */
-		lput(0L);			/* complete mystery */
-		break;
-	case 2:
-		lputbe(0x84b);			/* magic */
-		lputbe(textsize);		/* sizes */
-		lputbe(datsize);
-		lputbe(bsssize);
-		lputbe(symsize);		/* nsyms */
-		lputbe(entryvalue());		/* va of entry */
-		lputbe(0L);
-		lputbe(lcsize);
-		break;
-	case 3:
-		/* ``headerless'' boot image -- magic no is a branch */
-		lput(0xc3e00007);		/* magic (branch) */
-		lputbe(textsize);		/* sizes */
-		lputbe(datsize);
-		lputbe(bsssize);
-		lputbe(symsize);		/* nsyms */
-		lputbe(entryvalue());		/* va of entry */
-		lputbe(0L);
-		lputbe(lcsize);
-		break;
-	}
-	cflush();
-}
-
-void
-lput(long l)
-{
-	LPUT(l);
-}
-
-void
-lputbe(long l)
-{
-	LPUTBE(l);
-}
-
-void
-vlput(vlong l)
-{
-	VLPUT(l);
-}
-
-void
-cflush(void)
-{
-	int n;
-
-	n = sizeof(buf.cbuf) - cbc;
-	if(n)
-		write(cout, buf.cbuf, n);
-	cbp = buf.cbuf;
-	cbc = sizeof(buf.cbuf);
-}
-
-void
-asmsym(void)
-{
-	Prog *p;
-	Auto *a;
-	Sym *s;
-	int h;
-
-	s = lookup("etext", 0);
-	if(s->type == STEXT)
-		putsymb(s->name, 'T', s->value, s->version);
-
-	for(h=0; h<NHASH; h++)
-		for(s=hash[h]; s!=S; s=s->link)
-			switch(s->type) {
-			case SCONST:
-				putsymb(s->name, 'D', s->value, s->version);
-				continue;
-
-			case SDATA:
-				putsymb(s->name, 'D', s->value+INITDAT, s->version);
-				continue;
-
-			case SBSS:
-				putsymb(s->name, 'B', s->value+INITDAT, s->version);
-				continue;
-
-			case SFILE:
-				putsymb(s->name, 'f', s->value, s->version);
-				continue;
-			}
-
-	for(p=textp; p!=P; p=p->cond) {
-		s = p->from.sym;
-		if(s->type != STEXT && s->type != SLEAF)
-			continue;
-
-		/* filenames first */
-		for(a=p->to.autom; a; a=a->link)
-			if(a->type == D_FILE)
-				putsymb(a->sym->name, 'z', a->offset, 0);
-			else
-			if(a->type == D_FILE1)
-				putsymb(a->sym->name, 'Z', a->offset, 0);
-
-		if(s->type == STEXT)
-			putsymb(s->name, 'T', s->value, s->version);
-		else
-			putsymb(s->name, 'L', s->value, s->version);
-
-		/* frame, auto and param after */
-		putsymb(".frame", 'm', p->to.offset+8, 0);
-		for(a=p->to.autom; a; a=a->link)
-			if(a->type == D_AUTO)
-				putsymb(a->sym->name, 'a', -a->offset, 0);
-			else
-			if(a->type == D_PARAM)
-				putsymb(a->sym->name, 'p', a->offset, 0);
-	}
-	if(debug['v'] || debug['n'])
-		Bprint(&bso, "symsize = %lud\n", symsize);
-	Bflush(&bso);
-}
-
-void
-putsymb(char *s, int t, long v, int ver)
-{
-	int i, f;
-
-	if(t == 'f')
-		s++;
-	LPUTBE(v);
-	if(ver)
-		t += 'a' - 'A';
-	CPUT(t+0x80);			/* 0x80 is variable length */
-
-	if(t == 'Z' || t == 'z') {
-		CPUT(s[0]);
-		for(i=1; s[i] != 0 || s[i+1] != 0; i += 2) {
-			CPUT(s[i]);
-			CPUT(s[i+1]);
-		}
-		CPUT(0);
-		CPUT(0);
-		i++;
-	}
-	else {
-		for(i=0; s[i]; i++)
-			CPUT(s[i]);
-		CPUT(0);
-	}
-	symsize += 4 + 1 + i + 1;
-
-	if(debug['n']) {
-		if(t == 'z' || t == 'Z') {
-			Bprint(&bso, "%c %.8lux ", t, v);
-			for(i=1; s[i] != 0 || s[i+1] != 0; i+=2) {
-				f = ((s[i]&0xff) << 8) | (s[i+1]&0xff);
-				Bprint(&bso, "/%x", f);
-			}
-			Bprint(&bso, "\n");
-			return;
-		}
-		if(ver)
-			Bprint(&bso, "%c %.8lux %s<%d>\n", t, v, s, ver);
-		else
-			Bprint(&bso, "%c %.8lux %s\n", t, v, s);
-	}
-}
-
-#define	MINLC	4
-void
-asmlc(void)
-{
-	long oldpc, oldlc;
-	Prog *p;
-	long v, s;
-
-	oldpc = INITTEXT;
-	oldlc = 0;
-	for(p = firstp; p != P; p = p->link) {
-		if(p->line == oldlc || p->as == ATEXT || p->as == ANOP) {
-			if(p->as == ATEXT)
-				curtext = p;
-			if(debug['L'])
-				Bprint(&bso, "%6lux %P\n",
-					p->pc, p);
-			continue;
-		}
-		if(debug['L'])
-			Bprint(&bso, "\t\t%6ld", lcsize);
-		v = (p->pc - oldpc) / MINLC;
-		while(v) {
-			s = 127;
-			if(v < 127)
-				s = v;
-			CPUT(s+128);	/* 129-255 +pc */
-			if(debug['L'])
-				Bprint(&bso, " pc+%ld*%d(%ld)", s, MINLC, s+128);
-			v -= s;
-			lcsize++;
-		}
-		s = p->line - oldlc;
-		oldlc = p->line;
-		oldpc = p->pc + MINLC;
-		if(s > 64 || s < -64) {
-			CPUT(0);	/* 0 vv +lc */
-			CPUT(s>>24);
-			CPUT(s>>16);
-			CPUT(s>>8);
-			CPUT(s);
-			if(debug['L']) {
-				if(s > 0)
-					Bprint(&bso, " lc+%ld(%d,%ld)\n",
-						s, 0, s);
-				else
-					Bprint(&bso, " lc%ld(%d,%ld)\n",
-						s, 0, s);
-				Bprint(&bso, "%6lux %P\n",
-					p->pc, p);
-			}
-			lcsize += 5;
-			continue;
-		}
-		if(s > 0) {
-			CPUT(0+s);	/* 1-64 +lc */
-			if(debug['L']) {
-				Bprint(&bso, " lc+%ld(%ld)\n", s, 0+s);
-				Bprint(&bso, "%6lux %P\n",
-					p->pc, p);
-			}
-		} else {
-			CPUT(64-s);	/* 65-128 -lc */
-			if(debug['L']) {
-				Bprint(&bso, " lc%ld(%ld)\n", s, 64-s);
-				Bprint(&bso, "%6lux %P\n",
-					p->pc, p);
-			}
-		}
-		lcsize++;
-	}
-	while(lcsize & 1) {
-		s = 129;
-		CPUT(s);
-		lcsize++;
-	}
-	if(debug['v'] || debug['L'])
-		Bprint(&bso, "lcsize = %ld\n", lcsize);
-	Bflush(&bso);
-}
-
-void
-datblk(long s, long n)
-{
-	Prog *p;
-	char *cast;
-	long l, fl, j, d;
-	int i, c;
-
-	memset(buf.dbuf, 0, n+100);
-	for(p = datap; p != P; p = p->link) {
-		curp = p;
-		l = p->from.sym->value + p->from.offset - s;
-		c = p->reg;
-		i = 0;
-		if(l < 0) {
-			if(l+c <= 0)
-				continue;
-			while(l < 0) {
-				l++;
-				i++;
-			}
-		}
-		if(l >= n)
-			continue;
-		if(p->as != AINIT && p->as != ADYNT) {
-			for(j=l+(c-i)-1; j>=l; j--)
-				if(buf.dbuf[j]) {
-					print("%P\n", p);
-					diag("multiple initialization");
-					break;
-				}
-		}
-		switch(p->to.type) {
-		default:
-			diag("unknown mode in initialization\n%P", p);
-			break;
-
-		case D_FCONST:
-			switch(c) {
-			default:
-			case 4:
-				fl = ieeedtof(p->to.ieee);
-				cast = (char*)&fl;
-				for(; i<c; i++) {
-					buf.dbuf[l] = cast[fnuxi8[i]];
-					l++;
-				}
-				break;
-			case 8:
-				cast = (char*)p->to.ieee;
-				for(; i<c; i++) {
-					buf.dbuf[l] = cast[fnuxi8[i]];
-					l++;
-				}
-				break;
-			}
-			break;
-
-		case D_SCONST:
-			for(; i<c; i++) {
-				buf.dbuf[l] = p->to.sval[i];
-				l++;
-			}
-			break;
-
-		case D_CONST:
-			d = p->to.offset;
-			if(p->to.sym) {
-				if(p->to.sym->type == STEXT ||
-				   p->to.sym->type == SLEAF)
-					d += p->to.sym->value;
-				if(p->to.sym->type == SDATA)
-					d += p->to.sym->value + INITDAT;
-				if(p->to.sym->type == SBSS)
-					d += p->to.sym->value + INITDAT;
-			}
-			cast = (char*)&d;
-			switch(c) {
-			default:
-				diag("bad nuxi %d %d\n%P", c, i, curp);
-				break;
-			case 1:
-				for(; i<c; i++) {
-					buf.dbuf[l] = cast[inuxi1[i]];
-					l++;
-				}
-				break;
-			case 2:
-				for(; i<c; i++) {
-					buf.dbuf[l] = cast[inuxi2[i]];
-					l++;
-				}
-				break;
-			case 4:
-				for(; i<c; i++) {
-					buf.dbuf[l] = cast[inuxi4[i]];
-					l++;
-				}
-				break;
-			case 8:
-				for(; i<4; i++) {
-					buf.dbuf[l] = cast[inuxi4[i]];
-					l++;
-				}
-				d = p->to.offset >> 32;
-				for(; i<c; i++) {
-					buf.dbuf[l] = cast[inuxi4[i-4]];
-					l++;
-				}
-				break;
-			}
-			break;
-		}
-	}
-	write(cout, buf.dbuf, n);
-}
-
-#define	OP_RRR(op,r1,r2,r3)\
-	(op|(((r1)&31L)<<16)|(((r2)&31L)<<21)|((r3)&31L))
-#define	OP_IRR(op,i,r2,r3)\
-	(op|(((i)&255L)<<13)|0x1000|(((r2)&31L)<<21)|((r3)&31L))
-#define	OP_MEM(op,d,r1,r2)\
-	(op|(((r1)&31L)<<16)|(((r2)&31L)<<21)|((d)&0xffff))
-#define OP_BR(op,d,r1)\
-	(op|((d)&0x1fffff)|(((r1)&31L)<<21))
-
-int
-asmout(Prog *p, Optab *o)
-{
-	long o1, o2, o3, o4, o5, o6;
-	vlong v;
-	int r, a;
-
-	o1 = 0;
-	o2 = 0;
-	o3 = 0;
-	o4 = 0;
-	o5 = 0;
-	o6 = 0;
-	switch(o->type) {
-	default:
-		diag("unknown type %d", o->type);
-		if(!debug['a'])
-			prasm(p);
-		break;
-
-	case 0:		/* pseudo ops */
-		break;
-
-	case 1:		/* register-register moves */
-		if(p->as == AMOVB || p->as == AMOVW)		/* noop should rewrite */
-			diag("forbidden SEX: %P", p);
-		if(p->as == AMOVBU || p->as == AMOVWU) {
-			v = 1;
-			if (p->as == AMOVWU)
-				v = 3;
-			o1 = OP_IRR(opcode(AZAPNOT), v, p->from.reg, p->to.reg);
-		}
-		else {
-			a = AOR;
-			if(p->as == AMOVL)
-				a = AADDL;
-			if(p->as == AMOVLU)
-				a = AEXTLL;
-			o1 = OP_RRR(opcode(a), REGZERO, p->from.reg, p->to.reg);
-		}
-		break;
-
-	case 2:		/* <operate> r1,[r2],r3 */
-		r = p->reg;
-		if(r == NREG)
-			r = p->to.reg;
-		o1 = OP_RRR(opcode(p->as), p->from.reg, r, p->to.reg);
-		break;
-
-	case 3:		/* <operate> $n,[r2],r3 */
-		v = regoff(&p->from);
-		r = p->reg;
-		if(r == NREG)
-			r = p->to.reg;
-		o1 = OP_IRR(opcode(p->as), v, r, p->to.reg);
-		break;
-
-	case 4:		/* beq r1,sbra */
-		if(p->cond == P)
-			v = -4 >> 2;
-		else
-			v = (p->cond->pc - pc-4) >> 2;
-		o1 = OP_BR(opcode(p->as), v, p->from.reg);
-		break;
-
-	case 5:		/* jmp [r1],0(r2) */
-		r = p->reg;
-		a = p->as;
-		if(r == NREG) {
-			r = o->param;
-/*			if(a == AJMP && p->to.reg == REGLINK)
-				a = ARET; /* this breaks the kernel -- maybe we need to clear prediction stack on each context switch... */
-		}
-		o1 = OP_MEM(opcode(a), 0, p->to.reg, r);
-		break;
-
-	case 6:		/* movq $n,r1 and movq $soreg,r1 */
-		r = p->from.reg;
-		if(r == NREG)
-			r = o->param;
-		v = regoff(&p->from);
-		o1 = OP_MEM(opcode(AMOVA), v, r, p->to.reg);
-		break;
-
-	case 7:		/* movbu r1, r2 */
-		v = 1;
-		if (p->as == AMOVWU)
-			v = 3;
-		o1 = OP_IRR(opcode(AZAPNOT), v, p->from.reg, p->to.reg);
-		break;
-
-	case 8:		/* mov r, soreg ==> stq o(r) */
-		r = p->to.reg;
-		if(r == NREG)
-			r = o->param;
-		v = regoff(&p->to);
-		if (p->as == AMOVQ || p->as == AMOVT)
-			if ((r == REGSP || r == REGSB) && (v&7) != 0)
-				diag("bad alignment: %P", p);
-		o1 = OP_MEM(opcode(p->as+AEND), v, r, p->from.reg);
-		break;
-
-	case 9:		/* mov soreg, r ==> ldq o(r) */
-		r = p->from.reg;
-		if(r == NREG)
-			r = o->param;
-		v = regoff(&p->from);
-		if (p->as == AMOVQ || p->as == AMOVT)
-			if ((r == REGSP || r == REGSB) && (v&7) != 0)
-				diag("bad alignment: %P", p);
-		o1 = OP_MEM(opcode(p->as), v, r, p->to.reg);
-		break;
-
-	case 10:	/* movb r1,r2 */
-		v = 64 - 8;
-		if (p->as == AMOVW)
-			v = 64 - 16;
-		o1 = OP_IRR(opcode(ASLLQ), v, p->from.reg, p->to.reg);
-		o2 = OP_IRR(opcode(ASRAQ), v, p->to.reg, p->to.reg);
-		break;
-
-	case 11:	/* jmp lbra */
-		if(p->cond == P)
-			v = -4 >> 2;
-		else
-			v = (p->cond->pc - pc-4) >> 2;
-		a = ABR;
-		r = REGZERO;
-		if (p->as == AJSR) {
-			a = ABSR;
-			r = REGLINK;
-		}
-		o1 = OP_BR(opcode(a), v, r);
-		break;
-
-	case 12:	/* addq $n,[r2],r3 ==> lda */
-		v = regoff(&p->from);
-		if (p->as == ASUBQ)
-			v = -v;
-		r = p->reg;
-		if(r == NREG)
-			r = p->to.reg;
-		o1 = OP_MEM(opcode(AMOVA), v, r, p->to.reg);
-		break;
-
-	case 13:	/* <op> $scon,[r2],r3 */
-		v = regoff(&p->from);
-		if(p->to.reg == REGTMP || p->reg == REGTMP)
-			diag("cant synthesize large constant\n%P", p);
-		r = p->reg;
-		if(r == NREG)
-			r = p->to.reg;
-		o1 = OP_MEM(opcode(AMOVA), v, REGZERO, REGTMP);
-		o2 = OP_RRR(opcode(p->as), REGTMP, r, p->to.reg);
-		break;
-
-	case 14:	/* <op> $lcon,[r2],r3 */
-		v = regoff(&p->from);
-		if(v & 0x8000)
-			v += 0x10000;
-		if(p->to.reg == REGTMP || p->reg == REGTMP)
-			diag("cant synthesize large constant\n%P", p);
-		r = p->reg;
-		if(r == NREG)
-			r = p->to.reg;
-		o1 = OP_MEM(opcode(AMOVA), v, REGZERO, REGTMP);
-		o2 = OP_MEM(opcode(AMOVAH), v>>16, REGTMP, REGTMP);
-		o3 = OP_RRR(opcode(p->as), REGTMP, r, p->to.reg);
-		break;
-
-	case 15:	/* mov $lcon,r1 */
-		v = regoff(&p->from);
-		if(v & 0x8000)
-			v += 0x10000;
-		o1 = OP_MEM(opcode(AMOVA), v, o->param, REGTMP);
-		o2 = OP_MEM(opcode(AMOVAH), v>>16, REGTMP, p->to.reg);
-		break;
-
-	case 16:	/* mov $qcon,r1 */
-		v = regoff(&p->from);
-		if(v & 0x8000)
-			v += 0x10000;
-		if((v>>31)&1)
-			v += (1LL<<32);
-		if((v>>47)&1)
-			v += (1LL<<48);
-		o1 = OP_MEM(opcode(AMOVA), v>>32, o->param, REGTMP);
-		o2 = OP_MEM(opcode(AMOVAH), v>>48, REGTMP, REGTMP);
-		o3 = OP_IRR(opcode(ASLLQ), 32, REGTMP, REGTMP);
-		o4 = OP_MEM(opcode(AMOVA), v, REGTMP, REGTMP);
-		o5 = OP_MEM(opcode(AMOVAH), v>>16, REGTMP, p->to.reg);
-		break;
-
-	case 17:	/* mov f1,f2 ==> fcpys f1,f1,f2 */
-		o1 = OP_RRR(opcode(ACPYS), p->from.reg, p->from.reg, p->to.reg);
-		break;
-
-	case 18:	/* call_pal imm */
-		v = regoff(&p->from);
-		o1 = OP_MEM(opcode(ACALL_PAL), v, 0, 0);
-		break;
-
-	case 19:	/* mov r, loreg ==> ldah,stq */
-		r = p->to.reg;
-		if(r == NREG)
-			r = o->param;
-		v = regoff(&p->to);
-		if (p->as == AMOVQ || p->as == AMOVT)
-			if ((r == REGSP || r == REGSB) && (v&7) != 0)
-				diag("bad alignment: %P", p);
-		if(v & 0x8000)
-			v += 0x10000;
-		o1 = OP_MEM(opcode(AMOVAH), v>>16, r, REGTMP);
-		o2 = OP_MEM(opcode(p->as+AEND), v, REGTMP, p->from.reg);
-		break;
-
-	case 20:	/* mov loreg, r ==> ldah,ldq */
-		r = p->from.reg;
-		if(r == NREG)
-			r = o->param;
-		v = regoff(&p->from);
-		if (p->as == AMOVQ || p->as == AMOVT)
-			if ((r == REGSP || r == REGSB) && (v&7) != 0)
-				diag("bad alignment: %P", p);
-		if(v & 0x8000)
-			v += 0x10000;
-		o1 = OP_MEM(opcode(AMOVAH), v>>16, r, REGTMP);
-		o2 = OP_MEM(opcode(p->as), v, REGTMP, p->to.reg);
-		break;
-
-#ifdef	NEVER
-	case 21:	/* mov r1,$qoreg */
-		r = p->to.reg;
-		if(r == NREG)
-			r = o->param;
-		v = regoff(&p->to);
-		if(v & 0x8000)
-			v += 0x10000;
-		if((v>>31)&1)
-			v += (1LL<<32);
-		if((v>>47)&1)
-			v += (1LL<<48);
-		o1 = OP_MEM(opcode(AMOVA), v>>32, r, REGTMP);
-		o2 = OP_MEM(opcode(AMOVAH), v>>48, REGTMP, REGTMP);
-		o3 = OP_IRR(opcode(ASLLQ), 32, REGTMP, REGTMP);
-		o4 = OP_MEM(opcode(AMOVAH), v>>16, REGTMP, REGTMP);
-		o5 = OP_MEM(opcode(p->as+AEND), v, REGTMP, p->from.reg);
-		break;
-
-	case 22:	/* mov $qoreg,r1 */
-		r = p->from.reg;
-		if(r == NREG)
-			r = o->param;
-		v = regoff(&p->from);
-		if(v & 0x8000)
-			v += 0x10000;
-		if((v>>31)&1)
-			v += (1LL<<32);
-		if((v>>47)&1)
-			v += (1LL<<48);
-		o1 = OP_MEM(opcode(AMOVA), v>>32, r, REGTMP);
-		o2 = OP_MEM(opcode(AMOVAH), v>>48, REGTMP, REGTMP);
-		o3 = OP_IRR(opcode(ASLLQ), 32, REGTMP, REGTMP);
-		o4 = OP_MEM(opcode(AMOVAH), v>>16, REGTMP, REGTMP);
-		o5 = OP_MEM(opcode(p->as), v, REGTMP, p->to.reg);
-		break;
-#endif
-
-	case 23:	/* <op> $qcon,r1 */
-		if(p->to.reg == REGTMP || p->reg == REGTMP)
-			diag("cant synthesize large constant\n%P", p);
-		v = regoff(&p->from);
-		r = p->reg;
-		if(r == NREG)
-			r = p->to.reg;
-		if(v & 0x8000)
-			v += 0x10000;
-		if((v>>31)&1)
-			v += (1LL<<32);
-		if((v>>47)&1)
-			v += (1LL<<48);
-		o1 = OP_MEM(opcode(AMOVA), v>>32, REGZERO, REGTMP);
-		o2 = OP_MEM(opcode(AMOVAH), v>>48, REGTMP, REGTMP);
-		o3 = OP_IRR(opcode(ASLLQ), 32, REGTMP, REGTMP);
-		o4 = OP_MEM(opcode(AMOVA), v, REGTMP, REGTMP);
-		o5 = OP_MEM(opcode(AMOVAH), v>>16, REGTMP, REGTMP);
-		o6 = OP_RRR(opcode(p->as), REGTMP, r, p->to.reg);
-		break;
-
-	case 24:	/* movq Fn, FPCR */
-		r = p->from.reg;
-		o1 = OP_RRR(opcode(AADDT+AEND), r, r, r);
-		break;
-
-	case 25:	/* movq FPCR, Fn */
-		r = p->to.reg;
-		o1 = OP_RRR(opcode(AADDS+AEND), r, r, r);
-		break;
-
-	case 26:	/* movq Rn, C_PREG */
-		r = p->from.reg;
-		o1 = OP_RRR(opcode(ASUBQ+AEND), r, r, 0) | p->to.reg & 255;
-		break;
-
-	case 27:	/* movq C_PREG, Rn */
-		r = p->to.reg;
-		o1 = OP_RRR(opcode(AADDQ+AEND), r, r, 0) | p->from.reg & 255;
-		break;
-
-	case 28:	/* cvttq r1,r3 */
-		r = p->from.reg;
-		o1 = OP_RRR(opcode(p->as), r, REGZERO, p->to.reg);
-		break;
-
-	case 29:	/* movq pcc, rpcc -> Rn */
-		o1 = OP_MEM(opcode(ARPCC), 0, REGZERO, p->to.reg);
-		break;
-
-	case 30:	/* rei/mb/trapb */
-		o1 = OP_MEM(opcode(p->as), 0, REGZERO, REGZERO);
-		break;
-
-	case 31:	/* fetch (Rn) */
-		o1 = OP_MEM(opcode(p->as), 0, REGZERO, p->from.reg);
-		break;
-
-	case 32:	/* movqp r, soreg ==> stqp o(r) */
-		r = p->to.reg;
-		if(r == NREG)
-			r = o->param;
-		v = regoff(&p->to);
-		if (v < -0x800 || v >= 0x800)
-			diag("physical store out of range\n%P", p);
-		v &= 0xfff;
-		o1 = OP_MEM(opcode(p->as+AEND), v, r, p->from.reg);
-		break;
-
-	case 33:	/* movqp soreg, r ==> ldqp o(r) */
-		r = p->from.reg;
-		if(r == NREG)
-			r = o->param;
-		v = regoff(&p->from);
-		if (v < -0x800 || v >= 0x800)
-			diag("physical load out of range\n%P", p);
-		v &= 0xfff;
-		o1 = OP_MEM(opcode(p->as), v, r, p->to.reg);
-		break;
-
-	case 34:	/* <operate> $-n,[r2],r3 */
-		v = regoff(&p->from);
-		r = p->reg;
-		if(r == NREG)
-			r = p->to.reg;
-		switch (a = p->as) {
-		case AAND:
-			a = AANDNOT;
-			break;
-		case AANDNOT:
-			a = AAND;
-			break;
-		case AOR:
-			a = AORNOT;
-			break;
-		case AORNOT:
-			a = AOR;
-			break;
-		case AXOR:
-			a = AXORNOT;
-			break;
-		case AXORNOT:
-			a = AXOR;
-			break;
-		default:
-			diag("bad in NCON case: %P", p);
-		}
-		v = ~v;
-		o1 = OP_IRR(opcode(a), v, r, p->to.reg);
-		break;
-
-	case 40:	/* word */
-		o1 = regoff(&p->to);
-		break;
-
-	}
-	switch(o->size) {
-	default:
-		if(debug['a'])
-			Bprint(&bso, " %.8lux:\t\t%P\n", p->pc, p);
-		break;
-	case 4:
-		if(debug['a'])
-			Bprint(&bso, " %.8lux: %.8lux\t%P\n", p->pc, o1, p);
-		LPUT(o1);
-		break;
-	case 8:
-		if(debug['a'])
-			Bprint(&bso, " %.8lux: %.8lux %.8lux %P\n", p->pc, o1, o2, p);
-		LPUT(o1);
-		LPUT(o2);
-		break;
-	case 12:
-		if(debug['a'])
-			Bprint(&bso, " %.8lux: %.8lux %.8lux %.8lux %P\n", p->pc, o1, o2, o3, p);
-		LPUT(o1);
-		LPUT(o2);
-		LPUT(o3);
-		break;
-	case 16:
-		if(debug['a'])
-			Bprint(&bso, " %.8lux: %.8lux %.8lux %.8lux %.8lux %P\n",
-				p->pc, o1, o2, o3, o4, p);
-		LPUT(o1);
-		LPUT(o2);
-		LPUT(o3);
-		LPUT(o4);
-		break;
-	case 20:
-		if(debug['a'])
-			Bprint(&bso, " %.8lux: %.8lux %.8lux %.8lux %.8lux %.8lux %P\n",
-				p->pc, o1, o2, o3, o4, o5, p);
-		LPUT(o1);
-		LPUT(o2);
-		LPUT(o3);
-		LPUT(o4);
-		LPUT(o5);
-		break;
-	case 24:
-		if(debug['a'])
-			Bprint(&bso, " %.8lux: %.8lux %.8lux %.8lux %.8lux %.8lux %.8lux %P\n",
-				p->pc, o1, o2, o3, o4, o5, o6, p);
-		LPUT(o1);
-		LPUT(o2);
-		LPUT(o3);
-		LPUT(o4);
-		LPUT(o5);
-		LPUT(o6);
-		break;
-	}
-	return 0;
-}
-
-#define	OP(x,y)	(((x)<<26)|((y)<<5))
-#define	FP(x)	OP(22, (x)|0xc0)	/* note: this sets round/trap modes (dynamic, software?). not used for cvtxx? */
-#define	FP2(x)	OP(22, (x) /*|0x080*/)	/* note: this sets round/trap modes (chopped, software?). used for cvtxx? */
-#define	FP3(x)	OP(22, (x)|0x080)	/* note: this sets round/trap modes (dynamic, software?). not used for cvtxx? */
-
-long
-opcode(int a)
-{
-	switch (a) {
-	/* loads */
-	case AMOVB:		/* misnomer; pretend it's ok for now */
-diag("opcode(AMOVB)");
-	case AMOVBU:		return OP(10, 0);	/* v 3 */
-	case AMOVW:		/* misnomer; pretend it's ok for now */
-diag("opcode(AMOVW)");
-	case AMOVWU:		return OP(12, 0);	/* v 3 */
-	case AMOVL:		return OP(40, 0);
-	case AMOVQ:		return OP(41, 0);
-	case AMOVQU:		return OP(11, 0);
-	case AMOVS:		return OP(34, 0);
-	case AMOVT:		return OP(35, 0);
-
-	/* stores */
-	case AMOVB+AEND:		/* misnomer; pretend it's ok for now */
-	case AMOVBU+AEND:	return OP(14, 0);	/* v 3 */
-	case AMOVW+AEND:	/* misnomer; pretend it's ok for now */
-	case AMOVWU+AEND:	return OP(13, 0);	/* v 3 */
-	case AMOVL+AEND:	return OP(44, 0);
-	case AMOVQ+AEND:	return OP(45, 0);
-	case AMOVQU+AEND:	return OP(15, 0);
-	case AMOVS+AEND:	return OP(38, 0);
-	case AMOVT+AEND:	return OP(39, 0);
-
-	/* physical */
-	case AMOVLP+AEND:	return OP(31, 0)|0x8000;
-	case AMOVQP+AEND:	return OP(31, 0)|0x9000;
-	case AMOVLP:		return OP(27, 0)|0x8000;
-	case AMOVQP:		return OP(27, 0)|0x9000;
-
-	/* load address */
-	case AMOVA:		return OP(8, 0);
-	case AMOVAH:		return OP(9, 0);
-
-	/* locking */
-	case AMOVLL:		return OP(42, 0);	/* load locked */
-	case AMOVQL:		return OP(43, 0);	/* load locked */
-	case AMOVLC+AEND:	return OP(46, 0);	/* store cond */
-	case AMOVQC+AEND:	return OP(47, 0);	/* store cond */
-
-	case AADDL:		return OP(16, 0);
-	case AADDLV:		return OP(16, 64);
-	case AADDQ:		return OP(16, 32);
-	case AADDQV:		return OP(16, 96);
-	case AS4ADDL:		return OP(16, 2);
-	case AS4ADDQ:		return OP(16, 34);
-	case AS8ADDL:		return OP(16, 18);
-	case AS8ADDQ:		return OP(16, 50);
-	case AS4SUBL:		return OP(16, 11);
-	case AS4SUBQ:		return OP(16, 43);
-	case AS8SUBL:		return OP(16, 27);
-	case AS8SUBQ:		return OP(16, 59);
-	case ASUBL:		return OP(16, 9);
-	case ASUBLV:		return OP(16, 73);
-	case ASUBQ:		return OP(16, 41);
-	case ASUBQV:		return OP(16, 105);
-	case ACMPEQ:		return OP(16, 45);
-	case ACMPGT:		return OP(16, 77);
-	case ACMPGE:		return OP(16, 109);
-	case ACMPUGT:		return OP(16, 29);
-	case ACMPUGE:		return OP(16, 61);
-	case ACMPBLE:		return OP(16, 15);
-
-	case AAND:		return OP(17, 0);
-	case AANDNOT:		return OP(17, 8);
-	case AOR:		return OP(17, 32);
-	case AORNOT:		return OP(17, 40);
-	case AXOR:		return OP(17, 64);
-	case AXORNOT:		return OP(17, 72);
-
-	case ACMOVEQ:		return OP(17, 36);
-	case ACMOVNE:		return OP(17, 38);
-	case ACMOVLT:		return OP(17, 68);
-	case ACMOVGE:		return OP(17, 70);
-	case ACMOVLE:		return OP(17, 100);
-	case ACMOVGT:		return OP(17, 102);
-	case ACMOVLBS:		return OP(17, 20);
-	case ACMOVLBC:		return OP(17, 22);
-
-	case AMULL:		return OP(19, 0);
-	case AMULQ:		return OP(19, 32);
-	case AMULLV:		return OP(19, 64);
-	case AMULQV:		return OP(19, 96);
-	case AUMULH:		return OP(19, 48);
-
-	case ASLLQ:		return OP(18, 57);
-	case ASRLQ:		return OP(18, 52);
-	case ASRAQ:		return OP(18, 60);
-
-	case AEXTBL:		return OP(18, 6);
-	case AEXTWL:		return OP(18, 22);
-	case AEXTLL:		return OP(18, 38);
-	case AEXTQL:		return OP(18, 54);
-	case AEXTWH:		return OP(18, 90);
-	case AEXTLH:		return OP(18, 106);
-	case AEXTQH:		return OP(18, 122);
-
-	case AINSBL:		return OP(18, 11);
-	case AINSWL:		return OP(18, 27);
-	case AINSLL:		return OP(18, 43);
-	case AINSQL:		return OP(18, 59);
-	case AINSWH:		return OP(18, 87);
-	case AINSLH:		return OP(18, 103);
-	case AINSQH:		return OP(18, 119);
-
-	case AMSKBL:		return OP(18, 2);
-	case AMSKWL:		return OP(18, 18);
-	case AMSKLL:		return OP(18, 34);
-	case AMSKQL:		return OP(18, 50);
-	case AMSKWH:		return OP(18, 82);
-	case AMSKLH:		return OP(18, 98);
-	case AMSKQH:		return OP(18, 114);
-
-	case AZAP:		return OP(18, 48);
-	case AZAPNOT:		return OP(18, 49);
-
-	case AJMP:		return OP(26, 0);
-	case AJSR:		return OP(26, 512);
-	case ARET:		return OP(26, 1024);
-
-	case ABR:		return OP(48, 0);
-	case ABSR:		return OP(52, 0);
-
-	case ABEQ:		return OP(57, 0);
-	case ABNE:		return OP(61, 0);
-	case ABLT:		return OP(58, 0);
-	case ABGE:		return OP(62, 0);
-	case ABLE:		return OP(59, 0);
-	case ABGT:		return OP(63, 0);
-	case ABLBC:		return OP(56, 0);
-	case ABLBS:		return OP(60, 0);
-
-	case AFBEQ:		return OP(49, 0);
-	case AFBNE:		return OP(53, 0);
-	case AFBLT:		return OP(50, 0);
-	case AFBGE:		return OP(54, 0);
-	case AFBLE:		return OP(51, 0);
-	case AFBGT:		return OP(55, 0);
-
-	case ATRAPB:		return OP(24, 0);
-	case AMB:		return OP(24, 0x200);
-	case AFETCH:		return OP(24, 0x400);
-	case AFETCHM:		return OP(24, 0x500);
-	case ARPCC:		return OP(24, 0x600);
-
-	case ACPYS:		return OP(23, 32);
-	case ACPYSN:		return OP(23, 33);
-	case ACPYSE:		return OP(23, 34);
-	case AADDS+AEND:	return OP(23, 37);	/* MF_FPCR */
-	case AADDT+AEND:	return OP(23, 36);	/* MT_FPCR */
-	case ACVTLQ:		return OP(23, 16);
-	case ACVTQL:		return OP(23, 48);	/* XXX trap mode */
-	case AFCMOVEQ:		return OP(23, 42);
-	case AFCMOVNE:		return OP(23, 43);
-	case AFCMOVLT:		return OP(23, 44);
-	case AFCMOVGE:		return OP(23, 45);
-	case AFCMOVLE:		return OP(23, 46);
-	case AFCMOVGT:		return OP(23, 47);
-
-	case AADDS:		return FP(0);
-	case AADDT:		return FP(32);
-	case ACMPTEQ:		return FP3(37);
-	case ACMPTGT:		return FP3(38);
-	case ACMPTGE:		return FP3(39);
-	case ACMPTUN:		return FP3(36);
-
-	case ACVTQS:		return FP2(60);
-	case ACVTQT:		return FP2(62);
-	case ACVTTS:		return FP2(44);
-	case ACVTTQ:		return FP2(47);
-
-	case ADIVS:		return FP(3);
-	case ADIVT:		return FP(35);
-	case AMULS:		return FP(2);
-	case AMULT:		return FP(34);
-	case ASUBS:		return FP(1);
-	case ASUBT:		return FP(33);
-
-	case ACALL_PAL:		return 0;
-	case AREI:		return OP(30, 0x400);	/* HW_REI */
-
-	case AADDQ+AEND:	return OP(25,0);	/* HW_MFPR */
-	case ASUBQ+AEND:	return OP(29,0);	/* HW_MTPR */
-	}
-	diag("bad op %A(%d)", a, a);
-	return 0;
-}
-
--- a/sys/src/cmd/7l/compat.c
+++ /dev/null
@@ -1,56 +1,0 @@
-#include	"l.h"
-
-/*
- * fake malloc
- */
-void*
-malloc(ulong n)
-{
-	void *p;
-
-	while(n & 7)
-		n++;
-	while(nhunk < n)
-		gethunk();
-	p = hunk;
-	nhunk -= n;
-	hunk += n;
-	return p;
-}
-
-void
-free(void *p)
-{
-	USED(p);
-}
-
-void*
-calloc(ulong m, ulong n)
-{
-	void *p;
-
-	n *= m;
-	p = malloc(n);
-	memset(p, 0, n);
-	return p;
-}
-
-void*
-realloc(void *p, ulong n)
-{
-	fprint(2, "realloc(0x%p %ld) called\n", p, n);
-	abort();
-	return 0;
-}
-
-void*
-mysbrk(ulong size)
-{
-	return sbrk(size);
-}
-
-void
-setmalloctag(void *v, uintptr pc)
-{
-	USED(v, pc);
-}
--- a/sys/src/cmd/7l/l.h
+++ /dev/null
@@ -1,316 +1,0 @@
-#include	<u.h>
-#include	<libc.h>
-#include	<bio.h>
-#include	"../7c/7.out.h"
-
-typedef	struct	Adr	Adr;
-typedef	struct	Sym	Sym;
-typedef	struct	Autom	Auto;
-typedef	struct	Prog	Prog;
-typedef	struct	Optab	Optab;
-typedef	struct	Oprang	Oprang;
-typedef	uchar	Opcross[32][2][32];
-typedef	struct	Count	Count;
-
-#define	P		((Prog*)0)
-#define	S		((Sym*)0)
-#define	TNAME		(curtext&&curtext->from.sym?curtext->from.sym->name:noname)
-
-struct	Adr
-{
-	union
-	{
-		vlong	offset;
-		char*	sval;
-		Ieee*	ieee;
-	};
-	union
-	{
-		Auto*	autom;
-		Sym*	sym;
-	};
-	char	type;
-	char	reg;
-	char	name;
-	char	class;
-};
-struct	Prog
-{
-	Adr	from;
-	Adr	to;
-	union
-	{
-		long	regused;
-		Prog*	forwd;
-	};
-	Prog*	cond;
-	Prog*	link;
-	long	pc;
-	long	line;
-	uchar	mark;
-	uchar	optab;
-	uchar	as;
-	char	reg;
-};
-struct	Sym
-{
-	char	*name;
-	short	type;
-	short	version;
-	short	become;
-	short	frame;
-	long	value;
-	Sym*	link;
-};
-struct	Autom
-{
-	Sym*	sym;
-	Auto*	link;
-	long	offset;
-	short	type;
-};
-struct	Optab
-{
-	uchar	as;
-	char	a1;
-	char	a2;
-	char	a3;
-	char	type;
-	char	size;
-	char	param;
-};
-struct	Oprang
-{
-	Optab*	start;
-	Optab*	stop;
-};
-struct	Count
-{
-	long	count;
-	long	outof;
-};
-
-enum
-{
-	STEXT		= 1,
-	SDATA,
-	SBSS,
-	SDATA1,
-	SXREF,
-	SLEAF,
-	SFILE,
-	SCONST,
-
-	C_NONE		= 0,
-	C_REG,
-	C_FREG,
-	C_FCREG,
-	C_PREG,
-	C_PCC,
-	C_ZCON,
-	C_BCON,
-	C_NCON,
-	C_SCON,
-	C_UCON,
-	C_LCON,
-	C_QCON,
-	C_SACON,
-	C_SECON,
-	C_LACON,
-	C_LECON,
-	C_SBRA,
-	C_LBRA,
-	C_SAUTO,
-	C_SEXT,
-	C_LAUTO,
-	C_LEXT,
-	C_ZOREG,
-	C_SOREG,
-	C_LOREG,
-	C_GOK,
-
-	NSCHED		= 20,
-
-/* mark flags */
-	FOLL		= 1<<0,
-	LABEL		= 1<<1,
-	LEAF		= 1<<2,
-	SYNC		= 1<<3,
-	BRANCH		= 1<<4,
-	LABEL2		= 1<<5,
-	COMPARE		= 1<<6,
-	NOSCHED		= 1<<7,
-
-	BIG		= 32760,
-	STRINGSZ	= 200,
-	NHASH		= 10007,
-	NHUNK		= 100000,
-	MINSIZ		= 64,
-	NENT		= 100,
-	MAXIO		= 8192,
-	MAXHIST		= 20,				/* limit of path elements for history symbols */
-};
-
-union
-{
-	struct
-	{
-		uchar	cbuf[MAXIO];			/* output buffer */
-		uchar	xbuf[MAXIO];			/* input buffer */
-	};
-	char	dbuf[1];
-} buf;
-
-long	HEADR;			/* length of header */
-int	HEADTYPE;		/* type of header */
-long	INITDAT;		/* data location */
-long	INITRND;		/* data round above text location */
-long	INITTEXT;		/* text location */
-char*	INITENTRY;		/* entry point */
-long	autosize;
-Biobuf	bso;
-long	bsssize;
-int	cbc;
-uchar*	cbp;
-int	cout;
-Auto*	curauto;
-Auto*	curhist;
-Prog*	curp;
-Prog*	curtext;
-Prog*	datap;
-long	datsize;
-char	debug[128];
-Prog*	etextp;
-Prog*	firstp;
-char	fnuxi8[8];
-char*	noname;
-Sym*	hash[NHASH];
-Sym*	histfrog[MAXHIST];
-int	histfrogp;
-int	histgen;
-char*	library[50];
-char*	libraryobj[50];
-int	libraryp;
-int	xrefresolv;
-char*	hunk;
-char	inuxi1[1];
-char	inuxi2[2];
-char	inuxi4[4];
-Prog*	lastp;
-long	lcsize;
-char	literal[32];
-int	nerrors;
-long	nhunk;
-vlong	offset;
-Opcross	opcross[7];
-Oprang	oprange[ALAST];
-char*	outfile;
-long	pc;
-Prog	*prog_divq;
-Prog	*prog_divqu;
-Prog	*prog_modq;
-Prog	*prog_modqu;
-Prog	*prog_divl;
-Prog	*prog_divlu;
-Prog	*prog_modl;
-Prog	*prog_modlu;
-uchar	repop[ALAST];
-long	symsize;
-Prog*	textp;
-long	textsize;
-long	thunk;
-int	version;
-char	xcmp[32][32];
-Prog	zprg;
-int	dtype;
-
-extern	char*	anames[];
-extern	Optab	optab[];
-
-#pragma	varargck	type	"A"	int
-#pragma	varargck	type	"A"	uint
-#pragma	varargck	type	"D"	Adr*
-#pragma	varargck	type	"N"	Adr*
-#pragma	varargck	type	"P"	Prog*
-#pragma	varargck	type	"S"	char*
-
-#pragma	varargck	argpos	diag 1
-
-int	Aconv(Fmt*);
-int	Dconv(Fmt*);
-int	Nconv(Fmt*);
-int	Pconv(Fmt*);
-int	Sconv(Fmt*);
-int	aclass(Adr*);
-void	addhist(long, int);
-void	addnop(Prog*);
-void	append(Prog*, Prog*);
-void	asmb(void);
-void	asmlc(void);
-int	asmout(Prog*, Optab*);
-void	asmsym(void);
-long	atolwhex(char*);
-Prog*	brloop(Prog*);
-Biobuf	bso;
-void	buildop(void);
-void	buildrep(int, int);
-void	cflush(void);
-int	cmp(int, int);
-int	compound(Prog*);
-int	conflict(long, long);
-double	cputime(void);
-void	datblk(long, long);
-int	depend(long, long);
-void	diag(char*, ...);
-Prog *divsubr(int);
-void	dodata(void);
-void	doprof1(void);
-void	doprof2(void);
-long	entryvalue(void);
-void	errorexit(void);
-void	exchange(Prog*);
-int	find1(long, int);
-void	follow(void);
-Prog *genXXX(Prog *, int, Adr*, int, Adr*);
-Prog *genRRR(Prog *, int, int, int, int);
-Prog *genIRR(Prog *, int, vlong, int, int);
-Prog *genstore(Prog *, int, int, vlong, int);
-Prog *genload(Prog *, int, vlong, int, int);
-Prog *genjmp(Prog *, int, vlong, int);
-void	gethunk(void);
-void	histtoauto(void);
-double	ieeedtod(Ieee*);
-long	ieeedtof(Ieee*);
-void	initdiv(void);
-void	ldobj(int, long, char*);
-void	loadlib(void);
-void	listinit(void);
-Sym*	lookup(char*, int);
-void	lput(long);
-void	lputbe(long);
-void	mkfwd(void);
-void*	mysbrk(ulong);
-void	names(void);
-void	nocache(Prog*);
-void	noops(void);
-void	nuxiinit(void);
-void	objfile(char*);
-int	ocmp(void*, void*);
-long	opcode(int);
-Optab*	oplook(Prog*);
-void	patch(void);
-void	prasm(Prog*);
-void	prepend(Prog*, Prog*);
-Prog*	prg(void);
-int	pseudo(Prog*);
-void	putsymb(char*, int, long, int);
-vlong	regoff(Adr*);
-long	regused(Prog*);
-int	relinv(int);
-long	rnd(long, long);
-void	sched(Prog*, Prog*);
-void	span(void);
-void	vlput(vlong);
-void	undef(void);
-void	xdefine(char*, int, long);
-void	xfol(Prog*);
--- a/sys/src/cmd/7l/list.c
+++ /dev/null
@@ -1,246 +1,0 @@
-#include "l.h"
-
-void
-listinit(void)
-{
-
-	fmtinstall('A', Aconv);
-	fmtinstall('D', Dconv);
-	fmtinstall('P', Pconv);
-	fmtinstall('S', Sconv);
-	fmtinstall('N', Nconv);
-}
-
-void
-prasm(Prog *p)
-{
-	print("%P\n", p);
-}
-
-int
-Pconv(Fmt *fp)
-{
-	char str[STRINGSZ];
-	Prog *p;
-	int a;
-
-	p = va_arg(fp->args, Prog*);
-	curp = p;
-	a = p->as;
-	if(a == ADATA)
-		snprint(str, sizeof str, "(%ld)	%A	%D/%d,%D",
-			p->line, a, &p->from, p->reg, &p->to);
-	else
-	if(p->reg == NREG)
-		snprint(str, sizeof str, "(%ld)	%A	%D,%D",
-			p->line, a, &p->from, &p->to);
-	else
-	if(p->from.type != D_FREG)
-		snprint(str, sizeof str, "(%ld)	%A	%D,R%d,%D",
-			p->line, a, &p->from, p->reg, &p->to);
-	else
-		snprint(str, sizeof str, "(%ld)	%A	%D,F%d,%D",
-			p->line, a, &p->from, p->reg, &p->to);
-	return fmtstrcpy(fp, str);
-}
-
-int
-Aconv(Fmt *fp)
-{
-	char *s;
-	int a;
-
-	a = va_arg(fp->args, int);
-	s = "???";
-	if(a >= AXXX && a <= AEND)
-		s = anames[a];
-	return fmtstrcpy(fp, s);
-}
-
-int
-Dconv(Fmt *fp)
-{
-	char str[STRINGSZ];
-	Adr *a;
-	long v;
-
-	a = va_arg(fp->args, Adr*);
-	switch(a->type) {
-
-	default:
-		snprint(str, sizeof str, "GOK-type(%d)", a->type);
-		break;
-
-	case D_NONE:
-		str[0] = 0;
-		if(a->name != D_NONE || a->reg != NREG || a->sym != S)
-			snprint(str, sizeof str, "%N(R%d)(NONE)", a, a->reg);
-		break;
-
-	case D_CONST:
-		snprint(str, sizeof str, "$%N", a);
-		if(a->reg != NREG)
-			snprint(str, sizeof str, "%N(R%d)(CONST)", a, a->reg);
-		break;
-
-	case D_OREG:
-		if(a->reg != NREG)
-			snprint(str, sizeof str, "%N(R%d)", a, a->reg);
-		else
-			snprint(str, sizeof str, "%N", a);
-		break;
-
-	case D_REG:
-		snprint(str, sizeof str, "R%d", a->reg);
-		if(a->name != D_NONE || a->sym != S)
-			snprint(str, sizeof str, "%N(R%d)(REG)", a, a->reg);
-		break;
-
-	case D_PREG:
-		snprint(str, sizeof str, "P%d", a->reg & 255);
-		if(a->name != D_NONE || a->sym != S)
-			snprint(str, sizeof str, "%N(R%d)(PREG)", a, a->reg);
-		break;
-
-	case D_FREG:
-		snprint(str, sizeof str, "F%d", a->reg);
-		if(a->name != D_NONE || a->sym != S)
-			snprint(str, sizeof str, "%N(R%d)(FREG)", a, a->reg);
-		break;
-
-	case D_FCREG:
-		snprint(str, sizeof str, "FPCR");
-		if(a->name != D_NONE || a->sym != S)
-			snprint(str, sizeof str, "%N(R%d)(FCREG)", a, a->reg);
-		break;
-
-	case D_BRANCH:	/* botch */
-		if(curp->cond != P) {
-			v = curp->cond->pc;
-			if(v >= INITTEXT)
-				v -= INITTEXT-HEADR;
-			if(a->sym != S)
-				snprint(str, sizeof str, "%s+%.5lux(BRANCH)", a->sym->name, v);
-			else
-				snprint(str, sizeof str, "%.5lux(BRANCH)", v);
-		} else
-			if(a->sym != S)
-				snprint(str, sizeof str, "%s+%lld(APC)", a->sym->name, a->offset);
-			else
-				snprint(str, sizeof str, "%lld(APC)", a->offset);
-		break;
-
-	case D_FCONST:
-		snprint(str, sizeof str, "$%e", ieeedtod(a->ieee));
-		break;
-
-	case D_SCONST:
-		snprint(str, sizeof str, "$\"%S\"", a->sval);
-		break;
-	}
-	return fmtstrcpy(fp, str);
-}
-
-int
-Nconv(Fmt *fp)
-{
-	char str[STRINGSZ];
-	Adr *a;
-	Sym *s;
-
-	a = va_arg(fp->args, Adr*);
-	s = a->sym;
-	if(s == S) {
-		snprint(str, sizeof str, "%lld", a->offset);
-		goto out;
-	}
-	switch(a->name) {
-	default:
-		snprint(str, sizeof str, "GOK-name(%d)", a->name);
-		break;
-
-	case D_NONE:
-		snprint(str, sizeof str, "%lld", a->offset);
-		break;
-
-	case D_EXTERN:
-		snprint(str, sizeof str, "%s+%lld(SB)", s->name, a->offset);
-		break;
-
-	case D_STATIC:
-		snprint(str, sizeof str, "%s<>+%lld(SB)", s->name, a->offset);
-		break;
-
-	case D_AUTO:
-		snprint(str, sizeof str, "%s-%lld(SP)", s->name, -a->offset);
-		break;
-
-	case D_PARAM:
-		snprint(str, sizeof str, "%s+%lld(FP)", s->name, a->offset);
-		break;
-	}
-out:
-	return fmtstrcpy(fp, str);
-}
-
-int
-Sconv(Fmt *fp)
-{
-	int i, c;
-	char str[STRINGSZ], *p, *a;
-
-	a = va_arg(fp->args, char*);
-	p = str;
-	for(i=0; i<sizeof(long); i++) {
-		c = a[i] & 0xff;
-		if(c >= 'a' && c <= 'z' ||
-		   c >= 'A' && c <= 'Z' ||
-		   c >= '0' && c <= '9' ||
-		   c == ' ' || c == '%') {
-			*p++ = c;
-			continue;
-		}
-		*p++ = '\\';
-		switch(c) {
-		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);
-}
-
-void
-diag(char *fmt, ...)
-{
-	char buf[STRINGSZ], *tn;
-	va_list arg;
-
-	tn = "??none??";
-	if(curtext != P && curtext->from.sym != S)
-		tn = curtext->from.sym->name;
-	va_start(arg, fmt);
-	vseprint(buf, buf+sizeof(buf), fmt, arg);
-	va_end(arg);
-	print("%s: %s\n", tn, buf);
-
-	nerrors++;
-	if(nerrors > 10) {
-		print("too many errors\n");
-		errorexit();
-	}
-}
--- a/sys/src/cmd/7l/mkfile
+++ /dev/null
@@ -1,33 +1,0 @@
-</$objtype/mkfile
-
-TARG=7l
-OFILES=\
-	asm.$O\
-	list.$O\
-	noop.$O\
-	obj.$O\
-	optab.$O\
-	pass.$O\
-	sched.$O\
-	span.$O\
-	enam.$O\
-	compat.$O\
-
-HFILES=\
-	l.h\
-	../7c/7.out.h\
-
-BIN=/$objtype/bin
-</sys/src/cmd/mkone
-
-enam.$O:	../7c/enam.c
-	$CC $CFLAGS ../7c/enam.c
-
-x:V:	$O.out
-	$O.out -la -o/dev/null x.7
-
-test:V:	$O.out
-	rm -f xxx
-	mv $O.out xxx
-	./xxx $OFILES
-	cmp $O.out xxx
--- a/sys/src/cmd/7l/noop.c
+++ /dev/null
@@ -1,947 +1,0 @@
-#include	"l.h"
-
-Prog	*divuconst(Prog *, uvlong, int, int, int);
-Prog	*divconst(Prog *, vlong, int, int, int);
-Prog	*modconst(Prog *, vlong, int, int, int);
-void	excise(Prog *);
-
-void
-noops(void)
-{
-	Prog *p, *p1, *q, *q1, *q2;
-	int o, curframe, curbecome, maxbecome, shift;
-
-	/*
-	 * find leaf subroutines
-	 * become sizes
-	 * frame sizes
-	 * strip NOPs
-	 * expand RET and other macros
-	 * expand BECOME pseudo
-	 * use conditional moves where appropriate
-	 */
-
-	if(debug['v'])
-		Bprint(&bso, "%5.2f noops\n", cputime());
-	Bflush(&bso);
-
-	curframe = 0;
-	curbecome = 0;
-	maxbecome = 0;
-	curtext = 0;
-
-	q = P;
-	for(p = firstp; p != P; p = p->link) {
-
-		/* find out how much arg space is used in this TEXT */
-		if(p->to.type == D_OREG && p->to.reg == REGSP)
-			if(p->to.offset > curframe)
-				curframe = p->to.offset;
-
-		switch(p->as) {
-		case ATEXT:
-			if(curtext && curtext->from.sym) {
-				curtext->from.sym->frame = curframe;
-				curtext->from.sym->become = curbecome;
-				if(curbecome > maxbecome)
-					maxbecome = curbecome;
-			}
-			curframe = 0;
-			curbecome = 0;
-
-			p->mark |= LABEL|LEAF|SYNC;
-			if(p->link)
-				p->link->mark |= LABEL;
-			curtext = p;
-			break;
-
-		/* don't mess with what we don't understand */
-		case AWORD:
-		case ACALL_PAL:
-		/* etc. */
-			p->mark |= LABEL;
-			for(q1=p->link; q1 != P; q1 = q1->link) {
-				q1->mark |= LABEL;
-				if(q1->as != AXORNOT)		/* used as NOP in PALcode */
-					break;
-			}
-			break;
-
-		case ARET:
-			/* special form of RET is BECOME */
-			if(p->from.type == D_CONST)
-				if(p->from.offset > curbecome)
-					curbecome = p->from.offset;
-
-			if(p->link != P)
-				p->link->mark |= LABEL;
-			break;
-
-		case ANOP:
-			q1 = p->link;
-			q->link = q1;		/* q is non-nop */
-			q1->mark |= p->mark;
-			continue;
-
-		case AJSR:
-			if(curtext != P)
-				curtext->mark &= ~LEAF;
-		case ABEQ:
-		case ABNE:
-		case ABGE:
-		case ABGT:
-		case ABLE:
-		case ABLT:
-		case ABLBC:
-		case ABLBS:
-		case AFBEQ:
-		case AFBNE:
-		case AFBGE:
-		case AFBGT:
-		case AFBLE:
-		case AFBLT:
-		case AJMP:
-			p->mark |= BRANCH;
-			q1 = p->cond;
-			if(q1 != P) {
-				while(q1->as == ANOP) {
-					q1 = q1->link;
-					p->cond = q1;
-				}
-				if(!(q1->mark & LEAF)) {
-					if (q1->mark & LABEL)
-						q1->mark |= LABEL2;
-					else
-						q1->mark |= LABEL;
-				}
-			} else
-				p->mark |= LABEL;
-			q1 = p->link;
-			if(q1 != P) {
-				if (q1->mark & LABEL)
-					q1->mark |= LABEL2;
-				else
-					q1->mark |= LABEL;
-			}
-			else
-				p->mark |= LABEL;	/* ??? */
-			break;
-
-		case ADIVQ:
-		case ADIVQU:
-		case AMODQ:
-		case AMODQU:
-		case ADIVL:
-		case ADIVLU:
-		case AMODL:
-		case AMODLU:
-			if(p->from.type == D_CONST /*&& !debug['d']*/)
-				continue;
-			if(prog_divq == P)
-				initdiv();
-			if(curtext != P)
-				curtext->mark &= ~LEAF;
-			break;
-		}
-		q = p;
-	}
-
-	if(curtext && curtext->from.sym) {
-		curtext->from.sym->frame = curframe;
-		curtext->from.sym->become = curbecome;
-		if(curbecome > maxbecome)
-			maxbecome = curbecome;
-	}
-
-	if(debug['b'])
-		print("max become = %d\n", maxbecome);
-	xdefine("ALEFbecome", STEXT, maxbecome);
-
-	curtext = 0;
-	for(p = firstp; p != P; p = p->link) {
-		switch(p->as) {
-		case ATEXT:
-			curtext = p;
-			break;
-		case AJSR:
-			if(curtext != P && curtext->from.sym != S && curtext->to.offset >= 0) {
-				o = maxbecome - curtext->from.sym->frame;
-				if(o <= 0)
-					break;
-				/* calling a become or calling a variable */
-				if(p->to.sym == S || p->to.sym->become) {
-					curtext->to.offset += o;
-					if(debug['b']) {
-						curp = p;
-						print("%D calling %D increase %d\n",
-							&curtext->from, &p->to, o);
-					}
-				}
-			}
-			break;
-		}
-	}
-
-	for(p = firstp; p != P; p = p->link) {
-		o = p->as;
-		switch(o) {
-		case ATEXT:
-			curtext = p;
-			autosize = p->to.offset + 8;
-			if(autosize <= 8)
-			if(curtext->mark & LEAF) {
-				p->to.offset = -8;
-				autosize = 0;
-			}
-			if (autosize & 4)
-				autosize += 4;
-
-			q = p;
-			if(autosize)
-				q = genIRR(p, ASUBQ, autosize, NREG, REGSP);
-			else if(!(curtext->mark & LEAF)) {
-				if(debug['v'])
-					Bprint(&bso, "save suppressed in: %s\n",
-						curtext->from.sym->name);
-				Bflush(&bso);
-				curtext->mark |= LEAF;
-			}
-
-			if(curtext->mark & LEAF) {
-				if(curtext->from.sym)
-					curtext->from.sym->type = SLEAF;
-				break;
-			}
-
-			genstore(q, AMOVL, REGLINK, 0LL, REGSP);
-			break;
-
-		case ARET:
-			nocache(p);
-			if(p->from.type == D_CONST)
-				goto become;
-			if(curtext->mark & LEAF) {
-				if(!autosize) {
-					p->as = AJMP;
-					p->from = zprg.from;
-					p->to.type = D_OREG;
-					p->to.offset = 0;
-					p->to.reg = REGLINK;
-					break;
-				}
-
-				p->as = AADDQ;
-				p->from.type = D_CONST;
-				p->from.offset = autosize;
-				p->to.type = D_REG;
-				p->to.reg = REGSP;
-
-				q = prg();
-				q->as = AJMP;
-				q->line = p->line;
-				q->to.type = D_OREG;
-				q->to.offset = 0;
-				q->to.reg = REGLINK;
-				q->mark |= BRANCH;
-
-				q->link = p->link;
-				p->link = q;
-				break;
-			}
-			p->as = AMOVL;
-			p->from.type = D_OREG;
-			p->from.offset = 0;
-			p->from.reg = REGSP;
-			p->to.type = D_REG;
-			p->to.reg = REGLINK;
-
-			q = p;
-			if(autosize)
-				q = genIRR(p, AADDQ, autosize, NREG, REGSP);
-
-			q1 = prg();
-			q1->as = AJMP;
-			q1->line = p->line;
-			q1->to.type = D_OREG;
-			q1->to.offset = 0;
-			q1->to.reg = REGLINK;
-			q1->mark |= BRANCH;
-
-			q1->link = q->link;
-			q->link = q1;
-			break;
-
-		become:
-			if(curtext->mark & LEAF) {
-
-				q = prg();
-				q->line = p->line;
-				q->as = AJMP;
-				q->from = zprg.from;
-				q->to = p->to;
-				q->cond = p->cond;
-				q->link = p->link;
-				q->mark |= BRANCH;
-				p->link = q;
-
-				p->as = AADDQ;
-				p->from = zprg.from;
-				p->from.type = D_CONST;
-				p->from.offset = autosize;
-				p->to = zprg.to;
-				p->to.type = D_REG;
-				p->to.reg = REGSP;
-
-				break;
-			}
-			q = prg();
-			q->line = p->line;
-			q->as = AJMP;
-			q->from = zprg.from;
-			q->to = p->to;
-			q->cond = p->cond;
-			q->link = p->link;
-			q->mark |= BRANCH;
-			p->link = q;
-
-			q = genIRR(p, AADDQ, autosize, NREG, REGSP);
-
-			p->as = AMOVL;
-			p->from = zprg.from;
-			p->from.type = D_OREG;
-			p->from.offset = 0;
-			p->from.reg = REGSP;
-			p->to = zprg.to;
-			p->to.type = D_REG;
-			p->to.reg = REGLINK;
-
-			break;
-			
-
-		/* All I wanted was a MOVB... */
-		case AMOVB:
-		case AMOVW:
-			/* rewrite sign extend; could use v3 extension in asmout case 1 */
-			if (p->to.type == D_REG) {
-				nocache(p);
-				shift = (p->as == AMOVB) ? (64-8) : (64-16);
-				if (p->from.type == D_REG) {
-					p->as = ASLLQ;
-					p->reg = p->from.reg;
-					p->from.type = D_CONST;
-					p->from.offset = shift;
-					q = genIRR(p, ASRAQ, shift, p->to.reg, p->to.reg);
-					break;
-				}
-				else {
-					p->as = (p->as == AMOVB) ? AMOVBU : AMOVWU;
-					q = genIRR(p, ASLLQ, shift, p->to.reg, p->to.reg);
-					q = genIRR(q, ASRAQ, shift, p->to.reg, p->to.reg);
-				}
-			}
-			/* fall through... */
-		case AMOVBU:
-		case AMOVWU:
-			if(!debug['x'])
-				break;		/* use BWX extension */
-			o = p->as;
-			nocache(p);
-			if (p->from.type == D_OREG) {
-				if (p->to.type != D_REG)
-					break;
-				p->as = AMOVQU;
-				q = genXXX(p, AEXTBL, &p->to, REGTMP2, &p->to);
-				if (o == AMOVW || o == AMOVWU)
-					q->as = AEXTWL;
-				p->to.reg = REGTMP2;
-				if ((p->from.offset & 7) != 0 || aclass(&p->from) != C_SOREG) {
-					q1 = genXXX(p, AMOVA, &p->from, NREG, &q->to);
-					q1->from.offset &= 7;
-					q->from = q->to;
-				}
-				else
-					q->from.reg = p->from.reg;
-				if (o == AMOVB || o == AMOVW)
-					genXXX(q, o, &q->to, NREG, &q->to);
-			}
-			else if (p->to.type == D_OREG) {
-				if (aclass(&p->from) == C_ZCON) {
-					p->from.type = D_REG;
-					p->from.reg = REGZERO;
-				}
-				else if (p->from.type != D_REG)
-					break;
-				p->as = AMOVQU;
-				q = genRRR(p, AMSKBL, p->to.reg, REGTMP2, REGTMP2);
-				q1 = genRRR(q, AINSBL, p->to.reg, p->from.reg, REGTMP);
-				if (o == AMOVW || o == AMOVWU) {
-					q->as = AMSKWL;
-					q1->as = AINSWL;
-				}
-				q2 = genXXX(q1, AOR, &q->to, REGTMP, &q->to);
-				genXXX(q2, AMOVQU, &q->to, NREG, &p->to);
-				p->from = p->to;
-				p->to = q->to;
-				if ((p->from.offset & 7) != 0 || aclass(&p->from) != C_SOREG) {
-					q->from.reg = REGTMP;
-					q1->from.reg = REGTMP;
-					q = genXXX(p, AMOVA, &p->from, NREG, &q->from);
-					q->from.offset &= 7;
-				}
-			}
-			break;
-
-		case ASLLL:
-			p->as = ASLLQ;
-			p = genXXX(p, AADDL, &p->to, REGZERO, &p->to);
-			break;
-
-		case ASRLL:
-			if (p->to.type != D_REG) {
-				diag("illegal dest type in %P", p);
-				break;
-			}
-			if (p->reg == NREG)
-				p->reg = p->to.reg;
-
-			q = genXXX(p, ASRLQ, &p->from, REGTMP, &p->to);
-
-			p->as = AZAP;
-			p->from.type = D_CONST;
-			p->from.offset = 0xf0;
-			p->to.reg = REGTMP;
-			p = q;
-
-			p = genXXX(p, AADDL, &p->to, REGZERO, &p->to);
-			break;
-
-		case ASRAL:
-			p->as = ASRAQ;
-			break;
-
-		case ADIVQ:
-		case ADIVQU:
-		case AMODQ:
-		case AMODQU:
-		case ADIVL:
-		case ADIVLU:
-		case AMODL:
-		case AMODLU:
-			/* if (debug['d'])
-				print("%P\n", p); */
-			if(p->to.type != D_REG)
-				break;
-			/*if(debug['d'] && p->from.type == D_CONST) {
-				q = genRRR(p, p->as, REGTMP, p->reg, p->to.reg);
-				p->as = AMOVQ;
-				p->reg = NREG;
-				p->to.reg = REGTMP;
-				p = q;
-			}*/
-			if(p->from.type == D_CONST) {
-				if (p->reg == NREG)
-					p->reg = p->to.reg;
-				switch (p->as) {
-				case ADIVQ:
-					q = divconst(p, p->from.offset, p->reg, p->to.reg, 64);
-					break;
-				case ADIVQU:
-					q = divuconst(p, p->from.offset, p->reg, p->to.reg, 64);
-					break;
-				case AMODQ:
-					q = modconst(p, p->from.offset, p->reg, p->to.reg, 64);
-					break;
-				case AMODQU:
-					q = divuconst(p, p->from.offset, p->reg, REGTMP2, 64);
-					q = genIRR(q, AMULQ, p->from.offset, REGTMP2, REGTMP2);
-					q = genRRR(q, ASUBQ, REGTMP2, p->reg, p->to.reg);
-					break;
-				case ADIVL:
-					q = divconst(p, p->from.offset, p->reg, p->to.reg, 32);
-					break;
-				case ADIVLU:
-					q = divuconst(p, p->from.offset, p->reg, p->to.reg, 32);
-					break;
-				case AMODL:
-					q = modconst(p, p->from.offset, p->reg, p->to.reg, 32);
-					break;
-				case AMODLU:
-					q = divuconst(p, p->from.offset, p->reg, REGTMP2, 32);
-					q = genIRR(q, AMULQ, p->from.offset, REGTMP2, REGTMP2);
-					q = genRRR(q, ASUBQ, REGTMP2, p->reg, p->to.reg);
-					break;
-				}
-				excise(p);
-				p = q;
-				break;
-			}
-			if(p->from.type != D_REG){
-				diag("bad instruction %P", p);
-				break;
-			}
-			o = p->as;
-			q = genIRR(p, ASUBQ, 16LL, NREG, REGSP);
-			q = genstore(q, AMOVQ, p->from.reg, 8LL, REGSP);
-			if (o == ADIVL || o == ADIVL || o == AMODL || o == AMODLU)
-				q->as = AMOVL;
-
-			q = genRRR(q, AMOVQ, p->reg, NREG, REGTMP);
-			if (p->reg == NREG)
-				q->from.reg = p->to.reg;
-
-			/* CALL appropriate */
-			q1 = prg();
-			q1->link = q->link;
-			q->link = q1;
-
-			q1->as = AJSR;
-			q1->line = p->line;
-			q1->to.type = D_BRANCH;
-			q1->cond = divsubr(o);
-			q1->mark |= BRANCH;
-			q = q1;
-
-			q = genRRR(q, AMOVQ, REGTMP, NREG, p->to.reg);
-			q = genIRR(q, AADDQ, 16LL, NREG, REGSP);
-			excise(p);
-			p = q;
-			break;
-
-		/* Attempt to replace {cond. branch, mov} with a cmov */
-		/* XXX warning: this is all a bit experimental */
-		case ABEQ:
-		case ABNE:
-		case ABGE:
-		case ABGT:
-		case ABLE:
-		case ABLT:
-		case ABLBC:
-		case ABLBS:
-			q = p->link;
-			if (q == P)
-				break;
-			q1 = q->link;
-			if (q1 != p->cond || q1 == P)
-				break;
-/*print("%P\n", q); /* */
-			if (q->to.type != D_REG)
-				break;
-			if (q->from.type != D_REG && (q->from.type != D_CONST || q->from.name != D_NONE))
-				break;
-			if (q->mark&LABEL2)
-				break;
-/* print("%P\n", q); /* */
-			if (q->as != AMOVQ)		/* XXX can handle more than this! */
-				break;
-			q->as = (p->as^1) + ACMOVEQ-ABEQ;	/* sleazy hack */
-			q->reg = p->from.reg;		/* XXX check CMOVx operand order! */
-			excise(p);		/* XXX p's LABEL? */
-			if (!(q1->mark&LABEL2))
-				q1->mark &= ~LABEL;
-			break;
-		case AFBEQ:
-		case AFBNE:
-		case AFBGE:
-		case AFBGT:
-		case AFBLE:
-		case AFBLT:
-			q = p->link;
-			if (q == P)
-				break;
-			q1 = q->link;
-			if (q1 != p->cond || q1 == P)
-				break;
-			if (q->from.type != D_FREG || q->to.type != D_FREG)
-				break;
-/* print("%P\n", q); /* */
-			if (q->mark&LABEL2)
-				break;
-			if (q->as != AMOVT)		/* XXX can handle more than this! */
-				break;
-			q->as = (p->as^1) + AFCMOVEQ-AFBEQ;	/* sleazy hack */
-			q->reg = p->from.reg;		/* XXX check CMOVx operand order! */
-			excise(p);		/* XXX p's LABEL? */
-			if (!(q1->mark&LABEL2))
-				q1->mark &= ~LABEL;
-			break;
-		}
-	}
-
-	curtext = P;
-	q = P;		/* p - 1 */
-	q1 = firstp;	/* top of block */
-	o = 0;		/* count of instructions */
-	for(p = firstp; p != P; p = p1) {
-		p1 = p->link;
-		o++;
-		if(p->mark & NOSCHED){
-			if(q1 != p){
-				sched(q1, q);
-			}
-			for(; p != P; p = p->link){
-				if(!(p->mark & NOSCHED))
-					break;
-				q = p;
-			}
-			p1 = p;
-			q1 = p;
-			o = 0;
-			continue;
-		}
-		if(p->mark & (LABEL|SYNC)) {
-			if(q1 != p)
-				sched(q1, q);
-			q1 = p;
-			o = 1;
-		}
-		if(p->mark & (BRANCH|SYNC)) {
-			sched(q1, p);
-			q1 = p1;
-			o = 0;
-		}
-		if(o >= NSCHED) {
-			sched(q1, p);
-			q1 = p1;
-			o = 0;
-		}
-		q = p;
-	}
-}
-
-void
-nocache(Prog *p)
-{
-	p->optab = 0;
-	p->from.class = 0;
-	p->to.class = 0;
-}
-
-/* XXX use of this may lose important LABEL flags, check that this isn't happening (or fix) */
-void
-excise(Prog *p)
-{
-	Prog *q;
-
-	q = p->link;
-	*p = *q;
-}
-
-void
-initdiv(void)
-{
-	Sym *s1, *s2, *s3, *s4, *s5, *s6, *s7, *s8;
-	Prog *p;
-
-	s1 = lookup("_divq", 0);
-	s2 = lookup("_divqu", 0);
-	s3 = lookup("_modq", 0);
-	s4 = lookup("_modqu", 0);
-	s5 = lookup("_divl", 0);
-	s6 = lookup("_divlu", 0);
-	s7 = lookup("_modl", 0);
-	s8 = lookup("_modlu", 0);
-	for(p = firstp; p != P; p = p->link)
-		if(p->as == ATEXT) {
-			if(p->from.sym == s1)
-				prog_divq = p;
-			if(p->from.sym == s2)
-				prog_divqu = p;
-			if(p->from.sym == s3)
-				prog_modq = p;
-			if(p->from.sym == s4)
-				prog_modqu = p;
-			if(p->from.sym == s5)
-				prog_divl = p;
-			if(p->from.sym == s6)
-				prog_divlu = p;
-			if(p->from.sym == s7)
-				prog_modl = p;
-			if(p->from.sym == s8)
-				prog_modlu = p;
-		}
-	if(prog_divq == P) {
-		diag("undefined: %s", s1->name);
-		prog_divq = curtext;
-	}
-	if(prog_divqu == P) {
-		diag("undefined: %s", s2->name);
-		prog_divqu = curtext;
-	}
-	if(prog_modq == P) {
-		diag("undefined: %s", s3->name);
-		prog_modq = curtext;
-	}
-	if(prog_modqu == P) {
-		diag("undefined: %s", s4->name);
-		prog_modqu = curtext;
-	}
-	if(prog_divl == P) {
-		diag("undefined: %s", s5->name);
-		prog_divl = curtext;
-	}
-	if(prog_divlu == P) {
-		diag("undefined: %s", s6->name);
-		prog_divlu = curtext;
-	}
-	if(prog_modl == P) {
-		diag("undefined: %s", s7->name);
-		prog_modl = curtext;
-	}
-	if(prog_modlu == P) {
-		diag("undefined: %s", s8->name);
-		prog_modlu = curtext;
-	}
-}
-
-Prog *
-divsubr(int o)
-{
-	switch(o) {
-	case ADIVQ:
-		return prog_divq;
-	case ADIVQU:
-		return prog_divqu;
-	case AMODQ:
-		return prog_modq;
-	case AMODQU:
-		return prog_modqu;
-	case ADIVL:
-		return prog_divl;
-	case ADIVLU:
-		return prog_divlu;
-	case AMODL:
-		return prog_modl;
-	case AMODLU:
-		return prog_modlu;
-	default:
-		diag("bad op %A in divsubr", o);
-		return prog_modlu;
-	}
-}
-
-Prog*
-divuconst(Prog *p, uvlong y, int num, int quot, int bits)
-{
-	int logy, i, shift;
-	uvlong k, m, n, mult, tmp, msb;
-
-	if(num == NREG)
-		num = quot;
-	if(y == 0) {
-		diag("division by zero");
-		return p;
-	}
-	if(y == 1)
-		return genRRR(p, AMOVQ, num, NREG, quot);
-
-	if(num == REGTMP || quot == REGTMP)
-		diag("bad register in divuconst");
-
-	tmp = y;
-	for(logy = -1; tmp != 0; logy++)
-		tmp >>= 1;
-
-	msb = (1LL << (bits-1));
-	if((y & (y-1)) == 0)		/* power of 2 */
-		return genIRR(p, ASRLQ, logy, num, quot);
-	if(y > msb)
-		return genIRR(p, ACMPUGE, y, num, quot);
-
-	/* k = (-2^(bits+logy)) % y */
-	m = msb/y;
-	n = msb%y;
-	if(debug['d'])
-		Bprint(&bso, "divuconst: y=%lld msb=%lld m=%lld n=%lld\n",
-			y, msb, m, n);
-	for(i = 0; i <= logy; i++) {
-		m *= 2LL;
-		n *= 2LL;
-		if(n > y) {
-			m += 1LL;
-			n -= y;
-		}
-	}
-	if(debug['d'])
-		Bprint(&bso, "divuconst: y=%lld msb=%lld m=%lld n=%lld\n",
-			y, msb, m, n);
-	k = y - n;
-	if(k > (1LL << logy)) {
-		mult = 2LL*m + 1LL;
-		bits++;
-	} else
-		mult = m + 1LL;
-
-	shift = bits + logy;
-	if(debug['d'])
-		Bprint(&bso, "divuconst: y=%lld mult=%lld shift=%d bits=%d k=%lld\n",
-			y, mult, shift, bits, k);
-	if(bits <= 32) {
-		p = genIRR(p, AMOVQ, mult, NREG, REGTMP);
-		p = genRRR(p, AEXTLL, REGZERO, num, quot);
-		p = genRRR(p, AMULQ, REGTMP, quot, quot);
-		p = genIRR(p, ASRLQ, shift, quot, quot);
-		p = genRRR(p, AADDL, quot, REGZERO, quot);
-		return p;
-	}
-	if(bits == 33) {
-		if(shift < 64) {
-			mult <<= (64-shift);
-			shift = 64;
-		}
-		p = genIRR(p, AMOVQ, mult, NREG, REGTMP);
-		p = genRRR(p, AEXTLL, REGZERO, num, quot);
-		p = genRRR(p, AUMULH, REGTMP, quot, quot);
-		if(shift != 64)
-			p = genIRR(p, ASRLQ, shift-64, quot, quot);
-		p = genRRR(p, AADDL, quot, REGZERO, quot);
-		return p;
-	}
-	if(bits <= 64) {
-		if(shift < 64) {
-			mult <<= (64-shift);
-			shift = 64;
-		}
-		p = genIRR(p, AMOVQ, mult, NREG, REGTMP);
-		p = genRRR(p, AUMULH, REGTMP, num, quot);
-		if(shift != 64)
-			p = genIRR(p, ASRLQ, shift-64, quot, quot);
-		return p;
-	}
-
-	p = genIRR(p, AMOVQ, mult, NREG, REGTMP);
-	p = genRRR(p, AUMULH, REGTMP, num, REGTMP);
-	p = genRRR(p, AADDQ, num, REGTMP, quot);
-	p = genRRR(p, ACMPUGT, REGTMP, quot, REGTMP);
-	p = genIRR(p, ASLLQ, 128-shift, REGTMP, REGTMP);
-	p = genIRR(p, ASRLQ, shift-64, quot, quot);
-	p = genRRR(p, AADDQ, REGTMP, quot, quot);
-	return p;
-}
-
-Prog *
-divconst(Prog *p, vlong y, int num, int quot, int bits)
-{
-	vlong yabs;
-	Prog *q;
-
-	yabs = y;
-	if (y < 0)
-		yabs = -y;
-	q = genRRR(p, ASUBQ, num, REGZERO, REGTMP2);
-	if (num != quot)
-		q = genRRR(q, AMOVQ, num, NREG, quot);
-	q = genRRR(q, ACMOVGT, REGTMP2, REGTMP2, quot);
-	q = divuconst(q, yabs, quot, quot, bits-1);
-	q = genRRR(q, ASUBQ, quot, REGZERO, REGTMP);
-	q = genRRR(q, (y < 0)? ACMOVLT: ACMOVGT, REGTMP, REGTMP2, quot);
-	return q;
-}
-
-Prog *
-modconst(Prog *p, vlong y, int num, int quot, int bits)
-{
-	vlong yabs;
-	Prog *q;
-
-	yabs = y;
-	if (y < 0)
-		yabs = -y;
-	q = genRRR(p, ASUBQ, num, REGZERO, REGTMP2);
-	q = genRRR(q, ACMOVLT, num, REGTMP2, REGTMP2);
-	q = divuconst(q, yabs, REGTMP2, REGTMP2, bits-1);
-	q = genRRR(q, ASUBQ, REGTMP2, REGZERO, REGTMP);
-	q = genRRR(q, ACMOVLT, REGTMP, num, REGTMP2);
-	q = genIRR(q, AMULQ, yabs, REGTMP2, REGTMP2);
-	q = genRRR(q, ASUBQ, REGTMP2, num, quot);
-	return q;
-}
-
-Prog *
-genXXX(Prog *q, int op, Adr *from, int reg, Adr *to)
-{
-	Prog *p;
-
-	p = prg();
-	p->as = op;
-	p->line = q->line;
-	p->from = *from;
-	p->to = *to;
-	p->reg = reg;
-	p->link = q->link;
-	q->link = p;
-	return p;
-}
-
-Prog *
-genRRR(Prog *q, int op, int from, int reg, int to)
-{
-	Prog *p;
-
-	p = prg();
-	p->as = op;
-	p->line = q->line;
-	p->from.type = D_REG;
-	p->from.reg = from;
-	p->to.type = D_REG;
-	p->to.reg = to;
-	p->reg = reg;
-	p->link = q->link;
-	q->link = p;
-	return p;
-}
-
-Prog *
-genIRR(Prog *q, int op, vlong v, int reg, int to)
-{
-	Prog *p;
-
-	p = prg();
-	p->as = op;
-	p->line = q->line;
-	p->from.type = D_CONST;
-	p->from.offset = v;
-	p->to.type = D_REG;
-	p->to.reg = to;
-	p->reg = reg;
-	p->link = q->link;
-	q->link = p;
-	return p;
-}
-
-Prog *
-genstore(Prog *q, int op, int from, vlong offset, int to)
-{
-	Prog *p;
-
-	p = prg();
-	p->as = op;
-	p->line = q->line;
-	p->from.type = D_REG;
-	p->from.reg = from;
-	p->to.type = D_OREG;
-	p->to.reg = to;
-	p->to.offset = offset;
-	p->reg = NREG;
-	p->link = q->link;
-	q->link = p;
-	return p;
-}
-
-Prog *
-genload(Prog *q, int op, vlong offset, int from, int to)
-{
-	Prog *p;
-
-	p = prg();
-	p->as = op;
-	p->line = q->line;
-	p->from.type = D_OREG;
-	p->from.offset = offset;
-	p->from.reg = from;
-	p->to.type = D_REG;
-	p->to.reg = to;
-	p->reg = NREG;
-	p->link = q->link;
-	q->link = p;
-	return p;
-}
--- a/sys/src/cmd/7l/obj.c
+++ /dev/null
@@ -1,1350 +1,0 @@
-#include	"l.h"
-#include	<ar.h>
-
-#ifndef	DEFAULT
-#define	DEFAULT	'9'
-#endif
-
-char	*noname		= "<none>";
-char	symname[]	= SYMDEF;
-char	thechar		= '7';
-char	*thestring 	= "alpha";
-
-/*
- *	-H0 -T0x12000004C -D0x140000000	is abbrev unix
- *	-H1 -T0x20000000 -R4		is bootp() format
- *	-H2 -T8224 -R8192		is plan9 format
- */
-
-void
-main(int argc, char *argv[])
-{
-	int c;
-	char *a;
-
-	Binit(&bso, 1, OWRITE);
-	cout = -1;
-	listinit();
-	outfile = 0;
-	nerrors = 0;
-	curtext = P;
-	HEADTYPE = -1;
-	INITTEXT = -1;
-	INITDAT = -1;
-	INITRND = -1;
-	INITENTRY = 0;
-
-	ARGBEGIN {
-	default:
-		c = ARGC();
-		if(c >= 0 && c < sizeof(debug))
-			debug[c]++;
-		break;
-	case 'o':
-		outfile = ARGF();
-		break;
-	case 'E':
-		a = ARGF();
-		if(a)
-			INITENTRY = a;
-		break;
-	case 'T':
-		a = ARGF();
-		if(a)
-			INITTEXT = atolwhex(a);
-		break;
-	case 'D':
-		a = ARGF();
-		if(a)
-			INITDAT = atolwhex(a);
-		break;
-	case 'R':
-		a = ARGF();
-		if(a)
-			INITRND = atolwhex(a);
-		break;
-	case 'H':
-		a = ARGF();
-		if(a)
-			HEADTYPE = atolwhex(a);
-		/* do something about setting INITTEXT */
-		break;
-	} ARGEND
-
-	USED(argc);
-
-	if(*argv == 0) {
-		diag("usage: 7l [-options] objects");
-		errorexit();
-	}
-	if(!debug['9'] && !debug['B'] && !debug['U'])
-		debug[DEFAULT] = 1;
-	if(HEADTYPE == -1) {
-		if(debug['U'])
-			HEADTYPE = 0;
-		if(debug['B'])
-			HEADTYPE = 1;
-		if(debug['9'])
-			HEADTYPE = 2;
-	}
-	switch(HEADTYPE) {
-	default:
-		diag("unknown -H option");
-		errorexit();
-
-	case 0:	/* unix simple */
-		HEADR = 32L+80L;
-		if(INITTEXT == -1)
-			INITTEXT = 0x120000070LL;		/* BUG */
-		if(INITDAT == -1)
-			INITDAT = 0x140000000LL;		/* BUG */
-		if(INITRND == -1)
-			INITRND = 0;
-		break;
-
-	case 1:	/* boot */
-		HEADR = 32L+84L;
-		if(INITTEXT == -1)
-			INITTEXT = 0x20000074L;
-		if(INITDAT == -1)
-			INITDAT = 0;
-		if(INITRND == -1)
-			INITRND = 8;
-		break;
-	case 2:	/* plan 9 */
-		HEADR = 32L;
-		if(INITTEXT == -1)
-			INITTEXT = 8224;
-		if(INITDAT == -1)
-			INITDAT = 0;
-		if(INITRND == -1)
-			INITRND = 8192;
-		break;
-	case 3:	/* ``headerless'' tftp boot -- uses branch as magic */
-		HEADR = 32L;
-		if(INITTEXT == -1)
-			INITTEXT = 0x20000020L;
-		if(INITDAT == -1)
-			INITDAT = 0;
-		if(INITRND == -1)
-			INITRND = 8;
-		break;
-	}
-	if(INITDAT != 0 && INITRND != 0)
-		print("warning: -D0x%lux is ignored because of -R0x%lux\n",
-			INITDAT, INITRND);
-	if(debug['v'])
-		Bprint(&bso, "HEADER = -H0x%d -T0x%lux -D0x%lux -R0x%lux\n",
-			HEADTYPE, INITTEXT, INITDAT, INITRND);
-	Bflush(&bso);
-	zprg.as = AGOK;
-	zprg.reg = NREG;
-	zprg.from.name = D_NONE;
-	zprg.from.type = D_NONE;
-	zprg.from.reg = NREG;
-	zprg.to = zprg.from;
-	buildop();
-	histgen = 0;
-	textp = P;
-	datap = P;
-	pc = 0;
-	dtype = 4;
-	if(outfile == 0)
-		outfile = "7.out";
-	cout = create(outfile, 1, 0775);
-	if(cout < 0) {
-		diag("%s: cannot create", outfile);
-		errorexit();
-	}
-	nuxiinit();
-
-	version = 0;
-	cbp = buf.cbuf;
-	cbc = sizeof(buf.cbuf);
-	firstp = prg();
-	lastp = firstp;
-
-	if(INITENTRY == 0) {
-		INITENTRY = "_main";
-		if(debug['p'])
-			INITENTRY = "_mainp";
-		if(!debug['l'])
-			lookup(INITENTRY, 0)->type = SXREF;
-	} else
-		lookup(INITENTRY, 0)->type = SXREF;
-
-	while(*argv)
-		objfile(*argv++);
-	if(!debug['l'])
-		loadlib();
-	firstp = firstp->link;
-	if(firstp == P)
-		goto out;
-	patch();
-	if(debug['p'])
-		if(debug['1'])
-			doprof1();
-		else
-			doprof2();
-	follow();
-	if(firstp == P)
-		goto out;
-	noops();
-	dodata();		/* is before follow() on other arch */
-	span();
-	asmb();
-	undef();
-
-out:
-	if(debug['v']) {
-		Bprint(&bso, "%5.2f cpu time\n", cputime());
-		Bprint(&bso, "%ld memory used\n", thunk);
-		Bprint(&bso, "%d sizeof adr\n", sizeof(Adr));
-		Bprint(&bso, "%d sizeof prog\n", sizeof(Prog));
-	}
-	Bflush(&bso);
-	errorexit();
-}
-
-void
-loadlib(void)
-{
-	int i;
-	long h;
-	Sym *s;
-
-loop:
-	xrefresolv = 0;
-	for(i=0; i<libraryp; i++) {
-		if(debug['v'])
-			Bprint(&bso, "%5.2f autolib: %s\n", cputime(), library[i]);
-		objfile(library[i]);
-	}
-	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
-errorexit(void)
-{
-
-	Bflush(&bso);
-	if(nerrors) {
-		if(cout >= 0)
-			remove(outfile);
-		exits("error");
-	}
-	exits(0);
-}
-
-void
-objfile(char *file)
-{
-	long off, esym, cnt, l;
-	int f, work;
-	Sym *s;
-	char magbuf[SARMAG];
-	char name[100], pname[150];
-	struct ar_hdr arhdr;
-	char *e, *start, *stop;
-
-	if(file[0] == '-' && file[1] == 'l') {
-		if(debug['9'])
-			snprint(name, sizeof name, "/%s/lib/lib%s.a", thestring, file+2);
-		else
-			snprint(name, sizeof name, "/usr/%clib/lib%s.a", thechar, file+2);
-		file = name;
-	}
-	if(debug['v'])
-		Bprint(&bso, "%5.2f ldobj: %s\n", cputime(), file);
-	Bflush(&bso);
-	f = open(file, 0);
-	if(f < 0) {
-		diag("cannot open file: %s", file);
-		errorexit();
-	}
-	l = read(f, magbuf, SARMAG);
-	if(l != SARMAG || strncmp(magbuf, ARMAG, SARMAG)){
-		/* load it as a regular file */
-		l = seek(f, 0L, 2);
-		seek(f, 0L, 0);
-		ldobj(f, l, file);
-		close(f);
-		return;
-	}
-
-	if(debug['v'])
-		Bprint(&bso, "%5.2f ldlib: %s\n", cputime(), file);
-	l = read(f, &arhdr, SAR_HDR);
-	if(l != SAR_HDR) {
-		diag("%s: short read on archive file symbol header", file);
-		goto out;
-	}
-	if(strncmp(arhdr.name, symname, strlen(symname))) {
-		diag("%s: first entry not symbol header", file);
-		goto out;
-	}
-
-	esym = SARMAG + SAR_HDR + atolwhex(arhdr.size);
-	off = SARMAG + SAR_HDR;
-
-	/*
-	 * just bang the whole symbol file into memory
-	 */
-	seek(f, off, 0);
-	cnt = esym - off;
-	start = malloc(cnt + 10);
-	cnt = read(f, start, cnt);
-	if(cnt <= 0){
-		close(f);
-		return;
-	}
-	stop = &start[cnt];
-	memset(stop, 0, 10);
-
-	work = 1;
-	while(work){
-		if(debug['v'])
-			Bprint(&bso, "%5.2f library pass: %s\n", cputime(), file);
-		Bflush(&bso);
-		work = 0;
-		for(e = start; e < stop; e = strchr(e+5, 0) + 1) {
-			s = lookup(e+5, 0);
-			if(s->type != SXREF)
-				continue;
-			snprint(pname, sizeof pname, "%s(%s)", file, s->name);
-			if(debug['v'])
-				Bprint(&bso, "%5.2f library: %s\n", cputime(), pname);
-			Bflush(&bso);
-			l = e[1] & 0xff;
-			l |= (e[2] & 0xff) << 8;
-			l |= (e[3] & 0xff) << 16;
-			l |= (e[4] & 0xff) << 24;
-			seek(f, l, 0);
-			l = read(f, &arhdr, SAR_HDR);
-			if(l != SAR_HDR)
-				goto bad;
-			if(strncmp(arhdr.fmag, ARFMAG, sizeof(arhdr.fmag)))
-				goto bad;
-			l = atolwhex(arhdr.size);
-			ldobj(f, l, pname);
-			if(s->type == SXREF) {
-				diag("%s: failed to load: %s", file, s->name);
-				errorexit();
-			}
-			work = 1;
-			xrefresolv = 1;
-		}
-	}
-	return;
-
-bad:
-	diag("%s: bad or out of date archive", file);
-out:
-	close(f);
-}
-
-int
-zaddr(uchar *p, Adr *a, Sym *h[])
-{
-	int i, c;
-	vlong l;
-	Sym *s;
-	Auto *u;
-
-	c = p[2];
-	if(c < 0 || c > NSYM){
-		print("sym out of range: %d\n", c);
-		p[0] = ALAST+1;
-		return 0;
-	}
-	a->type = p[0];
-	a->reg = p[1];
-	a->sym = h[p[2]];
-	a->name = p[3];
-	c = 4;
-
-	if(a->reg < 0 || a->reg > NREG) {
-		print("register out of range %d\n", a->reg);
-		p[0] = ALAST+1;
-		return 0;	/*  force real diagnostic */
-	}
-
-	switch(a->type) {
-	default:
-		print("unknown type %d\n", a->type);
-		p[0] = ALAST+1;
-		return 0;	/*  force real diagnostic */
-
-	case D_NONE:
-	case D_REG:
-	case D_FREG:
-	case D_PREG:
-	case D_FCREG:
-	case D_PCC:
-		break;
-
-	case D_BRANCH:
-	case D_OREG:
-	case D_CONST:
-		a->offset = (uvlong)p[4] | ((uvlong)p[5]<<8L) |
-			((uvlong) p[6]<<16L) | ((uvlong) p[7]<<24L) |
-			((uvlong) p[8]<<32L) | ((uvlong) p[9]<<40L) |
-			((uvlong) p[10]<<48L) | ((uvlong) p[11]<<56L);
-		c += 8;
-		break;
-
-	case D_SCONST:
-		while(nhunk < NSNAME)
-			gethunk();
-		a->sval = (char*)hunk;
-		nhunk -= NSNAME;
-		hunk += NSNAME;
-
-		memmove(a->sval, p+4, NSNAME);
-		c += NSNAME;
-		break;
-
-	case D_FCONST:
-		while(nhunk < sizeof(Ieee))
-			gethunk();
-		a->ieee = (Ieee*)hunk;
-		nhunk -= sizeof(Ieee);
-		hunk += sizeof(Ieee);
-
-		a->ieee->l = p[4] | (p[5]<<8) |
-			(p[6]<<16) | (p[7]<<24);
-		a->ieee->h = p[8] | (p[9]<<8) |
-			(p[10]<<16) | (p[11]<<24);
-		c += 8;
-		break;
-	}
-	s = a->sym;
-	if(s == S)
-		return c;
-	i = a->name;
-	if(i != D_AUTO && i != D_PARAM)
-		return c;
-
-	l = a->offset;
-	for(u=curauto; u; u=u->link)
-		if(u->sym == s)
-		if(u->type == i) {
-			if(u->offset > l)
-				u->offset = l;
-			return c;
-		}
-
-	while(nhunk < sizeof(Auto))
-		gethunk();
-	u = (Auto*)hunk;
-	nhunk -= sizeof(Auto);
-	hunk += sizeof(Auto);
-
-	u->link = curauto;
-	curauto = u;
-	u->sym = s;
-	u->offset = l;
-	u->type = i;
-	return c;
-}
-
-void
-addlib(char *obj)
-{
-	char name[1024], comp[256], *p;
-	int i;
-
-	if(histfrogp <= 0)
-		return;
-
-	if(histfrog[0]->name[1] == '/') {
-		name[0] = 0;
-		i = 1;
-	} else
-	if(histfrog[0]->name[1] == '.') {
-		snprint(name, sizeof name, ".");
-		i = 0;
-	} else {
-		if(debug['9'])
-			snprint(name, sizeof name, "/%s/lib", thestring);
-		else
-			snprint(name, sizeof name, "/usr/%clib", thechar);
-		i = 0;
-	}
-
-	for(; i<histfrogp; i++) {
-		snprint(comp, sizeof comp, histfrog[i]->name+1);
-		for(;;) {
-			p = strstr(comp, "$O");
-			if(p == 0)
-				break;
-			memmove(p+1, p+2, strlen(p+2)+1);
-			p[0] = thechar;
-		}
-		for(;;) {
-			p = strstr(comp, "$M");
-			if(p == 0)
-				break;
-			if(strlen(comp)+strlen(thestring)-2+1 >= sizeof comp) {
-				diag("library component too long");
-				return;
-			}
-			memmove(p+strlen(thestring), p+2, strlen(p+2)+1);
-			memmove(p, thestring, strlen(thestring));
-		}
-		if(strlen(name) + strlen(comp) + 3 >= sizeof(name)) {
-			diag("library component too long");
-			return;
-		}
-		strcat(name, "/");
-		strcat(name, comp);
-	}
-	for(i=0; i<libraryp; i++)
-		if(strcmp(name, library[i]) == 0)
-			return;
-	if(libraryp == nelem(library)){
-		diag("too many autolibs; skipping %s", name);
-		return;
-	}
-
-	p = malloc(strlen(name) + 1);
-	strcpy(p, name);
-	library[libraryp] = p;
-	p = malloc(strlen(obj) + 1);
-	strcpy(p, obj);
-	libraryobj[libraryp] = p;
-	libraryp++;
-}
-
-void
-addhist(long line, int type)
-{
-	Auto *u;
-	Sym *s;
-	int i, j, k;
-
-	u = malloc(sizeof(Auto));
-	s = malloc(sizeof(Sym));
-	s->name = malloc(2*(histfrogp+1) + 1);
-
-	u->sym = s;
-	u->type = type;
-	u->offset = line;
-	u->link = curhist;
-	curhist = u;
-
-	j = 1;
-	for(i=0; i<histfrogp; i++) {
-		k = histfrog[i]->value;
-		s->name[j+0] = k>>8;
-		s->name[j+1] = k;
-		j += 2;
-	}
-}
-
-void
-histtoauto(void)
-{
-	Auto *l;
-
-	while(l = curhist) {
-		curhist = l->link;
-		l->link = curauto;
-		curauto = l;
-	}
-}
-
-void
-collapsefrog(Sym *s)
-{
-	int i;
-
-	/*
-	 * bad encoding of path components only allows
-	 * MAXHIST components. if there is an overflow,
-	 * first try to collapse xxx/..
-	 */
-	for(i=1; i<histfrogp; i++)
-		if(strcmp(histfrog[i]->name+1, "..") == 0) {
-			memmove(histfrog+i-1, histfrog+i+1,
-				(histfrogp-i-1)*sizeof(histfrog[0]));
-			histfrogp--;
-			goto out;
-		}
-
-	/*
-	 * next try to collapse .
-	 */
-	for(i=0; i<histfrogp; i++)
-		if(strcmp(histfrog[i]->name+1, ".") == 0) {
-			memmove(histfrog+i, histfrog+i+1,
-				(histfrogp-i-1)*sizeof(histfrog[0]));
-			goto out;
-		}
-
-	/*
-	 * last chance, just truncate from front
-	 */
-	memmove(histfrog+0, histfrog+1,
-		(histfrogp-1)*sizeof(histfrog[0]));
-
-out:
-	histfrog[histfrogp-1] = s;
-}
-
-void
-nopout(Prog *p)
-{
-	p->as = ANOP;
-	p->from.type = D_NONE;
-	p->to.type = D_NONE;
-}
-
-uchar*
-readsome(int f, uchar *buf, uchar *good, uchar *stop, int max)
-{
-	int n;
-
-	n = stop - good;
-	memmove(buf, good, stop - good);
-	stop = buf + n;
-	n = MAXIO - n;
-	if(n > max)
-		n = max;
-	n = read(f, stop, n);
-	if(n <= 0)
-		return 0;
-	return stop + n;
-}
-
-void
-ldobj(int f, long c, char *pn)
-{
-	long ipc;
-	Prog *p, *t;
-	uchar *bloc, *bsize, *stop;
-	Sym *h[NSYM], *s, *di;
-	int v, o, r, skip;
-
-	bsize = buf.xbuf;
-	bloc = buf.xbuf;
-	di = S;
-
-newloop:
-	memset(h, 0, sizeof(h));
-	version++;
-	histfrogp = 0;
-	ipc = pc;
-	skip = 0;
-
-loop:
-	if(c <= 0)
-		goto eof;
-	r = bsize - bloc;
-	if(r < 100 && r < c) {		/* enough for largest prog */
-		bsize = readsome(f, buf.xbuf, bloc, bsize, c);
-		if(bsize == 0)
-			goto eof;
-		bloc = buf.xbuf;
-		goto loop;
-	}
-	o = bloc[0];		/* as */
-	if(o <= AXXX || o >= ALAST) {
-		diag("%s: line %ld: opcode out of range %d", pn, pc-ipc, o);
-		print("	probably not a .7 file\n");
-		errorexit();
-	}
-	if(o == ANAME) {
-		stop = memchr(&bloc[3], 0, bsize-&bloc[3]);
-		if(stop == 0){
-			bsize = readsome(f, buf.xbuf, bloc, bsize, c);
-			if(bsize == 0)
-				goto eof;
-			bloc = buf.xbuf;
-			stop = memchr(&bloc[3], 0, bsize-&bloc[3]);
-			if(stop == 0){
-				fprint(2, "%s: name too long\n", pn);
-				errorexit();
-			}
-		}
-		v = bloc[1];	/* type */
-		o = bloc[2];	/* sym */
-		bloc += 3;
-		c -= 3;
-
-		r = 0;
-		if(v == D_STATIC)
-			r = version;
-		s = lookup((char*)bloc, r);
-		c -= &stop[1] - bloc;
-		bloc = stop + 1;
-
-		if(debug['W'])
-			print("	ANAME	%s\n", s->name);
-		h[o] = s;
-		if((v == D_EXTERN || v == D_STATIC) && s->type == 0)
-			s->type = SXREF;
-		if(v == D_FILE) {
-			if(s->type != SFILE) {
-				histgen++;
-				s->type = SFILE;
-				s->value = histgen;
-			}
-			if(histfrogp < MAXHIST) {
-				histfrog[histfrogp] = s;
-				histfrogp++;
-			} else
-				collapsefrog(s);
-		}
-		goto loop;
-	}
-
-	if(nhunk < sizeof(Prog))
-		gethunk();
-	p = (Prog*)hunk;
-	nhunk -= sizeof(Prog);
-	hunk += sizeof(Prog);
-
-	p->as = o;
-	p->reg = bloc[1] & 0x7f;
-	if(bloc[1] & 0x80)
-		p->mark = NOSCHED;
-	p->line = bloc[2] | (bloc[3]<<8) | (bloc[4]<<16) | (bloc[5]<<24);
-
-	r = zaddr(bloc+6, &p->from, h) + 6;
-	r += zaddr(bloc+r, &p->to, h);
-	bloc += r;
-	c -= r;
-
-	if(p->reg < 0 || p->reg > NREG)
-		diag("register out of range %d", p->reg);
-
-	p->link = P;
-	p->cond = P;
-
-	if(debug['W'])
-		print("%P\n", p);
-
-	switch(o) {
-	case AHISTORY:
-		if(p->to.offset == -1) {
-			addlib(pn);
-			histfrogp = 0;
-			goto loop;
-		}
-		addhist(p->line, D_FILE);		/* 'z' */
-		if(p->to.offset)
-			addhist(p->to.offset, D_PREG);	/* 'Z' */
-		histfrogp = 0;
-		goto loop;
-
-	case AEND:
-		histtoauto();
-		if(curtext != P)
-			curtext->to.autom = curauto;
-		curauto = 0;
-		curtext = P;
-		if(c)
-			goto newloop;
-		return;
-
-	case AGLOBL:
-		s = p->from.sym;
-		if(s == S) {
-			diag("GLOBL must have a name\n%P", p);
-			errorexit();
-		}
-		if(s->type == 0 || s->type == SXREF) {
-			s->type = SBSS;
-			s->value = 0;
-		}
-		if(s->type != SBSS) {
-			diag("redefinition: %s\n%P", s->name, p);
-			s->type = SBSS;
-			s->value = 0;
-		}
-		if(p->to.offset > s->value)
-			s->value = p->to.offset;
-		break;
-
-	case ADYNT:
-		if(p->to.sym == S) {
-			diag("DYNT without a sym\n%P", p);
-			break;
-		}
-		di = p->to.sym;
-		p->reg = 4;
-		if(di->type == SXREF) {
-			if(debug['z'])
-				Bprint(&bso, "%P set to %d\n", p, dtype);
-			di->type = SCONST;
-			di->value = dtype;
-			dtype += 4;
-		}
-		if(p->from.sym == S)
-			break;
-
-		p->from.offset = di->value;
-		p->from.sym->type = SDATA;
-		if(curtext == P) {
-			diag("DYNT not in text: %P", p);
-			break;
-		}
-		p->to.sym = curtext->from.sym;
-		p->to.type = D_CONST;
-		p->link = datap;
-		datap = p;
-		break;
-
-	case AINIT:
-		if(p->from.sym == S) {
-			diag("INIT without a sym\n%P", p);
-			break;
-		}
-		if(di == S) {
-			diag("INIT without previous DYNT\n%P", p);
-			break;
-		}
-		p->from.offset = di->value;
-		p->from.sym->type = SDATA;
-		p->link = datap;
-		datap = p;
-		break;
-	
-	case ADATA:
-		if(p->from.sym == S) {
-			diag("DATA without a sym\n%P", p);
-			break;
-		}
-		p->link = datap;
-		datap = p;
-		break;
-
-	case AGOK:
-		diag("unknown opcode\n%P", p);
-		p->pc = pc;
-		pc++;
-		break;
-
-	case ATEXT:
-		if(curtext != P) {
-			histtoauto();
-			curtext->to.autom = curauto;
-			curauto = 0;
-		}
-		skip = 0;
-		curtext = p;
-		autosize = (p->to.offset+3L) & ~3L;
-		if (autosize & 4)
-			autosize += 4;
-		p->to.offset = autosize;
-		autosize += 8;
-		s = p->from.sym;
-		if(s == S) {
-			diag("TEXT must have a name\n%P", p);
-			errorexit();
-		}
-		if(s->type != 0 && s->type != SXREF) {
-			if(p->reg & DUPOK) {
-				skip = 1;
-				goto casedef;
-			}
-			diag("redefinition: %s\n%P", s->name, p);
-		}
-		s->type = STEXT;
-		s->value = pc;
-		lastp->link = p;
-		lastp = p;
-		p->pc = pc;
-		pc++;
-		if(textp == P) {
-			textp = p;
-			etextp = p;
-			goto loop;
-		}
-		etextp->cond = p;
-		etextp = p;
-		break;
-
-	case AMOVS:
-		if(skip)
-			goto casedef;
-
-		if(p->from.type == D_FCONST) {
-			/* size sb 9 max */
-			snprint(literal, sizeof literal, "$%lux", ieeedtof(p->from.ieee));
-			s = lookup(literal, 0);
-			if(s->type == 0) {
-				s->type = SBSS;
-				s->value = 4;
-				t = prg();
-				t->as = ADATA;
-				t->line = p->line;
-				t->from.type = D_OREG;
-				t->from.sym = s;
-				t->from.name = D_EXTERN;
-				t->reg = 4;
-				t->to = p->from;
-				t->link = datap;
-				datap = t;
-			}
-			p->from.type = D_OREG;
-			p->from.sym = s;
-			p->from.name = D_EXTERN;
-			p->from.offset = 0;
-		}
-		goto casedef;
-
-	case AMOVT:
-		if(skip)
-			goto casedef;
-
-		if(p->from.type == D_FCONST) {
-			/* size sb 18 max */
-			snprint(literal, sizeof literal, "$%lux.%lux",
-				p->from.ieee->l, p->from.ieee->h);
-			s = lookup(literal, 0);
-			if(s->type == 0) {
-				s->type = SBSS;
-				s->value = 8;
-				t = prg();
-				t->as = ADATA;
-				t->line = p->line;
-				t->from.type = D_OREG;
-				t->from.sym = s;
-				t->from.name = D_EXTERN;
-				t->reg = 8;
-				t->to = p->from;
-				t->link = datap;
-				datap = t;
-			}
-			p->from.type = D_OREG;
-			p->from.sym = s;
-			p->from.name = D_EXTERN;
-			p->from.offset = 0;
-		}
-		goto casedef;
-
-	case AMOVQ:
-		if(skip)
-			goto casedef;
-
-		if (p->from.type == D_FREG || p->to.type == D_FREG)
-			p->as = AMOVT;		/* stupid compiler optimiser kkludge */
-
-	case AMOVL:
-	case AMOVW:
-	case AMOVB:
-		/* BOTCH */
-		if (p->from.type == D_CONST)
-		if (p->from.offset == 0LL && p->from.name == D_NONE) {
-			p->from.type = D_REG;
-			p->from.reg = REGZERO;
-		}
-		goto casedef;
-
-	default:
-	casedef:
-		if(skip)
-			nopout(p);
-
-		if(p->to.type == D_BRANCH)
-			p->to.offset += ipc;
-		lastp->link = p;
-		lastp = p;
-		p->pc = pc;
-		pc++;
-		break;
-	}
-	goto loop;
-
-eof:
-	diag("truncated object file: %s", pn);
-}
-
-Sym*
-lookup(char *symb, int v)
-{
-	Sym *s;
-	char *p;
-	long h;
-	int c0, l;
-
-	h = v;
-	for(p=symb; c0 = *p; p++)
-		h = h+h+h + c0;
-	l = (p - symb) + 1;
-	if(h < 0)
-		h = ~h;
-	h %= NHASH;
-	for(s = hash[h]; s != S; s = s->link)
-		if(s->version == v)
-		if(memcmp(s->name, symb, l) == 0)
-			return s;
-
-	while(nhunk < sizeof(Sym))
-		gethunk();
-	s = (Sym*)hunk;
-	nhunk -= sizeof(Sym);
-	hunk += sizeof(Sym);
-
-	s->name = malloc(l);
-	memmove(s->name, symb, l);
-
-	s->link = hash[h];
-	s->type = 0;
-	s->version = v;
-	s->value = 0;
-	hash[h] = s;
-	return s;
-}
-
-Prog*
-prg(void)
-{
-	Prog *p;
-
-	while(nhunk < sizeof(Prog))
-		gethunk();
-	p = (Prog*)hunk;
-	nhunk -= sizeof(Prog);
-	hunk += sizeof(Prog);
-
-	*p = zprg;
-	return p;
-}
-
-void
-gethunk(void)
-{
-	char *h;
-	long nh;
-
-	nh = NHUNK;
-	if(thunk >= 5L*NHUNK) {
-		nh = 5L*NHUNK;
-		if(thunk >= 25L*NHUNK)
-			nh = 25L*NHUNK;
-	}
-	h = mysbrk(nh);
-	if(h == (char*)-1) {
-		diag("out of memory");
-		errorexit();
-	}
-	hunk = h;
-	nhunk = nh;
-	thunk += nh;
-}
-
-void
-doprof1(void)
-{
-	Sym *s;
-	long n;
-	Prog *p, *q;
-
-	if(debug['v'])
-		Bprint(&bso, "%5.2f profile 1\n", cputime());
-	Bflush(&bso);
-	s = lookup("__mcount", 0);
-	n = 1;
-	for(p = firstp->link; p != P; p = p->link) {
-		if(p->as == ATEXT) {
-			q = prg();
-			q->line = p->line;
-			q->link = datap;
-			datap = q;
-			q->as = ADATA;
-			q->from.type = D_OREG;
-			q->from.name = D_EXTERN;
-			q->from.offset = n*4;
-			q->from.sym = s;
-			q->reg = 4;
-			q->to = p->from;
-			q->to.type = D_CONST;
-
-			q = prg();
-			q->line = p->line;
-			q->pc = p->pc;
-			q->link = p->link;
-			p->link = q;
-			p = q;
-			p->as = AMOVL;
-			p->from.type = D_OREG;
-			p->from.name = D_EXTERN;
-			p->from.sym = s;
-			p->from.offset = n*4 + 4;
-			p->to.type = D_REG;
-			p->to.reg = REGTMP;
-
-			q = prg();
-			q->line = p->line;
-			q->pc = p->pc;
-			q->link = p->link;
-			p->link = q;
-			p = q;
-			p->as = AADDQ;
-			p->from.type = D_CONST;
-			p->from.offset = 1;
-			p->to.type = D_REG;
-			p->to.reg = REGTMP;
-
-			q = prg();
-			q->line = p->line;
-			q->pc = p->pc;
-			q->link = p->link;
-			p->link = q;
-			p = q;
-			p->as = AMOVL;
-			p->from.type = D_REG;
-			p->from.reg = REGTMP;
-			p->to.type = D_OREG;
-			p->to.name = D_EXTERN;
-			p->to.sym = s;
-			p->to.offset = n*4 + 4;
-
-			n += 2;
-			continue;
-		}
-	}
-	q = prg();
-	q->line = 0;
-	q->link = datap;
-	datap = q;
-
-	q->as = ADATA;
-	q->from.type = D_OREG;
-	q->from.name = D_EXTERN;
-	q->from.sym = s;
-	q->reg = 4;
-	q->to.type = D_CONST;
-	q->to.offset = n;
-
-	s->type = SBSS;
-	s->value = n*4;
-}
-
-void
-doprof2(void)
-{
-	Sym *s2, *s4;
-	Prog *p, *q, *q2, *ps2, *ps4;
-
-	if(debug['v'])
-		Bprint(&bso, "%5.2f profile 2\n", cputime());
-	Bflush(&bso);
-
-	if(debug['e']){
-		s2 = lookup("_tracein", 0);
-		s4 = lookup("_traceout", 0);
-	}else{
-		s2 = lookup("_profin", 0);
-		s4 = lookup("_profout", 0);
-	}
-	if(s2->type != STEXT || s4->type != STEXT) {
-		if(debug['e'])
-			diag("_tracein/_traceout not defined %d %d", s2->type, s4->type);
-		else
-			diag("_profin/_profout not defined");
-		return;
-	}
-
-	ps2 = P;
-	ps4 = P;
-	for(p = firstp; p != P; p = p->link) {
-		if(p->as == ATEXT) {
-			if(p->from.sym == s2) {
-				ps2 = p;
-				p->reg = 1;
-			}
-			if(p->from.sym == s4) {
-				ps4 = p;
-				p->reg = 1;
-			}
-		}
-	}
-	for(p = firstp; p != P; p = p->link) {
-		if(p->as == ATEXT) {
-			if(p->reg != NREG) {
-				for(;;) {
-					q = p->link;
-					if(q == P)
-						break;
-					if(q->as == ATEXT)
-						break;
-					p = q;
-				}
-				continue;
-			}
-
-			/*
-			 * JSR	profin, R2
-			 */
-			q = prg();
-			q->line = p->line;
-			q->pc = p->pc;
-			q->link = p->link;
-			if(debug['e']){		/* embedded tracing */
-				q2 = prg();
-				p->link = q2;
-				q2->link = q;
-
-				q2->line = p->line;
-				q2->pc = p->pc;
-
-				q2->as = AJMP;
-				q2->to.type = D_BRANCH;
-				q2->to.sym = p->to.sym;
-				q2->cond = q->link;
-			}else
-				p->link = q;
-			p = q;
-			p->as = AJSR;
-			p->to.type = D_BRANCH;
-			p->cond = ps2;
-			p->to.sym = s2;
-
-			continue;
-		}
-		if(p->as == ARET) {
-			/*
-			 * JSR (default)
-			 */
-			if(debug['e']){		/* embedded tracing */
-				q = prg();
-				q->line = p->line;
-				q->pc = p->pc;
-				q->link = p->link;
-				p->link = q;
-				p = q;
-			}
-			/*
-			 * JSR	profout
-			 */
-			p->as = AJSR;
-			p->to.type = D_BRANCH;
-			p->cond = ps4;
-			p->to.sym = s4;
-
-			
-			/*
-			 * RET
-			 */
-			q = prg();
-			q->line = p->line;
-			q->pc = p->pc;
-			q->link = p->link;
-			p->link = q;
-			p = q;
-			p->as = ARET;
-
-			continue;
-		}
-	}
-}
-
-void
-nuxiinit(void)
-{
-	int i, c;
-
-	for(i=0; i<4; i++) {
-		c = find1(0x04030201L, i+1);
-		if(i <= 4)
-			inuxi4[i] = c;
-		if(i <= 2)
-			inuxi2[i] = c;
-		if(i <= 1)
-			inuxi1[i] = c;
-	}
-	for (i = 0; i < 4; i++) {
-		c = find1(0x04030201L, i+1);
-		fnuxi8[i] = c;
-		fnuxi8[i+4] = c + sizeof(long);
-	}
-
-	if(debug['v']) {
-		Bprint(&bso, "inuxi = ");
-		for(i=0; i<1; i++)
-			Bprint(&bso, "%d", inuxi1[i]);
-		Bprint(&bso, " ");
-		for(i=0; i<2; i++)
-			Bprint(&bso, "%d", inuxi2[i]);
-		Bprint(&bso, " ");
-		for(i=0; i<4; i++)
-			Bprint(&bso, "%d", inuxi4[i]);
-		Bprint(&bso, " ");
-		Bprint(&bso, "\nfnuxi = ");
-		for(i=0; i<8; i++)
-			Bprint(&bso, "%d", fnuxi8[i]);
-		Bprint(&bso, "\n");
-	}
-	Bflush(&bso);
-}
-
-find1(long l, int c)
-{
-	char *p;
-	int i;
-
-	p = (char*)&l;
-	for(i=0; i<4; i++)
-		if(*p++ == c)
-			return i;
-	return 0;
-}
-
-long
-ieeedtof(Ieee *ieee)
-{
-	int exp;
-	long v;
-
-	if(ieee->h == 0)
-		return 0;
-	exp = (ieee->h>>20) & ((1L<<11)-1L);
-	exp -= (1L<<10) - 2L;
-	v = (ieee->h & 0xfffffL) << 3;
-	v |= (ieee->l >> 29) & 0x7L;
-	if((ieee->l >> 28) & 1) {
-		v++;
-		if(v & 0x800000L) {
-			v = (v & 0x7fffffL) >> 1;
-			exp++;
-		}
-	}
-	if(exp <= -126 || exp >= 130)
-		diag("double fp to single fp overflow");
-	v |= ((exp + 126) & 0xffL) << 23;
-	v |= ieee->h & 0x80000000L;
-	return v;
-}
-
-double
-ieeedtod(Ieee *ieee)
-{
-	Ieee e;
-	double fr;
-	int exp;
-
-	if(ieee->h & (1L<<31)) {
-		e.h = ieee->h & ~(1L<<31);
-		e.l = ieee->l;
-		return -ieeedtod(&e);
-	}
-	if(ieee->l == 0 && ieee->h == 0)
-		return 0;
-	fr = ieee->l & ((1L<<16)-1L);
-	fr /= 1L<<16;
-	fr += (ieee->l>>16) & ((1L<<16)-1L);
-	fr /= 1L<<16;
-	fr += (ieee->h & (1L<<20)-1L) | (1L<<20);
-	fr /= 1L<<21;
-	exp = (ieee->h>>20) & ((1L<<11)-1L);
-	exp -= (1L<<10) - 2L;
-	return ldexp(fr, exp);
-}
--- a/sys/src/cmd/7l/optab.c
+++ /dev/null
@@ -1,141 +1,0 @@
-#include	"l.h"
-
-#define	X	99
-
-Optab	optab[] =
-{
-	{ ATEXT,	C_LEXT,	C_NONE,	C_LCON, 	 0, 0, 0 },
-	{ ATEXT,	C_LEXT,	C_REG,	C_LCON, 	 0, 0, 0 },
-
-	{ AMOVQ,	C_REG,	C_NONE,	C_REG,		 1, 4, 0 },
-	{ AMOVQ,	C_SCON,	C_NONE,	C_REG,		 6, 4, REGZERO },
-	{ AMOVQ,	C_SECON,C_NONE,	C_REG,		 6, 4, REGSB },
-	{ AMOVQ,	C_SACON,C_NONE,	C_REG,		 6, 4, REGSP },
-
-	{ AMOVQ,	C_LCON,	C_NONE,	C_REG,		15, 8, REGZERO },
-	{ AMOVQ,	C_LECON,C_NONE,	C_REG,		15, 8, REGSB },
-	{ AMOVQ,	C_LACON,C_NONE,	C_REG,		15, 8, REGSP },
-
-	{ AMOVQ,	C_QCON,	C_NONE,	C_REG,		16,20, REGZERO },
-
-	{ AMOVQ,	C_REG,	C_NONE,	C_SOREG,	 8, 4, REGZERO },
-	{ AMOVQ,	C_REG,	C_NONE,	C_SEXT,		 8, 4, REGSB },
-	{ AMOVQ,	C_REG,	C_NONE,	C_SAUTO,	 8, 4, REGSP },
-
-	{ AMOVQ,	C_SOREG,C_NONE,	C_REG,		 9, 4, REGZERO },
-	{ AMOVQ,	C_SEXT,	C_NONE,	C_REG,		 9, 4, REGSB },
-	{ AMOVQ,	C_SAUTO,C_NONE,	C_REG,		 9, 4, REGSP },
-
-	{ AMOVQ,	C_REG,	C_NONE,	C_LOREG,	19, 8, REGZERO },
-	{ AMOVQ,	C_REG,	C_NONE,	C_LEXT,		19, 8, REGSB },
-	{ AMOVQ,	C_REG,	C_NONE,	C_LAUTO,	19, 8, REGSP },
-
-	{ AMOVQ,	C_LOREG,C_NONE,	C_REG,		20, 8, REGZERO },
-	{ AMOVQ,	C_LEXT,	C_NONE,	C_REG,		20, 8, REGSB },
-	{ AMOVQ,	C_LAUTO,C_NONE,	C_REG,		20, 8, REGSP },
-/*
-	{ AMOVBU,	C_REG,	C_NONE,	C_REG,		 7, 4, 0 },
-	{ AMOVB,	C_REG,	C_NONE,	C_REG,		10, 8, 0 },
-*/
-	{ AMOVT,	C_FREG,	C_NONE,	C_FREG,		17, 4, 0 },
-
-	{ AMOVT,	C_FREG,	C_NONE,	C_SOREG,	 8, 4, REGZERO },
-	{ AMOVT,	C_FREG,	C_NONE,	C_SEXT,		 8, 4, REGSB },
-	{ AMOVT,	C_FREG,	C_NONE,	C_SAUTO,	 8, 4, REGSP },
-
-	{ AMOVT,	C_SOREG,C_NONE,	C_FREG,		 9, 4, REGZERO },
-	{ AMOVT,	C_SEXT,	C_NONE,	C_FREG,		 9, 4, REGSB },
-	{ AMOVT,	C_SAUTO,C_NONE,	C_FREG,		 9, 4, REGSP },
-
-	{ AMOVT,	C_FREG,	C_NONE,	C_LOREG,	19, 8, REGZERO },
-	{ AMOVT,	C_FREG,	C_NONE,	C_LEXT,		19, 8, REGSB },
-	{ AMOVT,	C_FREG,	C_NONE,	C_LAUTO,	19, 8, REGSP },
-
-	{ AMOVT,	C_LOREG,C_NONE,	C_FREG,		20, 8, REGZERO },
-	{ AMOVT,	C_LEXT,	C_NONE,	C_FREG,		20, 8, REGSB },
-	{ AMOVT,	C_LAUTO,C_NONE,	C_FREG,		20, 8, REGSP },
-
-	{ AADDQ,	C_REG,	C_REG,	C_REG,		 2, 4, 0 },
-	{ AADDL,	C_REG,	C_REG,	C_REG,		 2, 4, 0 },
-	{ AAND,		C_REG,	C_REG,	C_REG,		 2, 4, 0 },
-	{ AMULQ,	C_REG,	C_REG,	C_REG,		 2, 4, 0 },
-	{ AADDQ,	C_REG,	C_NONE,	C_REG,		 2, 4, 0 },
-	{ AADDL,	C_REG,	C_NONE,	C_REG,		 2, 4, 0 },
-	{ AAND,		C_REG,	C_NONE,	C_REG,		 2, 4, 0 },
-	{ AMULQ,	C_REG,	C_NONE,	C_REG,		 2, 4, 0 },
-
-	{ AADDQ,	C_SCON,	C_REG,	C_REG,		12, 4, 0 },
-	{ AADDQ,	C_SCON,	C_NONE,	C_REG,		12, 4, 0 },
-
-	{ AADDL,	C_BCON,	C_REG,	C_REG,		 3, 4, 0 },
-	{ AAND,		C_BCON,	C_REG,	C_REG,		 3, 4, 0 },
-	{ AMULQ,	C_BCON,	C_REG,	C_REG,		 3, 4, 0 },
-	{ AADDL,	C_BCON,	C_NONE,	C_REG,		 3, 4, 0 },
-	{ AAND,		C_BCON,	C_NONE,	C_REG,		 3, 4, 0 },
-	{ AMULQ,	C_BCON,	C_NONE,	C_REG,		 3, 4, 0 },
-
-/*	{ AADDL,	C_NCON,	C_REG,	C_REG,		34, 4, 0 }, */
-	{ AAND,		C_NCON,	C_REG,	C_REG,		34, 4, 0 },
-/*	{ AADDL,	C_NCON,	C_NONE,	C_REG,		34, 4, 0 }, */
-	{ AAND,		C_NCON,	C_NONE,	C_REG,		34, 4, 0 },
-
-	{ AADDL,	C_SCON,	C_REG,	C_REG,		13, 8, 0 },
-	{ AAND,		C_SCON,	C_REG,	C_REG,		13, 8, 0 },
-	{ AMULQ,	C_SCON,	C_REG,	C_REG,		13, 8, 0 },
-	{ AADDL,	C_SCON,	C_NONE,	C_REG,		13, 8, 0 },
-	{ AAND,		C_SCON,	C_NONE,	C_REG,		13, 8, 0 },
-	{ AMULQ,	C_SCON,	C_NONE,	C_REG,		13, 8, 0 },
-
-	{ AADDQ,	C_LCON,	C_REG,	C_REG,		14,12, 0 },
-	{ AADDQ,	C_LCON,	C_NONE,	C_REG,		14,12, 0 },
-	{ AADDL,	C_LCON,	C_REG,	C_REG,		14,12, 0 },
-	{ AAND,		C_LCON,	C_REG,	C_REG,		14,12, 0 },
-	{ AMULQ,	C_LCON,	C_REG,	C_REG,		14,12, 0 },
-	{ AADDL,	C_LCON,	C_NONE,	C_REG,		14,12, 0 },
-	{ AAND,		C_LCON,	C_NONE,	C_REG,		14,12, 0 },
-	{ AMULQ,	C_LCON,	C_NONE,	C_REG,		14,12, 0 },
-
-	{ AADDQ,	C_QCON,	C_REG,	C_REG,		23,24, 0 },
-	{ AADDQ,	C_QCON,	C_NONE,	C_REG,		23,24, 0 },
-	{ AADDL,	C_QCON,	C_REG,	C_REG,		23,24, 0 },
-	{ AAND,		C_QCON,	C_REG,	C_REG,		23,24, 0 },
-	{ AMULQ,	C_QCON,	C_REG,	C_REG,		23,24, 0 },
-	{ AADDL,	C_QCON,	C_NONE,	C_REG,		23,24, 0 },
-	{ AAND,		C_QCON,	C_NONE,	C_REG,		23,24, 0 },
-	{ AMULQ,	C_QCON,	C_NONE,	C_REG,		23,24, 0 },
-
-	{ AADDT,	C_FREG,	C_REG,	C_FREG,		 2, 4, 0 },
-	{ AADDT,	C_FREG,	C_NONE,	C_FREG,		 2, 4, 0 },
-	{ ACVTTQ,	C_FREG,	C_NONE,	C_FREG,		28, 4, 0 },
-
-	{ ABEQ,		C_REG,	C_NONE,	C_SBRA,		 4, 4, 0 },
-	{ AFBEQ,	C_FREG,	C_NONE,	C_SBRA,		 4, 4, 0 },
-
-	{ AJMP,		C_NONE,	C_NONE,	C_SBRA,		11, 4, 0 },
-	{ AJSR,		C_NONE,	C_NONE,	C_SBRA,		11, 4, 0 },
-
-	{ AJMP,		C_NONE,	C_NONE,	C_ZOREG,	 5, 4, REGZERO },
-	{ AJSR,		C_NONE,	C_NONE,	C_ZOREG,	 5, 4, REGLINK },
-	{ AJMP,		C_NONE,	C_REG,	C_ZOREG,	 5, 4, REGZERO },
-	{ AJSR,		C_NONE,	C_REG,	C_ZOREG,	 5, 4, REGLINK },
-	{ ACALL_PAL,	C_SCON, C_NONE, C_NONE,		18, 4, 0 },
-	{ AWORD,	C_NONE,	C_NONE,	C_LCON,		40, 4, 0 },
-
-	{ AMOVT,	C_FREG, C_NONE, C_FCREG,	24, 4, 0 },
-	{ AMOVT,	C_FCREG,C_NONE, C_FREG,		25, 4, 0 },
-
-	{ AMOVQ,	C_REG,  C_NONE, C_PREG,		26, 4, 0 },
-	{ AMOVQ,	C_PREG, C_NONE, C_REG,		27, 4, 0 },
-	{ AMOVQ,	C_PCC,  C_NONE, C_REG,		29, 4, 0 },
-
-	{ AREI,		C_NONE, C_NONE, C_NONE,		30, 4, 0 },
-	{ AFETCH,	C_ZOREG,C_NONE, C_NONE,		31, 4, REGZERO },
-
-	{ AMOVQL,	C_SOREG,C_NONE,	C_REG,		 9, 4, REGZERO },
-	{ AMOVQC,	C_REG,	C_NONE,	C_SOREG,	 8, 4, REGZERO },
-
-	{ AMOVQP,	C_SOREG,C_NONE,	C_REG,		33, 4, REGZERO },
-	{ AMOVQP,	C_REG,	C_NONE,	C_SOREG,	32, 4, REGZERO },
-
-	{ AXXX,		C_NONE,	C_NONE,	C_NONE,		 0, 4, 0 },
-};
--- a/sys/src/cmd/7l/pass.c
+++ /dev/null
@@ -1,495 +1,0 @@
-#include	"l.h"
-
-void
-dodata(void)
-{
-	int i, t, size;
-	Sym *s;
-	Prog *p, *p1;
-	long orig, orig1, v;
-	vlong vv;
-
-	if(debug['v'])
-		Bprint(&bso, "%5.2f dodata\n", cputime());
-	Bflush(&bso);
-	for(p = datap; p != P; p = p->link) {
-		s = p->from.sym;
-		if(p->as == ADYNT || p->as == AINIT)
-			s->value = dtype;
-		if(s->type == SBSS)
-			s->type = SDATA;
-		if(s->type != SDATA)
-			diag("initialize non-data (%d): %s\n%P",
-				s->type, s->name, p);
-		v = p->from.offset + p->reg;
-		if(v > s->value)
-			diag("initialize bounds (%ld): %s\n%P",
-				s->value, s->name, p);
-	}
-
-	/*
-	 * pass 1
-	 *	assign 'small' variables to data segment
-	 *	(rational is that data segment is more easily
-	 *	 addressed through offset on REGSB)
-	 */
-	orig = 0;
-	for(i=0; i<NHASH; i++)
-	for(s = hash[i]; s != S; s = s->link) {
-		t = s->type;
-		if(t != SDATA && t != SBSS)
-			continue;
-		v = s->value;
-		if(v == 0) {
-			diag("%s: no size", s->name);
-			v = 1;
-		}
-		while(v & 3)
-			v++;
-		
-		s->value = v;
-		if(v > MINSIZ)
-			continue;
-		if (v >= 8)
-			orig = rnd(orig, 8);
-		s->value = orig;
-		orig += v;
-		s->type = SDATA1;
-	}
-	orig = rnd(orig, 8);
-	orig1 = orig;
-
-	/*
-	 * pass 2
-	 *	assign 'data' variables to data segment
-	 */
-	for(i=0; i<NHASH; i++)
-	for(s = hash[i]; s != S; s = s->link) {
-		t = s->type;
-		if(t != SDATA) {
-			if(t == SDATA1)
-				s->type = SDATA;
-			continue;
-		}
-		v = s->value;
-		if (v >= 8)
-			orig = rnd(orig, 8);
-		s->value = orig;
-		orig += v;
-		s->type = SDATA1;
-	}
-
-	orig = rnd(orig, 8);
-	datsize = orig;
-
-	/*
-	 * pass 3
-	 *	everything else to bss segment
-	 */
-	for(i=0; i<NHASH; i++)
-	for(s = hash[i]; s != S; s = s->link) {
-		if(s->type != SBSS)
-			continue;
-		v = s->value;
-		if (v >= 8)
-			orig = rnd(orig, 8);
-		s->value = orig;
-		orig += v;
-	}
-	orig = rnd(orig, 8);
-	bsssize = orig-datsize;
-
-	/*
-	 * pass 4
-	 *	add literals to all large values.
-	 *	at this time:
-	 *		small data is allocated DATA
-	 *		large data is allocated DATA1
-	 *		large bss is allocated BSS
-	 *	the new literals are loaded between
-	 *	small data and large data.
-	 */
-	orig = 0;
-	for(p = firstp; p != P; p = p->link) {
-		if(p->as != AMOVQ)
-			continue;
-		if(p->from.type != D_CONST)
-			continue;
-		if(s = p->from.sym) {
-			t = s->type;
-			if(t != SDATA && t != SDATA1 && t != SBSS)
-				continue;
-			t = p->from.name;
-			if(t != D_EXTERN && t != D_STATIC)
-				continue;
-			v = s->value + p->from.offset;
-			size = 4;
-			if(v >= 0 && v <= 0xffff)
-				continue;
-			if(!strcmp(s->name, "setSB"))
-				continue;
-			/* size should be 19 max */
-			if(strlen(s->name) >= 10)	/* has loader address */ 
-				snprint(literal, sizeof literal, "$%p.%llux", s, p->from.offset);
-			else
-				snprint(literal, sizeof literal, "$%s.%d.%llux", s->name, s->version, p->from.offset);
-		} else {
-			if(p->from.name != D_NONE)
-				continue;
-			if(p->from.reg != NREG)
-				continue;
-			vv = p->from.offset;
-			if(vv >= -0x8000LL && vv <= 0x7fff)
-				continue;
-			if(!(vv & 0xffff))
-				continue;
-			size = 8;
-			if (vv <= 0x7FFFFFFFLL && vv >= -0x80000000LL)
-				size = 4;
-			/* size should be 17 max */
-			snprint(literal, sizeof literal, "$%llux", vv);
-		}
-		s = lookup(literal, 0);
-		if(s->type == 0) {
-			s->type = SDATA;
-			orig = rnd(orig, size);
-			s->value = orig1+orig;
-			orig += size;
-			p1 = prg();
-			p1->line = p->line;
-			p1->as = ADATA;
-			p1->from.type = D_OREG;
-			p1->from.sym = s;
-			p1->from.name = D_EXTERN;
-			p1->reg = size;
-			p1->to = p->from;
-			p1->link = datap;
-			datap = p1;
-			if(debug['C'])
-				Bprint(&bso, "literal %P for %P\n", p1, p);
-		}
-		if(s->type != SDATA)
-			diag("literal not data: %s", s->name);
-		if (size == 4)
-			p->as = AMOVL;
-		p->from.type = D_OREG;
-		p->from.sym = s;
-		p->from.name = D_EXTERN;
-		p->from.offset = 0;
-		continue;
-	}
-	orig = rnd(orig, 8);
-
-	/*
-	 * pass 5
-	 *	re-adjust offsets
-	 */
-	for(i=0; i<NHASH; i++)
-	for(s = hash[i]; s != S; s = s->link) {
-		t = s->type;
-		if(t == SBSS) {
-			s->value += orig;
-			continue;
-		}
-		if(t == SDATA1) {
-			s->type = SDATA;
-			s->value += orig;
-			continue;
-		}
-	}
-	datsize += orig;
-	if (debug['v'] || debug['z'])
-		Bprint(&bso, "datsize = %lux, bsssize = %lux\n", datsize, bsssize);
-	xdefine("setSB", SDATA, 0L+BIG);
-	xdefine("bdata", SDATA, 0L);
-	xdefine("edata", SDATA, datsize);
-	xdefine("end", SBSS, datsize+bsssize);
-	xdefine("etext", STEXT, 0L);
-}
-
-void
-undef(void)
-{
-	int i;
-	Sym *s;
-
-	for(i=0; i<NHASH; i++)
-	for(s = hash[i]; s != S; s = s->link)
-		if(s->type == SXREF)
-			diag("%s: not defined", s->name);
-}
-
-void
-follow(void)
-{
-	if(debug['v'])
-		Bprint(&bso, "%5.2f follow\n", cputime());
-	Bflush(&bso);
-
-	firstp = prg();
-	lastp = firstp;
-	xfol(textp);
-
-	firstp = firstp->link;
-	lastp->link = P;
-}
-
-void
-xfol(Prog *p)
-{
-	Prog *q, *r;
-	int a, i;
-
-loop:
-	if(p == P)
-		return;
-	a = p->as;
-	if(a == ATEXT)
-		curtext = p;
-	if(a == AJMP) {
-		q = p->cond;
-		if(q != P) {
-			p->mark = FOLL;
-			p = q;
-			if(!(p->mark & FOLL))
-				goto loop;
-		}
-	}
-	if(p->mark & FOLL) {
-		for(i=0,q=p; i<4; i++,q=q->link) {
-			if(q == lastp)
-				break;
-			a = q->as;
-			if(a == ANOP) {
-				i--;
-				continue;
-			}
-			if(a == AJMP || a == ARET || a == AREI)
-				goto copy;
-			if(!q->cond || (q->cond->mark&FOLL))
-				continue;
-			if(a != ABEQ && a != ABNE)
-				continue;
-		copy:
-			for(;;) {
-				r = prg();
-				*r = *p;
-				if(!(r->mark&FOLL))
-					print("cant happen 1\n");
-				r->mark = FOLL;
-				if(p != q) {
-					p = p->link;
-					lastp->link = r;
-					lastp = r;
-					continue;
-				}
-				lastp->link = r;
-				lastp = r;
-				if(a == AJMP || a == ARET || a == AREI)
-					return;
-				r->as = ABNE;
-				if(a == ABNE)
-					r->as = ABEQ;
-				r->cond = p->link;
-				r->link = p->cond;
-				if(!(r->link->mark&FOLL))
-					xfol(r->link);
-				if(!(r->cond->mark&FOLL))
-					print("cant happen 2\n");
-				return;
-			}
-		}
-		a = AJMP;
-		q = prg();
-		q->as = a;
-		q->line = p->line;
-		q->to.type = D_BRANCH;
-		q->to.offset = p->pc;
-		q->cond = p;
-		p = q;
-	}
-	p->mark = FOLL;
-	lastp->link = p;
-	lastp = p;
-	if(a == AJMP || a == ARET || a == AREI)
-		return;
-	if(p->cond != P)
-	if(a != AJSR && p->link != P) {
-		xfol(p->link);
-		p = p->cond;
-		if(p == P || (p->mark&FOLL))
-			return;
-		goto loop;
-	}
-	p = p->link;
-	goto loop;
-}
-
-void
-patch(void)
-{
-	long c, vexit;
-	Prog *p, *q;
-	Sym *s;
-	int a;
-
-	if(debug['v'])
-		Bprint(&bso, "%5.2f patch\n", cputime());
-	Bflush(&bso);
-	mkfwd();
-	s = lookup("exit", 0);
-	vexit = s->value;
-	for(p = firstp; p != P; p = p->link) {
-		a = p->as;
-		if(a == ATEXT)
-			curtext = p;
-		if((a == AJSR || a == AJMP || a == ARET) &&
-		   p->to.type != D_BRANCH && p->to.sym != S) {
-			s = p->to.sym;
-			if(s->type != STEXT) {
-				diag("undefined: %s\n%P", s->name, p);
-				s->type = STEXT;
-				s->value = vexit;
-			}
-			p->to.offset = s->value;
-			p->to.type = D_BRANCH;
-		}
-		if(p->to.type != D_BRANCH)
-			continue;
-		c = p->to.offset;
-		for(q = firstp; q != P;) {
-			if(q->forwd != P)
-			if(c >= q->forwd->pc) {
-				q = q->forwd;
-				continue;
-			}
-			if(c == q->pc)
-				break;
-			q = q->link;
-		}
-		if(q == P) {
-			diag("branch out of range %ld\n%P", c, p);
-			p->to.type = D_NONE;
-		}
-		p->cond = q;
-	}
-
-	for(p = firstp; p != P; p = p->link) {
-		if(p->as == ATEXT)
-			curtext = p;
-		if(p->cond != P) {
-			p->cond = brloop(p->cond);
-			if(p->cond != P)
-			if(p->to.type == D_BRANCH)
-				p->to.offset = p->cond->pc;
-		}
-	}
-}
-
-#define	LOG	5
-void
-mkfwd(void)
-{
-	Prog *p;
-	long dwn[LOG], cnt[LOG], i;
-	Prog *lst[LOG];
-
-	for(i=0; i<LOG; i++) {
-		if(i == 0)
-			cnt[i] = 1; else
-			cnt[i] = LOG * cnt[i-1];
-		dwn[i] = 1;
-		lst[i] = P;
-	}
-	i = 0;
-	for(p = firstp; p != P; p = p->link) {
-		if(p->as == ATEXT)
-			curtext = p;
-		i--;
-		if(i < 0)
-			i = LOG-1;
-		p->forwd = P;
-		dwn[i]--;
-		if(dwn[i] <= 0) {
-			dwn[i] = cnt[i];
-			if(lst[i] != P)
-				lst[i]->forwd = p;
-			lst[i] = p;
-		}
-	}
-}
-
-Prog*
-brloop(Prog *p)
-{
-	Prog *q;
-	int c;
-
-	for(c=0; p!=P;) {
-		if(p->as != AJMP)
-			return p;
-		q = p->cond;
-		if(q <= p) {
-			c++;
-			if(q == p || c > 50)
-				break;
-		}
-		p = q;
-	}
-	return P;
-}
-
-long
-atolwhex(char *s)
-{
-	long n;
-	int f;
-
-	n = 0;
-	f = 0;
-	while(*s == ' ' || *s == '\t')
-		s++;
-	if(*s == '-' || *s == '+') {
-		if(*s++ == '-')
-			f = 1;
-		while(*s == ' ' || *s == '\t')
-			s++;
-	}
-	if(s[0]=='0' && s[1]){
-		if(s[1]=='x' || s[1]=='X'){
-			s += 2;
-			for(;;){
-				if(*s >= '0' && *s <= '9')
-					n = n*16 + *s++ - '0';
-				else if(*s >= 'a' && *s <= 'f')
-					n = n*16 + *s++ - 'a' + 10;
-				else if(*s >= 'A' && *s <= 'F')
-					n = n*16 + *s++ - 'A' + 10;
-				else
-					break;
-			}
-		} else
-			while(*s >= '0' && *s <= '7')
-				n = n*8 + *s++ - '0';
-	} else
-		while(*s >= '0' && *s <= '9')
-			n = n*10 + *s++ - '0';
-	if(f)
-		n = -n;
-	return n;
-}
-
-long
-rnd(long v, long r)
-{
-	long c;
-
-	if(r <= 0)
-		return v;
-	v += r - 1;
-	c = v % r;
-	if(c < 0)
-		c += r;
-	v -= c;
-	return v;
-}
--- a/sys/src/cmd/7l/sched.c
+++ /dev/null
@@ -1,18 +1,0 @@
-#include	"l.h"
-
-void
-sched(Prog *p0, Prog *p1)
-{
-#ifdef	CODSCHED
-	Prog *p, *q, *t;
-	int r, a;
-
-	if(debug['X'])
-		Bprint(&bso, "\n");
-#endif
-	if (p0 == P || p0 == p1)
-		return;
-	if(debug['X'])
-		Bprint(&bso, "sched from %P to %P\n", p0, p1);
-}
-
--- a/sys/src/cmd/7l/span.c
+++ /dev/null
@@ -1,584 +1,0 @@
-#include	"l.h"
-
-void
-span(void)
-{
-	Prog *p;
-	Sym *setext;
-	Optab *o;
-	int m;
-	long c;
-
-	if(debug['v'])
-		Bprint(&bso, "%5.2f span\n", cputime());
-	Bflush(&bso);
-	c = INITTEXT;
-	for(p = firstp; p != P; p = p->link) {
-		p->pc = c;
-		o = oplook(p);
-		m = o->size;
-		if(m == 0) {
-			if(p->as == ATEXT) {
-				curtext = p;
-				autosize = p->to.offset + 8;
-				if(p->from.sym != S)
-					p->from.sym->value = c;
-				continue;
-			}
-			diag("zero-width instruction\n%P", p);
-			continue;
-		}
-		c += m;
-	}
-	c = rnd(c, 8);
-
-	setext = lookup("etext", 0);
-	if(setext != S) {
-		setext->value = c;
-		textsize = c - INITTEXT;
-	}
-	if(INITRND)
-		INITDAT = rnd(c, INITRND);
-	if(debug['v'])
-		Bprint(&bso, "tsize = %lux\n", textsize);
-	Bflush(&bso);
-}
-		
-void
-xdefine(char *p, int t, long v)
-{
-	Sym *s;
-
-	s = lookup(p, 0);
-	if(s->type == 0 || s->type == SXREF) {
-		s->type = t;
-		s->value = v;
-	}
-}
-
-vlong		/* BUG? */
-regoff(Adr *a)
-{
-
-	offset = 0;
-	aclass(a);
-	return offset;
-}
-
-/*
- * note that we can't generate every 32 bit constant with MOVQA+MOVQAH, hence the
- * comparison with 0x7fff8000.  offset >= this value gets incorrectly sign extended in
- * the 64 bit register.
- */
-aclass(Adr *a)
-{
-	Sym *s;
-	int t;
-
-	switch(a->type) {
-	case D_NONE:
-		return C_NONE;
-
-	case D_REG:
-		return C_REG;
-
-	case D_FREG:
-		return C_FREG;
-
-	case D_FCREG:
-		return C_FCREG;
-
-	case D_PREG:
-		return C_PREG;
-
-	case D_PCC:
-		return C_PCC;
-
-	case D_OREG:
-		switch(a->name) {
-		case D_EXTERN:
-		case D_STATIC:
-			if(a->sym == 0) {
-				print("null sym external\n");
-				print("%D\n", a);
-				return C_GOK;
-			}
-			t = a->sym->type;
-			if(t == 0 || t == SXREF) {
-				diag("undefined external: %s in %s",
-					a->sym->name, TNAME);
-				a->sym->type = SDATA;
-			}
-			offset = a->sym->value + a->offset - BIG;
-			if(offset >= -BIG && offset < BIG)
-				return C_SEXT;
-			if (offset >= -0x80000000LL && offset < 0x7fff8000LL)
-				return C_LEXT;
-		badoff:
-			diag("offset out of range: %#llux", offset);
-			return C_GOK;
-		case D_AUTO:
-			offset = autosize + a->offset;
-			if(offset >= -BIG && offset < BIG)
-				return C_SAUTO;
-			if (offset >= -0x80000000LL && offset < 0x7fff8000LL)
-				return C_LAUTO;
-			goto badoff;
-		case D_PARAM:
-			offset = autosize + a->offset + 8L;
-			if(offset >= -BIG && offset < BIG)
-				return C_SAUTO;
-			if (offset >= -0x80000000LL && offset < 0x7fff8000LL)
-				return C_LAUTO;
-			goto badoff;
-		case D_NONE:
-			offset = a->offset;
-			if(offset == 0)
-				return C_ZOREG;
-			if(offset >= -BIG && offset < BIG)
-				return C_SOREG;
-			if (offset >= -0x80000000LL && offset < 0x7fff8000LL)
-				return C_LOREG;
-			goto badoff;
-		}
-		return C_GOK;
-
-	case D_CONST:
-		switch(a->name) {
-
-		case D_NONE:
-			offset = a->offset;
-			if(offset > 0) {
-				if(offset <= 0xffLL)
-					return C_BCON;
-				if(offset <= 0x7fffLL)
-					return C_SCON;
-				if((offset & 0xffffLL) == 0 && offset <= 0x7fff0000LL)
-					return C_UCON;
-				if (offset < 0x7fff8000LL)
-					return C_LCON;
-				return C_QCON;
-			}
-			if(offset == 0)
-				return C_ZCON;
-			if(offset >= -0x100LL)
-				return C_NCON;
-			if(offset >= -0x8000LL)
-				return C_SCON;
-			if((offset & 0xffffLL) == 0 && offset >= -0x80000000LL)
-				return C_UCON;
-			if (offset >= -0x80000000LL)
-				return C_LCON;
-			return C_QCON;
-
-		case D_EXTERN:
-		case D_STATIC:
-			s = a->sym;
-			if(s == 0) {
-				print("null sym const\n");
-				print("%D\n", a);
-				return C_GOK;
-			}
-			t = s->type;
-			if(t == 0 || t == SXREF) {
-				diag("undefined external: %s in %s",
-					s->name, TNAME);
-				s->type = SDATA;
-			}
-			if(s->type == STEXT || s->type == SLEAF) {
-				offset = s->value + a->offset;
-				return C_LCON;
-			}
-			offset = s->value + a->offset - BIG;
-			if (offset == 0L) {
-				offset = s->value + a->offset + INITDAT;
-				return C_LCON;		/* botch */
-			}
-			if(offset >= -BIG && offset < BIG && offset != 0L)
-				return C_SECON;
-			if (offset >= -0x80000000LL && offset < 0x7fff8000L && offset != 0LL /*&& offset >= -INITDAT*/)
-				return C_LECON;
-			/*offset = s->value + a->offset + INITDAT;*/
-/*			if (offset >= -BIG && offset < BIG)
-				return C_SCON;
-			if (offset >= -0x80000000LL && offset < 0x7fff8000LL)
-				return C_LCON; */
-			goto badoff;
-			/*return C_QCON;*/
-
-		case D_AUTO:
-			offset = autosize + a->offset;
-			if(offset >= -BIG && offset < BIG)
-				return C_SACON;
-			if (offset >= -0x80000000LL && offset < 0x7fff8000LL)
-				return C_LACON;
-			goto badoff;
-
-		case D_PARAM:
-			offset = autosize + a->offset + 8L;
-			if(offset >= -BIG && offset < BIG)
-				return C_SACON;
-			if (offset >= -0x80000000LL && offset < 0x7fff8000LL)
-				return C_LACON;
-			goto badoff;
-		}
-		return C_GOK;
-
-	case D_BRANCH:
-		return C_SBRA;
-	}
-	return C_GOK;
-}
-
-Optab*
-oplook(Prog *p)
-{
-	int a1, a2, a3, r;
-	char *c1, *c3;
-	Optab *o, *e;
-
-	a1 = p->optab;
-	if(a1)
-		return optab+(a1-1);
-	a1 = p->from.class;
-	if(a1 == 0) {
-		a1 = aclass(&p->from) + 1;
-		p->from.class = a1;
-	}
-	a1--;
-	a3 = p->to.class;
-	if(a3 == 0) {
-		a3 = aclass(&p->to) + 1;
-		p->to.class = a3;
-	}
-	a3--;
-	a2 = C_NONE;
-	if(p->reg != NREG)
-		a2 = C_REG;
-	r = p->as;
-	o = oprange[r].start;
-	if(o == 0) {
-		a1 = opcross[repop[r]][a1][a2][a3];
-		if(a1) {
-			p->optab = a1+1;
-			return optab+a1;
-		}
-		o = oprange[r].stop; /* just generate an error */
-	}
-	e = oprange[r].stop;
-	c1 = xcmp[a1];
-	c3 = xcmp[a3];
-	for(; o<e; o++)
-		if(o->a2 == a2)
-		if(c1[o->a1])
-		if(c3[o->a3]) {
-			p->optab = (o-optab)+1;
-			return o;
-		}
-	diag("illegal combination %A %d %d %d (opcross %d)",
-		p->as, p->from.class-1, a2, a3, a1);
-	if(!debug['a'])
-		prasm(p);
-	o = optab;
-	p->optab = (o-optab)+1;
-	return o;
-}
-
-int
-cmp(int a, int b)
-{
-
-	if(a == b)
-		return 1;
-	switch(a) {
-	case C_QCON:
-		if(b == C_ZCON || b == C_BCON || b == C_NCON || b == C_SCON || b == C_UCON || b == C_LCON)
-			return 1;
-		break;
-	case C_LCON:
-		if(b == C_ZCON || b == C_BCON || b == C_NCON || b == C_SCON || b == C_UCON)
-			return 1;
-		break;
-	case C_UCON:
-		if(b == C_ZCON)
-			return 1;
-		break;
-	case C_SCON:
-		if(b == C_ZCON || b == C_BCON || b == C_NCON)
-			return 1;
-		break;
-	case C_BCON:
-		if(b == C_ZCON)
-			return 1;
-		break;
-	case C_LACON:
-		if(b == C_SACON)
-			return 1;
-		break;
-	case C_LBRA:
-		if(b == C_SBRA)
-			return 1;
-		break;
-	case C_LEXT:
-		if(b == C_SEXT)
-			return 1;
-		break;
-	case C_LAUTO:
-		if(b == C_SAUTO)
-			return 1;
-		break;
-	case C_REG:
-/*		if(b == C_ZCON)
-			return 1; */
-		break;
-	case C_LOREG:
-		if(b == C_ZOREG || b == C_SOREG)
-			return 1;
-		break;
-	case C_SOREG:
-		if(b == C_ZOREG)
-			return 1;
-		break;
-	}
-	return 0;
-}
-
-int
-ocmp(void *a1, void *a2)
-{
-	Optab *p1, *p2;
-	int n;
-
-	p1 = a1;
-	p2 = a2;
-	n = p1->as - p2->as;
-	if(n)
-		return n;
-	n = p1->a1 - p2->a1;
-	if(n)
-		return n;
-	n = p1->a2 - p2->a2;
-	if(n)
-		return n;
-	n = p1->a3 - p2->a3;
-	if(n)
-		return n;
-	return 0;
-}
-
-void
-buildop(void)
-{
-	int i, n, r;
-
-	for(i=0; i<32; i++)
-		for(n=0; n<32; n++)
-			xcmp[i][n] = cmp(n, i);
-	for(n=0; optab[n].as != AXXX; n++)
-		;
-	qsort(optab, n, sizeof(optab[0]), ocmp);
-	for(i=0; i<n; i++) {
-		r = optab[i].as;
-		oprange[r].start = optab+i;
-		while(optab[i].as == r)
-			i++;
-		oprange[r].stop = optab+i;
-		i--;
-		
-		switch(r)
-		{
-		default:
-			diag("unknown op in build: %A", r);
-			errorexit();
-		case AADDQ:
-			oprange[AS4ADDQ] = oprange[r];
-			oprange[AS8ADDQ] = oprange[r];
-			oprange[ASUBQ] = oprange[r];
-			oprange[AS4SUBQ] = oprange[r];
-			oprange[AS8SUBQ] = oprange[r];
-			break;
-		case AADDL:
-			oprange[AADDLV] = oprange[r];
-			oprange[AS4ADDL] = oprange[r];
-			oprange[AS8ADDL] = oprange[r];
-			oprange[AADDQV] = oprange[r];
-			oprange[ASUBQV] = oprange[r];
-			oprange[ASUBL] = oprange[r];
-			oprange[ASUBLV] = oprange[r];
-			oprange[AS4SUBL] = oprange[r];
-			oprange[AS8SUBL] = oprange[r];
-			break;
-		case AAND:
-			oprange[AANDNOT] = oprange[r];
-			oprange[AOR] = oprange[r];
-			oprange[AORNOT] = oprange[r];
-			oprange[AXOR] = oprange[r];
-			oprange[AXORNOT] = oprange[r];
-			break;
-		case AMULQ:
-			oprange[ACMPEQ] = oprange[r];
-			oprange[ACMPGT] = oprange[r];
-			oprange[ACMPGE] = oprange[r];
-			oprange[ACMPUGT] = oprange[r];
-			oprange[ACMPUGE] = oprange[r];
-			oprange[ACMPBLE] = oprange[r];
-			oprange[ACMOVEQ] = oprange[r];
-			oprange[ACMOVNE] = oprange[r];
-			oprange[ACMOVLT] = oprange[r];
-			oprange[ACMOVGE] = oprange[r];
-			oprange[ACMOVLE] = oprange[r];
-			oprange[ACMOVGT] = oprange[r];
-			oprange[ACMOVLBS] = oprange[r];
-			oprange[ACMOVLBC] = oprange[r];
-			oprange[AMULL] = oprange[r];
-			oprange[AMULLV] = oprange[r];
-			oprange[AMULQV] = oprange[r];
-			oprange[AUMULH] = oprange[r];
-			oprange[ASLLQ] = oprange[r];
-			oprange[ASRLQ] = oprange[r];
-			oprange[ASRAQ] = oprange[r];
-			oprange[AEXTBL] = oprange[r];
-			oprange[AEXTWL] = oprange[r];
-			oprange[AEXTLL] = oprange[r];
-			oprange[AEXTQL] = oprange[r];
-			oprange[AEXTWH] = oprange[r];
-			oprange[AEXTLH] = oprange[r];
-			oprange[AEXTQH] = oprange[r];
-			oprange[AINSBL] = oprange[r];
-			oprange[AINSWL] = oprange[r];
-			oprange[AINSLL] = oprange[r];
-			oprange[AINSQL] = oprange[r];
-			oprange[AINSWH] = oprange[r];
-			oprange[AINSLH] = oprange[r];
-			oprange[AINSQH] = oprange[r];
-			oprange[AMSKBL] = oprange[r];
-			oprange[AMSKWL] = oprange[r];
-			oprange[AMSKLL] = oprange[r];
-			oprange[AMSKQL] = oprange[r];
-			oprange[AMSKWH] = oprange[r];
-			oprange[AMSKLH] = oprange[r];
-			oprange[AMSKQH] = oprange[r];
-			oprange[AZAP] = oprange[r];
-			oprange[AZAPNOT] = oprange[r];
-			break;
-		case ABEQ:
-			oprange[ABNE] = oprange[r];
-			oprange[ABGE] = oprange[r];
-			oprange[ABLE] = oprange[r];
-			oprange[ABGT] = oprange[r];
-			oprange[ABLT] = oprange[r];
-			break;
-		case AFBEQ:
-			oprange[AFBNE] = oprange[r];
-			oprange[AFBGE] = oprange[r];
-			oprange[AFBLE] = oprange[r];
-			oprange[AFBGT] = oprange[r];
-			oprange[AFBLT] = oprange[r];
-			break;
-		case AMOVQ:
-			oprange[AMOVL] = oprange[r];
-			oprange[AMOVLU] = oprange[r];
-			oprange[AMOVQU] = oprange[r];
-			oprange[AMOVA] = oprange[r];
-			oprange[AMOVAH] = oprange[r];
-
-			oprange[AMOVBU] = oprange[r];
-			oprange[AMOVWU] = oprange[r];
-			oprange[AMOVB] = oprange[r];
-			oprange[AMOVW] = oprange[r];
-			break;
-		case AMOVT:
-			oprange[AMOVS] = oprange[r];
-			break;
-		case AADDT:
-			oprange[AADDS] = oprange[r];
-			oprange[ACMPTEQ] = oprange[r];
-			oprange[ACMPTGT] = oprange[r];
-			oprange[ACMPTGE] = oprange[r];
-			oprange[ACMPTUN] = oprange[r];
-			oprange[ADIVS] = oprange[r];
-			oprange[ADIVT] = oprange[r];
-			oprange[AMULS] = oprange[r];
-			oprange[AMULT] = oprange[r];
-			oprange[ASUBS] = oprange[r];
-			oprange[ASUBT] = oprange[r];
-			oprange[ACPYS] = oprange[r];
-			oprange[ACPYSN] = oprange[r];
-			oprange[ACPYSE] = oprange[r];
-			oprange[ACVTLQ] = oprange[r];
-			oprange[ACVTQL] = oprange[r];
-			oprange[AFCMOVEQ] = oprange[r];
-			oprange[AFCMOVNE] = oprange[r];
-			oprange[AFCMOVLT] = oprange[r];
-			oprange[AFCMOVGE] = oprange[r];
-			oprange[AFCMOVLE] = oprange[r];
-			oprange[AFCMOVGT] = oprange[r];
-			break;
-		case ACVTTQ:
-			oprange[ACVTQT] = oprange[r];
-			oprange[ACVTTS] = oprange[r];
-			oprange[ACVTQS] = oprange[r];
-			break;
-		case AJMP:
-		case AJSR:
-			break;
-		case ACALL_PAL:
-			break;
-		case AMOVQL:
-			oprange[AMOVLL] = oprange[r];
-			break;
-		case AMOVQC:
-			oprange[AMOVLC] = oprange[r];
-			break;
-		case AMOVQP:
-			oprange[AMOVLP] = oprange[r];
-			break;
-		case AREI:
-			oprange[AMB] = oprange[r];
-			oprange[ATRAPB] = oprange[r];
-			break;
-		case AFETCH:
-			oprange[AFETCHM] = oprange[r];
-			break;
-		case AWORD:
-		case ATEXT:
-			break;
-		}
-	}
-}
-
-void
-buildrep(int x, int as)
-{
-	Opcross *p;
-	Optab *e, *s, *o;
-	int a1, a2, a3, n;
-
-	if(C_NONE != 0 || C_REG != 1 || C_GOK >= 32 || x >= nelem(opcross)) {
-		diag("assumptions fail in buildrep");
-		errorexit();
-	}
-	repop[as] = x;
-	p = (opcross + x);
-	s = oprange[as].start;
-	e = oprange[as].stop;
-	for(o=e-1; o>=s; o--) {
-		n = o-optab;
-		for(a2=0; a2<2; a2++) {
-			if(a2) {
-				if(o->a2 == C_NONE)
-					continue;
-			} else
-				if(o->a2 != C_NONE)
-					continue;
-			for(a1=0; a1<32; a1++) {
-				if(!xcmp[a1][o->a1])
-					continue;
-				for(a3=0; a3<32; a3++)
-					if(xcmp[a3][o->a3])
-						(*p)[a1][a2][a3] = n;
-			}
-		}
-	}
-	oprange[as].start = 0;
-}
--- a/sys/src/cmd/gs/alpha.h
+++ /dev/null
@@ -1,44 +1,0 @@
-/* Parameters derived from machine and compiler architecture */
-
-	 /* ---------------- Scalar alignments ---------------- */
-
-#define ARCH_ALIGN_SHORT_MOD 2
-#define ARCH_ALIGN_INT_MOD 4
-#define ARCH_ALIGN_LONG_MOD 4
-#define ARCH_ALIGN_PTR_MOD 4
-#define ARCH_ALIGN_FLOAT_MOD 4
-#define ARCH_ALIGN_DOUBLE_MOD 8
-#define ARCH_ALIGN_STRUCT_MOD 4
-
-	 /* ---------------- Scalar sizes ---------------- */
-
-#define ARCH_LOG2_SIZEOF_SHORT 1
-#define ARCH_LOG2_SIZEOF_INT 2
-#define ARCH_LOG2_SIZEOF_LONG 2
-#define ARCH_LOG2_SIZEOF_LONG_LONG 3
-#define ARCH_SIZEOF_PTR 4
-#define ARCH_SIZEOF_FLOAT 4
-#define ARCH_SIZEOF_DOUBLE 8
-#define ARCH_FLOAT_MANTISSA_BITS 24
-#define ARCH_DOUBLE_MANTISSA_BITS 53
-
-	 /* ---------------- Unsigned max values ---------------- */
-
-#define ARCH_MAX_UCHAR ((unsigned char)0xff + (unsigned char)0)
-#define ARCH_MAX_USHORT ((unsigned short)0xffff + (unsigned short)0)
-#define ARCH_MAX_UINT ((unsigned int)~0 + (unsigned int)0)
-#define ARCH_MAX_ULONG ((unsigned long)~0L + (unsigned long)0)
-
-	 /* ---------------- Cache sizes ---------------- */
-
-#define ARCH_CACHE1_SIZE 65536
-#define ARCH_CACHE2_SIZE 131072
-
-	 /* ---------------- Miscellaneous ---------------- */
-
-#define ARCH_IS_BIG_ENDIAN 0
-#define ARCH_PTRS_ARE_SIGNED 0
-#define ARCH_FLOATS_ARE_IEEE 1
-#define ARCH_ARITH_RSHIFT 2
-#define ARCH_CAN_SHIFT_FULL_LONG 1
-#define ARCH_DIV_NEG_POS_TRUNCATES 1
--- a/sys/src/cmd/gs/arch.h
+++ b/sys/src/cmd/gs/arch.h
@@ -8,8 +8,6 @@
 #include "spim.h"
 #elif Tpower
 #include "mips.h"
-#elif Talpha
-#include "alpha.h"
 #elif Tarm
 #include "arm.h"
 #elif Tamd64
--- a/sys/src/cmd/gs/default.alpha.h
+++ /dev/null
@@ -1,44 +1,0 @@
-/* Parameters derived from machine and compiler architecture */
-
-	 /* ---------------- Scalar alignments ---------------- */
-
-#define ARCH_ALIGN_SHORT_MOD 2
-#define ARCH_ALIGN_INT_MOD 4
-#define ARCH_ALIGN_LONG_MOD 4
-#define ARCH_ALIGN_PTR_MOD 4
-#define ARCH_ALIGN_FLOAT_MOD 4
-#define ARCH_ALIGN_DOUBLE_MOD 8
-#define ARCH_ALIGN_STRUCT_MOD 4
-
-	 /* ---------------- Scalar sizes ---------------- */
-
-#define ARCH_LOG2_SIZEOF_SHORT 1
-#define ARCH_LOG2_SIZEOF_INT 2
-#define ARCH_LOG2_SIZEOF_LONG 2
-#define ARCH_LOG2_SIZEOF_LONG_LONG 3
-#define ARCH_SIZEOF_PTR 4
-#define ARCH_SIZEOF_FLOAT 4
-#define ARCH_SIZEOF_DOUBLE 8
-#define ARCH_FLOAT_MANTISSA_BITS 24
-#define ARCH_DOUBLE_MANTISSA_BITS 53
-
-	 /* ---------------- Unsigned max values ---------------- */
-
-#define ARCH_MAX_UCHAR ((unsigned char)0xff + (unsigned char)0)
-#define ARCH_MAX_USHORT ((unsigned short)0xffff + (unsigned short)0)
-#define ARCH_MAX_UINT ((unsigned int)~0 + (unsigned int)0)
-#define ARCH_MAX_ULONG ((unsigned long)~0L + (unsigned long)0)
-
-	 /* ---------------- Cache sizes ---------------- */
-
-#define ARCH_CACHE1_SIZE 65536
-#define ARCH_CACHE2_SIZE 131072
-
-	 /* ---------------- Miscellaneous ---------------- */
-
-#define ARCH_IS_BIG_ENDIAN 0
-#define ARCH_PTRS_ARE_SIGNED 0
-#define ARCH_FLOATS_ARE_IEEE 1
-#define ARCH_ARITH_RSHIFT 2
-#define ARCH_CAN_SHIFT_FULL_LONG 1
-#define ARCH_DIV_NEG_POS_TRUNCATES 1
--- a/sys/src/cmd/pcc.c
+++ b/sys/src/cmd/pcc.c
@@ -16,7 +16,6 @@
 	{"68020",	"2c", "2l", "2", "2.out"},
 	{"arm",		"5c", "5l", "5", "5.out"},
 	{"amd64",	"6c", "6l", "6", "6.out"},
-	{"alpha",	"7c", "7l", "7", "7.out"},
 	{"386",		"8c", "8l", "8", "8.out"},
 	{"power64",	"9c", "9l", "9", "9.out"},
 	{"sparc",	"kc", "kl", "k", "k.out"},
--- a/sys/src/cmd/prof.c
+++ b/sys/src/cmd/prof.c
@@ -335,7 +335,6 @@
 {
 	"386",		"8.out",
 	"68020",		"2.out",
-	"alpha",		"7.out",
 	"amd64",	"6.out",
 	"arm",		"5.out",
 	"mips",		"v.out",
--- a/sys/src/cmd/python/pyconfig.h
+++ b/sys/src/cmd/python/pyconfig.h
@@ -17,7 +17,7 @@
 
 typedef struct Threadarg Threadarg;
 
-#if defined(T386) || defined(Talpha) || defined(Tarm) || defined(Tpower) || defined(Tamd64) || defined(Tspim)
+#if defined(T386) || defined(Tarm) || defined(Tpower) || defined(Tamd64) || defined(Tspim)
 #undef WORDS_BIGENDIAN
 #elif defined(Tmips) || defined(Tsparc)
 #define WORDS_BIGENDIAN
--- a/sys/src/libc/alpha/_seek.c
+++ /dev/null
@@ -1,14 +1,0 @@
-#include <u.h>
-#include <libc.h>
-
-extern	int	_seek(vlong*, int, vlong, int);
-
-vlong
-seek(int fd, vlong o, int p)
-{
-	vlong l;
-
-	if(_seek(&l, fd, o, p) < 0)
-		l = -1LL;
-	return l;
-}
--- a/sys/src/libc/alpha/argv0.s
+++ /dev/null
@@ -1,4 +1,0 @@
-GLOBL	argv0(SB), $4
-GLOBL	_tos(SB), $4
-GLOBL	_privates(SB), $4
-GLOBL	_nprivates(SB), $4
--- a/sys/src/libc/alpha/atom.s
+++ /dev/null
@@ -1,67 +1,0 @@
-TEXT	ainc(SB),$-8	/* long ainc(long *); */
-	MOVQ	R0, R1			/* p */
-inc1:
-	MOVLL	(R1), R2		/* *p */
-	ADDL	$1, R2
-	MOVQ	R2, R0			/* copy to return */
-	MOVLC	R2, (R1)		/* (*p)++ */
-	BEQ	R2, inc1		/* write failed, retry */
-	RET
-
-TEXT	adec(SB),$-8	/* long ainc(long *); */
-	MOVQ	R0, R1			/* p */
-dec1:
-	MOVLL	(R1), R2		/* *p */
-	SUBL	$1, R2
-	MOVQ	R2, R0			/* copy to return */
-	MOVLC	R2, (R1)		/* (*p)++ */
-	BEQ	R2, dec1		/* write failed, retry */
-	RET
-
-TEXT	_xinc(SB), $-8
-	MOVQ	R0, R1			/* p */
-xinc1:
-	MOVLL	(R1), R0		/* *p */
-	ADDL	$1, R0
-	MOVLC	R0, (R1)		/* (*p)++ */
-	BEQ	R0, xinc1		/* write failed, retry */
-	RET
-
-TEXT	_xdec(SB), $-8
-	MOVQ	R0, R1			/* p */
-xdec1:
-	MOVLL	(R1), R0		/* *p */
-	SUBL	$1, R0
-	MOVQ	R0, R2
-	MOVLC	R2, (R1)		/* --(*p) */
-	BEQ	R2, xdec1		/* write failed, retry */
-	RET
-
-TEXT	cas(SB), $-8
-TEXT	casp(SB), $-8
-	MOVQ	R0, R1	/* p */
-	MOVL	old+4(FP), R2
-	MOVL	new+8(FP), R3
-	MOVLL	(R1), R0
-	CMPEQ	R0, R2, R4
-	BEQ	R4, fail		/* if R0 != [sic] R2, goto fail */
-	MOVQ	R3, R0
-	MOVLC	R0, (R1)
-	RET
-fail:
-	MOVL	$0, R0
-	RET
-
-TEXT	loadlink(SB), $-8
-	MOVLL	(R0), R0
-	RET
-
-TEXT	storecond(SB), $-8
-	MOVW	val+4(FP), R1
-	MOVLC	R1, (R0)
-	BEQ	R1, storecondfail	/* write failed */
-	MOVW	$1, R0
-	RET
-storecondfail:
-	MOVW	$0, R0
-	RET
--- a/sys/src/libc/alpha/cycles.c
+++ /dev/null
@@ -1,7 +1,0 @@
-#include <u.h>
-#include <libc.h>
-
-void	cycles(uvlong*u)
-{
-	*u = 0LL;
-}
--- a/sys/src/libc/alpha/divl.s
+++ /dev/null
@@ -1,189 +1,0 @@
-/*
- *	ulong
- *	_udiv(ulong num, ulong den)
- *	{
- *		int i;
- *		ulong quo;
- *
- *		if(den == 0)
- *			*(ulong*)-1 = 0;
- *		quo = num;
- *		if(quo > 1<<(32-1))
- *			quo = 1<<(32-1);
- *		for(i=0; den<quo; i++)
- *			den <<= 1;
- *		quo = 0;
- *		for(; i>=0; i--) {
- *			quo <<= 1;
- *			if(num >= den) {
- *				num -= den;
- *				quo |= 1;
- *			}
- *			den >>= 1;
- *		}
- *		return quo::num;
- *	}
- */
-
-#define	NOPROF	1
-
-/*
- * calling sequence:
- *	num: 8(R30)
- *	den: 12(R30)
- * returns
- *	quo: 8(R30)
- *	rem: 12(R30)
- */
-TEXT	_udivmodl(SB), NOPROF, $-8
-
-	MOVQ	$-1, R11
-	SLLQ	$31, R11			/* (1<<31) in canonical form */
-	MOVL	8(R30), R23	/* numerator */
-	MOVL	12(R30), R10	/* denominator */
-	BNE	R10, udm20
-	MOVQ	R31, -1(R31)	/* fault -- divide by zero; todo: use gentrap? */
-udm20:
-	MOVQ	R23, R12
-	BGE	R12, udm34
-	MOVQ	R11, R12
-udm34:
-	MOVQ	R31, R11
-udm38:
-	CMPUGE	R10, R12, R24
-	BNE	R24, udm54
-	SLLL	$1, R10
-	ADDQ	$1, R11
-	JMP	udm38
-udm54:
-	MOVQ	R31, R12
-udm58:
-	BLT	R11, udm8c
-	SLLL		$1, R12
-	CMPUGE	R23, R10, R24
-	BEQ		R24, udm7c
-	SUBL		R10, R23
-	OR		$1, R12
-udm7c:
-	SRLL		$1, R10
-	SUBQ	$1, R11
-	JMP	udm58
-udm8c:
-	MOVL	R12, 8(R30)	/* quotient */
-	MOVL	R23, 12(R30)	/* remainder */
-	RET
-
-/*
- * save working registers
- * and bring in num/den parameters
- */
-TEXT	_unsargl(SB), NOPROF, $-8
-	MOVQ	R10, 24(R30)
-	MOVQ	R11, 32(R30)
-	MOVQ	R12, 40(R30)
-	MOVQ	R23, 48(R30)
-	MOVQ	R24, 56(R30)
-
-	MOVL	R27, 8(R30)
-	MOVL	72(R30), R27
-	MOVL	R27, 12(R30)
-
-	RET
-
-/*
- * save working registers
- * and bring in absolute value
- * of num/den parameters
- */
-TEXT	_absargl(SB), NOPROF, $-8
-	MOVQ	R10, 24(R30)
-	MOVQ	R11, 32(R30)
-	MOVQ	R12, 40(R30)
-	MOVQ	R23, 48(R30)
-	MOVQ	R24, 56(R30)
-
-	MOVL	R27, 64(R30)
-	BGE	R27, ab1
-	SUBL	R27, R31, R27
-ab1:
-	MOVL	R27, 8(R30)	/* numerator */
-
-	MOVL	72(R30), R27
-	BGE	R27, ab2
-	SUBL	R27, R31, R27
-ab2:
-	MOVL	R27, 12(R30)	/* denominator */
-	RET
-
-/*
- * restore registers and
- * return to original caller
- * answer is in R27
- */
-TEXT	_retargl(SB), NOPROF, $-8
-	MOVQ	24(R30), R10
-	MOVQ	32(R30), R11
-	MOVQ	40(R30), R12
-	MOVQ	48(R30), R23
-	MOVQ	56(R30), R24
-	MOVL	0(R30), R26
-
-	ADDQ	$64, R30
-	RET			/* back to main sequence */
-
-TEXT	_divl(SB), NOPROF, $-8
-	SUBQ	$64, R30	/* 5 reg save, 2 parameters, link */
-	MOVL	R26, 0(R30)
-
-	JSR	_absargl(SB)
-	JSR	_udivmodl(SB)
-	MOVL	8(R30), R27
-
-	MOVL	64(R30), R10	/* clean up the sign */
-	MOVL	72(R30), R11
-	XOR	R11, R10
-	BGE	R10, div1
-	SUBL	R27, R31, R27
-div1:
-
-	JSR	_retargl(SB)
-	RET			/* not executed */
-
-TEXT	_divlu(SB), NOPROF, $-8
-	SUBQ	$64, R30	/* 5 reg save, 2 parameters, link */
-	MOVL	R26, 0(R30)
-
-	JSR	_unsargl(SB)
-	JSR	_udivmodl(SB)
-	MOVL	8(R30), R27
-
-	JSR	_retargl(SB)
-	RET			/* not executed */
-
-TEXT	_modl(SB), NOPROF, $-8
-	SUBQ	$64, R30	/* 5 reg save, 2 parameters, link */
-	MOVL	R26, 0(R30)
-
-	JSR	_absargl(SB)
-	JSR	_udivmodl(SB)
-	MOVL	12(R30), R27
-
-	MOVL	64(R30), R10	/* clean up the sign */
-	BGE	R10, div2
-	SUBL	R27, R31, R27
-div2:
-
-	JSR	_retargl(SB)
-	RET			/* not executed */
-
-TEXT	_modlu(SB), NOPROF, $-8
-	SUBQ	$64, R30	/* 5 reg save, 2 parameters, link */
-	MOVL	R26, 0(R30)
-
-	JSR	_unsargl(SB)
-	JSR	_udivmodl(SB)
-	MOVL	12(R30), R27
-
-	JSR	_retargl(SB)
-	RET			/* not executed */
-
--- a/sys/src/libc/alpha/divq.s
+++ /dev/null
@@ -1,191 +1,0 @@
-/*
- *	uvlong
- *	_udiv(uvlong num, uvlong den)
- *	{
- *		int i;
- *		uvlong quo;
- *
- *		if(den == 0)
- *			*(ulong*)-1 = 0;
- *		quo = num;
- *		if(quo > 1<<(64-1))
- *			quo = 1<<(64-1);
- *		for(i=0; den<quo; i++)
- *			den <<= 1;
- *		quo = 0;
- *		for(; i>=0; i--) {
- *			quo <<= 1;
- *			if(num >= den) {
- *				num -= den;
- *				quo |= 1;
- *			}
- *			den >>= 1;
- *		}
- *		return quo::num;
- *	}
- */
-
-#define	NOPROF	1
-
-/*
- * calling sequence:
- *	num: 8(R30)
- *	den: 16(R30)
- * returns
- *	quo: 8(R30)
- *	rem: 16(R30)
- */
-TEXT	_udivmodq(SB), NOPROF, $-8
-
-	MOVQ	$1, R11
-	SLLQ	$63, R11
-	MOVQ	8(R30), R23	/* numerator */
-	MOVQ	16(R30), R10	/* denominator */
-	BNE	R10, udm20
-	MOVQ	R31, -1(R31)	/* fault -- divide by zero; todo: use gentrap? */
-udm20:
-	MOVQ	R23, R12
-	BGE	R12, udm34
-	MOVQ	R11, R12
-udm34:
-	MOVQ	R31, R11
-udm38:
-	CMPUGE	R10, R12, R24
-	BNE	R24, udm54
-	SLLQ	$1, R10
-	ADDQ	$1, R11
-	JMP	udm38
-udm54:
-	MOVQ	R31, R12
-udm58:
-	BLT	R11, udm8c
-	SLLQ	$1, R12
-	CMPUGE	R23, R10, R24
-	BEQ	R24, udm7c
-	SUBQ	R10, R23
-	OR	$1, R12
-udm7c:
-	SRLQ	$1, R10
-	SUBQ	$1, R11
-	JMP	udm58
-udm8c:
-	MOVQ	R12, 8(R30)	/* quotient */
-	MOVQ	R23, 16(R30)	/* remainder */
-	RET
-
-/*
- * save working registers
- * and bring in num/den parameters
- */
-TEXT	_unsargq(SB), NOPROF, $-8
-	MOVQ	R10, 24(R30)
-	MOVQ	R11, 32(R30)
-	MOVQ	R12, 40(R30)
-	MOVQ	R23, 48(R30)
-	MOVQ	R24, 56(R30)
-
-	MOVQ	R27, 8(R30)
-	MOVQ	72(R30), R27
-	MOVQ	R27, 16(R30)
-
-MOVQ	(R30), R10	/* debug */
-	RET
-
-/*
- * save working registers
- * and bring in absolute value
- * of num/den parameters
- */
-TEXT	_absargq(SB), NOPROF, $-8
-	MOVQ	R10, 24(R30)
-	MOVQ	R11, 32(R30)
-	MOVQ	R12, 40(R30)
-	MOVQ	R23, 48(R30)
-	MOVQ	R24, 56(R30)
-
-	MOVQ	R27, 64(R30)
-	BGE	R27, ab1
-	SUBQ	R27, R31, R27
-ab1:
-	MOVQ	R27, 8(R30)	/* numerator */
-
-	MOVQ	72(R30), R27
-	BGE	R27, ab2
-	SUBQ	R27, R31, R27
-ab2:
-	MOVQ	R27, 16(R30)	/* denominator */
-MOVQ	(R30), R10	/* debug */
-	RET
-
-/*
- * restore registers and
- * return to original caller
- * answer is in R27
- */
-TEXT	_retargq(SB), NOPROF, $-8
-	MOVQ	24(R30), R10
-	MOVQ	32(R30), R11
-	MOVQ	40(R30), R12
-	MOVQ	48(R30), R23
-	MOVQ	56(R30), R24
-	MOVL	0(R30), R26
-
-	ADDQ	$64, R30
-	RET			/* back to main sequence */
-
-TEXT	_divq(SB), NOPROF, $-8
-	SUBQ	$64, R30	/* 5 reg save, 2 parameters, link */
-	MOVQ	R26, 0(R30)
-
-	JSR	_absargq(SB)
-	JSR	_udivmodq(SB)
-	MOVQ	8(R30), R27
-
-	MOVQ	64(R30), R10	/* clean up the sign */
-	MOVQ	72(R30), R11
-	XOR	R11, R10
-	BGE	R10, div1
-	SUBQ	R27, R31, R27
-div1:
-
-	JSR	_retargq(SB)
-	RET			/* not executed */
-
-TEXT	_divqu(SB), NOPROF, $-8
-	SUBQ	$64, R30	/* 5 reg save, 2 parameters, link */
-	MOVQ	R26, 0(R30)
-
-	JSR	_unsargq(SB)
-	JSR	_udivmodq(SB)
-	MOVQ	8(R30), R27
-
-	JSR	_retargq(SB)
-	RET			/* not executed */
-
-TEXT	_modq(SB), NOPROF, $-8
-	SUBQ	$64, R30	/* 5 reg save, 2 parameters, link */
-	MOVQ	R26, 0(R30)
-
-	JSR	_absargq(SB)
-	JSR	_udivmodq(SB)
-	MOVQ	16(R30), R27
-
-	MOVQ	64(R30), R10	/* clean up the sign */
-	BGE	R10, div2
-	SUBQ	R27, R31, R27
-div2:
-
-	JSR	_retargq(SB)
-	RET			/* not executed */
-
-TEXT	_modqu(SB), NOPROF, $-8
-	SUBQ	$64, R30	/* 5 reg save, 2 parameters, link */
-	MOVQ	R26, 0(R30)
-
-	JSR	_unsargq(SB)
-	JSR	_udivmodq(SB)
-	MOVQ	16(R30), R27
-
-	JSR	_retargq(SB)
-	RET			/* not executed */
-
--- a/sys/src/libc/alpha/getcallerpc.s
+++ /dev/null
@@ -1,4 +1,0 @@
-TEXT	getcallerpc(SB), $-8
-	MOVL	0(SP), R0
-	RET
-
--- a/sys/src/libc/alpha/getfcr.s
+++ /dev/null
@@ -1,57 +1,0 @@
-#define	EXCB	WORD	$0x60000400		/* until 7a/7l catch up */
-
-TEXT	getfsr(SB), $8
-	EXCB
-	MOVT	FPCR, F0
-	EXCB
-	MOVT	F0, tmp-8(SP)
-	MOVL	tmp-4(SP), R1
-	MOVQ	$0x01e00000, R2
-	AND		R2, R1, R0
-	RET
-
-TEXT	setfsr(SB), $8
-	MOVQ	$0x01e00000, R2
-	EXCB
-	MOVT	FPCR, F0
-	EXCB
-	MOVT	F0, tmp-8(SP)
-	MOVL	tmp-4(SP), R1
-	ANDNOT	R2, R1, R3
-	AND		R2, R0, R4
-	OR		R3, R4, R5
-	MOVL	R5, tmp-4(SP)
-	MOVT	tmp-8(SP), F0
-	EXCB
-	MOVT	F0, FPCR
-	EXCB
-	RET
-
-TEXT	getfcr(SB), $8
-	EXCB
-	MOVT	FPCR, F0
-	EXCB
-	MOVT	F0, tmp-8(SP)
-	MOVL	tmp-4(SP), R1
-	MOVQ	$0x700c0000, R2
-	AND		R2, R1, R0
-	XOR		R2, R0
-	RET
-
-TEXT	setfcr(SB), $8
-	MOVQ	$0x700c0000, R2
-	XOR		R2, R0
-	EXCB
-	MOVT	FPCR, F0
-	EXCB
-	MOVT	F0, tmp-8(SP)
-	MOVL	tmp-4(SP), R1
-	ANDNOT	R2, R1, R3
-	AND		R2, R0, R4
-	OR		R3, R4, R5
-	MOVL	R5, tmp-4(SP)
-	MOVT	tmp-8(SP), F0
-	EXCB
-	MOVT	F0, FPCR
-	EXCB
-	RET
--- a/sys/src/libc/alpha/main9.s
+++ /dev/null
@@ -1,27 +1,0 @@
-#define NPRIVATES	16
-
-TEXT	_main(SB), 1, $(16 + NPRIVATES*4)
-
-	MOVQ	$setSB(SB), R29
-	MOVL	R0, _tos(SB)
-
-	MOVQ	$p-64(SP),R1
-	MOVL	R1,_privates+0(SB)
-	MOVQ	$16,R1
-	MOVL	R1,_nprivates+0(SB)
-
-	MOVL	inargc-8(FP), R0
-	MOVL	$inargv-4(FP), R1
-	MOVL	R0, 8(R30)
-	MOVL	R1, 12(R30)
-	JSR	main(SB)
-loop:
-	MOVL	$_exitstr<>(SB), R0
-	MOVL	R0, 8(R30)
-	JSR	exits(SB)
-	MOVQ	$_divq(SB), R31		/* force loading of divq */
-	MOVQ	$_divl(SB), R31			/* force loading of divl */
-	JMP	loop
-
-DATA	_exitstr<>+0(SB)/4, $"main"
-GLOBL	_exitstr<>+0(SB), $5
--- a/sys/src/libc/alpha/main9p.s
+++ /dev/null
@@ -1,38 +1,0 @@
-#define NPRIVATES	16
-
-TEXT	_mainp(SB), 1, $16
-
-	MOVQ	$setSB(SB), R29
-	MOVL	R0, _tos(SB)
-
-	MOVQ	$p-64(SP),R1
-	MOVL	R1,_privates+0(SB)
-	MOVQ	$16,R1
-	MOVL	R1,_nprivates+0(SB)
-	JSR	_profmain(SB)
-	MOVL	__prof+4(SB), R0
-	MOVL	R0, __prof+0(SB)
-	MOVL	inargc-4(FP), R0
-	MOVL	$inargv+0(FP), R1
-	MOVL	R0, 8(R30)
-	MOVL	R1, 12(R30)
-	JSR	main(SB)
-loop:
-	MOVQ	$exits<>(SB), R0
-	MOVL	R0, 8(R30)
-	JSR	exits(SB)
-	MOVQ	$_divq(SB), R31		/* force loading of divq */
-	MOVQ	$_divl(SB), R31		/* force loading of divl */
-	MOVQ	$_profin(SB), R31	/* force loading of profile */
-	JMP	loop
-
-TEXT	_saveret(SB), 1, $0
-TEXT	_savearg(SB), 1, $0
-	RET
-
-TEXT	_callpc(SB), 1, $0
-	MOVL	argp-8(FP), R0
-	RET
-
-DATA	exits<>+0(SB)/4, $"main"
-GLOBL	exits<>+0(SB), $5
--- a/sys/src/libc/alpha/memmove.s
+++ /dev/null
@@ -1,201 +1,0 @@
-#define QUAD	8
-#define ALIGN	64
-#define BLOCK	64
-
-TEXT memmove(SB), $0
-_memmove:
-	MOVL	from+4(FP), R7
-	MOVL	n+8(FP), R10
-	MOVQ	R0, R6
-
-	CMPUGE	R7, R0, R5
-	BNE	R5, _forward
-
-	MOVQ	R6, R8			/* end to address */
-	ADDL	R10, R6, R6		/* to+n */
-	ADDL	R10, R7, R7		/* from+n */
-
-	CMPUGE	$ALIGN, R10, R1		/* need at least ALIGN bytes */
-	BNE	R1, _b1tail
-
-_balign:
-	AND	$(ALIGN-1), R6, R1
-	BEQ	R1, _baligned
-
-	MOVBU	-1(R7), R2
-	ADDL	$-1, R6, R6
-	MOVB	R2, (R6)
-	ADDL	$-1, R7, R7
-	JMP	_balign
-
-_baligned:
-	AND	$(QUAD-1), R7, R1	/* is the source quad-aligned */
-	BNE	R1, _bunaligned
-
-	ADDL	$(BLOCK-1), R8, R9
-_bblock:
-	CMPUGE	R9, R6, R1
-	BNE	R1, _b8tail
-
-	MOVQ	-64(R7), R22
-	MOVQ	-56(R7), R23
-	MOVQ	-48(R7), R24
-	MOVQ	-40(R7), R25
-	MOVQ	-32(R7), R2
-	MOVQ	-24(R7), R3
-	MOVQ	-16(R7), R4
-	MOVQ	-8(R7), R5
-
-	SUBL	$64, R6, R6
-	SUBL	$64, R7, R7
-
-	MOVQ	R22, (R6)
-	MOVQ	R23, 8(R6)
-	MOVQ	R24, 16(R6)
-	MOVQ	R25, 24(R6)
-	MOVQ	R2, 32(R6)
-	MOVQ	R3, 40(R6)
-	MOVQ	R4, 48(R6)
-	MOVQ	R5, 56(R6)
-	JMP	_bblock
-
-_b8tail:
-	ADDL	$(QUAD-1), R8, R9
-_b8block:
-	CMPUGE	R9, R6, R1
-	BNE	R1, _b1tail
-
-	MOVQ	-8(R7), R2
-	SUBL	$8, R6
-	MOVQ	R2, (R6)
-	SUBL	$8, R7
-	JMP	_b8block
-
-_b1tail:
-	CMPUGE	R8, R6, R1
-	BNE	R1, _ret
-
-	MOVBU	-1(R7), R2
-	SUBL	$1, R6, R6
-	MOVB	R2, (R6)
-	SUBL	$1, R7, R7
-	JMP	_b1tail
-_ret:
-	RET
-
-_bunaligned:
-	ADDL	$(16-1), R8, R9
-
-_bu8block:
-	CMPUGE	R9, R6, R1
-	BNE	R1, _b1tail
-
-	MOVQU	-16(R7), R4
-	MOVQU	-8(R7), R3
-	MOVQU	(R7), R2
-	SUBL	$16, R6
-	EXTQH	R7, R2, R2
-	EXTQL	R7, R3, R5
-	OR	R5, R2, R11
-	EXTQH	R7, R3, R3
-	EXTQL	R7, R4, R4
-	OR	R3, R4, R13
-	MOVQ	R11, 8(R6)
-	MOVQ	R13, (R6)
-	SUBL	$16, R7
-	JMP	_bu8block
-
-_forward:
-	ADDL	R10, R6, R8		/* end to address */
-
-	CMPUGE	$ALIGN, R10, R1		/* need at least ALIGN bytes */
-	BNE	R1, _f1tail
-
-_falign:
-	AND	$(ALIGN-1), R6, R1
-	BEQ	R1, _faligned
-
-	MOVBU	(R7), R2
-	ADDL	$1, R6, R6
-	ADDL	$1, R7, R7
-	MOVB	R2, -1(R6)
-	JMP	_falign
-
-_faligned:
-	AND	$(QUAD-1), R7, R1	/* is the source quad-aligned */
-	BNE	R1, _funaligned
-
-	SUBL	$(BLOCK-1), R8, R9
-_fblock:
-	CMPUGT	R9, R6, R1
-	BEQ	R1, _f8tail
-
-	MOVQ	(R7), R2
-	MOVQ	8(R7), R3
-	MOVQ	16(R7), R4
-	MOVQ	24(R7), R5
-	MOVQ	32(R7), R22
-	MOVQ	40(R7), R23
-	MOVQ	48(R7), R24
-	MOVQ	56(R7), R25
-
-	ADDL	$64, R6, R6
-	ADDL	$64, R7, R7
-
-	MOVQ	R2, -64(R6)
-	MOVQ	R3, -56(R6)
-	MOVQ	R4, -48(R6)
-	MOVQ	R5, -40(R6)
-	MOVQ	R22, -32(R6)
-	MOVQ	R23, -24(R6)
-	MOVQ	R24, -16(R6)
-	MOVQ	R25, -8(R6)
-	JMP	_fblock
-
-_f8tail:
-	SUBL	$(QUAD-1), R8, R9
-_f8block:
-	CMPUGT	R9, R6, R1
-	BEQ	R1, _f1tail
-
-	MOVQ	(R7), R2
-	ADDL	$8, R6
-	ADDL	$8, R7
-	MOVQ	R2, -8(R6)
-	JMP	_f8block
-
-_f1tail:
-	CMPUGT	R8, R6, R1
-	BEQ	R1, _fret
-	MOVBU	(R7), R2
-	ADDL	$1, R6, R6
-	ADDL	$1, R7, R7
-	MOVB	R2, -1(R6)
-	JMP	_f1tail
-
-_fret:
-	RET
-
-_funaligned:
-	SUBL	$(16-1), R8, R9
-_fu8block:
-	CMPUGT	R9, R6, R1
-	BEQ	R1, _f1tail
-
-	MOVQU	(R7), R2
-	MOVQU	8(R7), R3
-	MOVQU	16(R7), R4
-	EXTQL	R7, R2, R2
-	EXTQH	R7, R3, R5
-	OR	R5, R2, R11
-	EXTQL	R7, R3, R3
-	MOVQ	R11, (R6)
-	EXTQH	R7, R4, R4
-	OR	R3, R4, R11
-	MOVQ	R11, 8(R6)
-	ADDL	$16, R6
-	ADDL	$16, R7
-	JMP	_fu8block
-
-TEXT	memcpy(SB), $0
-	JMP	_memmove
--- a/sys/src/libc/alpha/memset.s
+++ /dev/null
@@ -1,61 +1,0 @@
-TEXT memset(SB), $0
-	MOVL	R0, R6
-	MOVBU	data+4(FP), R2
-	MOVL	n+8(FP), R10
-
-	ADDL	R10, R0, R8
-
-	CMPUGE	$8, R10, R1		/* need at least 8 bytes */
-	BNE	R1, _1loop
-
-	SLLQ	$8, R2, R1		/* replicate the byte */
-	OR	R1, R2
-	SLLQ	$16, R2, R1
-	OR	R1, R2
-	SLLQ	$32, R2, R1
-	OR	R1, R2
-
-_align:
-	AND	$(8-1), R6, R1
-	BEQ	R1, _aligned
-
-	MOVB	R2, (R6)
-	ADDL	$1, R6, R6
-	JMP	_align
-
-_aligned:
-	SUBL	$(64-1), R8, R9		/* end pointer minus slop */
-_64loop:
-	CMPUGT	R9, R6, R1
-	BEQ	R1, _8tail
-
-	MOVQ	R2, (R6)
-	MOVQ	R2, 8(R6)
-	MOVQ	R2, 16(R6)
-	MOVQ	R2, 24(R6)
-	MOVQ	R2, 32(R6)
-	MOVQ	R2, 40(R6)
-	MOVQ	R2, 48(R6)
-	MOVQ	R2, 56(R6)
-	ADDL	$64, R6, R6
-	JMP	_64loop
-
-_8tail:
-	SUBL	$(8-1), R8, R9
-_8loop:
-	CMPUGT	R9, R6, R1
-	BEQ	R1, _1loop
-
-	MOVQ	R2, (R6)
-	ADDL	$8, R6
-	JMP	_8loop
-
-_1loop:
-	CMPUGT	R8, R6, R1
-	BEQ	R1, _ret
-	MOVB	R2, (R6)
-	ADDL	$1, R6
-	JMP	_1loop
-
-_ret:
-	RET
--- a/sys/src/libc/alpha/mkfile
+++ /dev/null
@@ -1,33 +1,0 @@
-objtype=alpha
-</$objtype/mkfile
-
-LIB=/$objtype/lib/libc.a
-SFILES=\
-	argv0.s\
-	atom.s\
-	divl.s\
-	divq.s\
-	getcallerpc.s\
-	getfcr.s\
-	main9.s\
-	main9p.s\
-	memmove.s\
-	memset.s\
-	setjmp.s\
-	tas.s
-
-CFILES=\
-	_seek.c\
-	cycles.c\
-	notejmp.c\
-
-HFILES=/sys/include/libc.h
-
-OFILES=${CFILES:%.c=%.$O} ${SFILES:%.s=%.$O}
-
-UPDATE=mkfile\
-	$HFILES\
-	$CFILES\
-	$SFILES\
-
-</sys/src/cmd/mksyslib
--- a/sys/src/libc/alpha/notejmp.c
+++ /dev/null
@@ -1,16 +1,0 @@
-#include <u.h>
-#include <libc.h>
-#include <ureg.h>
-
-void
-notejmp(void *vr, jmp_buf j, int ret)
-{
-	struct Ureg *r = vr;
-
-	r->r0 = ret;
-	if(ret == 0)
-		r->r0 = 1;
-	r->pc = j[JMPBUFPC];
-	r->sp = j[JMPBUFSP];
-	noted(NCONT);
-}
--- a/sys/src/libc/alpha/setjmp.s
+++ /dev/null
@@ -1,14 +1,0 @@
-TEXT	setjmp(SB), 1, $-8
-	MOVL	R30, (R0)
-	MOVL	R26, 4(R0)
-	MOVQ	$0, R0
-	RET
-
-TEXT	longjmp(SB), 1, $-8
-	MOVL	r+4(FP), R3
-	BNE	R3, ok		/* ansi: "longjmp(0) => longjmp(1)" */
-	MOVQ	$1, R3		/* bless their pointed heads */
-ok:	MOVL	(R0), R30
-	MOVL	4(R0), R26
-	MOVL	R3, R0
-	RET
--- a/sys/src/libc/alpha/tas.s
+++ /dev/null
@@ -1,10 +1,0 @@
-TEXT	_tas(SB), $-8
-	MOVQ	R0, R1			/* l */
-tas1:
-	MOVLL	(R1), R0		/* l->key */
-	BNE	R0, tas2
-	MOVQ	$1, R2
-	MOVLC	R2, (R1)		/* l->key = 1 */
-	BEQ	R2, tas1		/* write failed, try again? */
-tas2:
-	RET
--- a/sys/src/libmach/7.c
+++ /dev/null
@@ -1,115 +1,0 @@
-/*
- * alpha definition
- */
-#include <u.h>
-#include <libc.h>
-#include <bio.h>
-#include "/alpha/include/ureg.h"
-#include <mach.h>
-
-#define	REGOFF(x)	(ulong)(&((struct Ureg *) 0)->x)
-
-#define	REGSIZE		sizeof(struct Ureg)
-#define	FPREGSIZE	(8*33)
-
-#define	SP		REGOFF(sp)
-#define	PC		REGOFF(pc)
-#define	FP_REG(x)	(REGSIZE+8*(x))
-
-Reglist alphareglist[] = {
-	{"STATUS",	REGOFF(status),	RINT|RRDONLY, 'W'},
-	{"TYPE",	REGOFF(type),	RINT|RRDONLY, 'W'},
-	{"A0",	REGOFF(a0),	RINT|RRDONLY, 'W'},
-	{"A1",	REGOFF(a1),	RINT|RRDONLY, 'W'},
-	{"A2",		REGOFF(a2),	RINT|RRDONLY, 'W'},
-	{"PC",		PC,	RINT, 'X'},
-	{"SP",		SP,	RINT, 'X'},
-	{"R29",		REGOFF(r29),	RINT, 'W'},
-	{"R28",		REGOFF(r28),	RINT, 'W'},
-	{"R27",		REGOFF(r27),	RINT, 'W'},
-	{"R26",		REGOFF(r26),	RINT, 'W'},
-	{"R25",		REGOFF(r25),	RINT, 'W'},
-	{"R24",		REGOFF(r24),	RINT, 'W'},
-	{"R23",		REGOFF(r23),	RINT, 'W'},
-	{"R22",		REGOFF(r22),	RINT, 'W'},
-	{"R21",		REGOFF(r21),	RINT, 'W'},
-	{"R20",		REGOFF(r20),	RINT, 'W'},
-	{"R19",		REGOFF(r19),	RINT, 'W'},
-	{"R18",		REGOFF(r18),	RINT, 'W'},
-	{"R17",		REGOFF(r17),	RINT, 'W'},
-	{"R16",		REGOFF(r16),	RINT, 'W'},
-	{"R15",		REGOFF(r15),	RINT, 'W'},
-	{"R14",		REGOFF(r14),	RINT, 'W'},
-	{"R13",		REGOFF(r13),	RINT, 'W'},
-	{"R12",		REGOFF(r12),	RINT, 'W'},
-	{"R11",		REGOFF(r11),	RINT, 'W'},
-	{"R10",		REGOFF(r10),	RINT, 'W'},
-	{"R9",		REGOFF(r9),	RINT, 'W'},
-	{"R8",		REGOFF(r8),	RINT, 'W'},
-	{"R7",		REGOFF(r7),	RINT, 'W'},
-	{"R6",		REGOFF(r6),	RINT, 'W'},
-	{"R5",		REGOFF(r5),	RINT, 'W'},
-	{"R4",		REGOFF(r4),	RINT, 'W'},
-	{"R3",		REGOFF(r3),	RINT, 'W'},
-	{"R2",		REGOFF(r2),	RINT, 'W'},
-	{"R1",		REGOFF(r1),	RINT, 'W'},
-	{"R0",		REGOFF(r0),	RINT, 'W'},
-	{"F0",		FP_REG(0),	RFLT, 'F'},
-	{"F1",		FP_REG(1),	RFLT, 'F'},
-	{"F2",		FP_REG(2),	RFLT, 'F'},
-	{"F3",		FP_REG(3),	RFLT, 'F'},
-	{"F4",		FP_REG(4),	RFLT, 'F'},
-	{"F5",		FP_REG(5),	RFLT, 'F'},
-	{"F6",		FP_REG(6),	RFLT, 'F'},
-	{"F7",		FP_REG(7),	RFLT, 'F'},
-	{"F8",		FP_REG(8),	RFLT, 'F'},
-	{"F9",		FP_REG(9),	RFLT, 'F'},
-	{"F10",		FP_REG(10),	RFLT, 'F'},
-	{"F11",		FP_REG(11),	RFLT, 'F'},
-	{"F12",		FP_REG(12),	RFLT, 'F'},
-	{"F13",		FP_REG(13),	RFLT, 'F'},
-	{"F14",		FP_REG(14),	RFLT, 'F'},
-	{"F15",		FP_REG(15),	RFLT, 'F'},
-	{"F16",		FP_REG(16),	RFLT, 'F'},
-	{"F17",		FP_REG(17),	RFLT, 'F'},
-	{"F18",		FP_REG(18),	RFLT, 'F'},
-	{"F19",		FP_REG(19),	RFLT, 'F'},
-	{"F20",		FP_REG(20),	RFLT, 'F'},
-	{"F21",		FP_REG(21),	RFLT, 'F'},
-	{"F22",		FP_REG(22),	RFLT, 'F'},
-	{"F23",		FP_REG(23),	RFLT, 'F'},
-	{"F24",		FP_REG(24),	RFLT, 'F'},
-	{"F25",		FP_REG(25),	RFLT, 'F'},
-	{"F26",		FP_REG(26),	RFLT, 'F'},
-	{"F27",		FP_REG(27),	RFLT, 'F'},
-	{"F28",		FP_REG(28),	RFLT, 'F'},
-	{"F29",		FP_REG(29),	RFLT, 'F'},
-	{"F30",		FP_REG(30),	RFLT, 'F'},
-	{"F31",		FP_REG(31),	RFLT, 'F'},
-	{"FPCR",		FP_REG(32),	RFLT, 'W'},
-	{  0 }
-};
-
-	/* the machine description */
-Mach malpha =
-{
-	"alpha",
-	MALPHA,		/* machine type */
-	alphareglist,	/* register set */
-	REGSIZE,	/* number of bytes in reg set */
-	FPREGSIZE,	/* number of bytes in fp reg set */
-	"PC",
-	"SP",
-	"R29",
-	"setSB",	/* static base register name */
-	0,		/* static base register value */
-	0x2000,		/* page size */
-	0x80000000ULL,	/* kernel base */
-	0xF0000000ULL,	/* kernel text mask */
-	0x7FFFFFFFULL,	/* user stack top */
-	4,		/* quantization of pc */
-	4,		/* szaddr */
-	8,		/* szreg (not used?) */
-	4,		/* szfloat */
-	8,		/* szdouble */
-};
--- a/sys/src/libmach/7db.c
+++ /dev/null
@@ -1,925 +1,0 @@
-#include <u.h>
-#include <libc.h>
-#include <bio.h>
-#include <mach.h>
-/*
- * Alpha-specific debugger interface
- */
-
-static 	char	*alphaexcep(Map*, Rgetter);
-static	int	alphafoll(Map*, uvlong, Rgetter, uvlong*);
-static	int	alphainst(Map*, uvlong, char, char*, int);
-static	int	alphadas(Map*, uvlong, char*, int);
-static	int	alphainstlen(Map*, uvlong);
-/*
- *	Debugger interface
- */
-Machdata alphamach =
-{
-	{0x80, 0, 0, 0},		/* break point */
-	4,			/* break point size */
-
-	leswab,			/* short to local byte order */
-	leswal,			/* long to local byte order */
-	leswav,			/* vlong to local byte order */
-	risctrace,		/* C traceback */
-	riscframe,		/* Frame finder */
-	alphaexcep,		/* print exception */
-	0,			/* breakpoint fixup */
-	leieeesftos,		/* single precision float printer */
-	leieeedftos,		/* double precisioin float printer */
-	alphafoll,		/* following addresses */
-	alphainst,		/* print instruction */
-	alphadas,		/* dissembler */
-	alphainstlen,		/* instruction size */
-};
-
-static char *illegaltype[] = {
-	"breakpoint",
-	"bugchk",
-	"gentrap",
-	"fen",
-	"illegal instruction",
-};
-
-static char *
-alphaexcep(Map *map, Rgetter rget)
-{
-	ulong type, a0, a1;
-	static char buf[256];
-
-	type = (*rget)(map, "TYPE");
-	a0 = (*rget)(map, "A0");
-	a1 = (*rget)(map, "A1");
-/*	a2 = (*rget)(map, "A2"); */
-
-	switch (type) {
-	case 1:	/* arith */
-		sprint(buf, "trap: arithmetic trap 0x%lux", a0);
-		break;
-	case 2:	/* bad instr or FEN */
-		if (a0 <= 4)
-			return illegaltype[a0];
-		else
-			sprint(buf, "illegal instr trap, unknown type %lud", a0);
-		break;
-	case 3:	/* intr */
-		sprint(buf, "interrupt type %lud", a0);
-		break;
-	case 4:	/* memory fault */
-		sprint(buf, "fault %s addr=0x%lux", (a1&1)?"write":"read", a0);
-		break;
-	case 5:	/* syscall() */
-		return "system call";
-	case 6:	/* alignment fault */
-		sprint(buf, "unaligned op 0x%lux addr 0x%lux", a1, a0);
-		break;
-	default:	/* cannot happen */
-		sprint(buf, "unknown exception type %lud", type);
-		break;
-	}
-	return buf;
-}
-
-	/* alpha disassembler and related functions */
-
-static	char FRAMENAME[] = ".frame";
-
-typedef struct {
-	uvlong addr;
-	uchar op;			/* bits 31-26 */
-	uchar ra;			/* bits 25-21 */
-	uchar rb;			/* bits 20-16 */
-	uchar rc;			/* bits 4-0 */
-	long mem;			/* bits 15-0 */
-	long branch;			/* bits 20-0 */
-	uchar function;			/* bits 11-5 */
-	uchar literal;			/* bits 20-13 */
-	uchar islit;			/* bit 12 */
-	uchar fpfn;			/* bits 10-5 */
-	uchar fpmode;			/* bits 15-11 */
-	long w0;
-	long w1;
-	int size;			/* instruction size */
-	char *curr;			/* fill point in buffer */
-	char *end;			/* end of buffer */
-	char *err;			/* error message */
-} Instr;
-
-static Map *mymap;
-
-static int
-decode(uvlong pc, Instr *i)
-{
-	ulong w;
-
-	if (get4(mymap, pc, &w) < 0) {
-		werrstr("can't read instruction: %r");
-		return -1;
-	}
-	i->addr = pc;
-	i->size = 1;
-	i->op = (w >> 26) & 0x3F;
-	i->ra = (w >> 21) & 0x1F;
-	i->rb = (w >> 16) & 0x1F;
-	i->rc = w & 0x1F;
-	i->function = (w >> 5) & 0x7F;
-	i->mem = w & 0xFFFF;
-	if (i->mem & 0x8000)
-		i->mem -= 0x10000;
-	i->branch = w & 0x1FFFFF;
-	if (i->branch & 0x100000)
-		i->branch -= 0x200000;
-	i->function = (w >> 5) & 0x7F;
-	i->literal = (w >> 13) & 0xFF;
-	i->islit = (w >> 12) & 0x01;
-	i->fpfn = (w >> 5) & 0x3F;
-	i->fpmode = (w >> 11) & 0x1F;
-	i->w0 = w;
-	return 1;
-}
-
-static int
-mkinstr(uvlong pc, Instr *i)
-{
-/*	Instr x; */
-
-	if (decode(pc, i) < 0)
-		return -1;
-
-#ifdef	frommips
-/* we probably want to do something like this for alpha... */
-	/*
-	 * if it's a LUI followed by an ORI,
-	 * it's an immediate load of a large constant.
-	 * fix the LUI immediate in any case.
-	 */
-	if (i->op == 0x0F) {
-		if (decode(pc+4, &x) < 0)
-			return 0;
-		i->immediate <<= 16;
-		if (x.op == 0x0D && x.rs == x.rt && x.rt == i->rt) {
-			i->immediate |= (x.immediate & 0xFFFF);
-			i->w1 = x.w0;
-			i->size++;
-			return 1;
-		}
-	}
-#endif
-	return 1;
-}
-
-#pragma	varargck	argpos	bprint		2
-
-static void
-bprint(Instr *i, char *fmt, ...)
-{
-	va_list arg;
-
-	va_start(arg, fmt);
-	i->curr = vseprint(i->curr, i->end, fmt, arg);
-	va_end(arg);
-}
-
-typedef struct Opcode Opcode;
-
-struct Opcode {
-	char *mnemonic;
-	void (*f)(Opcode *, Instr *);
-	char *ken;
-};
-
-static void format(char *, Instr *, char *);
-
-static int
-plocal(Instr *i, char *m, char r, int store)
-{
-	int offset;
-	char *reg;
-	Symbol s;
-
-	if (!findsym(i->addr, CTEXT, &s) || !findlocal(&s, FRAMENAME, &s))
-		return 0;
-	if (s.value > i->mem) {
-		if(!getauto(&s, s.value-i->mem, CAUTO, &s))
-			return 0;
-		reg = "(SP)";
-		offset = i->mem;
-	} else {
-		offset = i->mem-s.value-8;
-		if (!getauto(&s, offset, CPARAM, &s))
-			return 0;
-		reg = "(FP)";
-	}
-	if (store)
-		bprint(i, "%s\t%c%d,%s+%d%s", m, r, i->ra, s.name, offset, reg);
-	else
-		bprint(i, "%s\t%s+%d%s,%c%d", m, s.name, offset, reg, r, i->ra);
-	return 1;
-}
-
-static void
-_load(Opcode *o, Instr *i, char r)
-{
-	char *m;
-
-	m = o->mnemonic;
-	if (i->rb == 30 && plocal(i, m, r, 0))
-		return;
-	if (i->rb == 29 && mach->sb) {
-		bprint(i, "%s\t", m);
-		i->curr += symoff(i->curr, i->end-i->curr, i->mem+mach->sb, CANY);
-		bprint(i, "(SB),%c%d", r, i->ra);
-		return;
-	}
-	format(m, i, o->ken);
-}
-
-static void
-load(Opcode *o, Instr *i)
-{
-	_load(o, i, 'R');
-}
-
-static void
-loadf(Opcode *o, Instr *i)
-{
-	_load(o, i, 'F');
-}
-
-static void
-_store(Opcode *o, Instr *i, char r)
-{
-	char *m;
-
-	m = o->mnemonic;
-	if (i->rb == 30 && plocal(i, m, r, 1))
-		return;
-	if (i->rb == 29 && mach->sb) {
-		bprint(i, "%s\t%c%d,", m, r, i->ra);
-		i->curr += symoff(i->curr, i->end-i->curr, i->mem+mach->sb, CANY);
-		bprint(i, "(SB)");
-		return;
-	}
-	format(o->mnemonic, i, o->ken);
-}
-
-static void
-store(Opcode *o, Instr *i)
-{
-	_store(o, i, 'R');
-}
-
-static void
-storef(Opcode *o, Instr *i)
-{
-	_store(o, i, 'F');
-}
-
-static void
-misc(Opcode *o, Instr *i)
-{
-	char *f;
-
-	USED(o);
-	switch (i->mem&0xFFFF) {
-	case 0x0000:
-		f = "TRAPB";
-		break;
-	case 0x4000:
-		f = "MB";
-		break;
-	case 0x8000:
-		f = "FETCH\t0(R%b)";
-		break;
-	case 0xA000:
-		f = "FETCH_M\t0(R%b)";
-		break;
-	case 0xC000:
-		f = "RPCC\tR%a";
-		break;
-	case 0xE000:
-		f = "RC\tR%a";
-		break;
-	case 0xF000:
-		f = "RS\tR%a";
-		break;
-	default:
-		f = "%w";
-	}
-	format(0, i, f);
-}
-
-static char	*jmpcode[4] = { "JMP", "JSR", "RET", "JSR_COROUTINE" };
-
-static void
-jmp(Opcode *o, Instr *i)
-{
-	int hint;
-	char *m;
-
-	USED(o);
-	hint = (i->mem >> 14) & 3;
-	m = jmpcode[hint];
-	if (i->ra == 31) {
-		if (hint == 2 && i->rb == 29)
-			bprint(i, m);
-		else
-			format(m, i, "(R%b)");
-	}
-	else
-		format(m, i, "R%a,(R%b)");
-}
-
-static void
-br(Opcode *o, Instr *i)
-{
-	if (i->ra == 31)
-		format(o->mnemonic, i, "%B");
-	else
-		format(o->mnemonic, i, o->ken);
-}
-
-static void
-bsr(Opcode *o, Instr *i)
-{
-	if (i->ra == 26)
-		format(o->mnemonic, i, "%B");
-	else
-		format(o->mnemonic, i, o->ken);
-}
-
-static void
-mult(Opcode *o, Instr *i)
-{
-	char *m;
-
-	switch (i->function) {
-	case 0x00:
-		m = "MULL";
-		break;
-	case 0x20:
-		m = "MULQ";
-		break;
-	case 0x40:
-		m = "MULL/V";
-		break;
-	case 0x60:
-		m = "MULQ/V";
-		break;
-	case 0x30:
-		m = "UMULH";
-		break;
-	default:
-		format("???", i, "%w");
-		return;
-	}
-	format(m, i, o->ken);
-}
-
-static char	alphaload[] = "%l,R%a";
-static char	alphafload[] = "%l,F%a";
-static char	alphastore[] = "R%a,%l";
-static char	alphafstore[] = "F%a,%l";
-static char	alphabranch[] = "R%a,%B";
-static char	alphafbranch[] = "F%a,%B";
-static char	alphaint[] = "%v,R%a,R%c";
-static char	alphafp[] = "F%b,F%a,F%c";
-static char	alphafp2[] = "F%b,F%c";
-static char	alphaxxx[] = "%w";
-
-static Opcode opcodes[64] = {
-	"PAL",		0,	alphaxxx,
-	"OPC01",	0,	alphaxxx,
-	"OPC02",	0,	alphaxxx,
-	"OPC03",	0,	alphaxxx,
-	"OPC04",	0,	alphaxxx,
-	"OPC05",	0,	alphaxxx,
-	"OPC06",	0,	alphaxxx,
-	"OPC07",	0,	alphaxxx,
-	"MOVQA",	load,	alphaload,
-	"MOVQAH",	load,	alphaload,
-	"MOVBU",	load,	alphaload,		/* v 3 */
-	"MOVQU",	load,	alphaload,
-	"MOVWU",	load,	alphaload,		/* v 3 */
-	"MOVWU",	store,	alphastore,		/* v 3 */
-	"MOVBU",	store,	alphastore,		/* v 3 */
-	"MOVQU",	store,	alphastore,
-	0,		0,	0,			/* int arith */
-	0,		0,	0,			/* logical */
-	0,		0,	0,			/* shift */
-	0,		mult,	alphaint,
-	"OPC14",	0,	alphaxxx,
-	"vax",		0,	alphafp,		/* vax */
-	0,		0,	0,			/* ieee */
-	0,		0,	0,			/* fp */
-	0,		misc,	alphaxxx,
-	"PAL19 [HW_MFPR]",0,	alphaxxx,
-	"JSR",		jmp,	0,
-	"PAL1B [HW_LD]",0,	alphaxxx,
-	"OPC1C",	0,	alphaxxx,
-	"PAL1D [HW_MTPR]",0,	alphaxxx,
-	"PAL1E [HW_REI]",0,	alphaxxx,
-	"PAL1F [HW_ST]",0,	alphaxxx,
-	"MOVF",		loadf,	alphafload,
-	"MOVG",		loadf,	alphafload,
-	"MOVS",		loadf,	alphafload,
-	"MOVT",		loadf,	alphafload,
-	"MOVF",		storef,	alphafstore,
-	"MOVG",		storef,	alphafstore,
-	"MOVS",		storef,	alphafstore,
-	"MOVT",		storef,	alphafstore,
-	"MOVL",		load,	alphaload,
-	"MOVQ",		load,	alphaload,
-	"MOVLL",	load,	alphaload,
-	"MOVQL",	load,	alphaload,
-	"MOVL",		store,	alphastore,
-	"MOVQ",		store,	alphastore,
-	"MOVLC",	store,	alphastore,
-	"MOVQC",	store,	alphastore,
-	"JMP",		br,	alphabranch,
-	"FBEQ",		0,	alphafbranch,
-	"FBLT",		0,	alphafbranch,
-	"FBLE",		0,	alphafbranch,
-	"JSR",		bsr,	alphabranch,
-	"FBNE",		0,	alphafbranch,
-	"FBGE",		0,	alphafbranch,
-	"FBGT",		0,	alphafbranch,
-	"BLBC",		0,	alphafbranch,
-	"BEQ",		0,	alphabranch,
-	"BLT",		0,	alphabranch,
-	"BLE",		0,	alphabranch,
-	"BLBS",		0,	alphabranch,
-	"BNE",		0,	alphabranch,
-	"BGE",		0,	alphabranch,
-	"BGT",		0,	alphabranch,
-};
-
-static Opcode fpopcodes[64] = {
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-
-	"CVTLQ",	0,	alphafp2,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-
-	"CPYS",		0,	alphafp,
-	"CPYSN",	0,	alphafp,
-	"CPYSE",	0,	alphafp,
-	"???",		0,	alphaxxx,
-	"MOVT",		0,	"FPCR,F%a",
-	"MOVT",		0,	"F%a,FPCR",
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"FCMOVEQ",	0,	alphafp,
-	"FCMOVNE",	0,	alphafp,
-	"FCMOVLT",	0,	alphafp,
-	"FCMOVGE",	0,	alphafp,
-	"FCMOVLE",	0,	alphafp,
-	"FCMOVGT",	0,	alphafp,
-
-	"CVTQL",	0,	alphafp2,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-};
-
-static Opcode ieeeopcodes[64] = {
-	"ADDS",		0,	alphafp,
-	"SUBS",		0,	alphafp,
-	"MULS",		0,	alphafp,
-	"DIVS",		0,	alphafp,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-
-	"ADDT",		0,	alphafp,
-	"SUBT",		0,	alphafp,
-	"MULT",		0,	alphafp,
-	"DIVT",		0,	alphafp,
-	"CMPTUN",	0,	alphafp,
-	"CMPTEQ",	0,	alphafp,
-	"CMPTLT",	0,	alphafp,
-	"CMPTLE",	0,	alphafp,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"CVTTS",	0,	alphafp2,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"CVTTQ",	0,	alphafp2,
-
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"???",		0,	alphaxxx,
-	"CVTQS",	0,	alphafp2,
-	"???",		0,	alphaxxx,
-	"CVTQT",	0,	alphafp2,
-	"???",		0,	alphaxxx,
-};
-
-static uchar	amap[128] = {
-	[0x00]	1,
-	[0x40]	2,
-	[0x20]	3,
-	[0x60]	4,
-	[0x09]	5,
-	[0x49]	6,
-	[0x29]	7,
-	[0x69]	8,
-	[0x2D]	9,
-	[0x4D]	10,
-	[0x6D]	11,
-	[0x1D]	12,	
-	[0x3D]	13,	
-	[0x0F]	14,	
-	[0x02]	15,	
-	[0x0B]	16,	
-	[0x12]	17,	
-	[0x1B]	18,
-	[0x22]	19,	
-	[0x2B]	20,	
-	[0x32]	21,	
-	[0x3B]	22,
-};
-
-static Opcode arithopcodes[64] = {
-	"???",		0,	alphaxxx,
-	"ADDL",		0,	alphaint,
-	"ADDL/V",	0,	alphaint,
-	"ADDQ",		0,	alphaint,
-	"ADDQ/V",	0,	alphaint,
-	"SUBL",		0,	alphaint,
-	"SUBL/V",	0,	alphaint,
-	"SUBQ",		0,	alphaint,
-	"SUBQ/V",	0,	alphaint,
-	"CMPEQ",	0,	alphaint,
-	"CMPLT",	0,	alphaint,
-	"CMPLE",	0,	alphaint,
-	"CMPULT",	0,	alphaint,
-	"CMPULE",	0,	alphaint,
-	"CMPBGE",	0,	alphaint,
-	"S4ADDL",	0,	alphaint,
-	"S4SUBL",	0,	alphaint,
-	"S8ADDL",	0,	alphaint,
-	"S8SUBL",	0,	alphaint,
-	"S4ADDQ",	0,	alphaint,
-	"S4SUBQ",	0,	alphaint,
-	"S8ADDQ",	0,	alphaint,
-	"S8SUBQ",	0,	alphaint,
-};
-
-static uchar	lmap[128] = {
-	[0x00]	1,
-	[0x20]	2,
-	[0x40]	3,
-	[0x08]	4,
-	[0x28]	5,
-	[0x48]	6,
-	[0x24]	7,
-	[0x44]	8,
-	[0x64]	9,
-	[0x26]	7,
-	[0x46]	8,
-	[0x66]	9,
-	[0x14]	10,
-	[0x16]	11,
-};
-
-static Opcode logicalopcodes[64] = {
-	"???",		0,	alphaxxx,
-	"AND",		0,	alphaint,
-	"OR",		0,	alphaint,
-	"XOR",		0,	alphaint,
-	"ANDNOT",	0,	alphaint,
-	"ORNOT",	0,	alphaint,
-	"XORNOT",	0,	alphaint,
-	"CMOVEQ",	0,	alphaint,
-	"CMOVLT",	0,	alphaint,
-	"CMOVLE",	0,	alphaint,
-	"CMOVNE",	0,	alphaint,
-	"CMOVGE",	0,	alphaint,
-	"CMOVGT",	0,	alphaint,
-	"CMOVLBS",	0,	alphaint,
-	"CMOVLBC",	0,	alphaint,
-};
-
-static uchar	smap[128] = {
-	[0x39]	1,
-	[0x3C]	2,
-	[0x34]	3,
-	[0x06]	4,
-	[0x16]	5,
-	[0x26]	6,
-	[0x36]	7,
-	[0x5A]	8,
-	[0x6A]	9,
-	[0x7A]	10,
-	[0x0B]	11,
-	[0x1B]	12,
-	[0x2B]	13,
-	[0x3B]	14,
-	[0x57]	15,
-	[0x67]	16,
-	[0x77]	17,
-	[0x02]	18,
-	[0x12]	19,
-	[0x22]	20,
-	[0x32]	21,
-	[0x52]	22,
-	[0x62]	23,
-	[0x72]	24,
-	[0x30]	25,
-	[0x31]	26,
-};
-
-static Opcode shiftopcodes[64] = {
-	"???",		0,	alphaxxx,
-	"SLLQ",		0,	alphaint,
-	"SRAQ",		0,	alphaint,
-	"SRLQ",		0,	alphaint,
-	"EXTBL",	0,	alphaint,
-	"EXTWL",	0,	alphaint,
-	"EXTLL",	0,	alphaint,
-	"EXTQL",	0,	alphaint,
-	"EXTWH",	0,	alphaint,
-	"EXTLH",	0,	alphaint,
-	"EXTQH",	0,	alphaint,
-	"INSBL",	0,	alphaint,
-	"INSWL",	0,	alphaint,
-	"INSLL",	0,	alphaint,
-	"INSQL",	0,	alphaint,
-	"INSWH",	0,	alphaint,
-	"INSLH",	0,	alphaint,
-	"INSQH",	0,	alphaint,
-	"MSKBL",	0,	alphaint,
-	"MSKWL",	0,	alphaint,
-	"MSKLL",	0,	alphaint,
-	"MSKQL",	0,	alphaint,
-	"MSKWH",	0,	alphaint,
-	"MSKLH",	0,	alphaint,
-	"MSKQH",	0,	alphaint,
-	"ZAP",		0,	alphaint,
-	"ZAPNOT",	0,	alphaint,
-};
-
-static void
-format(char *mnemonic, Instr *i, char *f)
-{
-	if (mnemonic)
-		format(0, i, mnemonic);
-	if (f == 0)
-		return;
-	if (mnemonic)
-		if (i->curr < i->end)
-			*i->curr++ = '\t';
-	for ( ; *f && i->curr < i->end; f++) {
-		if (*f != '%') {
-			*i->curr++ = *f;
-			continue;
-		}
-		switch (*++f) {
-
-		case 'a':
-			bprint(i, "%d", i->ra);
-			break;
-
-		case 'b':
-			bprint(i, "%d", i->rb);
-			break;
-
-		case 'c':
-			bprint(i, "%d", i->rc);
-			break;
-
-		case 'v':
-			if (i->islit)
-				bprint(i, "$%ux", i->literal);
-			else
-				bprint(i, "R%d", i->rb);
-			break;
-
-		case 'l':
-			bprint(i, "%lx(R%d)", i->mem, i->rb);
-			break;
-
-		case 'i':
-			bprint(i, "$%lx", i->mem);
-			break;
-
-		case 'B':
-			i->curr += symoff(i->curr, i->end-i->curr,
-				(i->branch<<2)+i->addr+4, CANY);
-			break;
-
-		case 'w':
-			bprint(i, "[%lux]", i->w0);
-			break;
-
-		case '\0':
-			*i->curr++ = '%';
-			return;
-
-		default:
-			bprint(i, "%%%c", *f);
-			break;
-		}
-	}
-	*i->curr = 0;
-}
-
-static int
-printins(Map *map, uvlong pc, char *buf, int n)
-{
-	Instr i;
-	Opcode *o;
-	uchar op;
-
-	i.curr = buf;
-	i.end = buf+n-1;
-	mymap = map;
-	if (mkinstr(pc, &i) < 0)
-		return -1;
-	switch (i.op) {
-
-	case 0x10:					/* INTA */
-		o = arithopcodes;
-		op = amap[i.function];
-		break;
-
-	case 0x11:					/* INTL */
-		o = logicalopcodes;
-		op = lmap[i.function];
-		break;
-
-	case 0x12:					/* INTS */
-		o = shiftopcodes;
-		op = smap[i.function];
-		break;
-
-	case 0x16:					/* FLTI */
-		o = ieeeopcodes;
-		op = i.fpfn;
-		break;
-
-	case 0x17:					/* FLTL */
-		o = fpopcodes;
-		op = i.fpfn;
-		break;
-
-	default:
-		o = opcodes;
-		op = i.op;
-		break;
-	}
-	if (o[op].f)
-		(*o[op].f)(&o[op], &i);
-	else
-		format(o[op].mnemonic, &i, o[op].ken);
-	return i.size*4;
-}
-
-static int
-alphainst(Map *map, uvlong pc, char modifier, char *buf, int n)
-{
-	USED(modifier);
-	return printins(map, pc, buf, n);
-}
-
-static int
-alphadas(Map *map, uvlong pc, char *buf, int n)
-{
-	Instr i;
-
-	i.curr = buf;
-	i.end = buf+n;
-	mymap = map;
-	if (mkinstr(pc, &i) < 0)
-		return -1;
-	if (i.end-i.curr > 8)
-		i.curr = _hexify(buf, i.w0, 7);
-	if (i.size == 2 && i.end-i.curr > 9) {
-		*i.curr++ = ' ';
-		i.curr = _hexify(i.curr, i.w1, 7);
-	}
-	*i.curr = 0;
-	return i.size*4;
-}
-
-static int
-alphainstlen(Map *map, uvlong pc)
-{
-	Instr i;
-
-	mymap = map;
-	if (mkinstr(pc, &i) < 0)
-		return -1;
-	return i.size*4;
-}
-
-static int
-alphafoll(Map *map, uvlong pc, Rgetter rget, uvlong *foll)
-{
-	char buf[8];
-	Instr i;
-
-	mymap = map;
-	if (mkinstr(pc, &i) < 0)
-		return -1;
-
-	switch(i.op) {
-	case 0x1A:				/* JMP/JSR/RET */
-		sprint(buf, "R%d", i.rb);
-		foll[0] = (*rget)(map, buf);
-		return 1;
-	case 0x30:				/* BR */
-	case 0x34:				/* BSR */
-		foll[0] = pc+4 + (i.branch<<2);
-		return 1;
-	default:
-		if (i.op > 0x30) {		/* cond */
-			foll[0] = pc+4;
-			foll[1] = pc+4 + (i.branch<<2);
-			return 2;
-		}
-		foll[0] = pc+i.size*4;
-		return 1;
-	}
-}
--- a/sys/src/libmach/7obj.c
+++ /dev/null
@@ -1,138 +1,0 @@
-/*
- * 7obj.c - identify and parse an alpha object file
- */
-#include <u.h>
-#include <libc.h>
-#include <bio.h>
-#include <mach.h>
-#include "7c/7.out.h"
-#include "obj.h"
-
-typedef struct Addr	Addr;
-struct Addr
-{
-	char	type;
-	char	sym;
-	char	name;
-};
-static Addr addr(Biobuf*);
-static char type2char(int);
-static void skip(Biobuf*, int);
-
-int
-_is7(char *s)
-{
-	return  s[0] == ANAME				/* ANAME */
-		&& s[1] == D_FILE			/* type */
-		&& s[2] == 1				/* sym */
-		&& s[3] == '<';				/* name of file */
-}
-
-int
-_read7(Biobuf *bp, Prog *p)
-{
-	int as, n;
-	Addr a;
-
-	as = Bgetc(bp);			/* as */
-	if(as < 0)
-		return 0;
-	p->kind = aNone;
-	p->sig = 0;
-	if(as == ANAME || as == ASIGNAME){
-		if(as == ASIGNAME){
-			Bread(bp, &p->sig, 4);
-			p->sig = leswal(p->sig);
-		}
-		p->kind = aName;
-		p->type = type2char(Bgetc(bp));		/* type */
-		p->sym = Bgetc(bp);			/* sym */
-		n = 0;
-		for(;;) {
-			as = Bgetc(bp);
-			if(as < 0)
-				return 0;
-			n++;
-			if(as == 0)
-				break;
-		}
-		p->id = malloc(n);
-		if(p->id == 0)
-			return 0;
-		Bseek(bp, -n, 1);
-		if(Bread(bp, p->id, n) != n)
-			return 0;
-		return 1;
-	}
-	if(as == ATEXT)
-		p->kind = aText;
-	else if(as == AGLOBL)
-		p->kind = aData;
-	skip(bp, 5);		/* reg(1), lineno(4) */
-	a = addr(bp);
-	addr(bp);
-	if(a.type != D_OREG || a.name != D_STATIC && a.name != D_EXTERN)
-		p->kind = aNone;
-	p->sym = a.sym;
-	return 1;
-}
-
-static Addr
-addr(Biobuf *bp)
-{
-	Addr a;
-	vlong off;
-
-	a.type = Bgetc(bp);	/* a.type */
-	skip(bp,1);		/* reg */
-	a.sym = Bgetc(bp);	/* sym index */
-	a.name = Bgetc(bp);	/* sym type */
-	switch(a.type){
-	default:
-	case D_NONE: case D_REG: case D_FREG: case D_PREG:
-	case D_FCREG: case D_PCC:
-		break;
-	case D_OREG:
-	case D_CONST:
-	case D_BRANCH:
-		off = (uvlong)Bgetc(bp);
-		off |= (uvlong)Bgetc(bp) << 8;
-		off |= (uvlong)Bgetc(bp) << 16;
-		off |= (uvlong)Bgetc(bp) << 24;
-		off |= (uvlong)Bgetc(bp) << 32;
-		off |= (uvlong)Bgetc(bp) << 40;
-		off |= (uvlong)Bgetc(bp) << 48;
-		off |= (uvlong)Bgetc(bp) << 56;
-		if(off < 0)
-			off = -off;
-		if(a.sym && (a.name==D_PARAM || a.name==D_AUTO))
-			_offset(a.sym, off);
-		break;
-	case D_SCONST:
-		skip(bp, NSNAME);
-		break;
-	case D_FCONST:
-		skip(bp, 8);
-		break;
-	}
-	return a;
-}
-
-static char
-type2char(int t)
-{
-	switch(t){
-	case D_EXTERN:		return 'U';
-	case D_STATIC:		return 'b';
-	case D_AUTO:		return 'a';
-	case D_PARAM:		return 'p';
-	default:		return UNKNOWN;
-	}
-}
-
-static void
-skip(Biobuf *bp, int n)
-{
-	while (n-- > 0)
-		Bgetc(bp);
-}
--- a/sys/src/libmach/mkfile
+++ b/sys/src/libmach/mkfile
@@ -18,7 +18,6 @@
 	2\
 	5\
 	6\
-	7\
 	8\
 	9\
 	vdb\
@@ -27,7 +26,6 @@
 	qdb\
 	2db\
 	5db\
-	7db\
 	8db\
 	vobj\
 	kobj\
@@ -35,7 +33,6 @@
 	2obj\
 	5obj\
 	6obj\
-	7obj\
 	8obj\
 	9obj\
 	qobj\
@@ -59,7 +56,6 @@
 2obj.$O: /sys/src/cmd/2c/2.out.h
 5obj.$O: /sys/src/cmd/5c/5.out.h
 6obj.$O: /sys/src/cmd/6c/6.out.h
-7obj.$O: /sys/src/cmd/7c/7.out.h
 8obj.$O: /sys/src/cmd/8c/8.out.h
 kobj.$O: /sys/src/cmd/kc/k.out.h
 qobj.$O: /sys/src/cmd/qc/q.out.h
--- a/sys/src/libmp/alpha/mkfile
+++ /dev/null
@@ -1,13 +1,0 @@
-objtype=alpha
-</alpha/mkfile
-
-LIB=/$objtype/lib/libmp.a
-OFILES=\
-
-HFILES=/$objtype/include/u.h /sys/include/mp.h ../port/dat.h
-
-UPDATE=\
-	mkfile\
-	$HFILES\
-
-</sys/src/cmd/mksyslib
--- a/sys/src/libsec/alpha/mkfile
+++ /dev/null
@@ -1,11 +1,0 @@
-objtype=alpha
-</$objtype/mkfile
-
-LIB=/$objtype/lib/libsec.a
-OFILES=	\
-
-HFILES=/sys/include/libsec.h
-
-UPDATE=mkfile
-
-</sys/src/cmd/mksyslib
--- a/sys/src/libthread/alpha.c
+++ /dev/null
@@ -1,32 +1,0 @@
-#include <u.h>
-#include <libc.h>
-#include <thread.h>
-#include "threadimpl.h"
-
-/* first argument goes in a register and on the stack; avoid it */
-static void
-launcheralpha(int, void (*f)(void *arg), void *arg)
-{
-	(*f)(arg);
-	threadexits(nil);
-}
-
-void
-_threadinitstack(Thread *t, void (*f)(void*), void *arg)
-{
-	ulong *tos;
-
-	tos = (ulong*)&t->stk[t->stksize&~7];
-
-	*--tos = 0;		/* pad arguments to 8 bytes */
-	*--tos = (ulong)arg;
-	*--tos = (ulong)f;
-	*--tos = 0;		/* first arg */
-
-	*--tos = 0;		/* for alignment with... */
-	*--tos = 0;		/* ... place to store return PC */
-
-	t->sched[JMPBUFPC] = (ulong)launcheralpha+JMPBUFDPC;
-	t->sched[JMPBUFSP] = (ulong)tos;
-}
-
--- a/sys/src/libthread/mkfile
+++ b/sys/src/libthread/mkfile
@@ -31,7 +31,6 @@
 
 CFILES=\
 	386.c\
-	alpha.c\
 	amd64.c\
 	arm.c\
 	channel.c\
--- a/sys/src/mkfile.proto
+++ b/sys/src/mkfile.proto
@@ -2,8 +2,8 @@
 # common mkfile parameters shared by all architectures
 #
 
-OS=05678qv
-CPUS=spim arm amd64 alpha 386 power mips
+OS=0568qv
+CPUS=spim arm amd64 386 power mips
 CFLAGS=-FTVw
 LEX=lex
 YACC=yacc