]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Fix magic-sequence spotting in 64-bit mode.
authorJulian Seward <jseward@acm.org>
Tue, 3 Jan 2006 18:41:00 +0000 (18:41 +0000)
committerJulian Seward <jseward@acm.org>
Tue, 3 Jan 2006 18:41:00 +0000 (18:41 +0000)
git-svn-id: svn://svn.valgrind.org/vex/trunk@1530

VEX/priv/guest-ppc/toIR.c

index 5850888a86b89502b5191173b85d8b73a67b1334..7b075f5557357da568713b950966bdfed3499d2e 100644 (file)
@@ -8361,7 +8361,35 @@ DisResult disInstr_PPC_WRK (
 
    /* Spot the client-request magic sequence. */
    // Essentially a v. unlikely sequence of noops that we can catch
-   {
+   if (mode64) {
+      /* Spot the magic sequence, 64-bit mode */
+      UChar* code = (UChar*)(&guest_code[delta]);
+
+      /* Spot this:                                       
+         0x7C03D808   tw 0,3,27            => trap word if (0) => nop
+         0x7800E802   rotldi  0,0,61       => ro = rotl(r0,61)
+         0x78001800   rotldi  0,0,3        => ro = rotl(r0,3)
+         0x78006800   rotldi  0,0,13       => ro = rotl(r0,13)
+         0x78009802   rotldi  0,0,51       => ro = rotl(r0,51)
+         0x60000000   nop
+      */
+      if (getUIntBigendianly(code+ 0) == 0x7C03D808 &&
+          getUIntBigendianly(code+ 4) == 0x7800E802 &&
+          getUIntBigendianly(code+ 8) == 0x78001800 &&
+          getUIntBigendianly(code+12) == 0x78006800 &&
+          getUIntBigendianly(code+16) == 0x78009802 &&
+          getUIntBigendianly(code+20) == 0x60000000) {
+         DIP("%%r3 = client_request ( %%r31 )\n");
+         dres.len = 24;
+         delta += 24;
+
+         irbb->next     = mkSzImm( ty, guest_CIA_bbstart + delta );
+         irbb->jumpkind = Ijk_ClientReq;
+         dres.whatNext  = Dis_StopHere;
+         goto decode_success;
+      }
+   } else {
+      /* Spot the magic sequence, 32-bit mode */
       UChar* code = (UChar*)(&guest_code[delta]);
 
       /* Spot this: