Browse Source

Plan 9 from Bell Labs 2012-07-04

David du Colombier 11 years ago
parent
commit
40a9dac659
6 changed files with 19 additions and 12 deletions
  1. 3 3
      sys/man/8/6in4
  2. 7 6
      sys/src/9/port/sysproc.c
  3. 1 1
      sys/src/9/teg2/arm.h
  4. 4 1
      sys/src/9/teg2/atom.s
  5. 2 1
      sys/src/libc/9sys/nsec.c
  6. 2 0
      sys/src/libc/arm/atom.s

+ 3 - 3
sys/man/8/6in4

@@ -1,6 +1,6 @@
 .TH 6IN4 8
 .SH NAME
-6in4 - configure and run automatic or manual 6to4 tunnel of IPv6 through IPv4
+6in4 - 6to4 tunnel of IPv6 through IPv4
 .SH SYNOPSIS
 .B ip/6in4
 [
@@ -17,7 +17,7 @@
 ] ] ]
 .SH DESCRIPTION
 .I 6in4
-sets up and maintains a tunnel of IPv6 traffic through an IPv4 connection.
+sets up and operates a tunnel of IPv6 traffic through an IPv4 connection.
 .PP
 .I Local6
 and
@@ -72,7 +72,7 @@ permit any remote IPv4 address as the far end of a tunnel.
 This is likely to be useful for the server side of a tunnel.
 .TP
 .B -g
-use the tunnel as the default route for global IPv6 addresses
+add a default route to the tunnel for global IPv6 addresses.
 .TP
 .B -x
 use the network mounted at

+ 7 - 6
sys/src/9/port/sysproc.c

@@ -1036,7 +1036,7 @@ static int
 tsemacquire(Segment *s, long *addr, ulong ms)
 {
 	int acquired, timedout;
-	ulong t;
+	ulong t, elms;
 	Sema phore;
 
 	if(canacquire(addr))
@@ -1056,13 +1056,13 @@ tsemacquire(Segment *s, long *addr, ulong ms)
 			break;
 		t = m->ticks;
 		tsleep(&phore, semawoke, &phore, ms);
-		if(TK2MS(m->ticks - t) >= ms){
+		elms = TK2MS(m->ticks - t);
+		poperror();
+		if(elms >= ms){
 			timedout = 1;
-			poperror();
 			break;
 		}
-		ms -= TK2MS(m->ticks - t);
-		poperror();
+		ms -= elms;
 	}
 	semdequeue(s, &phore);
 	coherence();	/* not strictly necessary due to lock in semdequeue */
@@ -1126,7 +1126,8 @@ syssemrelease(ulong *arg)
 
 	if((s = seg(up, (ulong)addr, 0)) == nil)
 		error(Ebadarg);
+	/* delta == 0 is a no-op, not a release */
 	if(delta < 0 || *addr < 0)
 		error(Ebadarg);
-	return semrelease(s, addr, arg[1]);
+	return semrelease(s, addr, delta);
 }

+ 1 - 1
sys/src/9/teg2/arm.h

@@ -280,7 +280,7 @@
 #define Noexecsmall	1			/* L2: no execute */
 #define Small		0x00000002		/* L2 4KB */
 /*
- * next 4 bits (Buffered, Cached, L2wralloc & L2sharable) must be set in
+ * next 3 bits (Buffered, Cached, L2wralloc) & L2sharable must be set in
  * l2 ptes for memory containing locks because LDREX/STREX require them.
  */
 #define Buffered	0x00000004		/* L[12]: 0 write-thru, 1 -back */

+ 4 - 1
sys/src/9/teg2/atom.s

@@ -5,9 +5,12 @@
  */
 
 TEXT	cas+0(SB),0,$12		/* r0 holds p */
+	B	_casp		/* must not fall through; would push LR again */
 TEXT	casp+0(SB),0,$12	/* r0 holds p */
+_casp:
 	MOVW	ov+4(FP), R1
 	MOVW	nv+8(FP), R2
+	BARRIERS
 spincas:
 	LDREX(0,3)	/*	LDREX	0(R0),R3	*/
 	CMP.S	R3, R1
@@ -15,8 +18,8 @@ spincas:
 	STREX(2,0,4)	/*	STREX	0(R0),R2,R4	*/
 	CMP.S	$0, R4
 	BNE	spincas
-	MOVW	$1, R0
 	BARRIERS
+	MOVW	$1, R0
 	RET
 fail:
 	CLREX

+ 2 - 1
sys/src/libc/9sys/nsec.c

@@ -36,7 +36,8 @@ nsec(void)
 	 */
 
 	/* First, look if we've opened it for this particular pid */
-	pid = _tos->pid;
+	if((pid = _tos->pid) == 0)		/* 9vx bug, perhaps? */
+		_tos->pid = pid = getpid();
 	do{
 		f = -1;
 		for(i = 0; i < nelem(fds); i++)

+ 2 - 0
sys/src/libc/arm/atom.s

@@ -8,7 +8,9 @@
 #define	STREX(v,a,r)	WORD	$(0xe<<28|0x01800f90 | (a)<<16 | (r)<<12 | (v)<<0)
 
 TEXT	cas+0(SB),0,$12		/* r0 holds p */
+	B	_casp		/* must not fall through; would push LR again */
 TEXT	casp+0(SB),0,$12	/* r0 holds p */
+_casp:
 	MOVW	ov+4(FP), R1
 	MOVW	nv+8(FP), R2
 spincas: