Browse Source

Further de-anonymizing. Harvey still boots fine.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Ronald G. Minnich 8 years ago
parent
commit
54cce8960c

+ 1 - 1
sys/src/9/386/ahci.h

@@ -287,7 +287,7 @@ enum {
 
 typedef struct {
 	QLock ql;
-	Rendez;
+	Rendez Rendez;
 	unsigned char	flag;
 	unsigned char	feat;
 	unsigned char	smart;

+ 64 - 64
sys/src/9/386/sdiahci.c

@@ -135,7 +135,7 @@ typedef struct Ctlr Ctlr;
 typedef struct Drive Drive;
 
 struct Drive {
-	Lock;
+	Lock Lock;
 
 	Ctlr	*ctlr;
 	SDunit	*unit;
@@ -173,7 +173,7 @@ struct Drive {
 };
 
 struct Ctlr {
-	Lock;
+	Lock Lock;
 
 	int	type;
 	int	enabled;
@@ -289,7 +289,7 @@ aesleep(Aportm *pm, Asleep *a, int ms)
 	Proc *up = externup();
 	if(waserror())
 		return;
-	tsleep(pm, ahciclear, a, ms);
+	tsleep(&pm->Rendez, ahciclear, a, ms);
 	poperror();
 }
 
@@ -942,7 +942,7 @@ updatedrive(Drive *d)
 
 	if(p->ci == 0){
 		d->portm.flag |= Fdone;
-		wakeup(&d->portm);
+		wakeup(&d->portm.Rendez);
 		pr = 0;
 	}else if(cause & Adps)
 		pr = 0;
@@ -999,7 +999,7 @@ updatedrive(Drive *d)
 	p->serror = serr;
 	if(ewake){
 		clearci(p);
-		wakeup(&d->portm);
+		wakeup(&d->portm.Rendez);
 	}
 	last = cause;
 }
@@ -1040,18 +1040,18 @@ configdrive(Drive *d)
 {
 	if(ahciconfigdrive(d) == -1)
 		return -1;
-	ilock(d);
+	ilock(&d->Lock);
 	pstatus(d, d->port->sstatus & Devdet);
-	iunlock(d);
+	iunlock(&d->Lock);
 	return 0;
 }
 
 static void
 setstate(Drive *d, int state)
 {
-	ilock(d);
+	ilock(&d->Lock);
 	d->state = state;
-	iunlock(d);
+	iunlock(&d->Lock);
 }
 
 static void
@@ -1066,20 +1066,20 @@ resetdisk(Drive *d)
 	state = (p->cmd>>28) & 0xf;
 	dprint("ahci: resetdisk: icc %#ux  det %d sdet %d\n", state, det, stat);
 
-	ilock(d);
+	ilock(&d->Lock);
 	state = d->state;
 	if(d->state != Dready || d->state != Dnew)
 		d->portm.flag |= Ferror;
 	clearci(p);			/* satisfy sleep condition. */
-	wakeup(&d->portm);
+	wakeup(&d->portm.Rendez);
 	if(stat != (Devpresent|Devphycomm)){
 		/* device absent or phy not communicating */
 		d->state = Dportreset;
-		iunlock(d);
+		iunlock(&d->Lock);
 		return;
 	}
 	d->state = Derror;
-	iunlock(d);
+	iunlock(&d->Lock);
 
 	qlock(&d->portm.ql);
 	if(p->cmd&Ast && ahciswreset(&d->portc) == -1)
@@ -1196,12 +1196,12 @@ checkdrive(Drive *d, int i)
 		print("checkdrive: nil d\n");
 		return;
 	}
-	ilock(d);
+	ilock(&d->Lock);
 	if(d->unit == nil || d->port == nil) {
 		if(0)
 			print("checkdrive: nil d->%s\n",
 				d->unit == nil? "unit": "port");
-		iunlock(d);
+		iunlock(&d->Lock);
 		return;
 	}
 	name = d->unit->SDperm.name;
@@ -1243,9 +1243,9 @@ reset:
 			}
 			dprint("%s: reset; new mode %s\n", name,
 				modename[d->mode]);
-			iunlock(d);
+			iunlock(&d->Lock);
 			resetdisk(d);
-			ilock(d);
+			ilock(&d->Lock);
 			break;
 		case Intactive|Devphycomm|Devpresent:
 			if((++d->wait&Midwait) == 0){
@@ -1257,9 +1257,9 @@ reset:
 			if(s == 0x7f || ((d->port->sig >> 16) != 0xeb14 &&
 			    (s & ~0x17) != (1<<6)))
 				break;
-			iunlock(d);
+			iunlock(&d->Lock);
 			newdrive(d);
-			ilock(d);
+			ilock(&d->Lock);
 			break;
 		}
 		break;
