changeset 101:78e4702884e3

thumbdis: nop recognition
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Mon, 31 Mar 2014 01:16:55 +0000
parents ec90136f07a6
children 44db5922ab8f
files arm7dis/thumbdis.c
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/arm7dis/thumbdis.c	Mon Mar 31 01:10:34 2014 +0000
+++ b/arm7dis/thumbdis.c	Mon Mar 31 01:16:55 2014 +0000
@@ -78,16 +78,21 @@
 format_5_hiops(word)
 	unsigned word;
 {
-	static char *opc[3] = {"add", "cmp", "mov"};
-	int reg1, reg2;
+	static char *opctab[3] = {"add", "cmp", "mov"};
+	int reg1, reg2, op;
 
 	if (word & 0xC0) {
 		reg1 = word & 7;
 		if (word & 0x80)
 			reg1 += 8;
 		reg2 = (word >> 3) & 0xF;
-		printf("%s\t%s, %s\n", opc[(word>>8)&3],
-			regnames[reg1], regnames[reg2]);
+		op = (word >> 8) & 3;
+		if (op == 2 && reg1 == reg2 && reg1 != 15)
+			printf("nop\t\t\t(mov %s, %s)\n",
+				regnames[reg1], regnames[reg2]);
+		else
+			printf("%s\t%s, %s\n", opctab[op],
+				regnames[reg1], regnames[reg2]);
 	} else
 		printf("<invalid: hi-reg format with both low regs>\n");
 }