misc: Serialize the ISA as a string in the checkpoint
With the introduction of multi-ISA gem5, we don't store the TARGET_ISA anymore as a string in the root section of the checkpoint [1]. There is therefore no way at the moment to asses the ISA of a CPU/ThreadContext. This is a problem when it comes to checkpoint updates which are ISA specific. By explicitly serializing the ISA as a string under the cpu.isa section we avoid this problem and we let cpt_upgraders be aware of the ISA in use. [1]: https://gem5-review.googlesource.com/c/public/gem5/+/48884 Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com> Change-Id: I1e75230cbc370cab84f4a54141b1e425af2dbfac Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
This commit is contained in:
@@ -80,7 +80,7 @@ RegClass floatRegClass(FloatRegClass, FloatRegClassName, 0, debug::FloatRegs);
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
ISA::ISA(const Params &p) : BaseISA(p), system(NULL),
|
||||
ISA::ISA(const Params &p) : BaseISA(p, "arm"), system(NULL),
|
||||
_decoderFlavor(p.decoderFlavor), pmu(p.pmu), impdefAsNop(p.impdef_nop)
|
||||
{
|
||||
_regClasses.push_back(&flatIntRegClass);
|
||||
@@ -1541,6 +1541,8 @@ ISA::getCurSmeVecLenInBits() const
|
||||
void
|
||||
ISA::serialize(CheckpointOut &cp) const
|
||||
{
|
||||
BaseISA::serialize(cp);
|
||||
|
||||
DPRINTF(Checkpoint, "Serializing Arm Misc Registers\n");
|
||||
SERIALIZE_MAPPING(miscRegs, miscRegName, NUM_PHYS_MISCREGS);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020 ARM Limited
|
||||
* Copyright (c) 2020, 2024 Arm Limited
|
||||
* All rights reserved
|
||||
*
|
||||
* The license below extends only to copyright in the software and shall
|
||||
@@ -61,12 +61,16 @@ class BaseISA : public SimObject
|
||||
typedef std::vector<const RegClass *> RegClasses;
|
||||
|
||||
protected:
|
||||
using SimObject::SimObject;
|
||||
BaseISA(const SimObjectParams &p, const std::string &name)
|
||||
: SimObject(p), isaName(name)
|
||||
{}
|
||||
|
||||
ThreadContext *tc = nullptr;
|
||||
|
||||
RegClasses _regClasses;
|
||||
|
||||
std::string isaName;
|
||||
|
||||
public:
|
||||
virtual PCStateBase *newPCState(Addr new_inst_addr=0) const = 0;
|
||||
virtual void clear() {}
|
||||
@@ -126,6 +130,12 @@ class BaseISA : public SimObject
|
||||
{
|
||||
globalClearExclusive();
|
||||
}
|
||||
|
||||
void
|
||||
serialize(CheckpointOut &cp) const override
|
||||
{
|
||||
SERIALIZE_SCALAR(isaName);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace gem5
|
||||
|
||||
@@ -110,7 +110,7 @@ constexpr RegClass ccRegClass(CCRegClass, CCRegClassName, 0, debug::IntRegs);
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
ISA::ISA(const Params &p) : BaseISA(p), numThreads(p.num_threads),
|
||||
ISA::ISA(const Params &p) : BaseISA(p, "mips"), numThreads(p.num_threads),
|
||||
numVpes(p.num_vpes)
|
||||
{
|
||||
_regClasses.push_back(&intRegClass);
|
||||
|
||||
@@ -62,7 +62,7 @@ RegClass ccRegClass(CCRegClass, CCRegClassName, 0, debug::IntRegs);
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
ISA::ISA(const Params &p) : BaseISA(p)
|
||||
ISA::ISA(const Params &p) : BaseISA(p, "power")
|
||||
{
|
||||
_regClasses.push_back(&intRegClass);
|
||||
_regClasses.push_back(&floatRegClass);
|
||||
|
||||
@@ -256,7 +256,7 @@ RegClass ccRegClass(CCRegClass, CCRegClassName, 0, debug::IntRegs);
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
ISA::ISA(const Params &p) : BaseISA(p),
|
||||
ISA::ISA(const Params &p) : BaseISA(p, "riscv"),
|
||||
_rvType(p.riscv_type), checkAlignment(p.check_alignment),
|
||||
enableRvv(p.enable_rvv), vlen(p.vlen), elen(p.elen),
|
||||
_privilegeModeSet(p.privilege_mode_set)
|
||||
@@ -792,6 +792,8 @@ ISA::setMiscReg(RegIndex idx, RegVal val)
|
||||
void
|
||||
ISA::serialize(CheckpointOut &cp) const
|
||||
{
|
||||
BaseISA::serialize(cp);
|
||||
|
||||
DPRINTF(Checkpoint, "Serializing Riscv Misc Registers\n");
|
||||
SERIALIZE_CONTAINER(miscRegFile);
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ RegClass ccRegClass(CCRegClass, CCRegClassName, 0, debug::IntRegs);
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
ISA::ISA(const Params &p) : BaseISA(p)
|
||||
ISA::ISA(const Params &p) : BaseISA(p, "sparc")
|
||||
{
|
||||
_regClasses.push_back(&flatIntRegClass);
|
||||
_regClasses.push_back(&floatRegClass);
|
||||
@@ -844,6 +844,8 @@ ISA::setMiscReg(RegIndex idx, RegVal val)
|
||||
void
|
||||
ISA::serialize(CheckpointOut &cp) const
|
||||
{
|
||||
BaseISA::serialize(cp);
|
||||
|
||||
SERIALIZE_SCALAR(asi);
|
||||
SERIALIZE_SCALAR(tick);
|
||||
SERIALIZE_SCALAR(fprs);
|
||||
|
||||
@@ -152,7 +152,7 @@ RegClass matRegClass(MatRegClass, MatRegClassName, 0, debug::MatRegs);
|
||||
} // anonymous namespace
|
||||
|
||||
ISA::ISA(const X86ISAParams &p)
|
||||
: BaseISA(p), cpuid(new X86CPUID(p.vendor_string, p.name_string))
|
||||
: BaseISA(p, "x86"), cpuid(new X86CPUID(p.vendor_string, p.name_string))
|
||||
{
|
||||
cpuid->addStandardFunc(FamilyModelStepping, p.FamilyModelStepping);
|
||||
cpuid->addStandardFunc(CacheParams, p.CacheParams);
|
||||
@@ -491,6 +491,8 @@ ISA::setMiscReg(RegIndex idx, RegVal val)
|
||||
void
|
||||
ISA::serialize(CheckpointOut &cp) const
|
||||
{
|
||||
BaseISA::serialize(cp);
|
||||
|
||||
SERIALIZE_ARRAY(regVal, misc_reg::NumRegs);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user