@@ -1271,9 +1271,9 @@ reset:
 	case Dreset:
 		dprint("%s: reset [%s]: mode %d; status %06#ux\n",
 			name, diskstates[d->state], d->mode, s);
-		iunlock(d);
+		iunlock(&d->Lock);
 		resetdisk(d);
-		ilock(d);
+		ilock(&d->Lock);
 		break;
 	case Dportreset:
 portreset:
@@ -1284,18 +1284,18 @@ portreset:
 			name, diskstates[d->state], d->mode, s);
 		d->portm.flag |= Ferror;
 		clearci(d->port);
-		wakeup(&d->portm);
+		wakeup(&d->portm.Rendez);
 		if((s & Devdet) == 0){	/* no device */
 			d->state = Dmissing;
 			break;
 		}
-		iunlock(d);
+		iunlock(&d->Lock);
 		doportreset(d);
-		ilock(d);
+		ilock(&d->Lock);
 		break;
 	}
 	statechange(d);
-	iunlock(d);
+	iunlock(&d->Lock);
 }
 
 static void
@@ -1355,12 +1355,12 @@ iainterrupt(Ureg *u, void *a)
 	Drive *d;
 
 	c = a;
-	ilock(c);
+	ilock(&c->Lock);
 	cause = c->hba->isr;
 	if (cause == 0) {
 		isctlrjabbering(c, cause);
 		// iprint("sdiahci: interrupt for no drive\n");
-		iunlock(c);
+		iunlock(&c->Lock);
 		return;
 	}
 	for(i = 0; cause && i <= c->mport; i++){
@@ -1368,12 +1368,12 @@ iainterrupt(Ureg *u, void *a)
 		if((cause & mask) == 0)
 			continue;
 		d = c->rawdrive + i;
-		ilock(d);
+		ilock(&d->Lock);
 		isdrivejabbering(d);
 		if(d->port->isr && c->hba->pi & mask)
 			updatedrive(d);
 		c->hba->isr = mask;
-		iunlock(d);
+		iunlock(&d->Lock);
 
 		cause &= ~mask;
 	}
@@ -1381,7 +1381,7 @@ iainterrupt(Ureg *u, void *a)
 		isctlrjabbering(c, cause);
 		iprint("sdiachi: intr cause unserviced: %#lux\n", cause);
 	}
-	iunlock(c);
+	iunlock(&c->Lock);
 }
 
 /* checkdrive, called from satakproc, will prod the drive while we wait */
@@ -1392,17 +1392,17 @@ awaitspinup(Drive *d)
 	uint16_t s;
 	char *name;
 
-	ilock(d);
+	ilock(&d->Lock);
 	if(d->unit == nil || d->port == nil) {
 		panic("awaitspinup: nil d->unit or d->port");
-		iunlock(d);
+		iunlock(&d->Lock);
 		return;
 	}
 	name = (d->unit? d->unit->SDperm.name: nil);
 	s = d->port->sstatus;
 	if(!(s & Devpresent)) {			/* never going to be ready */
 		dprint("awaitspinup: %s absent, not waiting\n", name);
-		iunlock(d);
+		iunlock(&d->Lock);
 		return;
 	}
 
@@ -1410,14 +1410,14 @@ awaitspinup(Drive *d)
 		switch(d->state){
 		case Dnull:
 			/* absent; done */
-			iunlock(d);
+			iunlock(&d->Lock);
 			dprint("awaitspinup: %s in null state\n", name);
 			return;
 		case Dready:
 		case Dnew:
 			if(d->sectors || d->mediachange) {
 				/* ready to use; done */
-				iunlock(d);
+				iunlock(&d->Lock);
 				dprint("awaitspinup: %s ready!\n", name);
 				return;
 			}
@@ -1428,13 +1428,13 @@ awaitspinup(Drive *d)
 		case Doffline:			/* transitional states */
 		case Derror:
 		case Dportreset:
-			iunlock(d);
+			iunlock(&d->Lock);
 			asleep(50);
-			ilock(d);
+			ilock(&d->Lock);
 			break;
 		}
 	print("awaitspinup: %s didn't spin up after 20 seconds\n", name);
-	iunlock(d);
+	iunlock(&d->Lock);
 }
 
 static int
@@ -1445,11 +1445,11 @@ iaverify(SDunit *u)
 
 	c = u->dev->ctlr;
 	d = c->drive[u->subno];
