ARM: Handle case where new TLB size is different from previous TLB size.
authorAli Saidi <Ali.Saidi@ARM.com>
Thu, 16 Jun 2011 20:08:12 +0000 (15:08 -0500)
committerAli Saidi <Ali.Saidi@ARM.com>
Thu, 16 Jun 2011 20:08:12 +0000 (15:08 -0500)
After a checkpoint we need to make sure that we restore the right
number of entries.

src/arch/arm/tlb.cc

index a2b1a9d8a0c162ebb8c6a05554ed7d9b4bc43bb1..c5949821295a24bc2e070f3993e092a4b3dd0d7a 100644 (file)
@@ -264,6 +264,9 @@ TLB::serialize(ostream &os)
     DPRINTF(Checkpoint, "Serializing Arm TLB\n");
 
     SERIALIZE_SCALAR(_attr);
+
+    int num_entries = size;
+    SERIALIZE_SCALAR(num_entries);
     for(int i = 0; i < size; i++){
         nameOut(os, csprintf("%s.TlbEntry%d", name(), i));
         table[i].serialize(os);
@@ -276,7 +279,9 @@ TLB::unserialize(Checkpoint *cp, const string &section)
     DPRINTF(Checkpoint, "Unserializing Arm TLB\n");
 
     UNSERIALIZE_SCALAR(_attr);
-    for(int i = 0; i < size; i++){
+    int num_entries;
+    UNSERIALIZE_SCALAR(num_entries);
+    for(int i = 0; i < min(size, num_entries); i++){
         table[i].unserialize(cp, csprintf("%s.TlbEntry%d", section, i));
     }
     miscRegValid = false;