summaryrefslogtreecommitdiff
path: root/src/arch/sparc
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/sparc')
-rw-r--r--src/arch/sparc/interrupts.hh4
-rw-r--r--src/arch/sparc/isa.cc4
-rw-r--r--src/arch/sparc/isa.hh5
-rw-r--r--src/arch/sparc/pagetable.cc4
-rw-r--r--src/arch/sparc/pagetable.hh4
-rw-r--r--src/arch/sparc/system.cc28
-rw-r--r--src/arch/sparc/system.hh4
-rw-r--r--src/arch/sparc/tlb.cc39
-rw-r--r--src/arch/sparc/tlb.hh4
9 files changed, 44 insertions, 52 deletions
diff --git a/src/arch/sparc/interrupts.hh b/src/arch/sparc/interrupts.hh
index 56cbbf0eb..432132f66 100644
--- a/src/arch/sparc/interrupts.hh
+++ b/src/arch/sparc/interrupts.hh
@@ -191,14 +191,14 @@ class Interrupts : public SimObject
}
void
- serialize(std::ostream &os)
+ serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE
{
SERIALIZE_ARRAY(interrupts,NumInterruptTypes);
SERIALIZE_SCALAR(intStatus);
}
void
- unserialize(Checkpoint *cp, const std::string &section)
+ unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE
{
UNSERIALIZE_ARRAY(interrupts,NumInterruptTypes);
UNSERIALIZE_SCALAR(intStatus);
diff --git a/src/arch/sparc/isa.cc b/src/arch/sparc/isa.cc
index c9a3a33b4..a588eaf66 100644
--- a/src/arch/sparc/isa.cc
+++ b/src/arch/sparc/isa.cc
@@ -638,7 +638,7 @@ ISA::setMiscReg(int miscReg, MiscReg val, ThreadContext * tc)
}
void
-ISA::serialize(std::ostream &os)
+ISA::serialize(CheckpointOut &cp) const
{
SERIALIZE_SCALAR(asi);
SERIALIZE_SCALAR(tick);
@@ -714,7 +714,7 @@ ISA::serialize(std::ostream &os)
}
void
-ISA::unserialize(Checkpoint *cp, const std::string &section)
+ISA::unserialize(CheckpointIn &cp)
{
UNSERIALIZE_SCALAR(asi);
UNSERIALIZE_SCALAR(tick);
diff --git a/src/arch/sparc/isa.hh b/src/arch/sparc/isa.hh
index 4551cf3c1..1d2a457d2 100644
--- a/src/arch/sparc/isa.hh
+++ b/src/arch/sparc/isa.hh
@@ -167,9 +167,8 @@ class ISA : public SimObject
void clear();
- void serialize(std::ostream & os);
-
- void unserialize(Checkpoint *cp, const std::string & section);
+ void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE;
+ void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE;
void startup(ThreadContext *tc) {}
diff --git a/src/arch/sparc/pagetable.cc b/src/arch/sparc/pagetable.cc
index bdd3e97fe..f0d2c10cf 100644
--- a/src/arch/sparc/pagetable.cc
+++ b/src/arch/sparc/pagetable.cc
@@ -35,7 +35,7 @@ namespace SparcISA
{
void
-TlbEntry::serialize(std::ostream &os)
+TlbEntry::serialize(CheckpointOut &cp) const
{
SERIALIZE_SCALAR(range.va);
SERIALIZE_SCALAR(range.size);
@@ -52,7 +52,7 @@ TlbEntry::serialize(std::ostream &os)
void
-TlbEntry::unserialize(Checkpoint *cp, const std::string &section)
+TlbEntry::unserialize(CheckpointIn &cp)
{
UNSERIALIZE_SCALAR(range.va);
UNSERIALIZE_SCALAR(range.size);
diff --git a/src/arch/sparc/pagetable.hh b/src/arch/sparc/pagetable.hh
index 727727f95..79b4d3cc5 100644
--- a/src/arch/sparc/pagetable.hh
+++ b/src/arch/sparc/pagetable.hh
@@ -277,8 +277,8 @@ struct TlbEntry
range.va = new_vaddr;
}
- void serialize(std::ostream &os);
- void unserialize(Checkpoint *cp, const std::string &section);
+ void serialize(CheckpointOut &cp) const;
+ void unserialize(CheckpointIn &cp);
};
} // namespace SparcISA
diff --git a/src/arch/sparc/system.cc b/src/arch/sparc/system.cc
index 0b36df9ca..b6fa645ce 100644
--- a/src/arch/sparc/system.cc
+++ b/src/arch/sparc/system.cc
@@ -177,26 +177,26 @@ SparcSystem::~SparcSystem()
}
void
-SparcSystem::serializeSymtab(std::ostream &os)
+SparcSystem::serializeSymtab(CheckpointOut &cp) const
{
- resetSymtab->serialize("reset_symtab", os);
- hypervisorSymtab->serialize("hypervisor_symtab", os);
- openbootSymtab->serialize("openboot_symtab", os);
- nvramSymtab->serialize("nvram_symtab", os);
- hypervisorDescSymtab->serialize("hypervisor_desc_symtab", os);
- partitionDescSymtab->serialize("partition_desc_symtab", os);
+ resetSymtab->serialize("reset_symtab", cp);
+ hypervisorSymtab->serialize("hypervisor_symtab", cp);
+ openbootSymtab->serialize("openboot_symtab", cp);
+ nvramSymtab->serialize("nvram_symtab", cp);
+ hypervisorDescSymtab->serialize("hypervisor_desc_symtab", cp);
+ partitionDescSymtab->serialize("partition_desc_symtab", cp);
}
void
-SparcSystem::unserializeSymtab(Checkpoint *cp, const std::string &section)
+SparcSystem::unserializeSymtab(CheckpointIn &cp)
{
- resetSymtab->unserialize("reset_symtab", cp, section);
- hypervisorSymtab->unserialize("hypervisor_symtab", cp, section);
- openbootSymtab->unserialize("openboot_symtab", cp, section);
- nvramSymtab->unserialize("nvram_symtab", cp, section);
- hypervisorDescSymtab->unserialize("hypervisor_desc_symtab", cp, section);
- partitionDescSymtab->unserialize("partition_desc_symtab", cp, section);
+ resetSymtab->unserialize("reset_symtab", cp);
+ hypervisorSymtab->unserialize("hypervisor_symtab", cp);
+ openbootSymtab->unserialize("openboot_symtab", cp);
+ nvramSymtab->unserialize("nvram_symtab", cp);
+ hypervisorDescSymtab->unserialize("hypervisor_desc_symtab", cp);
+ partitionDescSymtab->unserialize("partition_desc_symtab", cp);
}
SparcSystem *
diff --git a/src/arch/sparc/system.hh b/src/arch/sparc/system.hh
index a4bd64aa5..68688cc1f 100644
--- a/src/arch/sparc/system.hh
+++ b/src/arch/sparc/system.hh
@@ -54,8 +54,8 @@ class SparcSystem : public System
* Serialization stuff
*/
public:
- virtual void serializeSymtab(std::ostream &os);
- virtual void unserializeSymtab(Checkpoint *cp, const std::string &section);
+ void serializeSymtab(CheckpointOut &cp) const M5_ATTR_OVERRIDE;
+ void unserializeSymtab(CheckpointIn &cp) M5_ATTR_OVERRIDE;
/** reset binary symbol table */
SymbolTable *resetSymtab;
diff --git a/src/arch/sparc/tlb.cc b/src/arch/sparc/tlb.cc
index 84d748dd3..c0c28f952 100644
--- a/src/arch/sparc/tlb.cc
+++ b/src/arch/sparc/tlb.cc
@@ -1353,23 +1353,18 @@ TLB::MakeTsbPtr(TsbPageSize ps, uint64_t tag_access, uint64_t c0_tsb,
}
void
-TLB::serialize(std::ostream &os)
+TLB::serialize(CheckpointOut &cp) const
{
SERIALIZE_SCALAR(size);
SERIALIZE_SCALAR(usedEntries);
SERIALIZE_SCALAR(lastReplaced);
// convert the pointer based free list into an index based one
- int *free_list = (int*)malloc(sizeof(int) * size);
- int cntr = 0;
- std::list<TlbEntry*>::iterator i;
- i = freeList.begin();
- while (i != freeList.end()) {
- free_list[cntr++] = ((size_t)*i - (size_t)tlb)/ sizeof(TlbEntry);
- i++;
- }
- SERIALIZE_SCALAR(cntr);
- SERIALIZE_ARRAY(free_list, cntr);
+ std::vector<int> free_list;
+ for (const TlbEntry *entry : freeList)
+ free_list.push_back(entry - tlb);
+
+ SERIALIZE_CONTAINER(free_list);
SERIALIZE_SCALAR(c0_tsb_ps0);
SERIALIZE_SCALAR(c0_tsb_ps1);
@@ -1381,31 +1376,28 @@ TLB::serialize(std::ostream &os)
SERIALIZE_SCALAR(tag_access);
for (int x = 0; x < size; x++) {
- nameOut(os, csprintf("%s.PTE%d", name(), x));
- tlb[x].serialize(os);
+ ScopedCheckpointSection sec(cp, csprintf("PTE%d", x));
+ tlb[x].serialize(cp);
}
SERIALIZE_SCALAR(sfar);
}
void
-TLB::unserialize(Checkpoint *cp, const std::string &section)
+TLB::unserialize(CheckpointIn &cp)
{
int oldSize;
- paramIn(cp, section, "size", oldSize);
+ paramIn(cp, "size", oldSize);
if (oldSize != size)
panic("Don't support unserializing different sized TLBs\n");
UNSERIALIZE_SCALAR(usedEntries);
UNSERIALIZE_SCALAR(lastReplaced);
- int cntr;
- UNSERIALIZE_SCALAR(cntr);
-
- int *free_list = (int*)malloc(sizeof(int) * cntr);
+ std::vector<int> free_list;
+ UNSERIALIZE_CONTAINER(free_list);
freeList.clear();
- UNSERIALIZE_ARRAY(free_list, cntr);
- for (int x = 0; x < cntr; x++)
- freeList.push_back(&tlb[free_list[x]]);
+ for (int idx : free_list)
+ freeList.push_back(&tlb[idx]);
UNSERIALIZE_SCALAR(c0_tsb_ps0);
UNSERIALIZE_SCALAR(c0_tsb_ps1);
@@ -1418,7 +1410,8 @@ TLB::unserialize(Checkpoint *cp, const std::string &section)
lookupTable.clear();
for (int x = 0; x < size; x++) {
- tlb[x].unserialize(cp, csprintf("%s.PTE%d", section, x));
+ ScopedCheckpointSection sec(cp, csprintf("PTE%d", x));
+ tlb[x].unserialize(cp);
if (tlb[x].valid)
lookupTable.insert(tlb[x].range, &tlb[x]);
diff --git a/src/arch/sparc/tlb.hh b/src/arch/sparc/tlb.hh
index 1d229fba7..e64d3f1b4 100644
--- a/src/arch/sparc/tlb.hh
+++ b/src/arch/sparc/tlb.hh
@@ -176,8 +176,8 @@ class TLB : public BaseTLB
void GetTsbPtr(ThreadContext *tc, Addr addr, int ctx, Addr *ptrs);
// Checkpointing
- virtual void serialize(std::ostream &os);
- virtual void unserialize(Checkpoint *cp, const std::string &section);
+ void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE;
+ void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE;
/** Give an entry id, read that tlb entries' tte */
uint64_t TteRead(int entry);