-	ilock(c);
-	ilock(d);
+	ilock(&c->Lock);
+	ilock(&d->Lock);
 	d->unit = u;
-	iunlock(d);
-	iunlock(c);
+	iunlock(&d->Lock);
+	iunlock(&c->Lock);
 	checkdrive(d, d->driveno);		/* c->d0 + d->driveno */
 
 	/*
@@ -1469,7 +1469,7 @@ iaenable(SDev *s)
 	static int once;
 
 	c = s->ctlr;
-	ilock(c);
+	ilock(&c->Lock);
 	if(!c->enabled) {
 		if(once == 0) {
 			once = 1;
@@ -1484,7 +1484,7 @@ iaenable(SDev *s)
 		ahcienable(c->hba);
 		c->enabled = 1;
 	}
-	iunlock(c);
+	iunlock(&c->Lock);
 	return 1;
 }
 
@@ -1495,12 +1495,12 @@ iadisable(SDev *s)
 	Ctlr *c;
 
 	c = s->ctlr;
-	ilock(c);
+	ilock(&c->Lock);
 	ahcidisable(c->hba);
 	snprint(name, sizeof name, "%s (%s)", s->name, s->ifc->name);
 	intrdisable(c->vector);
 	c->enabled = 0;
-	iunlock(c);
+	iunlock(&c->Lock);
 	return 1;
 }
 
@@ -1522,7 +1522,7 @@ iaonline(SDunit *unit)
 		return r;
 	}
 
-	ilock(d);
+	ilock(&d->Lock);
 	if(d->mediachange){
 		r = 2;
 		d->mediachange = 0;
@@ -1531,7 +1531,7 @@ iaonline(SDunit *unit)
 		unit->secsize = 512;		/* default size */
 	} else if(d->state == Dready)
 		r = 1;
-	iunlock(d);
+	iunlock(&d->Lock);
 	return r;
 }
 
@@ -1663,9 +1663,9 @@ waitready(Drive *d)
 		delta = sys->ticks - d->lastseen;
 		if(d->state == Dnull || delta > 10*1000)
 			return -1;
-		ilock(d);
+		ilock(&d->Lock);
 		s = d->port->sstatus;
-		iunlock(d);
+		iunlock(&d->Lock);
 		if((s & Intpm) == 0 && delta > 1500)
 			return -1;	/* no detect */
 		if(d->state == Dready &&
@@ -1744,9 +1744,9 @@ retry:
 	}
 	/* d->portm qlock held here */
 
-	ilock(d);
+	ilock(&d->Lock);
 	d->portm.flag = 0;
-	iunlock(d);
+	iunlock(&d->Lock);
 	p->ci = 1;
 
 	as.p = p;
@@ -1757,7 +1757,7 @@ retry:
 	while(waserror())
 		;
 	/* don't sleep here forever */
-	tsleep(&d->portm, ahciclear, &as, 3*1000);
+	tsleep(&d->portm.Rendez, ahciclear, &as, 3*1000);
 	poperror();
 	if(!ahciclear(&as)) {
 		qunlock(&d->portm.ql);
@@ -1767,10 +1767,10 @@ retry:
 	}
 
 	d->active--;
-	ilock(d);
+	ilock(&d->Lock);
 	flag = d->portm.flag;
 	task = d->port->task;
-	iunlock(d);
+	iunlock(&d->Lock);
 
 	if(task & (Efatal<<8) || task & (ASbsy|ASdrq) && d->state == Dready){
 		d->port->ci = 0;
@@ -1888,9 +1888,9 @@ retry:
 			goto retry;
 		}
 		/* d->portm qlock held here */
-		ilock(d);
+		ilock(&d->Lock);
 		d->portm.flag = 0;
-		iunlock(d);
+		iunlock(&d->Lock);
 		p->ci = 1;
 
 		as.p = p;
@@ -1901,7 +1901,7 @@ retry:
 		while(waserror())
 			;
 		/* don't sleep here forever */
-		tsleep(&d->portm, ahciclear, &as, 3*1000);
+		tsleep(&d->portm.Rendez, ahciclear, &as, 3*1000);
 		poperror();
 		if(!ahciclear(&as)) {
 			qunlock(&d->portm.ql);
@@ -1911,10 +1911,10 @@ retry:
 		}
 
 		d->active--;
-		ilock(d);
+		ilock(&d->Lock);
 		flag = d->portm.flag;
 		task = d->port->task;
-		iunlock(d);
+		iunlock(&d->Lock);
 
 		if(task & (Efatal<<8) ||
 		    task & (ASbsy|ASdrq) && d->state == Dready){
@@ -2218,9 +2218,9 @@ forcemode(Drive *d, char *mode)
 			break;
 	if(i == nelem(modename))
 		i = 0;
-	ilock(d);
+	ilock(&d->Lock);
 	d->mode = i;
-	iunlock(d);
+	iunlock(&d->Lock);
 }
 
 static void
@@ -2265,10 +2265,10 @@ changemedia(SDunit *u)
 
 	c = u->dev->ctlr;
 	d = c->drive[u->subno];
-	ilock(d);
+	ilock(&d->Lock);
 	d->mediachange = 1;
 	u->sectors = 0;
-	iunlock(d);
+	iunlock(&d->Lock);
 }
 
 static int

+ 5 - 5
sys/src/9/386/uarti8250.c

@@ -122,7 +122,7 @@ typedef struct Ctlr {
 
 	unsigned char	sticky[8];
 
-	Lock;
+	Lock Lock;
 	int	hasfifo;
 	int	checkfifo;
 	int	fena;
@@ -224,7 +224,7 @@ i8250fifo(Uart* uart, int level)
 	 * the receive side, but it's possible to wait until
 	 * the transmitter is really empty.
 	 */
-	ilock(ctlr);
+	ilock(&ctlr->Lock);
 	while(!(csr8r(ctlr, Lsr) & Temt))
 		;
 
@@ -253,7 +253,7 @@ i8250fifo(Uart* uart, int level)
 	}
 	csr8w(ctlr, Fcr, level);
 	csr8w(ctlr, Fcr, level);
-	iunlock(ctlr);
+	iunlock(&ctlr->Lock);
 }
 
 static void
@@ -578,7 +578,7 @@ i8250enable(Uart* uart, int ie)
 	 * can be dangerous, but this should only happen
 	 * once, before interrupts are enabled.
 	 */
