From: Julian Seward Date: Tue, 3 Jan 2006 18:41:00 +0000 (+0000) Subject: Fix magic-sequence spotting in 64-bit mode. X-Git-Tag: svn/VALGRIND_3_2_3^2~129 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=848f9b9afc1cd110d8e634a1c20b0adb52c31285;p=thirdparty%2Fvalgrind.git Fix magic-sequence spotting in 64-bit mode. git-svn-id: svn://svn.valgrind.org/vex/trunk@1530 --- diff --git a/VEX/priv/guest-ppc/toIR.c b/VEX/priv/guest-ppc/toIR.c index 5850888a86..7b075f5557 100644 --- a/VEX/priv/guest-ppc/toIR.c +++ b/VEX/priv/guest-ppc/toIR.c @@ -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: