From: Julian Seward Date: Thu, 11 May 2017 14:28:10 +0000 (+0000) Subject: Bug 371491 - handleAddrOverrides() is truncating the segment base address when ASO... X-Git-Tag: svn/VALGRIND_3_13_0^2~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=03bdfdcb31e9d13e3260b2a3cf88a87cdefe6085;p=thirdparty%2Fvalgrind.git Bug 371491 - handleAddrOverrides() is truncating the segment base address when ASO prefix is used. Patch from Michael Daniels (mdaniels@blackberry.com). git-svn-id: svn://svn.valgrind.org/vex/trunk@3364 --- diff --git a/VEX/priv/guest_amd64_toIR.c b/VEX/priv/guest_amd64_toIR.c index b13d5aaa0d..ff9ff31bfb 100644 --- a/VEX/priv/guest_amd64_toIR.c +++ b/VEX/priv/guest_amd64_toIR.c @@ -2340,6 +2340,10 @@ static IRExpr* handleAddrOverrides ( const VexAbiInfo* vbi, Prefix pfx, IRExpr* virtual ) { + /* --- address size override --- */ + if (haveASO(pfx)) + virtual = unop(Iop_32Uto64, unop(Iop_64to32, virtual)); + /* Note that the below are hacks that relies on the assumption that %fs or %gs are constant. Typically, %fs is always 0x63 on linux (in the main thread, it @@ -2367,10 +2371,6 @@ IRExpr* handleAddrOverrides ( const VexAbiInfo* vbi, /* cs, ds, es and ss are simply ignored in 64-bit mode. */ - /* --- address size override --- */ - if (haveASO(pfx)) - virtual = unop(Iop_32Uto64, unop(Iop_64to32, virtual)); - return virtual; }