Merging in odd commits

This commit is contained in:
Maxim Poliakovski
2020-01-22 12:28:42 +01:00
committed by dingusdev
parent b16427e810
commit 99559c1e0c
3 changed files with 236 additions and 287 deletions
+35 -16
View File
@@ -25,6 +25,7 @@ void show_help()
cout << " until X -- execute until address X is reached" << endl;
cout << " regs -- dump content of the GRPs" << endl;
cout << " set R=X -- assign value X to register R" << endl;
cout << " memdump -- dump content of the system memory to memdump.bin" << endl;
#ifdef PROFILER
cout << " profiler -- show stats related to the processor" << endl;
#endif
@@ -38,12 +39,20 @@ void dump_regs()
for (uint32_t i = 0; i < 32; i++)
cout << "GPR " << dec << i << " : " << hex << ppc_state.ppc_gpr[i] << endl;
cout << "PC: " << hex << ppc_state.ppc_pc << endl;
cout << "LR: " << hex << ppc_state.ppc_spr[SPR::LR] << endl;
cout << "CR: " << hex << ppc_state.ppc_cr << endl;
cout << "CTR: " << hex << ppc_state.ppc_spr[SPR::CTR] << endl;
cout << "XER: " << hex << ppc_state.ppc_spr[SPR::XER] << endl;
cout << "MSR: " << hex << ppc_state.ppc_msr << endl;
cout << "PC: " << hex << ppc_state.ppc_pc << endl;
cout << "LR: " << hex << ppc_state.ppc_spr[8] << endl;
cout << "CR: " << hex << ppc_state.ppc_cr << endl;
cout << "CTR: " << hex << ppc_state.ppc_spr[9] << endl;
cout << "XER: " << hex << ppc_state.ppc_spr[1] << endl;
cout << "MSR: " << hex << ppc_state.ppc_msr << endl;
}
void dump_mem_file()
{
std::ofstream memdumpfile;
memdumpfile.open("memdump.bin", std::ofstream::out | std::ofstream::binary);
memdumpfile.write((char*)&machine_sysram_mem, sizeof(char) * 67108864);
memdumpfile.close();
}
void disasm()
@@ -85,9 +94,13 @@ void enter_debugger()
}
if (cmd == "help") {
show_help();
} else if (cmd == "quit") {
}
else if (cmd == "quit") {
break;
}
else if (cmd == "memdump") {
dump_mem_file();
}
#ifdef PROFILER
else if (cmd == "profiler") {
cout << "Number of Supervisor Instructions Executed:" << supervisor_inst_num << endl;
@@ -97,28 +110,34 @@ void enter_debugger()
#endif
else if (cmd == "regs") {
dump_regs();
} else if (cmd == "set") {
}
else if (cmd == "set") {
ss >> expr_str;
reg_expr = expr_str.substr(0, expr_str.find("="));
if (reg_expr == "pc") {
addr_str = expr_str.substr(expr_str.find("=") + 1);
addr = stoul(addr_str, NULL, 0);
addr = stol(addr_str, NULL, 0);
ppc_state.ppc_pc = addr;
} else {
}
else {
cout << "Unknown register " << reg_expr << endl;
}
} else if (cmd == "step") {
}
else if (cmd == "step") {
ppc_exec_single();
} else if (cmd == "until") {
}
else if (cmd == "until") {
ss >> addr_str;
addr = stoul(addr_str, NULL, 16);
addr = stol(addr_str, NULL, 16);
ppc_exec_until(addr);
} else if (cmd == "disas") {
}
else if (cmd == "disas") {
disasm();
} else {
}
else {
cout << "Unknown command: " << cmd << endl;
continue;
}
last_cmd = cmd;
}
}
}