From 7ce1d973c9214729dbc3dd6ec76e272081f0b98f Mon Sep 17 00:00:00 2001 From: Chih-Min Chao Date: Wed, 29 Apr 2020 00:43:44 -0700 Subject: rvv: commitlog: report status when memory trap occurs in vector load/store Signed-off-by: Chih-Min Chao --- riscv/execute.cc | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) (limited to 'riscv/execute.cc') 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; } -- cgit v1.1