From 3c8dafeef056dec71e731fe097750391fe1dfc25 Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Tue, 7 Mar 2017 01:58:41 -0800 Subject: [PATCH] Don't overload illegal instruction trap in interactive code --- riscv/interactive.cc | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/riscv/interactive.cc b/riscv/interactive.cc index 748f454..623c425 100644 --- a/riscv/interactive.cc +++ b/riscv/interactive.cc @@ -18,12 +18,14 @@ #include #include +DECLARE_TRAP(-1, interactive) + processor_t *sim_t::get_core(const std::string& i) { char *ptr; unsigned long p = strtoul(i.c_str(), &ptr, 10); if (*ptr || p >= num_cores()) - throw trap_illegal_instruction(); + throw trap_interactive(); return get_core(p); } @@ -161,7 +163,7 @@ void sim_t::interactive_quit(const std::string& cmd, const std::vector& args) { if(args.size() != 1) - throw trap_illegal_instruction(); + throw trap_interactive(); processor_t *p = get_core(args[0]); return p->state.pc; @@ -175,7 +177,7 @@ void sim_t::interactive_pc(const std::string& cmd, const std::vector& args) { if(args.size() != 2) - throw trap_illegal_instruction(); + throw trap_interactive(); processor_t *p = get_core(args[0]); @@ -192,7 +194,7 @@ reg_t sim_t::get_reg(const std::vector& args) } if (r >= NXPR) - throw trap_illegal_instruction(); + throw trap_interactive(); return p->state.XPR[r]; } @@ -200,14 +202,14 @@ reg_t sim_t::get_reg(const std::vector& args) reg_t sim_t::get_freg(const std::vector& args) { if(args.size() != 2) - throw trap_illegal_instruction(); + throw trap_interactive(); processor_t *p = get_core(args[0]); int r = std::find(fpr_name, fpr_name + NFPR, args[1]) - fpr_name; if (r == NFPR) r = atoi(args[1].c_str()); if (r >= NFPR) - throw trap_illegal_instruction(); + throw trap_interactive(); return p->state.FPR[r]; } @@ -251,7 +253,7 @@ void sim_t::interactive_fregd(const std::string& cmd, const std::vector& args) { if(args.size() != 1 && args.size() != 2) - throw trap_illegal_instruction(); + throw trap_interactive(); std::string addr_str = args[0]; mmu_t* mmu = debug_mmu; @@ -293,7 +295,7 @@ void sim_t::interactive_mem(const std::string& cmd, const std::vector& args) { if(args.size() != 1) - throw trap_illegal_instruction(); + throw trap_interactive(); reg_t addr = strtol(args[0].c_str(),NULL,16); -- 2.30.2