From 56adb4ce655d809bada23c556bc7cdd937f12811 Mon Sep 17 00:00:00 2001 From: Julian Seward Date: Mon, 14 Feb 2011 13:10:35 +0000 Subject: [PATCH] Merge from trunk, r2073 (Fix bug in ppc64g_dirtyhelper_LVS) git-svn-id: svn://svn.valgrind.org/vex/branches/VEX_3_6_BRANCH@2089 --- VEX/priv/guest_ppc_helpers.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/VEX/priv/guest_ppc_helpers.c b/VEX/priv/guest_ppc_helpers.c index e056a65328..11aa42815b 100644 --- a/VEX/priv/guest_ppc_helpers.c +++ b/VEX/priv/guest_ppc_helpers.c @@ -154,11 +154,17 @@ void ppc32g_dirtyhelper_LVS ( VexGuestPPC32State* gst, void ppc64g_dirtyhelper_LVS ( VexGuestPPC64State* gst, UInt vD_off, UInt sh, UInt shift_right ) { - static - UChar ref[32] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F }; + UChar ref[32]; + ULong i; + /* ref[] used to be a static const array, but this doesn't work on + ppc64 because VEX doesn't load the TOC pointer for the call here, + and so we wind up picking up some totally random other data. + (It's a wonder we don't segfault.) So, just to be clear, this + "fix" (vex r2073) is really a kludgearound for the fact that + VEX's 64-bit ppc code generation doesn't provide a valid TOC + pointer for helper function calls. Ick. (Bug 250038) */ + for (i = 0; i < 32; i++) ref[i] = i; + U128* pU128_src; U128* pU128_dst; -- 2.47.2