|
|
|
@ -18,12 +18,14 @@ |
|
|
|
#include <vector> |
|
|
|
#include <algorithm> |
|
|
|
|
|
|
|
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<std::stri |
|
|
|
reg_t sim_t::get_pc(const std::vector<std::string>& 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<std::string |
|
|
|
reg_t sim_t::get_reg(const std::vector<std::string>& 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<std::string>& 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<std::string>& args) |
|
|
|
reg_t sim_t::get_freg(const std::vector<std::string>& 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<std::str |
|
|
|
reg_t sim_t::get_mem(const std::vector<std::string>& 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<std::strin |
|
|
|
void sim_t::interactive_str(const std::string& cmd, const std::vector<std::string>& args) |
|
|
|
{ |
|
|
|
if(args.size() != 1) |
|
|
|
throw trap_illegal_instruction(); |
|
|
|
throw trap_interactive(); |
|
|
|
|
|
|
|
reg_t addr = strtol(args[0].c_str(),NULL,16); |
|
|
|
|
|
|
|
|