Browse Source

Plan 9 from Bell Labs 2012-03-28

David du Colombier 12 years ago
parent
commit
743a5992bc

+ 2 - 2
arm/include/u.h

@@ -22,7 +22,7 @@ typedef unsigned int	u32int;
 typedef unsigned long long u64int;
 
 /* VFP FCR */
-#define	FPINEX	(1<<12)
+#define	FPINEX	(1<<12)			/* trap enables for exceptions */
 #define	FPUNFL	(1<<11)
 #define	FPOVFL	(1<<10)
 #define	FPZDIV	(1<<9)
@@ -37,7 +37,7 @@ typedef unsigned long long u64int;
 #define	FPPDBL	0
 #define	FPPMASK	0
 /* FSR */
-#define	FPAINEX	(1<<4)
+#define	FPAINEX	(1<<4)			/* accrued exceptions */
 #define	FPAUNFL	(1<<3)
 #define	FPAOVFL	(1<<2)
 #define	FPAZDIV	(1<<1)

+ 3 - 1
rc/bin/diffy

@@ -1,5 +1,5 @@
 #!/bin/rc
-# diffy [diff-opts] file... - diff file against yesterday's version(s)
+# diffy [diff-opts] [file...] - diff file against yesterday's version(s)
 rfork e
 diffopts=()
 while(! ~ $#* 0 && ~ $1 -* && ! ~ $1 --){
@@ -10,5 +10,7 @@ if(~ $1 --)
 	shift
 if(! ~ $#* 1)
 	diffopts=($diffopts -m)
+if (~ $#* 0)
+	* = (.)
 for(f)
 	diff $diffopts `{yesterday $f} $f

+ 1 - 1
sys/man/3/cons

@@ -242,7 +242,7 @@ seconds.
 Set the frequency for interpreting clock ticks to be
 .I freq
 ticks per second.
-.PP
+.SS "Statistics and Dynamic Status"
 The rest of the files contain (mostly) read-only strings.
 Each string has a fixed length: a
 .IR read (2)

+ 39 - 11
sys/src/cmd/5l/obj.c

@@ -1229,6 +1229,8 @@ doprof1(void)
 	s->value = n*4;
 }
 
+static int brcond[] = {ABEQ, ABNE, ABCS, ABCC, ABMI, ABPL, ABVS, ABVC, ABHI, ABLS, ABGE, ABLT, ABGT, ABLE};
+
 void
 doprof2(void)
 {
@@ -1283,7 +1285,7 @@ doprof2(void)
 			}
 
 			/*
-			 * BL	profin, R2
+			 * BL	profin
 			 */
 			q = prg();
 			q->line = p->line;
@@ -1323,6 +1325,7 @@ doprof2(void)
 				p->link = q;
 				p = q;
 			}
+
 			/*
 			 * RET
 			 */
@@ -1330,21 +1333,46 @@ doprof2(void)
 			q->as = ARET;
 			q->from = p->from;
 			q->to = p->to;
+			q->cond = p->cond;
 			q->link = p->link;
+			q->reg = p->reg;
 			p->link = q;
 
-			/*
-			 * BL	profout
-			 */
-			p->as = ABL;
-			p->from = zprg.from;
-			p->to = zprg.to;
-			p->to.type = D_BRANCH;
-			p->cond = ps4;
-			p->to.sym = s4;
+			if(p->scond != 14) {
+				q = prg();
+				q->as = ABL;
+				q->from = zprg.from;
+				q->to = zprg.to;
+				q->to.type = D_BRANCH;
+				q->cond = ps4;
+				q->to.sym = s4;
+				q->link = p->link;
+				p->link = q;
 
-			p = q;
+				p->as = brcond[p->scond^1];	/* complement */
+				p->scond = 14;
+				p->from = zprg.from;
+				p->to = zprg.to;
+				p->to.type = D_BRANCH;
+				p->cond = q->link->link;	/* successor of RET */
+				p->to.offset = q->link->link->pc;
+
+				p = q->link->link;
+			} else {
+
+				/*
+				 * BL	profout
+				 */
+				p->as = ABL;
+				p->from = zprg.from;
+				p->to = zprg.to;
+				p->to.type = D_BRANCH;
+				p->cond = ps4;
+				p->to.sym = s4;
+				p->scond = 14;
 
+				p = q;
+			}
 			continue;
 		}
 	}

+ 1 - 1
sys/src/libc/arm/getcallerpc.s

@@ -1,3 +1,3 @@
-TEXT getcallerpc(SB), $-4
+TEXT getcallerpc(SB), 1, $-4
 	MOVW	0(R13), R0
 	RET

+ 2 - 2
sys/src/libc/arm/main9p.s

@@ -34,8 +34,8 @@ loop:
 TEXT	_savearg(SB), 1, $0
 	RET
 
-TEXT	_callpc(SB), 1, $0
-	MOVW	argp-4(FP), R(arg)
+TEXT	_callpc(SB), 1, $-4
+	MOVW	0(R13), R(arg)
 	RET
 
 DATA	_exitstr<>+0(SB)/4, $"main"

+ 2 - 2
sys/src/libc/arm/memmove.s

@@ -5,9 +5,9 @@ N = 3
 TMP = 3					/* N and TMP don't overlap */
 TMP1 = 4
 
-TEXT memcpy(SB), $-4
+TEXT memcpy(SB), $0
 	B	_memmove
-TEXT memmove(SB), $-4
+TEXT memmove(SB), $0
 _memmove:
 	MOVW	R(TS), to+0(FP)		/* need to save for return value */
 	MOVW	from+4(FP), R(FROM)

+ 1 - 1
sys/src/libc/arm/strchr.s

@@ -1,4 +1,4 @@
-TEXT strchr(SB), $-4
+TEXT strchr(SB), $0
 	MOVBU	c+4(FP), R1
 	CMP	$0, R1
 	BEQ	_null

+ 1 - 1
sys/src/libc/arm/strcmp.s

@@ -1,4 +1,4 @@
-TEXT strcmp(SB), $-4
+TEXT strcmp(SB), $0
 	MOVW	R0, R1
 	MOVW	s2+4(FP), R2
 

+ 1 - 1
sys/src/libc/arm/strcpy.s

@@ -1,4 +1,4 @@
-TEXT strcpy(SB), $-4
+TEXT strcpy(SB), $0
 	MOVW		R0, to+0(FP)	/* need to save for return value */
 	MOVW		from+4(FP), R1
 	MOVW		$0xFF, R2	/* mask */

+ 1 - 1
sys/src/libc/arm/tas.s

@@ -1,4 +1,4 @@
-TEXT	_tas(SB), $-4
+TEXT	_tas(SB), 1, $-4
 	MOVW	R0,R1
 	MOVW	$1,R0
 	SWPW	R0,(R1)		/* fix: deprecated in armv7 */

+ 1 - 1
sys/src/libc/arm/vlop.s

@@ -1,4 +1,4 @@
-TEXT	_mulv(SB), $0
+TEXT	_mulv(SB), 1, $0
 	MOVW	4(FP),R8	/* l0 */
 	MOVW	8(FP),R11	/* h0 */
 	MOVW	12(FP),R4	/* l1 */

+ 14 - 9
sys/src/libmach/5db.c

@@ -61,7 +61,7 @@ static	int	arminstlen(Map*, uvlong);
  */
 Machdata armmach =
 {
-	{0, 0, 0, 0xD},		/* break point */
+	{0x70, 0x00, 0x20, 0xD1},		/* break point */	/* D1200070 */
 	4,			/* break point size */
 
 	leswab,			/* short to local byte order */
@@ -210,6 +210,10 @@ armclass(long w)
 		op = (48+24+4) + ((w >> 22) & 0x1) + ((w >> 19) & 0x2);
 		break;
 	case 4:	/* block data transfer (r)(r) */
+		if ((w & 0xfe50ffff) == 0xf8100a00) {	/* v7 RFE */
+			op = 99;
+			break;
+		}
 		op = (48+24+4+4) + ((w >> 20) & 0x1);
 		break;
 	case 5:	/* branch / branch link */
@@ -632,19 +636,16 @@ armaddr(Map *map, Rgetter rget, Instr *i)
 	char buf[8];
 	ulong rn;
 
-	sprint(buf, "R%ld", (i->w >> 16) & 0xf);
+	snprint(buf, sizeof(buf), "R%ld", (i->w >> 16) & 0xf);
 	rn = rget(map, buf);
 
-	if((i->w & (1<<24)) == 0) {			/* POSTIDX */
-		sprint(buf, "R%ld", rn);
-		return rget(map, buf);
-	}
+	if((i->w & (1<<24)) == 0)			/* POSTIDX */
+		return rn;
 
 	if((i->w & (1<<25)) == 0) {			/* OFFSET */
-		sprint(buf, "R%ld", rn);
 		if(i->w & (1U<<23))
-			return rget(map, buf) + (i->w & BITS(0,11));
-		return rget(map, buf) - (i->w & BITS(0,11));
+			return rn + (i->w & BITS(0,11));
+		return rn - (i->w & BITS(0,11));
 	} else {					/* REGOFF */
 		ulong index = 0;
 		uchar c;
@@ -856,6 +857,7 @@ static Opcode opcodes[] =
 /* 48+24+4+4+2+2+4+4 = 92 */
 	"UNK",		armunk, 0,	"",
 
+	/* new v7 arch instructions */
 /* 93 */
 	"LDREX",	armdpi, 0,	"(R%n),R%d",
 	"STREX",	armdpi, 0,	"R%s,(R%n),R%d",
@@ -865,6 +867,9 @@ static Opcode opcodes[] =
 	"DSB",		armunk, 0,	"",
 	"DMB",		armunk, 0,	"",
 	"ISB",		armunk, 0,	"",
+
+/* 99 */
+	"RFEV7%P%a",	armbdt, 0,	"(R%n)",
 };
 
 static void