]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Implement YIELD (encodings T1 and A1). Fixes #348377.
authorJulian Seward <jseward@acm.org>
Mon, 17 Aug 2015 13:55:41 +0000 (13:55 +0000)
committerJulian Seward <jseward@acm.org>
Mon, 17 Aug 2015 13:55:41 +0000 (13:55 +0000)
git-svn-id: svn://svn.valgrind.org/vex/trunk@3177

VEX/priv/guest_arm_toIR.c

index 94f8de071d0a8f7515ff5324223f9e3f1d507442..d05276408fd1117f456aa68e54fbaf304c86abaa 100644 (file)
@@ -16782,12 +16782,6 @@ DisResult disInstr_ARM_WRK (
       }
    }
 
-   /* ------------------- NOP ------------------ */
-   if (0x0320F000 == (insn & 0x0FFFFFFF)) {
-      DIP("nop%s\n", nCC(INSN_COND));
-      goto decode_success;
-   }
-
    /* -------------- (A1) LDRT reg+/-#imm12 -------------- */
    /* Load Register Unprivileged:
       ldrt<c> Rt, [Rn] {, #+/-imm12}
@@ -17280,6 +17274,30 @@ DisResult disInstr_ARM_WRK (
          break;
    }
 
+   /* ----------------------------------------------------------- */
+   /* -- Hints                                                 -- */
+   /* ----------------------------------------------------------- */
+
+   switch (insn & 0x0FFFFFFF) {
+      /* ------------------- NOP ------------------ */
+      case 0x0320F000:
+         DIP("nop%s\n", nCC(INSN_COND));
+         goto decode_success;
+      /* ------------------- YIELD ------------------ */
+      case 0x0320F001:
+         /* Continue after conditionally yielding. */
+         DIP("yield%s\n", nCC(INSN_COND));
+         stmt( IRStmt_Exit( unop(Iop_32to1, 
+                                 condT == IRTemp_INVALID 
+                                    ? mkU32(1) : mkexpr(condT)),
+                            Ijk_Yield,
+                            IRConst_U32(guest_R15_curr_instr_notENC + 4),
+                            OFFB_R15T ));
+         goto decode_success;
+      default:
+         break;
+   }
+
    /* ----------------------------------------------------------- */
    /* -- VFP (CP 10, CP 11) instructions (in ARM mode)         -- */
    /* ----------------------------------------------------------- */
@@ -19170,16 +19188,18 @@ DisResult disInstr_THUMB_WRK (
          /* ------ NOP ------ */
          DIP("nop\n");
          goto decode_success;
-      case 0xBF20:
-         /* ------ WFE ------ */
-         /* WFE gets used as a spin-loop hint.  Do the usual thing,
+      case 0xBF10: // YIELD
+      case 0xBF20: // WFE
+         /* ------ WFE, YIELD ------ */
+         /* Both appear to get used as a spin-loop hints.  Do the usual thing,
             which is to continue after yielding. */
          stmt( IRStmt_Exit( unop(Iop_32to1, mkexpr(condT)),
                             Ijk_Yield,
                             IRConst_U32((guest_R15_curr_instr_notENC + 2) 
                                         | 1 /*CPSR.T*/),
                             OFFB_R15T ));
-         DIP("wfe\n");
+         Bool isWFE = INSN0(15,0) == 0xBF20;
+         DIP(isWFE ? "wfe\n" : "yield\n");
          goto decode_success;
       case 0xBF40:
          /* ------ SEV ------ */