r417 - trunk/emulator/usim

rswindells at common-lisp.net rswindells at common-lisp.net
Fri May 31 09:58:31 UTC 2013


Author: rswindells
Date: Fri May 31 02:58:31 2013
New Revision: 417

Log:
Add switch '-w' to select 25-bit pointers.

Modified:
   trunk/emulator/usim/lod.c
   trunk/emulator/usim/macro.c

Modified: trunk/emulator/usim/lod.c
==============================================================================
--- trunk/emulator/usim/lod.c	Sat May 25 10:28:44 2013	(r416)
+++ trunk/emulator/usim/lod.c	Fri May 31 02:58:31 2013	(r417)
@@ -27,6 +27,7 @@
 int show_fef;
 int show_initial_sg;
 int show_memory;
+int set_wide;
 
 struct {
 	char *name;
@@ -154,7 +155,7 @@
 	if (b != bnum) {
 		bnum = b;
 
-		if (0) printf("fd %d, block %d(10) offset %lld\n",
+		if (0) printf("fd %d, block %d(10) offset %ld\n",
 			      fd, b, offset);
 
 		ret = lseek(fd, offset, SEEK_SET);
@@ -356,7 +357,7 @@
 }
 
 void
-show_fef_func_name(unsigned int fefptr)
+show_fef_func_name(unsigned int fefptr, unsigned int width)
 {
 	unsigned int n, v;
 	int tag;
@@ -365,12 +366,12 @@
 
 	printf(" "); v = get(n);
 
-	tag = (v >> 24) & 077;
+	tag = (v >> width) & 037;
 	if (0) printf("tag %o\n", tag);
 
 	if (tag == 3) {
 		v = get(v);
-		tag = (v >> 24) & 077;
+		tag = (v >> width) & 037;
 	}
 
 	if (tag == 4) {
@@ -386,16 +387,18 @@
 	unsigned int addr, v, n, o;
 	int i, j, tag, icount, max;
 	unsigned short ib[512];
+	unsigned int width;
 
 	printf("\n");
 
+	width = set_wide ? 25 : 24;
 	addr = pc >> 2;
 	if (1) printf("pc %o, addr %o\n", pc, addr);
 
 	/* find fef */
 	for (i = 0; i < 512; i--) {
 		n = get(addr);
-		tag = (n >> 24) & 077;
+		tag = (n >> width) & 037;
 		if (tag == 7) break;
 		addr--;
 	}
@@ -433,13 +436,13 @@
 		case 2:
 			printf(" "); v = show(inst, 0);
 
-			tag = (v >> 24) & 077;
+			tag = (v >> width) & 037;
 			if (0) printf("tag %o\n", tag);
 
 			if (tag == 3) {
 				printf("\n");
 				printf(" "); v = show(v, 0);
-				tag = (v >> 24) & 077;
+				tag = (v >> 24) & 037;
 			}
 			if (tag == 4) {
 				printf(" "); showstr(v, 1);
@@ -451,7 +454,7 @@
 	for (i = o; i < o+icount; i++) {
 		unsigned int loc;
 		loc = addr+i/2;
-		disass(addr, loc, (i%2) ? 0 : 1, ib[i]);
+		disass(addr, loc, (i%2) ? 0 : 1, ib[i], width);
 	}
 
 	return 0;
@@ -471,6 +474,7 @@
 	fprintf(stderr, "-g	dump initial stack group\n");
 	fprintf(stderr, "-p <pc> find and disassemble FEF for given pc\n");
 	fprintf(stderr, "-a <addr> find and disassemble FEF for given address\n");
+	fprintf(stderr, "-w	decode 25-bit pointers\n");
 	exit(1);
 }
 
@@ -484,7 +488,7 @@
 	int i, c;
 	unsigned int pc, addr;
 
-	while ((c = getopt(argc, argv, "l:i:csfgp:a:m:")) != -1) {
+	while ((c = getopt(argc, argv, "l:i:csfgp:a:m:w")) != -1) {
 		switch (c) {
 		case 'l':
 			loadband_filename = strdup(optarg);
@@ -517,6 +521,9 @@
 			sscanf(optarg, "%o", &addr);
 			show_memory++;
 			break;
+		case 'w':
+			set_wide++;
+			break;
 		}
 	}
 

Modified: trunk/emulator/usim/macro.c
==============================================================================
--- trunk/emulator/usim/macro.c	Sat May 25 10:28:44 2013	(r416)
+++ trunk/emulator/usim/macro.c	Fri May 31 02:58:31 2013	(r417)
@@ -402,7 +402,9 @@
 static int misc_inst_vector_setup;
 
 void
-disass(unsigned int fefptr, unsigned int loc, int even, unsigned int inst)
+disass(unsigned int fefptr, unsigned int loc, int even, unsigned int inst,
+	unsigned int width)
+
 {
 	int op, dest, reg, delta, adr;
 	int to;
@@ -434,18 +436,21 @@
 		{
 			unsigned int v, tag;
 			v = get(fefptr + delta);
-			tag = (v >> 24) & 077;
+			tag = (v >> width) & 037;
 			if (0) printf("(tag%o %o) ", tag, v);
 			switch (tag) {
 			case 3:
 				v = get(v);
 				showstr(v, 0);
 				break;
+			case 4:
+				showstr(v, 0);
+				break;
 			case 027:
 				break;
 			default:
 				v = get(v);
-				show_fef_func_name( v );
+				show_fef_func_name( v , width);
 			}
 		}
 //		nlc = (loc*2 + (even?0:1)) + delta;



More information about the mit-cadr-cvs mailing list