Browse Source

Plan 9 from Bell Labs 2011-12-15

David du Colombier 7 years ago
parent
commit
4ba59bd565
5 changed files with 30 additions and 14 deletions
  1. 1 1
      sys/lib/mimetype
  2. 16 8
      sys/src/cmd/jpg/gif.c
  3. 10 4
      sys/src/cmd/kprof.c
  4. 2 0
      sys/src/libc/mips/lock.c
  5. 1 1
      sys/src/libmach/8.c

+ 1 - 1
sys/lib/mimetype

@@ -146,7 +146,7 @@
 .txt		text		plain		-		y
 .ucert		application	x-x509-user-cert	-	y # DER X.509 user certificate
 .ustar		application	x-ustar		-		m
-.vcf		text		directory	-		y # vCard
+.vcf		text		x-vcard		-		y # vCard
 .wav		audio		x-wav		-		y
 .wbmp		image		vnd.wap.wbmp	-		y # wireless bitmap
 .wml		text		vnd.wap.wml	-		m # WML doc

+ 16 - 8
sys/src/cmd/jpg/gif.c

@@ -14,6 +14,7 @@ int		output = 0;
 ulong	outchan = CMAP8;
 Image	**allims;
 Image	**allmasks;
+Rawimage	**allimages;
 int		which;
 int		defaultcolor = 1;
 
@@ -52,7 +53,12 @@ eresized(int new)
 	border(screen, r, -Border, nil, ZP);
 	r.min.x += allims[which]->r.min.x - allims[0]->r.min.x;
 	r.min.y += allims[which]->r.min.y - allims[0]->r.min.y;
-	drawop(screen, r, allims[which], allmasks[which], allims[which]->r.min, S);
+	if(which > 0 && allimages[which]->gifflags & TRANSP)
+		drawop(screen, r, allims[which], allmasks[which],
+			allims[which]->r.min, SoverD);
+	else
+		drawop(screen, r, allims[which], allmasks[which],
+			allims[which]->r.min, S);
 	flushimage(display, 1);
 }
 
@@ -229,7 +235,7 @@ addalpha(Rawimage *i)
  * r is used only for reference; the image is already in c.
  */
 void
-whiteout(Rawimage *r, Rawimage *c)
+blackout(Rawimage *r, Rawimage *c)
 {
 	int i, trindex;
 	uchar *rp, *cp;
@@ -241,9 +247,9 @@ whiteout(Rawimage *r, Rawimage *c)
 		for(i=0; i<r->chanlen; i++){
 			if(*rp == trindex){
 				*cp++ = 0x00;
-				*cp++ = 0xFF;
-				*cp++ = 0xFF;
-				*cp++ = 0xFF;
+				*cp++ = 0x00;
+				*cp++ = 0x00;
+				*cp++ = 0x00;
 			}else{
 				*cp++ = 0xFF;
 				cp += 3;
@@ -254,7 +260,7 @@ whiteout(Rawimage *r, Rawimage *c)
 		for(i=0; i<r->chanlen; i++){
 			if(*rp == trindex){
 				*cp++ = 0x00;
-				*cp++ = 0xFF;
+				*cp++ = 0x00;
 			}else{
 				*cp++ = 0xFF;
 				cp++;
@@ -349,6 +355,7 @@ show(int fd, char *name)
 		}
 	}
 
+	allimages = images;
 	allims = ims;
 	allmasks = masks;
 	loopcount = images[0]->gifloopcount;
@@ -380,7 +387,7 @@ show(int fd, char *name)
 	if(nineflag){
 		if(images[0]->gifflags&TRANSP){
 			addalpha(rgbv[0]);
-			whiteout(images[0], rgbv[0]);
+			blackout(images[0], rgbv[0]);
 		}
 		chantostr(buf, outchan);
 		print("%11s %11d %11d %11d %11d ", buf,
@@ -392,7 +399,7 @@ show(int fd, char *name)
 	}else if(cflag){
 		if(images[0]->gifflags&TRANSP){
 			addalpha(rgbv[0]);
-			whiteout(images[0], rgbv[0]);
+			blackout(images[0], rgbv[0]);
 		}
 		if(writerawimage(1, rgbv[0]) < 0){
 			fprint(2, "gif: %s: write error: %r\n", name);
@@ -403,6 +410,7 @@ show(int fd, char *name)
     Return:
 	allims = nil;
 	allmasks = nil;
+	allimages = nil;
 	for(k=0; images[k]; k++){
 		for(j=0; j<images[k]->nchans; j++)
 			free(images[k]->chans[j]);

+ 10 - 4
sys/src/cmd/kprof.c

@@ -94,19 +94,25 @@ main(int argc, char *argv[])
 		exits(0);
 	if (!textsym(&s, 0))
 		error(0, "no text symbols");
-	tbase = s.value & ~(mach->pgsize-1);	/* align down to page */
-	print("KTZERO %.8llux\n", tbase);
+
+	tbase = mach->kbase;
+	if(tbase != s.value & ~0xFFF)
+		print("warning: kbase %.8llux != tbase %.8llux\n",
+			tbase, s.value&~0xFFF);
+	print("KTZERO %.8llux PGSIZE %dKb\n", tbase, mach->pgsize/1024);
 	/*
 	 * Accumulate counts for each function
 	 */
 	cp = 0;
 	k = 0;
-	for (i = 0, j = (s.value-tbase)/PCRES+2; j < n; i++) {
+	for (i = 0, j = 2; j < n; i++) {
 		name = s.name;		/* save name */
 		if (!textsym(&s, i))	/* get next symbol */
 			break;
+		s.value -= tbase;
+		s.value /= PCRES;
 		sum = 0;
-		while (j < n && j*PCRES < s.value-tbase)
+		while (j < n && j < s.value)
 			sum += data[j++];
 		if (sum) {
 			cp = realloc(cp, (k+1)*sizeof(struct COUNTER));

+ 2 - 0
sys/src/libc/mips/lock.c

@@ -107,6 +107,7 @@ retry:
 			return 0;
 		return 1;
 	case R4K:
+	default:		/* silence compiler */
 		if(C_4ktas(&lk->val))
 			return 0;
 		return 1;
@@ -149,6 +150,7 @@ retry:
 	case MAGNUMII:
 		return C_3ktas(p);
 	case R4K:
+	default:		/* silence compiler */
 		return C_4ktas(p);
 	case POWER:
 		/* Use low order lock bits to generate hash */

+ 1 - 1
sys/src/libmach/8.c

@@ -68,7 +68,7 @@ Mach mi386 =
 	"setSB",	/* static base register name (bogus anyways) */
 	0,		/* static base register value */
 	0x1000,		/* page size */
-	0x80100000ULL,	/* kernel base */
+	0xF0100000ULL,	/* kernel base */
 	0xF0000000ULL,	/* kernel text mask */
 	0x7FFFFFFFULL,	/* user stack top */
 	1,		/* quantization of pc */