]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Origin tracking: handle 16-bit excess in guest state reads/writes.
authorJulian Seward <jseward@acm.org>
Thu, 30 Oct 2008 13:08:31 +0000 (13:08 +0000)
committerJulian Seward <jseward@acm.org>
Thu, 30 Oct 2008 13:08:31 +0000 (13:08 +0000)
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

memcheck/mc_translate.c

index 18ee11a86d7b2cde7ce1398079d1687b177cef94..6cf2a885ff6f2aa7aede539405b74ebd269fc84b 100644 (file)
@@ -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 */
    }
 
 }