Skip to contentSkip to conversation

qemu/target-sparc translate.c

Qemu-devel Blue Swirl 2 participants 3 messages Apr 1, 2007 – Apr 3, 2007

lore
Share & tools
lore
#1 lore raw
Quoted 10 lines · Blue Swirl

CVSROOT: /cvsroot/qemu
Module name: qemu
Changes by: Blue Swirl <blueswir1> 07/04/01 16:23:36

Modified files:
target-sparc : translate.c

Log message:
Fix off-by-one error

Looking at the code of this commit pointed me that my previous patch about coprocessor instructions was partly wrong. The store operation are not placed at the right place.

The patch below fixes that.

Index: target-sparc/translate.c
===================================================================
RCS file: /sources/qemu/qemu/target-sparc/translate.c,v retrieving revision 1.44

translate.c +8 -8
diff -u -d -p -r1.44 translate.c
@@ -2444,10 +2443,6 @@ static void disas_sparc_insn(DisasContex
 		case 0x30: /* ldc */
 		case 0x31: /* ldcsr */
 		case 0x33: /* lddc */
-		case 0x34: /* stc */
-		case 0x35: /* stcsr */
-		case 0x36: /* stdcq */
-		case 0x37: /* stdc */
 		    goto ncp_insn;
 		    break;
                     /* avoid warnings */
@@ -2612,8 +2609,8 @@ static void disas_sparc_insn(DisasContex
 		    goto illegal_insn;
 		}
 	    } else if (xop > 0x33 && xop < 0x3f) {
-#ifdef TARGET_SPARC64
 		switch (xop) {
+#ifdef TARGET_SPARC64
 		case 0x34: /* V9 stfa */
 		    gen_op_stfa(insn, 0, 0, 0); // XXX
 		    break;
@@ -2628,12 +2625,16 @@ static void disas_sparc_insn(DisasContex
 		    break;
 		case 0x36: /* V9 stqfa */
 		    goto nfpu_insn;
+#else
+		case 0x34: /* stc */
+		case 0x35: /* stcsr */
+		case 0x36: /* stdcq */
+		case 0x37: /* stdc */
+		    goto ncp_insn;
+#endif
 		default:
 		    goto illegal_insn;
 		}
-#else
-		goto illegal_insn;
-#endif
             }
 	    else
 		goto illegal_insn;
Signature · 4 lines
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   [email protected]         | [email protected]
   `-    people.debian.org/~aurel32 | www.aurel32.net
#2 lore raw
Quoted 12 lines · Aurelien Jarno
Quoted 10 lines · Blue Swirl

CVSROOT: /cvsroot/qemu
Module name: qemu
Changes by: Blue Swirl <blueswir1> 07/04/01 16:23:36

Modified files:
target-sparc : translate.c

Log message:
Fix off-by-one error

Quoted 5 lines

Looking at the code of this commit pointed me that my previous patch about coprocessor instructions was partly wrong. The store operation are not placed at the right place.

The patch below fixes that.

Please find attached an updated patch that also handles CBN+x instructions.

Signature · 4 lines
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   [email protected]         | [email protected]
   `-    people.debian.org/~aurel32 | www.aurel32.net
target-sparc/translate.c +13 -8
@@ -1012,6 +1011,11 @@ static void disas_sparc_insn(DisasContex
 		    do_fbranch(dc, target, insn, cc);
 		    goto jmp_insn;
 		}
+#else
+	    case 0x7:		/* CBN+x */
+		{
+		    goto ncp_insn;
+		}
 #endif
 	    case 0x2:		/* BN+x */
 		{
@@ -2444,10 +2448,6 @@ static void disas_sparc_insn(DisasContex
 		case 0x30: /* ldc */
 		case 0x31: /* ldcsr */
 		case 0x33: /* lddc */
-		case 0x34: /* stc */
-		case 0x35: /* stcsr */
-		case 0x36: /* stdcq */
-		case 0x37: /* stdc */
 		    goto ncp_insn;
 		    break;
                     /* avoid warnings */
@@ -2612,8 +2618,8 @@ static void disas_sparc_insn(DisasContex
 		    goto illegal_insn;
 		}
 	    } else if (xop > 0x33 && xop < 0x3f) {
-#ifdef TARGET_SPARC64
 		switch (xop) {
+#ifdef TARGET_SPARC64
 		case 0x34: /* V9 stfa */
 		    gen_op_stfa(insn, 0, 0, 0); // XXX
 		    break;
@@ -2628,12 +2634,16 @@ static void disas_sparc_insn(DisasContex
 		    break;
 		case 0x36: /* V9 stqfa */
 		    goto nfpu_insn;
+#else
+		case 0x34: /* stc */
+		case 0x35: /* stcsr */
+		case 0x36: /* stdcq */
+		case 0x37: /* stdc */
+		    goto ncp_insn;
+#endif
 		default:
 		    goto illegal_insn;
 		}
-#else
-		goto illegal_insn;
-#endif
             }
 	    else
 		goto illegal_insn;