aboutsummaryrefslogtreecommitdiff
path: root/riscv/trap.cc
diff options
context:
space:
mode:
Diffstat (limited to 'riscv/trap.cc')
-rw-r--r--riscv/trap.cc17
1 files changed, 10 insertions, 7 deletions
diff --git a/riscv/trap.cc b/riscv/trap.cc
index ba0d867..ead3a00 100644
--- a/riscv/trap.cc
+++ b/riscv/trap.cc
@@ -1,12 +1,15 @@
-// See LICENSE for license details.
-
#include "trap.h"
+#include "processor.h"
+#include <cstdio>
-const char* trap_name(trap_t t)
+const char* trap_t::name()
{
- #define DECLARE_TRAP(x) "trap_"#x
- static const char* names[] = { TRAP_LIST };
- #undef DECLARE_TRAP
+ const char* fmt = uint8_t(which) == which ? "trap #%u" : "interrupt #%u";
+ sprintf(_name, fmt, uint8_t(which));
+ return _name;
+}
- return (unsigned)t >= sizeof(names)/sizeof(names[0]) ? "unknown" : names[t];
+void mem_trap_t::side_effects(state_t* state)
+{
+ state->badvaddr = badvaddr;
}