aboutsummaryrefslogtreecommitdiff
path: root/riscv
diff options
context:
space:
mode:
authorChih-Min Chao <chihmin.chao@sifive.com>2020-03-16 18:48:49 -0700
committerChih-Min Chao <chihmin.chao@sifive.com>2020-03-16 19:56:43 -0700
commit78f99cca7b74f30f89c7c931f41e732a134e0f43 (patch)
treee19dd9108b9bbb84ff6ac485a57e5ea7f4d35bc7 /riscv
parent2f942b6966e7af68a5c49c34405371a9b32d0bf3 (diff)
downloadspike-78f99cca7b74f30f89c7c931f41e732a134e0f43.zip
spike-78f99cca7b74f30f89c7c931f41e732a134e0f43.tar.gz
spike-78f99cca7b74f30f89c7c931f41e732a134e0f43.tar.bz2
commitlog: fix wrong dump when exception occur
1. store_fault_access reorder the log and slow_path code 2. misaligned_access reset the log buffer in the beginning rather at the end of execution to avoid that uncompleted execution status is brought to the next instruction Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
Diffstat (limited to 'riscv')
-rw-r--r--riscv/execute.cc11
-rw-r--r--riscv/mmu.h2
2 files changed, 9 insertions, 4 deletions
diff --git a/riscv/execute.cc b/riscv/execute.cc
index a030555..79bd8c0 100644
--- a/riscv/execute.cc
+++ b/riscv/execute.cc
@@ -4,6 +4,12 @@
#include "mmu.h"
#include <cassert>
+static void commit_log_reset(processor_t* p)
+{
+ p->get_state()->log_reg_write.clear();
+ p->get_state()->log_mem_read.clear();
+ p->get_state()->log_mem_write.clear();
+}
static void commit_log_stash_privilege(processor_t* p)
{
@@ -122,9 +128,6 @@ static void commit_log_print_insn(processor_t* p, reg_t pc, insn_t insn)
commit_log_print_value(std::get<2>(item) << 3, 0, std::get<1>(item));
}
fprintf(stderr, "\n");
- reg.clear();
- load.clear();
- store.clear();
#endif
}
@@ -140,7 +143,9 @@ inline void processor_t::update_histogram(reg_t pc)
// function calls.
static reg_t execute_insn(processor_t* p, reg_t pc, insn_fetch_t fetch)
{
+ commit_log_reset(p);
commit_log_stash_privilege(p);
+
reg_t npc = fetch.func(p, fetch.insn, pc);
if (npc != PC_SERIALIZE_BEFORE) {
if (p->get_log_commits()) {
diff --git a/riscv/mmu.h b/riscv/mmu.h
index f73de59..b84fd4a 100644
--- a/riscv/mmu.h
+++ b/riscv/mmu.h
@@ -155,8 +155,8 @@ public:
} \
else { \
type##_t le_val = to_le(val); \
- if (proc) WRITE_MEM(addr, val, size); \
store_slow_path(addr, sizeof(type##_t), (const uint8_t*)&le_val); \
+ if (proc) WRITE_MEM(addr, val, size); \
} \
}