summaryrefslogtreecommitdiff
path: root/psp
diff options
context:
space:
mode:
authorDavid Guillen Fandos2021-04-03 00:37:42 +0200
committerDavid Guillen Fandos2021-04-03 00:37:42 +0200
commit5b5a4db6c2963ba72a3adcace6ec055ac65f2f3d (patch)
treedb7cd4db7d0c146a382e997f9f704a1983446e28 /psp
parent8c14ac96192f6d966ac0ad252003a8dd3c61667a (diff)
downloadpicogpsp-5b5a4db6c2963ba72a3adcace6ec055ac65f2f3d.tar.gz
picogpsp-5b5a4db6c2963ba72a3adcace6ec055ac65f2f3d.tar.bz2
picogpsp-5b5a4db6c2963ba72a3adcace6ec055ac65f2f3d.zip
Add instruction tracing, for testing purposes
Diffstat (limited to 'psp')
-rw-r--r--psp/mips_emit.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/psp/mips_emit.h b/psp/mips_emit.h
index 818b724..a435e63 100644
--- a/psp/mips_emit.h
+++ b/psp/mips_emit.h
@@ -2422,6 +2422,24 @@ u32 execute_store_cpsr_body(u32 _cpsr, u32 store_mask, u32 address)
generate_indirect_branch_cycle_update(dual); \
} \
+#ifdef TRACE_INSTRUCTIONS
+ void trace_instruction(u32 pc)
+ {
+ printf("Executed %x\n", pc);
+ }
+
+ #define emit_trace_instruction(pc) \
+ emit_save_regs(false); \
+ generate_load_imm(reg_a0, pc); \
+ genccall(&trace_instruction); \
+ emit_restore_regs(false)
+ #define emit_trace_thumb_instruction(pc) emit_trace_instruction(pc)
+ #define emit_trace_arm_instruction(pc) emit_trace_instruction(pc)
+#else
+ #define emit_trace_thumb_instruction(pc)
+ #define emit_trace_arm_instruction(pc)
+#endif
+
#define thumb_swi() \
generate_swi_hle_handler(opcode & 0xFF); \
generate_load_pc(reg_a0, (pc + 2)); \