From 022de674b8e25df2bfc6da31c3a3b9b3a9fdcc48 Mon Sep 17 00:00:00 2001 From: BL-GS Date: Fri, 3 Nov 2023 12:26:44 +0800 Subject: [PATCH 1/3] Fix bugs of gpt bin loading --- src/checkpoint/serializer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/checkpoint/serializer.cpp b/src/checkpoint/serializer.cpp index 9f7cefbd7..c65b7ae3a 100644 --- a/src/checkpoint/serializer.cpp +++ b/src/checkpoint/serializer.cpp @@ -75,7 +75,7 @@ void Serializer::serializePMem(uint64_t inst_count) { if (!fp) { xpanic("Cannot open restorer %s\n", restorer); } - uint32_t restorer_size = 0x400; + uint32_t restorer_size = 0xf00; fseek(fp, 0, SEEK_SET); assert(restorer_size == fread(pmem, 1, restorer_size, fp)); fclose(fp); From a52f65a35c6e9feef720bd6b7d6309f0b4168bf2 Mon Sep 17 00:00:00 2001 From: BL-GS Date: Fri, 3 Nov 2023 15:21:56 +0800 Subject: [PATCH 2/3] Avoid meaningless dir name as CptID truncation --- include/checkpoint/path_manager.h | 4 ++-- include/checkpoint/serializer.h | 2 +- src/checkpoint/path_manager.cpp | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/checkpoint/path_manager.h b/include/checkpoint/path_manager.h index cd6447df9..da75b0f7e 100644 --- a/include/checkpoint/path_manager.h +++ b/include/checkpoint/path_manager.h @@ -32,7 +32,7 @@ class PathManager std::string configName; std::string workloadName; - int cptID; + uint64_t cptID; std::string workloadPath; fs::path outputPath; @@ -43,7 +43,7 @@ class PathManager void incCptID(); - int getCptID() const {return cptID;} + uint64_t getCptID() const {return cptID;} std::string getOutputPath() const; diff --git a/include/checkpoint/serializer.h b/include/checkpoint/serializer.h index a9705a4bf..0d87a5c23 100644 --- a/include/checkpoint/serializer.h +++ b/include/checkpoint/serializer.h @@ -48,7 +48,7 @@ class Serializer uint64_t intervalSize{10 * 1000 * 1000}; - int cptID; + uint64_t cptID; std::string weightIndicator; const uint32_t IntRegStartAddr; diff --git a/src/checkpoint/path_manager.cpp b/src/checkpoint/path_manager.cpp index f5571a281..028d9a6bf 100644 --- a/src/checkpoint/path_manager.cpp +++ b/src/checkpoint/path_manager.cpp @@ -51,7 +51,7 @@ void PathManager::init() { // cptID = cpt_id; // } - Log("Cpt id: %i", cptID); + Log("Cpt id: %li", cptID); workloadPath = statsBaseDir + "/" + configName + "/" + workloadName + "/"; @@ -77,7 +77,7 @@ void PathManager::setSimpointProfilingOutputDir() { void PathManager::setCheckpointingOutputDir() { //set checkpoint id - cptID=serializer.next_index(); + cptID = serializer.next_index(); if (checkpoint_state!=NoCheckpoint) { std::string output_path = workloadPath; output_path += to_string(cptID) + "/"; @@ -93,7 +93,7 @@ void PathManager::setCheckpointingOutputDir() { } void PathManager::incCptID() { - cptID=serializer.next_index(); + cptID = serializer.next_index(); } std::string PathManager::getOutputPath() const { From f02f2388d5e1ffdca5e0689988be2c7e483a5097 Mon Sep 17 00:00:00 2001 From: BL-GS Date: Sat, 4 Nov 2023 23:10:23 +0800 Subject: [PATCH 3/3] Raise illegal instruction when execute RDTIME --- src/isa/riscv64/system/priv.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/isa/riscv64/system/priv.c b/src/isa/riscv64/system/priv.c index dcd8d23ed..03de37060 100644 --- a/src/isa/riscv64/system/priv.c +++ b/src/isa/riscv64/system/priv.c @@ -315,8 +315,15 @@ if (is_read(vsie)) { return (mie->val & (hideleg->val & (mideleg->val #endif // CONFIG_FPU_NONE } #ifndef CONFIG_SHARE - else if (is_read(mtime)) { difftest_skip_ref(); return clint_uptime(); } -#endif + else if (is_read(mtime)) { +#ifdef CONFIG_USE_XS_ARCH_CSRS + longjmp_exception(EX_II); +#else // CONFIG_USE_XS_ARCH_CSRS + difftest_skip_ref(); + return clint_uptime(); +#endif // CONFIG_USE_XS_ARCH_CSRS + } +#endif // CONFIG_SHARE #ifndef CONFIG_RVH if (is_read(mip)) { difftest_skip_ref(); } #endif