From: Julian Seward Date: Sun, 23 Nov 2014 17:27:11 +0000 (+0000) Subject: Merge, from trunk, r2990. X-Git-Tag: svn/VALGRIND_3_10_1^2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=87f5331c9e351dd227749ade9dcace22c6d2a70e;p=thirdparty%2Fvalgrind.git Merge, from trunk, r2990. 2990 Add detection of old ppc32 magic instructions from bug 278808. git-svn-id: svn://svn.valgrind.org/vex/branches/VEX_3_10_BRANCH@3015 --- diff --git a/VEX/priv/guest_ppc_toIR.c b/VEX/priv/guest_ppc_toIR.c index 6ee9a61b9d..1e3b2276e0 100644 --- a/VEX/priv/guest_ppc_toIR.c +++ b/VEX/priv/guest_ppc_toIR.c @@ -18782,10 +18782,26 @@ DisResult disInstr_PPC_WRK ( UInt word2 = mode64 ? 0x78006800 : 0x5400683E; UInt word3 = mode64 ? 0x7800E802 : 0x5400E83E; UInt word4 = mode64 ? 0x78009802 : 0x5400983E; + Bool is_special_preamble = False; if (getUIntPPCendianly(code+ 0) == word1 && getUIntPPCendianly(code+ 4) == word2 && getUIntPPCendianly(code+ 8) == word3 && getUIntPPCendianly(code+12) == word4) { + is_special_preamble = True; + } else if (! mode64 && + getUIntPPCendianly(code+ 0) == 0x54001800 && + getUIntPPCendianly(code+ 4) == 0x54006800 && + getUIntPPCendianly(code+ 8) == 0x5400E800 && + getUIntPPCendianly(code+12) == 0x54009800) { + static Bool reported = False; + if (!reported) { + vex_printf("disInstr(ppc): old ppc32 instruction magic detected. Code might clobber r0.\n"); + vex_printf("disInstr(ppc): source needs to be recompiled against latest valgrind.h.\n"); + reported = True; + } + is_special_preamble = True; + } + if (is_special_preamble) { /* Got a "Special" instruction preamble. Which one is it? */ if (getUIntPPCendianly(code+16) == 0x7C210B78 /* or 1,1,1 */) { /* %R3 = client_request ( %R4 ) */