Browse Source

First kernel round, types and hacks

Elbing Miss 9 years ago
parent
commit
b995c7b2b0

+ 1 - 1
amd64/mkfile

@@ -1,4 +1,4 @@
-<$ROOT/sys/src/mkfile.proto
+</sys/src/mkfile.proto
 
 #CC=6c
 #LD=6l

+ 1 - 1
sys/src/9/k10/acore.c

@@ -138,7 +138,7 @@ acmmuswitch(void)
 void
 actouser(void)
 {
-	void xactouser(u64int);
+	void xactouser(uint64_t);
 	Ureg *u;
 
 	acfpusysprocsetup(m->proc);

+ 91 - 91
sys/src/9/k10/acpi.h

@@ -107,7 +107,7 @@ struct Atable
 	char	sig[5];		/* signature */
 	char	oemid[7];	/* oem id str. */
 	char	oemtblid[9];	/* oem tbl. id str. */
-	uchar* tbl;		/* pointer to table in memory */
+	unsigned char* tbl;		/* pointer to table in memory */
 	long	dlen;		/* size of data in table, after Stdhdr */
 };
 
@@ -125,28 +125,28 @@ struct Gpe
 struct Parse
 {
 	char*	sig;
-	Atable*	(*f)(uchar*, int);	/* return nil to keep vmap */
+	Atable*	(*f)(unsigned char*, int);	/* return nil to keep vmap */
 };
 
 struct Regio{
 	void	*arg;
-	u8int	(*get8)(uintptr, void*);
-	void	(*set8)(uintptr, u8int, void*);
-	u16int	(*get16)(uintptr, void*);
-	void	(*set16)(uintptr, u16int, void*);
-	u32int	(*get32)(uintptr, void*);
-	void	(*set32)(uintptr, u32int, void*);
-	u64int	(*get64)(uintptr, void*);
-	void	(*set64)(uintptr, u64int, void*);
+	uint8_t	(*get8)(uintptr, void*);
+	void	(*set8)(uintptr, uint8_t, void*);
+	uint16_t	(*get16)(uintptr, void*);
+	void	(*set16)(uintptr, uint16_t, void*);
+	uint32_t	(*get32)(uintptr, void*);
+	void	(*set32)(uintptr, uint32_t, void*);
+	uint64_t	(*get64)(uintptr, void*);
+	void	(*set64)(uintptr, uint64_t, void*);
 };
 
 struct Reg
 {
 	char*	name;
 	int	spc;		/* io space */
-	u64int	base;		/* address, physical */
-	uchar*	p;		/* address, kmapped */
-	u64int	len;
+	uint64_t	base;		/* address, physical */
+	unsigned char*	p;		/* address, kmapped */
+	uint64_t	len;
 	int	tbdf;
 	int	accsz;		/* access size */
 };
@@ -156,11 +156,11 @@ struct Reg
 #pragma pack on
 struct Gas
 {
-	u8int	spc;	/* address space id */
-	u8int	len;	/* register size in bits */
-	u8int	off;	/* bit offset */
-	u8int	accsz;	/* 1: byte; 2: word; 3: dword; 4: qword */
-	u64int	addr;	/* address (or acpi encoded tbdf + reg) */
+	uint8_t	spc;	/* address space id */
+	uint8_t	len;	/* register size in bits */
+	uint8_t	off;	/* bit offset */
+	uint8_t	accsz;	/* 1: byte; 2: word; 3: dword; 4: qword */
+	uint64_t	addr;	/* address (or acpi encoded tbdf + reg) */
 };
 
 /* Root system description table pointer.
@@ -175,43 +175,43 @@ struct Gas
 
 struct Rsdp
 {
-	u8int	signature[8];			/* "RSD PTR " */
-	u8int	rchecksum;
-	u8int	oemid[6];
-	u8int	revision;
-	u8int	raddr[4];			/* RSDT */
-	u8int	length[4];
-	u8int	xaddr[8];			/* XSDT */
-	u8int	xchecksum;			/* XSDT */
-	u8int	_33_[3];			/* reserved */
+	uint8_t	signature[8];			/* "RSD PTR " */
+	uint8_t	rchecksum;
+	uint8_t	oemid[6];
+	uint8_t	revision;
+	uint8_t	raddr[4];			/* RSDT */
+	uint8_t	length[4];
+	uint8_t	xaddr[8];			/* XSDT */
+	uint8_t	xchecksum;			/* XSDT */
+	uint8_t	_33_[3];			/* reserved */
 };
 
 /* Header for ACPI description tables
  */
 struct Sdthdr
 {
-	u8int	sig[4];			/* "FACP" or whatever */
-	u8int	length[4];
-	u8int	rev;
-	u8int	csum;
-	u8int	oemid[6];
-	u8int	oemtblid[8];
-	u8int	oemrev[4];
-	u8int	creatorid[4];
-	u8int	creatorrev[4];
+	uint8_t	sig[4];			/* "FACP" or whatever */
+	uint8_t	length[4];
+	uint8_t	rev;
+	uint8_t	csum;
+	uint8_t	oemid[6];
+	uint8_t	oemtblid[8];
+	uint8_t	oemrev[4];
+	uint8_t	creatorid[4];
+	uint8_t	creatorrev[4];
 };
 
 /* Firmware control structure
  */
 struct Facs
 {
-	u32int	hwsig;
-	u32int	wakingv;
-	u32int	glock;
-	u32int	flags;
-	u64int	xwakingv;
-	u8int	vers;
-	u32int	ospmflags;
+	uint32_t	hwsig;
+	uint32_t	wakingv;
+	uint32_t	glock;
+	uint32_t	flags;
+	uint64_t	xwakingv;
+	uint8_t	vers;
+	uint32_t	ospmflags;
 };
 
 #pragma pack off
@@ -222,7 +222,7 @@ struct Msct
 {
 	int	ndoms;		/* number of domains */
 	int	nclkdoms;	/* number of clock domains */
-	u64int	maxpa;		/* max physical address */
+	uint64_t	maxpa;		/* max physical address */
 
 	Mdom*	dom;		/* domain information list */
 };
@@ -233,7 +233,7 @@ struct Mdom
 	int	start;		/* start dom id */
 	int	end;		/* end dom id */
 	int	maxproc;	/* max processor capacity */
-	u64int	maxmem;		/* max memory capacity */
+	uint64_t	maxmem;		/* max memory capacity */
 };
 
 /* Multiple APIC description table
@@ -244,7 +244,7 @@ struct Mdom
  */
 struct Madt
 {
-	u64int	lapicpa;		/* local APIC addr */
+	uint64_t	lapicpa;		/* local APIC addr */
 	int	pcat;		/* the machine has PC/AT 8259s */
 	Apicst*	st;		/* list of Apic related structures */
 };
@@ -260,8 +260,8 @@ struct Apicst
 		} lapic;
 		struct{
 			int	id;	/* io apic id */
-			u32int	ibase;	/* interrupt base addr. */
-			u64int	addr;	/* base address */
+			uint32_t	ibase;	/* interrupt base addr. */
+			uint64_t	addr;	/* base address */
 		} ioapic, iosapic;
 		struct{
 			int	irq;	/* bus intr. source (ISA only) */
@@ -320,8 +320,8 @@ struct Srat
 		} lapic;
 		struct{
 			int	dom;	/* proximity domain */
-			u64int	addr;	/* base address */
-			u64int	len;
+			uint64_t	addr;	/* base address */
+			uint64_t	len;
 			int	hplug;	/* hot pluggable */
 			int	nvram;	/* non volatile */	
 		} mem;
@@ -336,7 +336,7 @@ struct Srat
 /* System locality information table
  */
 struct Slit {
-	uvlong rowlen;
+	int64_t rowlen;
 	SlEntry **e;
 };
 
