From: Florian Krohm Date: Fri, 8 Jun 2012 16:01:19 +0000 (+0000) Subject: Amend do_shadow_Dirty and do_origins_Dirty so they no longer assert X-Git-Tag: svn/VALGRIND_3_8_0~244 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4c9a5b53c6cbab99fa2131b88c03975b31bf40a2;p=thirdparty%2Fvalgrind.git Amend do_shadow_Dirty and do_origins_Dirty so they no longer assert if the helper call touches an odd number of bytes in memory. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12624 --- diff --git a/memcheck/mc_translate.c b/memcheck/mc_translate.c index 40427480bd..f9524239ab 100644 --- a/memcheck/mc_translate.c +++ b/memcheck/mc_translate.c @@ -4309,7 +4309,17 @@ void do_shadow_Dirty ( MCEnv* mce, IRDirty* d ) curr = mkUifU32(mce, here, curr); toDo -= 2; } - tl_assert(toDo == 0); /* also need to handle 1-byte excess */ + /* chew off the remaining 8-bit chunk, if any */ + if (toDo == 1) { + here = mkPCastTo( + mce, Ity_I32, + expr2vbits_Load ( mce, end, Ity_I8, + d->mAddr, d->mSize - toDo ) + ); + curr = mkUifU32(mce, here, curr); + toDo -= 1; + } + tl_assert(toDo == 0); } /* Whew! So curr is a 32-bit V-value summarising pessimistically @@ -4377,7 +4387,15 @@ void do_shadow_Dirty ( MCEnv* mce, IRDirty* d ) NULL/*guard*/ ); toDo -= 2; } - tl_assert(toDo == 0); /* also need to handle 1-byte excess */ + /* chew off the remaining 8-bit chunk, if any */ + if (toDo == 1) { + do_shadow_Store( mce, end, d->mAddr, d->mSize - toDo, + NULL, /* original data */ + mkPCastTo( mce, Ity_I8, curr ), + NULL/*guard*/ ); + toDo -= 1; + } + tl_assert(toDo == 0); } } @@ -5894,7 +5912,13 @@ static void do_origins_Dirty ( MCEnv* mce, IRDirty* d ) curr = gen_maxU32( mce, curr, here ); toDo -= 2; } - tl_assert(toDo == 0); /* also need to handle 1-byte excess */ + /* chew off the remaining 8-bit chunk, if any */ + if (toDo == 1) { + here = gen_load_b( mce, 1, d->mAddr, d->mSize - toDo ); + curr = gen_maxU32( mce, curr, here ); + toDo -= 1; + } + tl_assert(toDo == 0); } /* Whew! So curr is a 32-bit B-value which should give an origin @@ -5959,7 +5983,13 @@ static void do_origins_Dirty ( MCEnv* mce, IRDirty* d ) NULL/*guard*/ ); toDo -= 2; } - tl_assert(toDo == 0); /* also need to handle 1-byte excess */ + /* chew off the remaining 8-bit chunk, if any */ + if (toDo == 1) { + gen_store_b( mce, 1, d->mAddr, d->mSize - toDo, curr, + NULL/*guard*/ ); + toDo -= 1; + } + tl_assert(toDo == 0); } }