mirror of
https://github.com/dingusdev/dingusppc.git
synced 2024-12-23 06:29:38 +00:00
Profiler + Missing Instruction Added
This commit is contained in:
parent
3650b655d7
commit
6dd8d55577
@ -205,7 +205,7 @@ extern uint32_t ppc_real_address;
|
||||
extern uint32_t ppc_next_instruction_address;
|
||||
|
||||
//Profiling Stats
|
||||
extern uint32_t mmu_operations_num;
|
||||
extern uint32_t mmu_translations_num;
|
||||
extern uint32_t exceptions_performed;
|
||||
extern uint32_t supervisor_inst_num;
|
||||
|
||||
|
@ -9,6 +9,9 @@ jmp_buf exc_env; /* Global exception environment. */
|
||||
uint32_t srr1_bits)
|
||||
{
|
||||
grab_exception = true;
|
||||
#ifdef PROFILER
|
||||
exceptions_performed++;
|
||||
#endif
|
||||
bb_kind = BB_end_kind::BB_EXCEPTION;
|
||||
|
||||
switch(exception_type) {
|
||||
|
@ -102,6 +102,7 @@ static std::unordered_map<uint16_t, PPCOpcode> SubOpcode31Grabber = {
|
||||
{1070, &ppc_lfsx}, {1072, &ppc_srw}, {1073, &ppc_srwdot},
|
||||
{1074, &power_rrib}, {1075, &power_rribdot}, {1082, &power_maskir},
|
||||
{1083, &power_maskirdot}, {1104, &ppc_subfo}, {1105, &ppc_subfodot},
|
||||
{1105, &ppc_tlbsync},
|
||||
{1134, &ppc_lfsux}, {1190, &ppc_mfsr}, {1194, &ppc_lswi},
|
||||
{1196, &ppc_sync}, {1232, &ppc_nego}, {1233, &ppc_negodot},
|
||||
{1238, &power_mulo}, {1239, &power_mulodot}, {1300, &ppc_addeo},
|
||||
|
@ -312,6 +312,10 @@ static uint32_t ppc_mmu_instr_translate(uint32_t la)
|
||||
/** PowerPC-style MMU data address translation. */
|
||||
static uint32_t ppc_mmu_addr_translate(uint32_t la, int is_write)
|
||||
{
|
||||
#if PROFILER
|
||||
mmu_translations_num++;
|
||||
#endif
|
||||
|
||||
uint32_t pa; /* translated physical address */
|
||||
|
||||
bool bat_hit = false;
|
||||
|
@ -1241,6 +1241,9 @@ void ppc_mfcr(){
|
||||
}
|
||||
|
||||
void ppc_mtsr(){
|
||||
#ifdef PROFILER
|
||||
supervisor_inst_num++;
|
||||
#endif
|
||||
if ((ppc_state.ppc_msr & 0x4000) == 0){
|
||||
reg_s = (ppc_cur_instruction >> 21) & 31;
|
||||
grab_sr = (ppc_cur_instruction >> 16) & 15;
|
||||
@ -1249,6 +1252,9 @@ void ppc_mtsr(){
|
||||
}
|
||||
|
||||
void ppc_mtsrin(){
|
||||
#ifdef PROFILER
|
||||
supervisor_inst_num++;
|
||||
#endif
|
||||
if ((ppc_state.ppc_msr & 0x4000) == 0){
|
||||
ppc_grab_regssb();
|
||||
grab_sr = ppc_result_b >> 28;
|
||||
@ -1257,6 +1263,9 @@ void ppc_mtsrin(){
|
||||
}
|
||||
|
||||
void ppc_mfsr(){
|
||||
#ifdef PROFILER
|
||||
supervisor_inst_num++;
|
||||
#endif
|
||||
if ((ppc_state.ppc_msr & 0x4000) == 0){
|
||||
reg_d = (ppc_cur_instruction >> 21) & 31;
|
||||
grab_sr = (ppc_cur_instruction >> 16) & 15;
|
||||
@ -1265,6 +1274,9 @@ void ppc_mfsr(){
|
||||
}
|
||||
|
||||
void ppc_mfsrin(){
|
||||
#ifdef PROFILER
|
||||
supervisor_inst_num++;
|
||||
#endif
|
||||
if ((ppc_state.ppc_msr & 0x4000) == 0){
|
||||
ppc_grab_regssb();
|
||||
grab_sr = ppc_result_b >> 28;
|
||||
@ -1273,6 +1285,9 @@ void ppc_mfsrin(){
|
||||
}
|
||||
|
||||
void ppc_mfmsr(){
|
||||
#ifdef PROFILER
|
||||
supervisor_inst_num++;
|
||||
#endif
|
||||
if (ppc_state.ppc_msr & 0x4000) {
|
||||
ppc_exception_handler(Except_Type::EXC_PROGRAM, 0x00040000);
|
||||
}
|
||||
@ -1281,6 +1296,9 @@ void ppc_mfmsr(){
|
||||
}
|
||||
|
||||
void ppc_mtmsr(){
|
||||
#ifdef PROFILER
|
||||
supervisor_inst_num++;
|
||||
#endif
|
||||
if (ppc_state.ppc_msr & 0x4000) {
|
||||
ppc_exception_handler(Except_Type::EXC_PROGRAM, 0x00040000);
|
||||
}
|
||||
@ -1290,6 +1308,12 @@ void ppc_mtmsr(){
|
||||
|
||||
void ppc_mfspr(){
|
||||
uint32_t ref_spr = (((ppc_cur_instruction >> 11) & 31) << 5) | ((ppc_cur_instruction >> 16) & 31);
|
||||
|
||||
#ifdef PROFILER
|
||||
if (ref_spr > 31) {
|
||||
supervisor_inst_num++;
|
||||
}
|
||||
#endif
|
||||
reg_d = (ppc_cur_instruction >> 21) & 31;
|
||||
ppc_state.ppc_gpr[reg_d] = ppc_state.ppc_spr[ref_spr];
|
||||
}
|
||||
@ -1298,6 +1322,12 @@ void ppc_mtspr(){
|
||||
uint32_t ref_spr = (((ppc_cur_instruction >> 11) & 31) << 5) | ((ppc_cur_instruction >> 16) & 31);
|
||||
reg_s = (ppc_cur_instruction >> 21) & 31;
|
||||
|
||||
#ifdef PROFILER
|
||||
if (ref_spr > 31) {
|
||||
supervisor_inst_num++;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (ref_spr != 287){
|
||||
ppc_state.ppc_spr[ref_spr] = ppc_state.ppc_gpr[reg_s];
|
||||
}
|
||||
@ -1734,6 +1764,9 @@ void ppc_crxor(){
|
||||
//Processor MGMT Fns.
|
||||
|
||||
void ppc_rfi(){
|
||||
#ifdef PROFILER
|
||||
supervisor_inst_num++;
|
||||
#endif
|
||||
uint32_t new_srr1_val = (ppc_state.ppc_spr[27] & 0x87C0FF73UL);
|
||||
uint32_t new_msr_val = (ppc_state.ppc_msr & ~(0x87C0FF73UL));
|
||||
ppc_state.ppc_msr = (new_msr_val | new_srr1_val) & 0xFFFBFFFFUL;
|
||||
@ -1794,6 +1827,9 @@ void ppc_dcbf(){
|
||||
}
|
||||
|
||||
void ppc_dcbi(){
|
||||
#ifdef PROFILER
|
||||
supervisor_inst_num++;
|
||||
#endif
|
||||
std::cout << "Oops. Placeholder for dcbi." << std::endl;
|
||||
}
|
||||
|
||||
@ -2415,6 +2451,9 @@ void ppc_stswx(){
|
||||
//TLB Instructions
|
||||
|
||||
void ppc_tlbie(){
|
||||
#ifdef PROFILER
|
||||
supervisor_inst_num++;
|
||||
#endif
|
||||
/**
|
||||
reg_b = (ppc_cur_instruction >> 11) & 31;
|
||||
uint32_t vps = ppc_state.ppc_gpr[reg_b] & 0xFFFF000;
|
||||
@ -2423,13 +2462,29 @@ void ppc_tlbie(){
|
||||
}
|
||||
|
||||
void ppc_tlbia(){
|
||||
#ifdef PROFILER
|
||||
supervisor_inst_num++;
|
||||
#endif
|
||||
printf("Placeholder for tlbia \n");
|
||||
}
|
||||
|
||||
void ppc_tlbld(){
|
||||
#ifdef PROFILER
|
||||
supervisor_inst_num++;
|
||||
#endif
|
||||
printf("Placeholder for tlbld - 603 only \n");
|
||||
}
|
||||
|
||||
void ppc_tlbli(){
|
||||
#ifdef PROFILER
|
||||
supervisor_inst_num++;
|
||||
#endif
|
||||
printf("Placeholder for tlbli - 603 only \n");
|
||||
}
|
||||
|
||||
void ppc_tlbsync() {
|
||||
#ifdef PROFILER
|
||||
supervisor_inst_num++;
|
||||
#endif
|
||||
printf("Placeholder for tlbsync \n");
|
||||
}
|
@ -24,6 +24,9 @@ void show_help()
|
||||
cout << " until X -- execute until address X is reached" << endl;
|
||||
cout << " regs -- dump content of the GRPs" << 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
|
||||
cout << " disas X,n -- disassemble N instructions starting at address X" << endl;
|
||||
cout << " quit -- quit the debugger" << endl << endl;
|
||||
cout << "Pressing ENTER will repeat last command." << endl;
|
||||
@ -79,10 +82,16 @@ void enter_debugger()
|
||||
show_help();
|
||||
} else if (cmd == "quit") {
|
||||
break;
|
||||
}
|
||||
else if (cmd == "memdump") {
|
||||
} else if (cmd == "memdump") {
|
||||
dump_mem_file();
|
||||
}
|
||||
#ifdef PROFILER
|
||||
else if (cmd == "profiler") {
|
||||
cout << "Number of Supervisor Instructions Executed:" << supervisor_inst_num << endl;
|
||||
cout << "Exception Handler Ran:" << exceptions_performed << endl;
|
||||
cout << "Number of MMU Translations:" << mmu_translations_num << endl;
|
||||
}
|
||||
#endif
|
||||
else if (cmd == "regs") {
|
||||
dump_regs();
|
||||
} else if (cmd == "step") {
|
||||
|
Loading…
Reference in New Issue
Block a user