diff options
author | Chih-Min Chao <chihmin.chao@sifive.com> | 2020-04-29 00:43:44 -0700 |
---|---|---|
committer | Chih-Min Chao <chihmin.chao@sifive.com> | 2020-04-29 10:57:49 -0700 |
commit | 7ce1d973c9214729dbc3dd6ec76e272081f0b98f (patch) | |
tree | a25661e5a4fcb1305809367467fa276d88303815 /riscv/execute.cc | |
parent | 7851d2c525cbf93ca03cd8a16c95f24ef2268d76 (diff) | |
download | spike-7ce1d973c9214729dbc3dd6ec76e272081f0b98f.zip spike-7ce1d973c9214729dbc3dd6ec76e272081f0b98f.tar.gz spike-7ce1d973c9214729dbc3dd6ec76e272081f0b98f.tar.bz2 |
rvv: commitlog: report status when memory trap occurs in vector load/store
Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
Diffstat (limited to 'riscv/execute.cc')
-rw-r--r-- | riscv/execute.cc | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/riscv/execute.cc b/riscv/execute.cc index ec0f479..b4ffc4c 100644 --- a/riscv/execute.cc +++ b/riscv/execute.cc @@ -153,18 +153,37 @@ 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; - reg_t npc = fetch.func(p, fetch.insn, pc); - if (npc != PC_SERIALIZE_BEFORE) { + try { + npc = fetch.func(p, fetch.insn, pc); + if (npc != PC_SERIALIZE_BEFORE) { #ifdef RISCV_ENABLE_COMMITLOG - if (p->get_log_commits_enabled()) { - commit_log_print_insn(p, pc, fetch.insn); - } + if (p->get_log_commits_enabled()) { + commit_log_print_insn(p, pc, fetch.insn); + } #endif - p->update_histogram(pc); + } +#ifdef RISCV_ENABLE_COMMITLOG + } catch(mem_trap_t& t) { + //handle segfault in midlle of vector load/store + if (p->get_log_commits_enabled()) { + for (auto item : p->get_state()->log_reg_write) { + if ((item.first & 3) == 3) { + commit_log_print_insn(p, pc, fetch.insn); + break; + } + } + } + throw; +#endif + } catch(...) { + throw; } + p->update_histogram(pc); + return npc; } |