@@ -354,49 +354,49 @@ struct SlEntry {
  */
 struct Fadt
 {
-	u32int	facs;
-	u32int	dsdt;
+	uint32_t	facs;
+	uint32_t	dsdt;
 	/* 1 reserved */
-	u8int	pmprofile;
-	u16int	sciint;
-	u32int	smicmd;
-	u8int	acpienable;
-	u8int	acpidisable;
-	u8int	s4biosreq;
-	u8int	pstatecnt;
-	u32int	pm1aevtblk;
-	u32int	pm1bevtblk;
-	u32int	pm1acntblk;
-	u32int	pm1bcntblk;
-	u32int	pm2cntblk;
-	u32int	pmtmrblk;
-	u32int	gpe0blk;
-	u32int	gpe1blk;
-	u8int	pm1evtlen;
-	u8int	pm1cntlen;
-	u8int	pm2cntlen;
-	u8int	pmtmrlen;
-	u8int	gpe0blklen;
-	u8int	gpe1blklen;
-	u8int	gp1base;
-	u8int	cstcnt;
-	u16int	plvl2lat;
-	u16int	plvl3lat;
-	u16int	flushsz;
-	u16int	flushstride;
-	u8int	dutyoff;
-	u8int	dutywidth;
-	u8int	dayalrm;
-	u8int	monalrm;
-	u8int	century;
-	u16int	iapcbootarch;
+	uint8_t	pmprofile;
+	uint16_t	sciint;
+	uint32_t	smicmd;
+	uint8_t	acpienable;
+	uint8_t	acpidisable;
+	uint8_t	s4biosreq;
+	uint8_t	pstatecnt;
+	uint32_t	pm1aevtblk;
+	uint32_t	pm1bevtblk;
+	uint32_t	pm1acntblk;
+	uint32_t	pm1bcntblk;
+	uint32_t	pm2cntblk;
+	uint32_t	pmtmrblk;
+	uint32_t	gpe0blk;
+	uint32_t	gpe1blk;
+	uint8_t	pm1evtlen;
+	uint8_t	pm1cntlen;
+	uint8_t	pm2cntlen;
+	uint8_t	pmtmrlen;
+	uint8_t	gpe0blklen;
+	uint8_t	gpe1blklen;
+	uint8_t	gp1base;
+	uint8_t	cstcnt;
+	uint16_t	plvl2lat;
+	uint16_t	plvl3lat;
+	uint16_t	flushsz;
+	uint16_t	flushstride;
+	uint8_t	dutyoff;
+	uint8_t	dutywidth;
+	uint8_t	dayalrm;
+	uint8_t	monalrm;
+	uint8_t	century;
+	uint16_t	iapcbootarch;
 	/* 1 reserved */
-	u32int	flags;
+	uint32_t	flags;
 	Gas	resetreg;
-	u8int	resetval;
+	uint8_t	resetval;
 	/* 3 reserved */
-	u64int	xfacs;
-	u64int	xdsdt;
+	uint64_t	xfacs;
+	uint64_t	xdsdt;
 	Gas	xpm1aevtblk;
 	Gas	xpm1bevtblk;
 	Gas	xpm1acntblk;
@@ -413,7 +413,7 @@ struct Xsdt
 {
 	int	len;
 	int	asize;
-	u8int*	p;
+	uint8_t*	p;
 };
 
 extern uintmem acpimblocksize(uintmem, int*);

+ 9 - 9
sys/src/9/k10/apic.h

@@ -20,7 +20,7 @@ typedef	struct	Apic	Apic;
 
 struct Ioapic {
 	Lock;					/* IOAPIC: register access */
-	u32int*	addr;				/* IOAPIC: register base */
+	uint32_t*	addr;				/* IOAPIC: register base */
 	int	nrdt;				/* IOAPIC: size of RDT */
 	int	gsib;				/* IOAPIC: global RDT index */
 };
@@ -28,14 +28,14 @@ struct Ioapic {
 struct Lapic {
 	int	machno;				/* APIC */
 
-	u32int	lvt[6];
+	uint32_t	lvt[6];
 	int	nlvt;
 	int	ver;
 
-	vlong	hz;				/* APIC Timer frequency */
-	vlong	max;
-	vlong	min;
-	vlong	div;
+	int64_t	hz;				/* APIC Timer frequency */
+	int64_t	max;
+	int64_t	min;
+	int64_t	div;
 };
 
 struct Apic {
@@ -90,12 +90,12 @@ extern	Apic	xioapic[Napic];
 extern	Mach	*xlapicmachptr[Napic];		/* maintained, but unused */
 
 #define l16get(p)	(((p)[1]<<8)|(p)[0])
-#define	l32get(p)	(((u32int)l16get(p+2)<<16)|l16get(p))
-#define	l64get(p)	(((u64int)l32get(p+4)<<32)|l32get(p))
+#define	l32get(p)	(((uint32_t)l16get(p+2)<<16)|l16get(p))
+#define	l64get(p)	(((uint64_t)l32get(p+4)<<32)|l32get(p))
 
 extern void apicdump(void);
 extern void apictimerenab(void);
 extern void ioapicdump(void);
 
-extern int pcimsienable(Pcidev*, uvlong);
+extern int pcimsienable(Pcidev*, uint64_t);
 extern int pcimsimask(Pcidev*, int);

+ 48 - 45
sys/src/9/k10/dat.h

@@ -21,7 +21,7 @@ typedef struct MFPU MFPU;
 typedef struct MMMU MMMU;
 typedef struct NIX NIX;
 typedef struct Mach Mach;
-typedef u64int Mpl;
+typedef uint64_t Mpl;
 typedef struct Page Page;
 typedef struct Pcidev Pcidev;
 typedef struct PFPU PFPU;
@@ -30,10 +30,10 @@ typedef struct PmcCtl PmcCtl;
 typedef struct PmcWait PmcWait;
 typedef struct PMMU PMMU;
 typedef struct PNOTIFY PNOTIFY;
-typedef u64int PTE;
+typedef uint64_t PTE;
 typedef struct Proc Proc;
 typedef struct Sys Sys;
-typedef u64int uintmem;				/* Physical address (hideous) */
+typedef uint64_t uintmem;				/* Physical address (hideous) */
 typedef struct Ureg Ureg;
 typedef struct Vctl Vctl;
 
@@ -53,13 +53,13 @@ typedef struct Vctl Vctl;
 
 struct Lock
 {
-	u32int	key;
+	uint32_t	key;
 	int	isilock;
 	Mpl	pl;
-	uintptr	pc;
+	uintptr	_pc;
 	Proc*	p;
 	Mach*	m;
-	uvlong	lockcycles;
+	uint64_t	lockcycles;
 };
 
 struct Label
@@ -69,18 +69,18 @@ struct Label
 };
 
 struct Fxsave {
-	u16int	fcw;			/* x87 control word */
-	u16int	fsw;			/* x87 status word */
-	u8int	ftw;			/* x87 tag word */
-	u8int	zero;			/* 0 */
-	u16int	fop;			/* last x87 opcode */
-	u64int	rip;			/* last x87 instruction pointer */
-	u64int	rdp;			/* last x87 data pointer */
-	u32int	mxcsr;			/* MMX control and status */
-	u32int	mxcsrmask;		/* supported MMX feature bits */
-	uchar	st[128];		/* shared 64-bit media and x87 regs */
-	uchar	xmm[256];		/* 128-bit media regs */
-	uchar	ign[96];		/* reserved, ignored */
+	uint16_t	fcw;			/* x87 control word */
+	uint16_t	fsw;			/* x87 status word */
+	uint8_t	ftw;			/* x87 tag word */
+	uint8_t	zero;			/* 0 */
+	uint16_t	fop;			/* last x87 opcode */
+	uint64_t	rip;			/* last x87 instruction pointer */
+	uint64_t	rdp;			/* last x87 data pointer */
+	uint32_t	mxcsr;			/* MMX control and status */
+	uint32_t	mxcsrmask;		/* supported MMX feature bits */
+	unsigned char	st[128];		/* shared 64-bit media and x87 regs */
+	unsigned char	xmm[256];		/* 128-bit media regs */
+	unsigned char	ign[96];		/* reserved, ignored */
 };
 
 /*
@@ -88,7 +88,7 @@ struct Fxsave {
  */
 struct PFPU {
 	int	fpustate;
-	uchar	fxsave[sizeof(Fxsave)+15];
+	unsigned char	fxsave[sizeof(Fxsave)+15];
 	void*	fpusave;
 };
 
@@ -106,7 +106,8 @@ struct PMMU
  */
 struct PNOTIFY
 {
-	void	emptiness;
+//	void	emptiness;
+	char	emptiness;
 };
 
 struct Confmem
@@ -121,7 +122,7 @@ struct Conf
 {
 	uint32_t	nproc;		/* processes */
 	Confmem	mem[4];		/* physical memory */
-	uvlong	npage;		/* total physical pages of memory */
+	uint64_t	npage;		/* total physical pages of memory */
 	usize	upages;		/* user page pool */
 	uint32_t	copymode;	/* 0 is copy on write, 1 is copy on reference */
 	uint32_t	ialloc;		/* max interrupt time allocation in bytes */
@@ -140,7 +141,7 @@ enum
  */
 struct MCPU
 {
-	u32int	cpuinfo[3][4];			/*  CPUID Functions 0, 1, and 5 (n.b.: 2-4 are invalid) */
+	uint32_t	cpuinfo[3][4];			/*  CPUID Functions 0, 1, and 5 (n.b.: 2-4 are invalid) */
 	int	ncpuinfos;			/* number of standard entries */
 	int	ncpuinfoe;			/* number of extended entries */
 	int	isintelcpu;			/*  */
@@ -151,9 +152,9 @@ struct MCPU
  */
 struct MFPU
 {
-	u16int	fcw;			/* x87 control word */
-	u32int	mxcsr;			/* MMX control and status */
-	u32int	mxcsrmask;		/* supported MMX feature bits */
+	uint16_t	fcw;			/* x87 control word */
+	uint32_t	mxcsr;			/* MMX control and status */
+	uint32_t	mxcsrmask;		/* supported MMX feature bits */
 };
 
 struct NIX
@@ -197,12 +198,12 @@ struct ICC
 	/* fn is kept in its own cache line */
 	union{
 		void	(*fn)(void);
-		uchar	_ln1_[ICCLNSZ];
+		unsigned char	_ln1_[ICCLNSZ];
 	};
 	int	flushtlb;	/* on the AC, before running fn */
 	int	rc;		/* return code from AC to TC */
 	char*	note;		/* to be posted in the TC after returning */
-	uchar	data[ICCLNSZ];	/* sent to the AC */
+	unsigned char	data[ICCLNSZ];	/* sent to the AC */
 };
 
 /*
@@ -210,7 +211,7 @@ struct ICC
  */
 struct PmcCtl {
 	Ref;
-	u32int coreno;
+	uint32_t coreno;
 	int enab;
 	int user;
 	int os;
@@ -228,7 +229,7 @@ struct PmcWait{
 struct PmcCtr{
 	int stale;
 	PmcWait *wq;
-	u64int ctr;
+	uint64_t ctr;
 	int ctrset;
 	PmcCtl;
 	int ctlset;
@@ -264,7 +265,7 @@ struct Mach
 
 	MMMU;
 
-	uchar*	vsvm;
+	unsigned char*	vsvm;
 	void*	gdt;
 	void*	tss;
 
@@ -290,10 +291,10 @@ struct Mach
 	int	lastintr;
 
 	Lock	apictimerlock;
-	uvlong	cyclefreq;		/* Frequency of user readable cycle counter */
-	vlong	cpuhz;
+	uint64_t	cyclefreq;		/* Frequency of user readable cycle counter */
+	int64_t	cpuhz;
 	int	cpumhz;
-	u64int	rdtsc;
+	uint64_t	rdtsc;
 
 	Lock	pmclock;
 	PmcCtr	pmc[PmcMaxCtrs];
@@ -317,46 +318,46 @@ struct Mach
  * the unions.
  */
 struct Sys {
-	uchar	machstk[MACHSTKSZ];
+	unsigned char	machstk[MACHSTKSZ];
 
 	PTE	pml4[PTSZ/sizeof(PTE)];	/*  */
 	PTE	pdp[PTSZ/sizeof(PTE)];
 	PTE	pd[PTSZ/sizeof(PTE)];
 	PTE	pt[PTSZ/sizeof(PTE)];
 
-	uchar	vsvmpage[4*KiB];
+	unsigned char	vsvmpage[4*KiB];
 
 	union {
 		Mach	mach;
-		uchar	machpage[MACHSZ];
+		unsigned char	machpage[MACHSZ];
 	};
 
 	union {
 		struct {
-			u64int	pmstart;	/* physical memory */
-			u64int	pmoccupied;	/* how much is occupied */
-			u64int	pmend;		/* total span */
+			uint64_t	pmstart;	/* physical memory */
+			uint64_t	pmoccupied;	/* how much is occupied */
+			uint64_t	pmend;		/* total span */
 
 			uintptr	vmstart;	/* base address for malloc */
 			uintptr	vmunused;	/* 1st unused va */
 			uintptr	vmunmapped;	/* 1st unmapped va */
 			uintptr	vmend;		/* 1st unusable va */
-			u64int	epoch;		/* crude time synchronisation */
+			uint64_t	epoch;		/* crude time synchronisation */
 
 			int		nc[NIXROLES];		/* number of online processors */
 			int		nmach;
 			int		load;
 			uint32_t	ticks;			/* of the clock since boot time */
 		};
-		uchar	syspage[4*KiB];
+		unsigned char	syspage[4*KiB];
 	};
 
 	union {
 		Mach*	machptr[MACHMAX];
-		uchar	ptrpage[4*KiB];
+		unsigned char	ptrpage[4*KiB];
 	};
 
-	uchar	_57344_[2][4*KiB];		/* unused */
+	unsigned char	_57344_[2][4*KiB];		/* unused */
 };
 
 extern Sys* sys;
@@ -403,8 +404,10 @@ struct ISAConf {
  * MMU information array machptr, mainly for disambiguation and access to
  * the clock which is only maintained by the bootstrap processor (0).
  */
-extern register Mach* m;			/* R15 */
-extern register Proc* up;			/* R14 */
+//extern register Mach* m;			/* R15 */
+//extern register Proc* up;			/* R14 */
+extern Mach* m;                      /* R15 */
+extern Proc* up;                     /* R14 */
 
 extern uintptr kseg0;
 

+ 8 - 8
sys/src/9/k10/etherif.h

@@ -24,13 +24,13 @@ struct Ether {
 
 	int	ctlrno;
 	int	tbdf;			/* type+busno+devno+funcno */
-	uchar	ea[Eaddrlen];
+	unsigned char	ea[Eaddrlen];
 
 	void	(*attach)(Ether*);	/* filled in by reset routine */
 	void	(*detach)(Ether*);
 	void	(*transmit)(Ether*);
 	void	(*interrupt)(Ureg*, void*);
-	long	(*ifstat)(Ether*, void*, long, ulong);
+	long	(*ifstat)(Ether*, void*, long, uint32_t);
 	long 	(*ctl)(Ether*, void*, long); /* custom ctl messages */
 	void	(*power)(Ether*, int);	/* power on/off */
 	void	(*shutdown)(Ether*);	/* shutdown hardware before reboot */
@@ -45,16 +45,16 @@ struct Ether {
 typedef struct Etherpkt Etherpkt;
 struct Etherpkt
 {
-	uchar	d[Eaddrlen];
-	uchar	s[Eaddrlen];
-	uchar	type[2];
-	uchar	data[1500];
+	unsigned char	d[Eaddrlen];
+	unsigned char	s[Eaddrlen];
+	unsigned char	type[2];
+	unsigned char	data[1500];
 };
 
 extern Block* etheriq(Ether*, Block*, int);
 extern void addethercard(char*, int(*)(Ether*));
-extern uint32_t ethercrc(uchar*, int);
-extern int parseether(uchar*, char*);
+extern uint32_t ethercrc(unsigned char*, int);
+extern int parseether(unsigned char*, char*);
 
 #define NEXT(x, l)	(((x)+1)%(l))
 #define PREV(x, l)	(((x) == 0) ? (l)-1: (x)-1)

+ 43 - 43
sys/src/9/k10/fns.h

@@ -18,21 +18,21 @@ void	acsysret(void);
 void	actouser(void);
 void		runacore(void);
 void	aamloop(int);
-Dirtab*	addarchfile(char*, int, long(*)(Chan*,void*,long,vlong), long(*)(Chan*,void*,long,vlong));
+Dirtab*	addarchfile(char*, int, long(*)(Chan*,void*,long,int64_t), long(*)(Chan*,void*,long,int64_t));
 void	acmmuswitch(void);
 void	acmodeset(int);
 void	archfmtinstall(void);
 void	archidle(void);
 int	archmmu(void);
 int	asmfree(uintmem, uintmem, int);
-uvlong	asmalloc(uintmem, uintmem, int, int);
+uint64_t	asmalloc(uintmem, uintmem, int, int);
 void	asminit(void);
 void	asmmapinit(uintmem, uintmem, int);
-extern void asmmodinit(u32int, u32int, char*);
+extern void asmmodinit(uint32_t, uint32_t, char*);
 void	noerrorsleft(void);
 void	archinit(void);
 void	archreset(void);
-vlong	archhz(void);
+int64_t	archhz(void);
 void	cgaconsputs(char*, int);
 void	cgainit(void);
 void	cgapost(int);
@@ -40,12 +40,12 @@ void	checkpa(char*, uintmem);
 #define	clearmmucache()				/* x86 doesn't have one */
 void	(*coherence)(void);
 int	corecolor(int);
-u32int	cpuid(u32int, u32int, u32int[4]);
+uint32_t	cpuid(uint32_t, uint32_t, uint32_t[4]);
 int	dbgprint(char*, ...);
 int	decref(Ref*);
 void	delay(int);
 void	dumpmmu(Proc*);
-void	dumpmmuwalk(u64int pa);
+void	dumpmmuwalk(uint64_t pa);
 void	dumpptepg(int lvl,uintptr pa);
 #define	evenaddr(x)				/* x86 doesn't care */
 int	fpudevprocio(Proc*, void*, long, uintptr, int);
@@ -62,19 +62,19 @@ char*	getconf(char*);
 void	halt(void);
 void	hardhalt(void);
 int	i8042auxcmd(int);
-int	i8042auxcmds(uchar*, int);
+int	i8042auxcmds(unsigned char*, int);
 void	i8042auxenable(void (*)(int, int));
 void	i8042reset(void);
 Uart*	i8250console(char*);
 void*	i8250alloc(int, int, int);
-vlong	i8254hz(u32int[2][4]);
+int64_t	i8254hz(uint32_t[2][4]);
 void	idlehands(void);
 void	acidthandlers(void);
 void	idthandlers(void);
 int	inb(int);
 int	incref(Ref*);
 void	insb(int, void*, int);
-ushort	ins(int);
+uint16_t	ins(int);
 void	inss(int, void*, int);
 uint32_t	inl(int);
 void	insl(int, void*, int);
@@ -96,24 +96,24 @@ void	lfence(void);
 void	links(void);
 void	machinit(void);
 void	mach0init(void);
-void	mapraminit(uvlong, uvlong);
-void	mapupainit(uvlong, uint32_t);
+void	mapraminit(uint64_t, uint64_t);
+void	mapupainit(uint64_t, uint32_t);
 void	meminit(void);
 void	mfence(void);
-void	mmuflushtlb(u64int);
+void	mmuflushtlb(uint64_t);
 void	mmuinit(void);
 uintptr	mmukmap(uintptr, uintptr, usize);
-int	mmukmapsync(uvlong);
+int	mmukmapsync(uint64_t);
 uintmem	mmuphysaddr(uintptr);
 int	mmuwalk(PTE*, uintptr, int, PTE**, PTE (*)(usize));
-int	multiboot(u32int, u32int, int);
+int	multiboot(uint32_t, uint32_t, int);
 void	ndnr(void);
-uchar	nvramread(int);
-void	nvramwrite(int, uchar);
+unsigned char	nvramread(int);
+void	nvramwrite(int, unsigned char);
 void	optionsinit(char*);
 void	outb(int, int);
 void	outsb(int, void*, int);
-void	outs(int, ushort);
+void	outs(int, uint16_t);
 void	outss(int, void*, int);
 void	outl(int, uint32_t);
 void	outsl(int, void*, int);
@@ -141,17 +141,17 @@ void	runapcore(int);
 int	screenprint(char*, ...);			/* debugging */
 void	sfence(void);
 void	spldone(void);
-u64int	splhi(void);
-u64int	spllo(void);
-void	splx(u64int);
-void	splxpc(u64int);
+uint64_t	splhi(void);
+uint64_t	spllo(void);
+void	splx(uint64_t);
+void	splxpc(uint64_t);
 void	stopac(void);
 void	syncclock(void);
 void	syscall(int scallnr, Ureg* ureg);
 void*	sysexecregs(uintptr, uint32_t, uint32_t);
 uintptr	sysexecstack(uintptr, int);
 void	sysprocsetup(Proc*);
-void	tssrsp0(u64int);
+void	tssrsp0(uint64_t);
 void	trapenable(int, void (*)(Ureg*, void*), void*, char*);
 void	trapinit(void);
 void	trap(Ureg*);
@@ -164,20 +164,20 @@ void*	vmap(uintptr, usize);
 void	vsvminit(int, int);
 void	vunmap(void*, usize);
 
-extern u64int cr0get(void);
-extern void cr0put(u64int);
-extern u64int cr2get(void);
-extern u64int cr3get(void);
-extern void cr3put(u64int);
-extern u64int cr4get(void);
-extern void cr4put(u64int);
+extern uint64_t cr0get(void);
+extern void cr0put(uint64_t);
+extern uint64_t cr2get(void);
+extern uint64_t cr3get(void);
+extern void cr3put(uint64_t);
+extern uint64_t cr4get(void);
+extern void cr4put(uint64_t);
 extern void gdtget(void*);
-extern void gdtput(int, u64int, u16int);
-extern void idtput(int, u64int);
-extern u64int rdmsr(u32int);
-extern u64int rdtsc(void);
-extern void trput(u64int);
-extern void wrmsr(u32int, u64int);
+extern void gdtput(int, uint64_t, uint16_t);
+extern void idtput(int, uint64_t);
+extern uint64_t rdmsr(uint32_t);
+extern uint64_t rdtsc(void);
+extern void trput(uint64_t);
+extern void wrmsr(uint32_t, uint64_t);
 
 extern int islo(void);
 extern void spldone(void);
@@ -185,17 +185,17 @@ extern Mpl splhi(void);
 extern Mpl spllo(void);
 extern void splx(Mpl);
 
-int	cas32(void*, u32int, u32int);
-int	cas64(void*, u64int, u64int);
+int	cas32(void*, uint32_t, uint32_t);
+int	cas64(void*, uint64_t, uint64_t);
 int	tas32(void*);
-u64int	fas64(u64int*, u64int);
+uint64_t	fas64(uint64_t*, uint64_t);
 
-#define CASU(p, e, n)	cas64((p), (u64int)(e), (u64int)(n))
-#define CASV(p, e, n)	cas64((p), (u64int)(e), (u64int)(n))
-#define CASP(p, e, n)	cas64((p), (u64int)(e), (u64int)(n))
+#define CASU(p, e, n)	cas64((p), (uint64_t)(e), (uint64_t)(n))
+#define CASV(p, e, n)	cas64((p), (uint64_t)(e), (uint64_t)(n))
+#define CASP(p, e, n)	cas64((p), (uint64_t)(e), (uint64_t)(n))
 #define CASW(p, e, n)	cas32((p), (e), (n))
 #define TAS(addr)	tas32((addr))
-#define	FASP(p, v)	((void*)fas64((u64int*)(p), (u64int)(v)))
+#define	FASP(p, v)	((void*)fas64((uint64_t*)(p), (uint64_t)(v)))
 
 void	touser(uintptr);
 void	syscallentry(void);
@@ -227,7 +227,7 @@ extern void apicpri(int);
 extern void apicsipi(int, uintmem);
 
 extern void ioapicinit(int, uintmem);
-extern void ioapicintrinit(int, int, int, int, u32int);
+extern void ioapicintrinit(int, int, int, int, uint32_t);
 extern void ioapiconline(void);
 
 /*

+ 10 - 10
sys/src/9/k10/io.h

@@ -234,17 +234,17 @@ typedef struct Pcidev Pcidev;
 struct Pcidev
 {
 	int	tbdf;			/* type+bus+device+function */
-	ushort	vid;			/* vendor ID */
-	ushort	did;			/* device ID */
+	uint16_t	vid;			/* vendor ID */
+	uint16_t	did;			/* device ID */
 
-	ushort	pcr;
+	uint16_t	pcr;
 
-	uchar	rid;
-	uchar	ccrp;
-	uchar	ccru;
-	uchar	ccrb;
-	uchar	cls;
-	uchar	ltr;
+	unsigned char	rid;
+	unsigned char	ccrp;
+	unsigned char	ccru;
+	unsigned char	ccrb;
+	unsigned char	cls;
+	unsigned char	ltr;
 
 	struct {
 		uint32_t	bar;		/* base address */
@@ -255,7 +255,7 @@ struct Pcidev
 		uint32_t	bar;
 		int	size;
 	} rom;
-	uchar	intl;			/* interrupt line */
+	unsigned char	intl;			/* interrupt line */
 
 	Pcidev*	list;
 	Pcidev*	link;			/* next device on this bno */

+ 4 - 4
sys/src/9/k10/k8cpunoasm

@@ -73,10 +73,10 @@ boot cpu
 	tcp
 
 rootdir
-	bootk8cpu.out boot
-	/amd64/bin/auth/factotum factotum
-	/amd64/bin/ip/ipconfig ipconfig
-	../root/nvram nvram
+#	bootk8cpu.out boot
+#	/amd64/bin/auth/factotum factotum
+#	/amd64/bin/ip/ipconfig ipconfig
+#	../root/nvram nvram
 
 conf
 	int cpuserver = 1;

+ 9 - 4
sys/src/9/k10/mkfile

@@ -1,12 +1,13 @@
 CONF=k8cpu
 CONFLIST=k8cpu
+objtype=amd64
+PORT=../port
 
 # override with the list of paths where to put extra
 # copies of the kernel. for each word $w in OTHERCOPIES,
 # the kernel is copied to $w/$objtype/...
 OTHERCOPIES=''
 
-objtype=amd64
 </$objtype/mkfile
 p=9
 
@@ -17,7 +18,8 @@ p=9
 <../mk/bootmkfile
 <../mk/portmkfile
 
-OBJ=$MACH $CONF.root.$O $DEVS $PORT
+#OBJ=$MACH $CONF.root.$O $DEVS $PORT
+OBJ=$MACH $DEVS $PORT
 
 $p$CONF:	$CONF.c $OBJ $LIB
 	$CC $CFLAGS '-DKERNDATE='`{date -n} $CONF.c
@@ -38,8 +40,11 @@ install:QV:	$p$CONF $p$CONF.gz
 	}
 	echo done
 
-init.out:	init9.$O initcode.$O /$objtype/lib/libc.a
-	$LD -l -R1 -s -o init.out init9.$O initcode.$O -lc
+init.out:
+	$CC $CFLAGS -o initcode.$O -c ../port/initcode.c
+	$CC $CFLAGS -o init9.$O -c init9.c
+	$CC $CFLAGS -o init.out init9.$O initcode.$O /$objtype/lib/libc.a
+	#$LD -l -R1 -s -o init.out init9.$O initcode.$O -lc
 
 l32p.$O:	${objtype}l.h
 l64idt.$O:	${objtype}l.h

+ 1 - 0
sys/src/9/mk/bootmkfile

@@ -1,3 +1,4 @@
+MKSHELL=$PLAN9/bin/rc
 BOOTDIR=../boot
 BOOTLIB=$BOOTDIR/libboot.a$O
 

+ 1 - 1
sys/src/9/mk/mkenum

@@ -1,4 +1,4 @@
-#!/bin/rc
+#!$PLAN9/bin/rc
 
 awk '
 BEGIN{

+ 1 - 1
sys/src/9/mk/mkroot

@@ -1,4 +1,4 @@
-#!/bin/rc
+#!$PLAN9/bin/rc
 
 rfork e
 echo mkroot $*

+ 1 - 1
sys/src/9/mk/mkrootall

@@ -1,4 +1,4 @@
-#!/bin/rc
+#!$PLAN9/bin/rc
 
 rfork e
 n=`{echo $#*^'%3' | hoc}

+ 1 - 1
sys/src/9/mk/mkrr

@@ -1,4 +1,4 @@
-#!/bin/rc
+#!$PLAN9/bin/rc
 
 rfork en
 

+ 2 - 1
sys/src/9/mk/parse

@@ -1,3 +1,4 @@
+MKSHELL=$PLAN9/bin/rc
 BEGIN{
 	oargc = 0;
 	for(argc = 1; argc < ARGC; argc++){
@@ -495,7 +496,7 @@ function mkrules(dir, exists, ameta, cmeta, flags,		f, i, s, t){
 			t = "$AS $AFLAGS " flags;
 		}
 		s = s $0 ".$O:\t" dir "/" f "\n";
-		s = s "\t" t " -D'_DBGC_='" dbgc[$0] "'' " dir "/" f "\n";
+#		s = s "\t" t " -D'_DBGC_='" dbgc[$0] "'' " dir "/" f "\n";
 	}
 	return s;
 }

+ 3 - 2
sys/src/9/mk/portmkfile

@@ -1,8 +1,9 @@
+MKSHELL=$PLAN9/bin/rc
 %.$O:	%.s
-	$AS $AFLAGS $stem.s
+	$AS $AFLAGS -o $stem.o -c $stem.s
 
 %.$O:	%.c
-	$CC $CFLAGS $stem.c
+	$CC $CFLAGS -c $stem.c
 
 %.m:	%.$O
 	$LD -o $target -uX -l $prereq

+ 23 - 23
sys/src/9/port/aoe.h

@@ -44,41 +44,41 @@ enum {
 };
 
 typedef struct {
-	uchar	dst[Eaddrlen];
-	uchar	src[Eaddrlen];
-	uchar	type[2];
-	uchar	verflag;
-	uchar	error;
-	uchar	major[2];
-	uchar	minor;
-	uchar	cmd;
-	uchar	tag[4];
-	uchar	payload[];
+	unsigned char	dst[Eaddrlen];
+	unsigned char	src[Eaddrlen];
+	unsigned char	type[2];
+	unsigned char	verflag;
+	unsigned char	error;
+	unsigned char	major[2];
+	unsigned char	minor;
+	unsigned char	cmd;
+	unsigned char	tag[4];
+	unsigned char	payload[];
 } Aoehdr;
 
 #define AOEHDRSZ	offsetof(Aoehdr, payload[0])
 
 typedef struct {
 	Aoehdr;
-	uchar	aflag;
-	uchar	errfeat;
-	uchar	scnt;
-	uchar	cmdstat;
-	uchar	lba[6];
-	uchar	res[2];
-	uchar	payload[];
+	unsigned char	aflag;
+	unsigned char	errfeat;
+	unsigned char	scnt;
+	unsigned char	cmdstat;
+	unsigned char	lba[6];
+	unsigned char	res[2];
+	unsigned char	payload[];
 } Aoeata;
 
 #define AOEATASZ	offsetof(Aoeata, payload[0])
 
 typedef struct {
 	Aoehdr;
-	uchar	bufcnt[2];
-	uchar	fwver[2];
-	uchar	scnt;
-	uchar	verccmd;
-	uchar	cslen[2];
-	uchar	payload[];
+	unsigned char	bufcnt[2];
+	unsigned char	fwver[2];
+	unsigned char	scnt;
+	unsigned char	verccmd;
+	unsigned char	cslen[2];
+	unsigned char	payload[];
 } Aoeqc;
 
 #define AOEQCSZ		offsetof(Aoeqc, payload[0])

+ 4 - 4
sys/src/9/port/edf.h

@@ -43,20 +43,20 @@ struct Edf {
 	long		testtime;
 	Proc		*testnext;
 	/* other */
-	ushort		flags;
+	uint16_t		flags;
 	Timer;
 	/* Stats */
 	long		edfused;
 	long		extraused;
 	long		aged;
-	ulong		periods;
-	ulong		missed;
+	uint32_t		periods;
+	uint32_t		missed;
 };
 
 extern Lock	edftestlock;	/* for atomic admitting/expelling */
 
 #pragma	varargck	type	"t"		long
-#pragma	varargck	type	"U"		uvlong
+#pragma	varargck	type	"U"		uint64_t
 
 /* Interface: */
 Edf*		edflock(Proc*);

+ 3 - 3
sys/src/9/port/kexec.h

@@ -15,7 +15,7 @@ typedef struct Kexecgrp Kexecgrp;
 struct Kvalue
 {
 	uintptr addr;
-	uvlong size;
+	uint64_t size;
 	int	len;
 	int inuse;
 	Kvalue	*link;
@@ -29,8 +29,8 @@ struct Kexecgrp
 	Kvalue	**ent;
 	int	nent;
 	int	ment;
-	ulong	path;	/* qid.path of next Kvalue to be allocated */
-	ulong	vers;	/* of Kexecgrp */
+	uint32_t	path;	/* qid.path of next Kvalue to be allocated */
+	uint32_t	vers;	/* of Kexecgrp */
 };
 
 void	kforkexecac(Proc*, int, char*, char**);

+ 16 - 16
sys/src/9/port/lib.h

@@ -11,7 +11,7 @@
  * functions (possibly) linked in, complete, from libc.
  */
 #define nelem(x)	(sizeof(x)/sizeof((x)[0]))
-#define offsetof(s, m)	(ulong)(&(((s*)0)->m))
+#define offsetof(s, m)	(uint32_t)(&(((s*)0)->m))
 #define assert(x)	if(x){}else _assert("x")
 
 /*
@@ -79,7 +79,7 @@ extern	void*	realloc(void *, uint32_t);
  */
 typedef struct Fmt	Fmt;
 struct Fmt{
-	uchar	runes;			/* output buffer is runes or chars? */
+	unsigned char	runes;			/* output buffer is runes or chars? */
 	void	*start;			/* of buffer */
 	void	*to;			/* current place in the buffer */
 	void	*stop;			/* end of the buffer; overwritten if flush fails */
@@ -124,14 +124,14 @@ extern	int	sprint(char*, char*, ...);
 #pragma	varargck	argpos	snprint		3
 #pragma	varargck	argpos	sprint		2
 
-#pragma	varargck	type	"lld"	vlong
-#pragma	varargck	type	"llx"	vlong
-#pragma	varargck	type	"lld"	uvlong
-#pragma	varargck	type	"llx"	uvlong
+#pragma	varargck	type	"lld"	int64_t
+#pragma	varargck	type	"llx"	int64_t
+#pragma	varargck	type	"lld"	uint64_t
+#pragma	varargck	type	"llx"	uint64_t
 #pragma	varargck	type	"ld"	long
 #pragma	varargck	type	"lx"	long
-#pragma	varargck	type	"ld"	ulong
-#pragma	varargck	type	"lx"	ulong
+#pragma	varargck	type	"ld"	uint32_t
+#pragma	varargck	type	"lx"	uint32_t
 #pragma	varargck	type	"d"	int
 #pragma	varargck	type	"x"	int
 #pragma	varargck	type	"c"	int
@@ -162,7 +162,7 @@ extern	void	quotefmtinstall(void);
 /*
  * Time-of-day
  */
-extern	void	cycles(uvlong*);	/* 64-bit value of the cycle counter if there is one, 0 if there isn't */
+extern	void	cycles(uint64_t*);	/* 64-bit value of the cycle counter if there is one, 0 if there isn't */
 
 /*
  * NIX core types
@@ -182,14 +182,14 @@ enum
 extern	int	abs(int);
 extern	int	atoi(char*);
 extern	char*	cleanname(char*);
-extern	int	dec64(uchar*, int, char*, int);
+extern	int	dec64(unsigned char*, int, char*, int);
 extern	uintptr	getcallerpc(void*);
 extern	int	getfields(char*, char**, int, int, char*);
 extern	int	gettokens(char *, char **, int, char *);
 extern	long	strtol(char*, char**, int);
 extern	uint32_t	strtoul(char*, char**, int);
-extern	vlong	strtoll(char*, char**, int);
-extern	uvlong	strtoull(char*, char**, int);
+extern	int64_t	strtoll(char*, char**, int);
+extern	uint64_t	strtoull(char*, char**, int);
 extern	void	qsort(void*, long, long, int (*)(void*, void*));
 /*
  * Syscall data structures
@@ -243,21 +243,21 @@ typedef struct Waitmsg	Waitmsg;
 
 struct Qid
 {
-	uvlong	path;
+	uint64_t	path;
 	uint32_t	vers;
-	uchar	type;
+	unsigned char	type;
 };
 
 struct Dir {
 	/* system-modified data */
-	ushort	type;	/* server type */
+	uint16_t	type;	/* server type */
 	uint	dev;	/* server subtype */
 	/* file data */
 	Qid	qid;	/* unique id from server */
 	uint32_t	mode;	/* permissions */
 	uint32_t	atime;	/* last read time */
 	uint32_t	mtime;	/* last write time */
-	vlong	length;	/* file length: see <u.h> */
+	int64_t	length;	/* file length: see <u.h> */
 	char	*name;	/* last element of path */
 	char	*uid;	/* owner name */
 	char	*gid;	/* group name */

+ 20 - 20
sys/src/9/port/netif.h

@@ -43,7 +43,7 @@ struct Netfile
 	QLock;
 
 	int	inuse;
-	ulong	mode;
+	uint32_t	mode;
 	char	owner[KNAMELEN];
 
 	int	type;			/* multiplexor type */
@@ -51,7 +51,7 @@ struct Netfile
 	int	scan;			/* base station scanning interval */
 	int	bridge;			/* bridge mode */
 	int	headersonly;		/* headers only - no data */
-	uchar	maddr[8];		/* bitmask of multicast addresses requested */
+	unsigned char	maddr[8];		/* bitmask of multicast addresses requested */
 	int	nmaddr;			/* number of multicast addresses */
 
 	Queue*	iq;			/* input */
@@ -64,7 +64,7 @@ struct Netaddr
 {
 	Netaddr	*next;			/* allocation chain */
 	Netaddr	*hnext;
-	uchar	addr[Nmaxaddr];
+	unsigned char	addr[Nmaxaddr];
 	int	ref;
 };
 
@@ -88,8 +88,8 @@ struct Netif
 	int	minmtu;
 	int 	maxmtu;
 	int	mtu;
-	uchar	addr[Nmaxaddr];
-	uchar	bcast[Nmaxaddr];
+	unsigned char	addr[Nmaxaddr];
+	unsigned char	bcast[Nmaxaddr];
 	Netaddr	*maddr;			/* known multicast addresses */
 	int	nmaddr;			/* number of known multicast addresses */
 	Netaddr *mhash[Nmhash];		/* hash table of multicast addresses */
@@ -100,20 +100,20 @@ struct Netif
 	Queue*	oq;			/* output */
 
 	/* statistics */
-	uvlong	misses;
-	uvlong	inpackets;
-	uvlong	outpackets;
-	uvlong	crcs;			/* input crc errors */
-	uvlong	oerrs;			/* output errors */
-	uvlong	frames;			/* framing errors */
-	uvlong	overflows;		/* packet overflows */
-	uvlong	buffs;			/* buffering errors */
-	uvlong	soverflows;		/* software overflow */
+	uint64_t	misses;
+	uint64_t	inpackets;
+	uint64_t	outpackets;
+	uint64_t	crcs;			/* input crc errors */
+	uint64_t	oerrs;			/* output errors */
+	uint64_t	frames;			/* framing errors */
+	uint64_t	overflows;		/* packet overflows */
+	uint64_t	buffs;			/* buffering errors */
+	uint64_t	soverflows;		/* software overflow */
 
 	/* routines for touching the hardware */
 	void	*arg;
 	void	(*promiscuous)(void*, int);
-	void	(*multicast)(void*, uchar*, int);
+	void	(*multicast)(void*, unsigned char*, int);
 	int	(*hwmtu)(void*, int);	/* get/set mtu */
 	void	(*scanbs)(void*, uint);	/* scan for base stations */
 };
@@ -122,9 +122,9 @@ void	netifinit(Netif*, char*, int, uint32_t);
 Walkqid*	netifwalk(Netif*, Chan*, Chan*, char **, int);
 Chan*	netifopen(Netif*, Chan*, int);
 void	netifclose(Netif*, Chan*);
-long	netifread(Netif*, Chan*, void*, long, vlong);
-Block*	netifbread(Netif*, Chan*, long, vlong);
+long	netifread(Netif*, Chan*, void*, long, int64_t);
+Block*	netifbread(Netif*, Chan*, long, int64_t);
 long	netifwrite(Netif*, Chan*, void*, long);
-long	netifwstat(Netif*, Chan*, uchar*, long);
-long	netifstat(Netif*, Chan*, uchar*, long);
-int	activemulti(Netif*, uchar*, int);
+long	netifwstat(Netif*, Chan*, unsigned char*, long);
+long	netifstat(Netif*, Chan*, unsigned char*, long);
+int	activemulti(Netif*, unsigned char*, int);

+ 4 - 4
sys/src/9/port/pmc.h

@@ -21,13 +21,13 @@ struct PmcCtlCtrId {
 };
 
 int		pmcnregs(void);
-int		pmcsetctl(u32int coreno, PmcCtl *p, u32int regno);
+int		pmcsetctl(uint32_t coreno, PmcCtl *p, uint32_t regno);
 int		pmctrans(PmcCtl *p);
-int		pmcgetctl(u32int coreno, PmcCtl *p, u32int regno);
+int		pmcgetctl(uint32_t coreno, PmcCtl *p, uint32_t regno);
 int		pmcdescstr(char *str, int nstr);
 int		pmcctlstr(char *str, int nstr, PmcCtl *p);
-u64int	pmcgetctr(u32int coreno, u32int regno);
-int		pmcsetctr(u32int coreno, u64int v, u32int regno);
+uint64_t	pmcgetctr(uint32_t coreno, uint32_t regno);
+int		pmcsetctr(uint32_t coreno, uint64_t v, uint32_t regno);
 
 void		pmcupdate(Mach *m);
 extern	void (*_pmcupdate)(Mach *m);

+ 62 - 62
sys/src/9/port/portdat.h

@@ -86,7 +86,7 @@ struct Ref
 struct Rendez
 {
 	Lock;
-	Proc	*p;
+	Proc	*_p;
 };
 
 enum{
@@ -107,8 +107,8 @@ struct Waitstats
 	int*	type;
 	uintptr*	pcs;
 	int*	ns;
-	uvlong*	wait;
-	uvlong* total;
+	uint64_t*	wait;
+	uint64_t* total;
 };
 extern Waitstats waitstats;
 
@@ -154,7 +154,7 @@ struct RWlock
 struct Alarms
 {
 	QLock;
-	Proc	*head;
+	Proc	*_head;
 };
 
 /*
@@ -172,7 +172,7 @@ enum
 
 	COPEN	= 0x0001,		/* for i/o */
 	CMSG	= 0x0002,		/* the message channel for a mount */
-/*rsc	CCREATE	= 0x0004,		/* permits creation if c->mnt */
+/*rsc	CCREATE	= 0x0004,*/		/* permits creation if c->mnt */
 	CCEXEC	= 0x0008,		/* close on exec */
 	CFREE	= 0x0010,		/* not in use */
 	CRCLOSE	= 0x0020,		/* remove on close */
@@ -194,13 +194,13 @@ struct Block
 {
 	Block*	next;
 	Block*	list;
-	uchar*	rp;			/* first unconsumed byte */
-	uchar*	wp;			/* first empty byte */
-	uchar*	lim;			/* 1 past the end of the buffer */
-	uchar*	base;			/* start of the buffer */
+	unsigned char*	rp;			/* first unconsumed byte */
+	unsigned char*	wp;			/* first empty byte */
+	unsigned char*	lim;			/* 1 past the end of the buffer */
+	unsigned char*	base;			/* start of the buffer */
 	void	(*free)(Block*);
-	ushort	flag;
-	ushort	checksum;		/* IP checksum of complete packet (minus media header) */
+	uint16_t	flag;
+	uint16_t	checksum;		/* IP checksum of complete packet (minus media header) */
 };
 #define BLEN(s)	((s)->wp - (s)->rp)
 #define BALLOC(s) ((s)->lim - (s)->base)
@@ -210,12 +210,12 @@ struct Chan
 	Ref;				/* the Lock in this Ref is also Chan's lock */
 	Chan*	next;			/* allocation */
 	Chan*	link;
-	vlong	offset;			/* in fd */
-	vlong	devoffset;		/* in underlying device; see read */
+	int64_t	offset;			/* in fd */
+	int64_t	devoffset;		/* in underlying device; see read */
 	Dev*	dev;
 	uint	devno;
-	ushort	mode;			/* read/write */
-	ushort	flag;
+	uint16_t	mode;			/* read/write */
+	uint16_t	flag;
 	Qid	qid;
 	int	fid;			/* for devmnt */
 	uint32_t	iounit;			/* chunk size for i/o; 0==default */
@@ -224,7 +224,7 @@ struct Chan
 	QLock	umqlock;		/* serialize unionreads */
 	int	uri;			/* union read index */
 	int	dri;			/* devdirread index */
-	uchar*	dirrock;		/* directory entry rock for translations */
+	unsigned char*	dirrock;		/* directory entry rock for translations */
 	int	nrock;
 	int	mrock;
 	QLock	rockqlock;
@@ -262,27 +262,27 @@ struct Dev
 	void	(*shutdown)(void);
 	Chan*	(*attach)(char*);
 	Walkqid*(*walk)(Chan*, Chan*, char**, int);
-	long	(*stat)(Chan*, uchar*, long);
+	long	(*stat)(Chan*, unsigned char*, long);
 	Chan*	(*open)(Chan*, int);
 	void	(*create)(Chan*, char*, int, int);
 	void	(*close)(Chan*);
-	long	(*read)(Chan*, void*, long, vlong);
-	Block*	(*bread)(Chan*, long, vlong);
-	long	(*write)(Chan*, void*, long, vlong);
-	long	(*bwrite)(Chan*, Block*, vlong);
+	long	(*read)(Chan*, void*, long, int64_t);
+	Block*	(*bread)(Chan*, long, int64_t);
+	long	(*write)(Chan*, void*, long, int64_t);
+	long	(*bwrite)(Chan*, Block*, int64_t);
 	void	(*remove)(Chan*);
-	long	(*wstat)(Chan*, uchar*, long);
+	long	(*wstat)(Chan*, unsigned char*, long);
 	void	(*power)(int);	/* power mgt: power(1) => on, power (0) => off */
 	int	(*config)(int, char*, DevConf*);	/* returns 0 on error */
-	int	(*zread)(Chan*, Kzio*, int, usize, vlong);
-	int	(*zwrite)(Chan*, Kzio*, int, vlong);
+	int	(*zread)(Chan*, Kzio*, int, usize, int64_t);
+	int	(*zwrite)(Chan*, Kzio*, int, int64_t);
 };
 
 struct Dirtab
 {
 	char	name[KNAMELEN];
 	Qid	qid;
-	vlong	length;
+	int64_t	length;
 	long	perm;
 };
 
@@ -374,7 +374,7 @@ struct Page
 	uintptr	va;			/* Virtual address for user */
 	uint32_t	daddr;			/* Disc address on swap */
 	int	ref;			/* Reference count */
-	uchar	modref;			/* Simulated modify/reference bits */
+	unsigned char	modref;			/* Simulated modify/reference bits */
 	int	color;			/* Cache coloring */
 	char	cachectl[MACHMAX];	/* Cache flushing control for mmuput */
 	Image	*image;			/* Associated text or swap image */
@@ -503,8 +503,8 @@ struct Segment
 {
 	Ref;
 	QLock	lk;
-	ushort	steal;		/* Page stealer lock */
-	ushort	type;		/* segment type */
+	uint16_t	steal;		/* Page stealer lock */
+	uint16_t	type;		/* segment type */
 	int	pgszi;		/* page size index in Mach MMMU */
 	uint	ptepertab;
 	int	color;
@@ -642,13 +642,13 @@ struct Timer
 {
 	/* Public interface */
 	int	tmode;		/* See above */
-	vlong	tns;		/* meaning defined by mode */
+	int64_t	tns;		/* meaning defined by mode */
 	void	(*tf)(Ureg*, Timer*);
 	void	*ta;
 	/* Internal */
 	Lock;
 	Timers	*tt;		/* Timers queue this timer runs on */
-	vlong	twhen;		/* ns represented in fastticks */
+	int64_t	twhen;		/* ns represented in fastticks */
 	Timer	*tnext;
 };
 
@@ -765,7 +765,7 @@ union Ar0 {
 	uintptr	p;
 	usize	u;
 	void*	v;
-	vlong	vl;
+	int64_t	vl;
 };
 
 typedef struct Nixpctl Nixpctl;
@@ -810,9 +810,9 @@ struct Proc
 	Fgrp	*closingfgrp;	/* used during teardown */
 
 	int	parentpid;
-	ulong	time[6];	/* User, Sys, Real; child U, S, R */
+	uint32_t	time[6];	/* User, Sys, Real; child U, S, R */
 
-	uvlong	kentry;		/* Kernel entry time stamp (for profiling) */
+	uint64_t	kentry;		/* Kernel entry time stamp (for profiling) */
 	/*
 	 * pcycles: cycles spent in this process (updated on procsave/restore)
 	 * when this is the current proc and we're in the kernel
@@ -821,14 +821,14 @@ struct Proc
 	 * when this is not the current process or we're in user mode
 	 * (procrestores and procsaves balance), it is pcycles.
 	 */
-	vlong	pcycles;
+	int64_t	pcycles;
 
 	int	insyscall;
 
 	QLock	debug;		/* to access debugging elements of User */
 	Proc	*pdbg;		/* the debugging process */
-	ulong	procmode;	/* proc device file mode */
-	ulong	privatemem;	/* proc does not let anyone read mem */
+	uint32_t	procmode;	/* proc device file mode */
+	uint32_t	privatemem;	/* proc does not let anyone read mem */
 	int	hang;		/* hang at next exec for debug */
 	int	procctl;	/* Control for /proc debugging */
 	uintptr	pc;		/* DEBUG only */
@@ -839,7 +839,7 @@ struct Proc
 	int	notepending;	/* note issued but not acted on */
 	int	kp;		/* true if a kernel process */
 	Proc	*palarm;	/* Next alarm time */
-	ulong	alarm;		/* Time of call */
+	uint32_t	alarm;		/* Time of call */
 	int	newtlb;		/* Pager has changed my pte's, I must flush */
 	int	noswap;		/* process is not swappable */
 
@@ -854,7 +854,7 @@ struct Proc
 	void	*kparg;
 
 	int	scallnr;	/* system call number */
-	uchar	arg[MAXSYSARG*sizeof(void*)];	/* system call arguments */
+	unsigned char	arg[MAXSYSARG*sizeof(void*)];	/* system call arguments */
 	int	nerrlab;
 	Label	errlab[NERR];
 	char	*syserrstr;	/* last error from a system call, errbuf0 or 1 */
@@ -878,14 +878,14 @@ struct Proc
 	Mach	*wired;
 	Mach	*mp;		/* machine this process last ran on */
 	int	nlocks;		/* number of locks held by proc */
-	ulong	delaysched;
-	ulong	priority;	/* priority level */
-	ulong	basepri;	/* base priority level */
+	uint32_t	delaysched;
+	uint32_t	priority;	/* priority level */
+	uint32_t	basepri;	/* base priority level */
 	int	fixedpri;	/* priority level does not change */
-	ulong	cpu;		/* cpu average */
-	ulong	lastupdate;
-	ulong	readytime;	/* time process came ready */
-	ulong	movetime;	/* last time process switched processors */
+	uint32_t	cpu;		/* cpu average */
+	uint32_t	lastupdate;
+	uint32_t	readytime;	/* time process came ready */
+	uint32_t	movetime;	/* last time process switched processors */
 	int	preempted;	/* true if this process hasn't finished the interrupt
 				 *  that last preempted it
 				 */
@@ -916,9 +916,9 @@ struct Proc
 	uint	nactrap;	/* # of traps in the AC for this process */
 	uint	nacsyscall;	/* # of syscalls in the AC for this process */
 	uint	nicc;		/* # of ICCs for the process */
-	uvlong	actime1;		/* ticks as of last call in AC */
-	uvlong	actime;		/* ∑time from call in AC to ret to AC, and... */
-	uvlong	tctime;		/* ∑time from call received to call handled */
+	uint64_t	actime1;		/* ticks as of last call in AC */
+	uint64_t	actime;		/* ∑time from call in AC to ret to AC, and... */
+	uint64_t	tctime;		/* ∑time from call received to call handled */
 	int	nqtrap;		/* # of traps in last quantum */
 	int	nqsyscall;	/* # of syscalls in the last quantum */
 	int	nfullq;
@@ -956,7 +956,7 @@ extern	char*	conffile;
 extern	int	cpuserver;
 extern  char*	eve;
 extern	char	hostdomain[];
-extern	uchar	initcode[];
+extern	unsigned char	initcode[];
 extern	int	kbdbuttons;
 extern  Ref	noteidalloc;
 extern	int	nphysseg;
@@ -1089,15 +1089,15 @@ struct Uart
 	Queue	*oq;
 
 	Lock	rlock;
-	uchar	istage[Stagesize];
-	uchar	*iw;
-	uchar	*ir;
-	uchar	*ie;
+	unsigned char	istage[Stagesize];
+	unsigned char	*iw;
+	unsigned char	*ir;
+	unsigned char	*ie;
 
 	Lock	tlock;			/* transmit */
-	uchar	ostage[Stagesize];
-	uchar	*op;
-	uchar	*oe;
+	unsigned char	ostage[Stagesize];
+	unsigned char	*op;
+	unsigned char	*oe;
 	int	drain;
 
 	int	modem;			/* hardware flow control on */
@@ -1154,16 +1154,16 @@ struct Fastcall {
 	void	(*fun)(Ar0*, Fastcall*);
 	void*	buf;
 	int	n;
-	vlong	offset;
+	int64_t	offset;
 };
 
 
 
 #define DEVDOTDOT -1
 
-#pragma	varargck	type	"I"	uchar*
-#pragma	varargck	type	"V"	uchar*
-#pragma	varargck	type	"E"	uchar*
-#pragma	varargck	type	"M"	uchar*
-#pragma	varargck	type	"W"	u64int
+#pragma	varargck	type	"I"	unsigned char*
+#pragma	varargck	type	"V"	unsigned char*
+#pragma	varargck	type	"E"	unsigned char*
+#pragma	varargck	type	"M"	unsigned char*
+#pragma	varargck	type	"W"	uint64_t
 #pragma	varargck	type	"Z"	Kzio*

+ 45 - 45
sys/src/9/port/portfns.h

@@ -10,12 +10,12 @@
 void		_assert(char*);
 void		accounttime(void);
 void		acsched(void);
-void		addbootfile(char*, uchar*, uint32_t);
+void		addbootfile(char*, unsigned char*, uint32_t);
 Timer*		addclock0link(void (*)(void), int);
 int		addconsdev(Queue*, void (*fn)(char*,int), int, int);
 int		addkbdq(Queue*, int);
 int		addphysseg(Physseg*);
-void		addwaitstat(uintptr pc, uvlong t0, int type);
+void		addwaitstat(uintptr pc, uint64_t t0, int type);
 void		addwatchdog(Watchdog*);
 int		adec(int*);
 Block*		adjustblock(Block*, int);
@@ -27,7 +27,7 @@ int		anyhigher(void);
 int		anyready(void);
 Image*		attachimage(int, Chan*, int, uintptr, usize);
 Page*		auxpage(usize);
-Block*		bl2mem(uchar*, Block*, int);
+Block*		bl2mem(unsigned char*, Block*, int);
 int		blocklen(Block*);
 void		bootlinks(void);
 void		cachedel(Image*, uint32_t);
@@ -66,12 +66,12 @@ void		delay(int);
 void		delconsdevs(void);
 Proc*		dequeueproc(Sched*, Schedq*, Proc*);
 Chan*		devattach(int, char*);
-Block*		devbread(Chan*, long, vlong);
-long		devbwrite(Chan*, Block*, vlong);
+Block*		devbread(Chan*, long, int64_t);
+long		devbwrite(Chan*, Block*, int64_t);
 Chan*		devclone(Chan*);
 int		devconfig(int, char *, DevConf *);
 void		devcreate(Chan*, char*, int, int);
-void		devdir(Chan*, Qid, char*, vlong, char*, long, Dir*);
+void		devdir(Chan*, Qid, char*, int64_t, char*, long, Dir*);
 long		devdirread(Chan*, char*, long, Dirtab*, int, Devgen*);
 Devgen		devgen;
 void		devinit(void);
@@ -81,16 +81,16 @@ void		devpower(int);
 void		devremove(Chan*);
 void		devreset(void);
 void		devshutdown(void);
-long		devstat(Chan*, uchar*, long, Dirtab*, int, Devgen*);
+long		devstat(Chan*, unsigned char*, long, Dirtab*, int, Devgen*);
 Dev*		devtabget(int, int);
 void		devtabinit(void);
-long		devtabread(Chan*, void*, long, vlong);
+long		devtabread(Chan*, void*, long, int64_t);
 void		devtabreset(void);
 void		devtabshutdown(void);
 Walkqid*		devwalk(Chan*, Chan*, char**, int, Dirtab*, int, Devgen*);
-long		devwstat(Chan*, uchar*, long);
-int		devzread(Chan*, Kzio*, int, usize, vlong);
-int		devzwrite(Chan*, Kzio*, int, vlong);
+long		devwstat(Chan*, unsigned char*, long);
+int		devzread(Chan*, Kzio*, int, usize, int64_t);
+int		devzwrite(Chan*, Kzio*, int, int64_t);
 void		drawactive(int);
 void		drawcmap(void);
 void		dumpaproc(Proc*);
@@ -116,9 +116,9 @@ int		eqqid(Qid, Qid);
 void		error(char*);
 void		exhausted(char*);
 void		exit(int);
-uvlong		fastticks(uvlong*);
-uvlong		fastticks2ns(uvlong);
-uvlong		fastticks2us(uvlong);
+uint64_t		fastticks(uint64_t*);
+uint64_t		fastticks2ns(uint64_t);
+uint64_t		fastticks2us(uint64_t);
 int		fault(uintptr, int);
 void		fdclose(int, int);
 Chan*		fdtochan(int, int, int, int);
@@ -138,8 +138,8 @@ Segment*	getzkseg(void);
 void		gotolabel(Label*);
 int		haswaitq(void*);
 void		hnputl(void*, uint);
-void		hnputs(void*, ushort);
-void		hnputv(void*, uvlong);
+void		hnputs(void*, uint16_t);
+void		hnputv(void*, uint64_t);
 long		hostdomainwrite(char*, long);
 long		hostownerwrite(char*, long);
 void		hzsched(void);
@@ -158,7 +158,7 @@ void		ixsummary(void);
 int		kbdcr2nl(Queue*, int);
 int		kbdgetmap(int, int*, int*, Rune*);
 int		kbdputc(Queue*, int);
-void		kbdputmap(ushort, ushort, Rune);
+void		kbdputmap(uint16_t, uint16_t, Rune);
 void		kickpager(int, int);
 void		killbig(char*);
 void		kproc(char*, void(*)(void*), void*);
@@ -180,27 +180,27 @@ Cmdtab*		lookupcmd(Cmdbuf*, Cmdtab*, int);
 void		mallocinit(void);
 long		mallocreadsummary(Chan*, void*, long, long);
 void		mallocsummary(void);
-Block*		mem2bl(uchar*, int);
+Block*		mem2bl(unsigned char*, int);
 void		(*mfcinit)(void);
 void		(*mfcopen)(Chan*);
-int		(*mfcread)(Chan*, uchar*, int, vlong);
-void		(*mfcupdate)(Chan*, uchar*, int, vlong);
-void		(*mfcwrite)(Chan*, uchar*, int, vlong);
+int		(*mfcread)(Chan*, unsigned char*, int, int64_t);
+void		(*mfcupdate)(Chan*, unsigned char*, int, int64_t);
+void		(*mfcwrite)(Chan*, unsigned char*, int, int64_t);
 void		mfreeseg(Segment*, uintptr, int);
 void		microdelay(int);
-uvlong		mk64fract(uvlong, uvlong);
-void		mkqid(Qid*, vlong, uint32_t, int);
+uint64_t		mk64fract(uint64_t, uint64_t);
+void		mkqid(Qid*, int64_t, uint32_t, int);
 void		mmuflush(void);
 void		mmuput(uintptr, Page*, uint);
 void		mmurelease(Proc*);
 void		mmuswitch(Proc*);
 Chan*		mntauth(Chan*, char*);
-usize		mntversion(Chan*, u32int, char*, usize);
+usize		mntversion(Chan*, uint32_t, char*, usize);
 void		mountfree(Mount*);
-uvlong		ms2fastticks(uint32_t);
-#define		MS2NS(n) (((vlong)(n))*1000000LL)
+uint64_t		ms2fastticks(uint32_t);
+#define		MS2NS(n) (((int64_t)(n))*1000000LL)
 uint32_t		ms2tk(uint32_t);
-void		mul64fract(uvlong*, uvlong, uvlong);
+void		mul64fract(uint64_t*, uint64_t, uint64_t);
 void		muxclose(Mnt*);
 void		(*mwait)(void *);
 Chan*		namec(char*, int, int, int);
@@ -214,15 +214,15 @@ Path*		newpath(char*);
 Pgrp*		newpgrp(void);
 Proc*		newproc(void);
 Rgrp*		newrgrp(void);
-Segment*	newseg(int, uintptr, u64int);
+Segment*	newseg(int, uintptr, uint64_t);
 void		newzmap(Segment*);
 void		nexterror(void);
 uint		nhgetl(void*);
-ushort		nhgets(void*);
-uvlong		nhgetv(void*);
+uint16_t		nhgets(void*);
+uint64_t		nhgetv(void*);
 void		nixprepage(int);
 int		nrand(int);
-uvlong		ns2fastticks(uvlong);
+uint64_t		ns2fastticks(uint64_t);
 int		okaddr(uintptr, long, int);
 int		openmode(int);
 Block*		packblock(Block*);
@@ -230,7 +230,7 @@ Block*		padblock(Block*, int);
 void		pagechainhead(Page*);
 void		pageinit(void);
 uint32_t		pagenumber(Page*);
-uvlong		pagereclaim(Image*);
+uint64_t		pagereclaim(Image*);
 void		pagersummary(void);
 void		pageunchain(Page*);
 void		panic(char*, ...);
@@ -242,10 +242,10 @@ Page*		pgalloc(usize, int);
 void		pgfree(Page*);
 void		pgrpcpy(Pgrp*, Pgrp*);
 void		pgrpnote(uint32_t, char*, long, int);
-uintmem		physalloc(u64int, int*, void*);
+uintmem		physalloc(uint64_t, int*, void*);
 void		physdump(void);
-void		physfree(uintmem, u64int);
-void		physinit(uintmem, u64int);
+void		physfree(uintmem, uint64_t);
+void		physinit(uintmem, uint64_t);
 void*		phystag(uintmem);
 void		pio(Segment*, uintptr, uint32_t, Page**, int);
 #define		poperror()		up->nerrlab--
@@ -264,7 +264,7 @@ void		procinit0(void);
 void		procpriority(Proc*, int, int);
 void		procrestore(Proc*);
 void		procsave(Proc*);
-void		(*proctrace)(Proc*, int, vlong);
+void		(*proctrace)(Proc*, int, int64_t);
 void		proctracepid(Proc*);
 void		procwired(Proc*, int);
 void		psdecref(Proc*);
@@ -359,20 +359,20 @@ void		startwaitstats(int);
 int		swapcount(uint32_t);
 void		swapinit(void);
 void		syscallfmt(int, va_list list);
-void		sysretfmt(int, va_list, Ar0*, uvlong, uvlong);
+void		sysretfmt(int, va_list, Ar0*, uint64_t, uint64_t);
 void		sysrforkchild(Proc*, Proc*);
 void		timeradd(Timer*);
 void		timerdel(Timer*);
-void		timerintr(Ureg*, vlong);
-void		timerset(uvlong);
+void		timerintr(Ureg*, int64_t);
+void		timerset(uint64_t);
 void		timersinit(void);
 uint32_t		tk2ms(uint32_t);
 #define		TK2MS(x) ((x)*(1000/HZ))
-uvlong		tod2fastticks(vlong);
-vlong		todget(vlong*);
+uint64_t		tod2fastticks(int64_t);
+int64_t		todget(int64_t*);
 void		todinit(void);
-void		todset(vlong, vlong, int);
-void		todsetfreq(vlong);
+void		todset(int64_t, int64_t, int);
+void		todsetfreq(int64_t);
 Block*		trimblock(Block*, int, int);
 void		tsleep(Rendez*, int (*)(void*), void*, long);
 Uart*		uartconsole(int, char*);
@@ -392,7 +392,7 @@ long		userwrite(char*, long);
 void*		validaddr(void*, long, int);
 void		validname(char*, int);
 char*		validnamedup(char*, int);
-void		validstat(uchar*, usize);
+void		validstat(unsigned char*, usize);
 void*		vmemchr(void*, int, int);
 Proc*		wakeup(Rendez*);
 int		walk(Chan**, char**, int, int, int*);
@@ -403,7 +403,7 @@ uintptr		zgetaddr(Segment*);
 void		zgrow(Segment*);
 int		ziofmt(Fmt*);
 int		zputaddr(Segment*, uintptr);
-ulong		µs(void);
+uint32_t		ms(void);
 
 #pragma		varargck	argpos	iprint		1
 #pragma		varargck	argpos	panic		1

+ 10 - 10
sys/src/9/port/sd.h

@@ -24,8 +24,8 @@ struct SDperm {
 };
 
 struct SDpart {
-	uvlong	start;
-	uvlong	end;
+	uint64_t	start;
+	uint64_t	end;
 	SDperm;
 	int	valid;
 	uint32_t	vers;
@@ -34,12 +34,12 @@ struct SDpart {
 struct SDunit {
 	SDev*	dev;
 	int	subno;
-	uchar	inquiry[255];		/* format follows SCSI spec */
-	uchar	sense[18];		/* format follows SCSI spec */
+	unsigned char	inquiry[255];		/* format follows SCSI spec */
+	unsigned char	sense[18];		/* format follows SCSI spec */
 	SDperm;
 
 	QLock	ctl;
-	uvlong	sectors;
+	uint64_t	sectors;
 	uint32_t	secsize;
 	SDpart*	part;			/* nil or array of size npart */
 	int	npart;
@@ -86,7 +86,7 @@ struct SDifc {
 	int	(*rctl)(SDunit*, char*, int);
 	int	(*wctl)(SDunit*, Cmdbuf*);
 
-	long	(*bio)(SDunit*, int, int, void*, long, vlong);
+	long	(*bio)(SDunit*, int, int, void*, long, int64_t);
 	SDev*	(*probe)(DevConf*);
 	void	(*clear)(SDev*);
 	char*	(*rtopctl)(SDev*, char*, char*);
@@ -97,7 +97,7 @@ struct SDreq {
 	SDunit*	unit;
 	int	lun;
 	int	write;
-	uchar	cmd[16];
+	unsigned char	cmd[16];
 	int	clen;
 	void*	data;
 	int	dlen;
@@ -106,7 +106,7 @@ struct SDreq {
 
 	int	status;
 	long	rlen;
-	uchar	sense[256];
+	unsigned char	sense[256];
 };
 
 enum {
@@ -136,13 +136,13 @@ enum {
 /* devsd.c */
 extern void sdadddevs(SDev*);
 extern int sdsetsense(SDreq*, int, int, int, int);
-extern int sdmodesense(SDreq*, uchar*, void*, int);
+extern int sdmodesense(SDreq*, unsigned char*, void*, int);
 extern int sdfakescsi(SDreq*, void*, int);
 
 /* sdscsi.c */
 extern int scsiverify(SDunit*);
 extern int scsionline(SDunit*);
-extern long scsibio(SDunit*, int, int, void*, long, vlong);
+extern long scsibio(SDunit*, int, int, void*, long, int64_t);
 extern SDev* scsiid(SDev*, SDifc*);
 
 /*

+ 8 - 9
sys/src/mkfile.proto

@@ -5,12 +5,19 @@
 # Provisional for cross compiling
 objtype=amd64
 
+
+INC_DIR=/sys/include
+INCX86_64_DIR=/$objtype/include
+LIB_DIR=/$objtype/lib
+WARNFLAGS=-Wall' '-Wno-missing-braces' '-Wno-parentheses' '-Wno-unknown-pragmas' '-Wuninitialized' '-Wmaybe-uninitialized
+LDFLAGS=-L$LIB_DIR
+
 #OS=568qv
 OS=o
 #CPUS=arm amd64 386 power mips
 CPUS=amd64
 #CFLAGS=-FTVw
-CFLAGS=-O0 -static -fplan9-extensions -ffreestanding -fno-builtin $WARNFLAGS -I$INCX86_64_DIR -I$INC_DIR
+CFLAGS=-O0 -static -fplan9-extensions -ffreestanding -fno-builtin -Wall -Wno-missing-braces -Wno-parentheses -Wno-unknown-pragmas -Wuninitialized -Wmaybe-uninitialized -I$INCX86_64_DIR -I$INC_DIR
 LEX=lex
 YACC=yacc
 
@@ -24,11 +31,6 @@ OFILES=
 HFILES=
 YFILES=
 
-INC_DIR=/sys/include
-INCX86_64_DIR=/$objtype/include
-CRT0=/$objtype/lib/crt0.o
-LIB_DIR=/$objtype/lib
-
 APELIB=/rc/bin/ape              # where helper programs go
 FAMILY=plan9
 AR=ar                            # manipulating libraries
@@ -39,6 +41,3 @@ INSOWNER=()                     # default installation parameter
 INSGROUP=bin                    # default installation parameter
 INSMODE=775                     # default installation parameter
 
-WARNFLAGS=-Wall' '-Wno-missing-braces' '-Wno-parentheses' '-Wno-unknown-pragmas' '-Wuninitialized' '-Wmaybe-uninitialized
-LDFLAGS=-L$LIB_DIR
-