Browse Source

realemu: print formatting

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Ronald G. Minnich 3 years ago
parent
commit
5d9e50f9ce
2 changed files with 18 additions and 18 deletions
  1. 10 10
      sys/src/cmd/aux/realemu/fmt.c
  2. 8 8
      sys/src/cmd/aux/realemu/main.c

+ 10 - 10
sys/src/cmd/aux/realemu/fmt.c

@@ -168,7 +168,7 @@ argconv(char *p, Inst *i, Iarg *a)
 	/* setup trap jump in case we dereference bad memory */
 	memmove(jmp, a->cpu->jmp, sizeof jmp);
 	if(setjmp(a->cpu->jmp)){
-		p += sprint(p, "<%.4lux:%.4lux>", a->seg, a->off);
+		p += sprint(p, "<%.4#x:%.4#x>", a->seg, a->off);
 		goto out;
 	}
 
@@ -177,12 +177,12 @@ argconv(char *p, Inst *i, Iarg *a)
 		abort();
 
 	case AAp:
-		p += sprint(p, "[%.4lux:%.4lux]", a->seg, a->off);
+		p += sprint(p, "[%.4#x:%.4#x]", a->seg, a->off);
 		break;
 
 	case AJb:
 	case AJv:
-		p += sprint(p, "[%.4lux]", a->off);
+		p += sprint(p, "[%.4#x]", a->off);
 		break;
 
 	case AIc:
@@ -191,7 +191,7 @@ argconv(char *p, Inst *i, Iarg *a)
 	case AIb:
 	case AIw:
 	case AIv:
-		p += sprint(p, "$%.*lux", (int)a->len*2, ar(a));
+		p += sprint(p, "$%.*#x", (int)a->len*2, ar(a));
 		break;
 
 	case AMp:
@@ -213,7 +213,7 @@ argconv(char *p, Inst *i, Iarg *a)
 			 (i->alen == 4 &&
 		             (i->rm == 5 ||
 			         (i->rm == 4 && i->index == 4 && i->base == 5)))))){
-			p += sprint(p, "[%.*lux]", (int)i->alen*2, a->off);
+			p += sprint(p, "[%.*#x]", (int)i->alen*2, a->off);
 			break;
 		}
 		*p++ = '[';
@@ -227,7 +227,7 @@ argconv(char *p, Inst *i, Iarg *a)
 					p += sprint(p, "%s", memstr32[i->base]);
 				else{
 					if(i->mod == 0)
-						p += sprint(p, "%.4lux", i->off);
+						p += sprint(p, "%.4#x", i->off);
 					else
 						p += sprint(p, "EBP");
 				}
@@ -364,10 +364,10 @@ cpufmt(Fmt *fmt)
 	memmove(cpu->jmp, jmp, sizeof jmp);
 
 	snprint(buf, sizeof(buf),
-		"%.6lux "
-		"%.8lux %.8lux %.8lux %.8lux %.8lux %.8lux %.8lux %.8lux "
-		"%.4lux %.4lux %.4lux %.4lux "
-		"%J %.4lux %.2x %I",
+		"%.6#x "
+		"%.8#x %.8#x %.8#x %.8#x %.8#x %.8#x %.8#x %.8#x "
+		"%.4#x %.4#x %.4#x %.4#x "
+		"%J %.4#x %.2x %I",
 
 		cpu->ic,
 

+ 8 - 8
sys/src/cmd/aux/realemu/main.c

@@ -119,7 +119,7 @@ static unsigned long
 rbad(void *aux, unsigned long off, int len)
 {
 	print_func_entry();
-	fprint(2, "bad mem read %.5lux\n", off);
+	fprint(2, "bad mem read %.5#x\n", off);
 	trap(&cpu, EMEM);
 
 	/* not reached */
@@ -131,7 +131,7 @@ static void
 wbad(void *aux, unsigned long off, unsigned long w, int len)
 {
 	print_func_entry();
-	fprint(2, "bad mem write %.5lux\n", off);
+	fprint(2, "bad mem write %.5#x\n", off);
 	trap(&cpu, EMEM);
 	print_func_exit();
 }
@@ -159,7 +159,7 @@ rrealmem(void *aux, unsigned long off, int len)
 	unsigned char data[4];
 
 	if(pread(realmemfd, data, len, off) != len){
-		fprint(2, "bad real mem read %.5lux: %r\n", off);
+		fprint(2, "bad real mem read %.5#x: %r\n", off);
 		trap(&cpu, EMEM);
 	}
 	print_func_exit();
@@ -174,7 +174,7 @@ wrealmem(void *aux, unsigned long off, unsigned long w, int len)
 
 	pw[len](data, w);
 	if(pwrite(realmemfd, data, len, off) != len){
-		fprint(2, "bad real mem write %.5lux: %r\n", off);
+		fprint(2, "bad real mem write %.5#x: %r\n", off);
 		trap(&cpu, EMEM);
 	}
 	print_func_exit();
@@ -242,13 +242,13 @@ rport(void *aux, unsigned long p, int len)
 		break;
 	default:
 		if(pread(portfd[len], data, len, p) != len){
-			fprint(2, "bad %d bit port read %.4lux: %r\n", len*8, p);
+			fprint(2, "bad %d bit port read %.4#x: %r\n", len*8, p);
 			trap(&cpu, EIO);
 		}
 		w = gw[len](data);
 	}
 	if(porttrace)
-		fprint(2, "rport %.4lux %.*lux\n", p, len<<1, w);
+		fprint(2, "rport %.4#x %.*#x\n", p, len<<1, w);
 	print_func_exit();
 	return w;
 }
@@ -260,7 +260,7 @@ wport(void *aux, unsigned long p, unsigned long w, int len)
 	unsigned char data[4];
 
 	if(porttrace)
-		fprint(2, "wport %.4lux %.*lux\n", p, len<<1, w);
+		fprint(2, "wport %.4#x %.*#x\n", p, len<<1, w);
 
 	switch(p){
 	case 0x20:	/* PIC 1 */
@@ -309,7 +309,7 @@ wport(void *aux, unsigned long p, unsigned long w, int len)
 	default:
 		pw[len](data, w);
 		if(pwrite(portfd[len], data, len, p) != len){
-			fprint(2, "bad %d bit port write %.4lux: %r\n", len*8, p);
+			fprint(2, "bad %d bit port write %.4#x: %r\n", len*8, p);
 			trap(&cpu, EIO);
 		}
 	}