-	ilock(ctlr);
+	ilock(&ctlr->Lock);
 	if(!ctlr->checkfifo){
 		/*
 		 * Wait until the transmitter is really empty.
@@ -591,7 +591,7 @@ i8250enable(Uart* uart, int ie)
 		csr8w(ctlr, Fcr, 0);
 		ctlr->checkfifo = 1;
 	}
-	iunlock(ctlr);
+	iunlock(&ctlr->Lock);
 
 	/*
  	 * Enable interrupts and turn on DTR and RTS.

+ 132 - 0
sys/src/9/amd64/build.json

@@ -0,0 +1,132 @@
+{
+	"cpu": {
+		"Env": [
+			"CONF=cpu"
+		],
+		"Include": [
+			"core.json",
+			"../386/386.json",
+			"../ip/ip.json",
+			"../port/port.json"
+		],
+		"Kernel": {
+			"Config": {
+				"Code": [
+					"int cpuserver = 1;",
+					"uint32_t kerndate = 1;"
+				],
+				"Dev": [
+					"acpi",
+					"arch",
+					"cap",
+					"cons",
+					"coreboot",
+					"draw",
+					"dup",
+					"env",
+					"fdmux",
+					"ether",
+					"ip",
+					"kbin",
+					"kprof",
+					"mnt",
+					"mntn",
+					"mouse",
+					"pci",
+					"pipe",
+					"pmc",
+					"proc",
+					"regress",
+					"root",
+					"rtc",
+					"sd",
+					"segment",
+					"srv",
+					"ssl",
+					"tls",
+					"uart",
+					"ws",
+					"usb",
+					"vga",
+					"zp"
+				],
+				"Ip": [
+					"tcp",
+					"udp",
+					"ipifc",
+					"icmp",
+					"icmp6",
+					"gre"
+				],
+				"Link": [
+					"ether8169",
+					"ether82557",
+					"ether82563",
+					"etherigbe",
+					"ether8139",
+					"ethermedium",
+					"loopbackmedium",
+					"netdevmedium",
+					"usbuhci",
+					"usbohci",
+					"usbehci"
+				],
+				"Sd": [
+					"sdiahci"
+				],
+				"Uart": [
+					"i8250",
+					"pci"
+				],
+				"VGA": [
+					"vgavesa"
+				]
+			},
+			"Ramfiles": {
+				"bind": "/$ARCH/bin/bind",
+				"boot": "/sys/src/9/boot/bootcpu.elf.out",
+				"cat": "/$ARCH/bin/cat",
+				"date": "/$ARCH/bin/date",
+				"echo": "/$ARCH/bin/echo",
+				"factotum": "/$ARCH/bin/auth/factotum",
+				"fdisk": "/$ARCH/bin/disk/fdisk",
+				"fossil": "/$ARCH/bin/fossil/fossil",
+				"ipconfig": "/$ARCH/bin/ip/ipconfig",
+				"ls": "/$ARCH/bin/ls",
+				"mount": "/$ARCH/bin/mount",
+				"nvram": "/util/nvram",
+				"prep": "/$ARCH/bin/disk/prep",
+				"rc": "/$ARCH/bin/rc",
+				"ps": "/$ARCH/bin/ps",
+				"ed": "/$ARCH/bin/ed",
+				"rcmain": "/rc/lib/rcmain",
+				"screenconsole": "/$ARCH/bin/aux/screenconsole",
+				"realemu": "/$ARCH/bin/aux/realemu",
+				"vga": "/$ARCH/bin/aux/vga",
+				"srv": "/$ARCH/bin/srv",
+				"startdisk": "startdisk",
+				"usbd": "/$ARCH/bin/usb/usbd",
+				"venti": "/$ARCH/bin/venti/venti"
+			},
+			"Systab": "/sys/src/libc/9syscall/sys.h"
+		},
+		"Program": "harvey",
+		"SourceFiles": [
+			"cga.c",
+			"devacpi.c",
+			"devusb.c",
+			"devvga.c",
+			"ether8139.c",
+			"ether82563.c",
+			"cpu.c",
+			"mouse.c",
+			"screen.c",
+			"sdata.c",
+			"usbehcipc.c",
+			"usbohci.c",
+			"usbuhci.c",
+			"vga.c",
+			"vgax.c"
+		]
+	}
+}

+ 7 - 7
sys/src/9/ip/netlog.c

@@ -35,7 +35,7 @@ struct Netlog {
 	int	iponlyset;
 
 	QLock ql;
-	Rendez;
+	Rendez Rendez;
 };
 
 typedef struct Netlogflag {
@@ -101,7 +101,7 @@ netlogopen(Fs *f)
 		f->alog->end = f->alog->buf + Nlog;
 	}
 	f->alog->opens++;
-	unlock(&f->alog->l);
+	unlock(&f->alog->Rendez.l);
 	poperror();
 }
 
@@ -109,9 +109,9 @@ void
 netlogclose(Fs *f)
 {
 	Proc *up = externup();
-	lock(&f->alog->l);
+	lock(&f->alog->Rendez.l);
 	if(waserror()){
-		unlock(&f->alog->l);
+		unlock(&f->alog->Rendez.l);
 		nexterror();
 	}
 	f->alog->opens--;
@@ -119,7 +119,7 @@ netlogclose(Fs *f)
 		free(f->alog->buf);
 		f->alog->buf = nil;
 	}
-	unlock(&f->alog->l);
+	unlock(&f->alog->Rendez.l);
 	poperror();
 }
 
@@ -168,7 +168,7 @@ netlogread(Fs *f, void *a, uint32_t u, int32_t n)
 		else
 			unlock(&f->alog->_lock);
 
-		sleep(f->alog, netlogready, f);
+		sleep(&f->alog->Rendez, netlogready, f);
 	}
 
 	qunlock(&f->alog->ql);
@@ -272,5 +272,5 @@ netlog(Fs *f, int mask, char *fmt, ...)
 		*t++ = *fp++;
 	}
 	unlock(&f->alog->_lock);
-	wakeup(f->alog);
+	wakeup(&f->alog->Rendez);
 }

+ 5 - 5
sys/src/9/port/allocb.c

@@ -21,7 +21,7 @@ enum
 
 struct
 {
-	Lock;
+	Lock Lock;
 	uint32_t	bytes;
 } ialloc;
 
@@ -107,9 +107,9 @@ iallocb(int size)
 	}
 	b->flag = BINTR;
 
-	ilock(&ialloc);
+	ilock(&ialloc.Lock);
 	ialloc.bytes += b->lim - b->base;
-	iunlock(&ialloc);
+	iunlock(&ialloc.Lock);
 
 	return b;
 }
@@ -132,9 +132,9 @@ freeb(Block *b)
 		return;
 	}
 	if(b->flag & BINTR) {
-		ilock(&ialloc);
+		ilock(&ialloc.Lock);
 		ialloc.bytes -= b->lim - b->base;
-		iunlock(&ialloc);
+		iunlock(&ialloc.Lock);
 	}
 
 	p = b->base;

+ 1 - 1
sys/src/9/port/ethermii.h

@@ -92,7 +92,7 @@ enum {					/* Esr */
 };
 
 typedef struct Mii {
-	Lock;
+	Lock Lock;
 	int	nphy;
 	int	mask;
 	MiiPhy*	phy[NMiiPhy];