From: Julian Seward Date: Thu, 30 Oct 2008 13:08:31 +0000 (+0000) Subject: Origin tracking: handle 16-bit excess in guest state reads/writes. X-Git-Tag: svn/VALGRIND_3_4_0~175 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=34fa5dc31bca46663c42ae76cdc8bddb0139e724;p=thirdparty%2Fvalgrind.git Origin tracking: handle 16-bit excess in guest state reads/writes. This gets rid of the messages "Approx: do_origins_Dirty(R): missed %d bytes\n" and "Approx: do_origins_Dirty(W): missed %d bytes\n". git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8719 --- diff --git a/memcheck/mc_translate.c b/memcheck/mc_translate.c index 18ee11a86d..6cf2a885ff 100644 --- a/memcheck/mc_translate.c +++ b/memcheck/mc_translate.c @@ -4174,10 +4174,13 @@ static void do_origins_Dirty ( MCEnv* mce, IRDirty* d ) curr = gen_maxU32( mce, curr, here ); toDo -= 4; } - if (toDo != 0) - VG_(printf)("Approx: do_origins_Dirty(R): missed %d bytes\n", - (Int)toDo ); - //tl_assert(toDo == 0); /* also need to handle 1,2-byte excess */ + /* handle possible 16-bit excess */ + while (toDo >= 2) { + here = gen_load_b( mce, 2, d->mAddr, d->mSize - toDo ); + curr = gen_maxU32( mce, curr, here ); + toDo -= 2; + } + tl_assert(toDo == 0); /* also need to handle 1-byte excess */ } /* Whew! So curr is a 32-bit B-value which should give an origin @@ -4231,10 +4234,12 @@ static void do_origins_Dirty ( MCEnv* mce, IRDirty* d ) gen_store_b( mce, 4, d->mAddr, d->mSize - toDo, curr ); toDo -= 4; } - if (toDo != 0) - VG_(printf)("Approx: do_origins_Dirty(W): missed %d bytes\n", - (Int)toDo ); - //tl_assert(toDo == 0); /* also need to handle 1,2-byte excess */ + /* handle possible 16-bit excess */ + while (toDo >= 2) { + gen_store_b( mce, 2, d->mAddr, d->mSize - toDo, curr ); + toDo -= 2; + } + tl_assert(toDo == 0); /* also need to handle 1-byte excess */ } }