summaryrefslogtreecommitdiff
path: root/x86
diff options
context:
space:
mode:
authorneonloop2021-05-05 17:12:36 +0000
committerneonloop2021-05-05 17:12:59 +0000
commit997d3f2183eb9e99a3a1578a0060cb2fcd2165a2 (patch)
tree5b2afae111495c75ddf5c2b8fd8e6699da50117e /x86
parent3aa34f7503bbb03e9bcd191f8af4fd5faac66d2e (diff)
parent52088a4d10af9a8c0e95b0eb168d4dfd0a13639f (diff)
downloadpicogpsp-997d3f2183eb9e99a3a1578a0060cb2fcd2165a2.tar.gz
picogpsp-997d3f2183eb9e99a3a1578a0060cb2fcd2165a2.tar.bz2
picogpsp-997d3f2183eb9e99a3a1578a0060cb2fcd2165a2.zip
Merge remote-tracking branch 'libretro/master' into pico-fe
Diffstat (limited to 'x86')
-rw-r--r--x86/x86_emit.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/x86/x86_emit.h b/x86/x86_emit.h
index 68930e1..ef79110 100644
--- a/x86/x86_emit.h
+++ b/x86/x86_emit.h
@@ -96,6 +96,7 @@ typedef enum
x86_opcode_push_reg = 0x50,
x86_opcode_push_rm = 0xFF,
x86_opcode_push_imm = 0x0668,
+ x86_opcode_pop_reg = 0x58,
x86_opcode_call_offset = 0xE8,
x86_opcode_ret = 0xC3,
x86_opcode_test_rm_imm = 0x00F7,
@@ -266,6 +267,12 @@ typedef enum
#define x86_emit_idiv_eax_reg(source) \
x86_emit_opcode_1b_ext_reg(idiv_eax_rm, source) \
+#define x86_emit_pop_reg(regn) \
+ x86_emit_opcode_1b(pop_reg, regn) \
+
+#define x86_emit_push_reg(regn) \
+ x86_emit_opcode_1b(push_reg, regn) \
+
#define x86_emit_push_mem(base, offset) \
x86_emit_opcode_1b_mem(push_rm, 0x06, base, offset) \
@@ -523,6 +530,28 @@ typedef enum
generate_function_call(execute_##name##_##flags_op##_reg); \
generate_mov(ireg, rv) \
+#ifdef TRACE_INSTRUCTIONS
+ void function_cc trace_instruction(u32 pc)
+ {
+ printf("Executed %x\n", pc);
+ }
+
+ #define emit_trace_thumb_instruction(pc) \
+ x86_emit_push_reg(eax); \
+ x86_emit_push_reg(ecx); \
+ x86_emit_push_reg(edx); \
+ x86_emit_mov_reg_imm(eax, pc); \
+ generate_function_call(trace_instruction); \
+ x86_emit_pop_reg(edx); \
+ x86_emit_pop_reg(ecx); \
+ x86_emit_pop_reg(eax);
+ #define emit_trace_arm_instruction(pc) \
+ emit_trace_thumb_instruction(pc)
+#else
+ #define emit_trace_thumb_instruction(pc)
+ #define emit_trace_arm_instruction(pc)
+#endif
+
u32 function_cc execute_lsl_no_flags_reg(u32 value, u32 shift)
{
if(shift != 0)