diff options
author | Scott Johnson <scott.johnson@arilinc.com> | 2021-11-02 19:16:58 -0700 |
---|---|---|
committer | Scott Johnson <scott.johnson@arilinc.com> | 2021-11-04 11:44:12 -0700 |
commit | f862f8c9f2d283b39d0141b798dcb9f96dca5129 (patch) | |
tree | 0c25399b69b5afe0cb622f10d4f29098c8ea77ce | |
parent | c8f11f3eae37833607d7d2635a30275f30cd5f78 (diff) | |
download | spike-f862f8c9f2d283b39d0141b798dcb9f96dca5129.zip spike-f862f8c9f2d283b39d0141b798dcb9f96dca5129.tar.gz spike-f862f8c9f2d283b39d0141b798dcb9f96dca5129.tar.bz2 |
Add gva field to trap_breakpoint
So I can fix breakpoints next to properly report gva.
-rw-r--r-- | riscv/execute.cc | 2 | ||||
-rw-r--r-- | riscv/insns/c_ebreak.h | 2 | ||||
-rw-r--r-- | riscv/insns/ebreak.h | 2 | ||||
-rw-r--r-- | riscv/trap.h | 8 |
4 files changed, 10 insertions, 4 deletions
diff --git a/riscv/execute.cc b/riscv/execute.cc index 21a9428..467a2b4 100644 --- a/riscv/execute.cc +++ b/riscv/execute.cc @@ -329,7 +329,7 @@ void processor_t::step(size_t n) enter_debug_mode(DCSR_CAUSE_HWBP); break; case ACTION_DEBUG_EXCEPTION: { - trap_breakpoint trap(t.address); + trap_breakpoint trap(/*gva*/false, t.address); take_trap(trap, pc); break; } diff --git a/riscv/insns/c_ebreak.h b/riscv/insns/c_ebreak.h index 128b86b..216e04b 100644 --- a/riscv/insns/c_ebreak.h +++ b/riscv/insns/c_ebreak.h @@ -1,2 +1,2 @@ require_extension('C'); -throw trap_breakpoint(pc); +throw trap_breakpoint(/*gva*/false, pc); diff --git a/riscv/insns/ebreak.h b/riscv/insns/ebreak.h index 736cebe..dda89d4 100644 --- a/riscv/insns/ebreak.h +++ b/riscv/insns/ebreak.h @@ -1 +1 @@ -throw trap_breakpoint(pc); +throw trap_breakpoint(/*gva*/false, pc); diff --git a/riscv/trap.h b/riscv/trap.h index 4434013..5ae7806 100644 --- a/riscv/trap.h +++ b/riscv/trap.h @@ -68,6 +68,12 @@ class mem_trap_t : public trap_t const char* name() { return "trap_"#x; } \ }; +#define DECLARE_INST_WITH_GVA_TRAP(n, x) class trap_##x : public insn_trap_t { \ + public: \ + trap_##x(bool gva, reg_t tval) : insn_trap_t(n, gva, tval) {} \ + const char* name() { return "trap_"#x; } \ +}; + #define DECLARE_MEM_TRAP(n, x) class trap_##x : public mem_trap_t { \ public: \ trap_##x(bool gva, reg_t tval, reg_t tval2, reg_t tinst) : mem_trap_t(n, gva, tval, tval2, tinst) {} \ @@ -83,7 +89,7 @@ class mem_trap_t : public trap_t DECLARE_MEM_TRAP(CAUSE_MISALIGNED_FETCH, instruction_address_misaligned) DECLARE_MEM_TRAP(CAUSE_FETCH_ACCESS, instruction_access_fault) DECLARE_INST_TRAP(CAUSE_ILLEGAL_INSTRUCTION, illegal_instruction) -DECLARE_INST_TRAP(CAUSE_BREAKPOINT, breakpoint) +DECLARE_INST_WITH_GVA_TRAP(CAUSE_BREAKPOINT, breakpoint) DECLARE_MEM_TRAP(CAUSE_MISALIGNED_LOAD, load_address_misaligned) DECLARE_MEM_TRAP(CAUSE_MISALIGNED_STORE, store_address_misaligned) DECLARE_MEM_TRAP(CAUSE_LOAD_ACCESS, load_access_fault) |