Temp MMX debugging logs

This commit is contained in:
Cacodemon345
2025-09-14 23:42:14 +06:00
parent 15a3df6135
commit 6229607277
7 changed files with 29 additions and 0 deletions

View File

@@ -30,6 +30,12 @@ static struct {
int TOP; int TOP;
} codegen_instructions[MAX_INSTRUCTION_COUNT]; } codegen_instructions[MAX_INSTRUCTION_COUNT];
void
codegen_print_mmx(void)
{
pclog("MMX results: %016llX, %016llX, %016llX, %016llX, %016llX, %016llX, %016llX, %016llX\n", cpu_state.MM[0], cpu_state.MM[1], cpu_state.MM[2], cpu_state.MM[3], cpu_state.MM[4], cpu_state.MM[5], cpu_state.MM[6], cpu_state.MM[7]);
}
int int
codegen_get_instruction_uop(codeblock_t *block, uint32_t pc, int *first_instruction, int *TOP) codegen_get_instruction_uop(codeblock_t *block, uint32_t pc, int *first_instruction, int *TOP)
{ {

View File

@@ -16,6 +16,8 @@
#include "codegen_ops_mmx_arith.h" #include "codegen_ops_mmx_arith.h"
#include "codegen_ops_helpers.h" #include "codegen_ops_helpers.h"
extern void codegen_print_mmx(void);
#define ropParith(func) \ #define ropParith(func) \
uint32_t rop##func(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), \ uint32_t rop##func(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), \
uint32_t fetchdat, uint32_t op_32, uint32_t op_pc) \ uint32_t fetchdat, uint32_t op_32, uint32_t op_pc) \
@@ -37,6 +39,7 @@
uop_##func(ir, IREG_MM(dest_reg), IREG_MM(dest_reg), IREG_temp0_Q); \ uop_##func(ir, IREG_MM(dest_reg), IREG_MM(dest_reg), IREG_temp0_Q); \
} \ } \
\ \
uop_CALL_FUNC(ir, codegen_print_mmx); \
return op_pc + 1; \ return op_pc + 1; \
} }

View File

@@ -16,6 +16,8 @@
#include "codegen_ops_mmx_cmp.h" #include "codegen_ops_mmx_cmp.h"
#include "codegen_ops_helpers.h" #include "codegen_ops_helpers.h"
extern void codegen_print_mmx(void);
#define ropPcmp(func) \ #define ropPcmp(func) \
uint32_t rop##func(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), \ uint32_t rop##func(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), \
uint32_t fetchdat, uint32_t op_32, uint32_t op_pc) \ uint32_t fetchdat, uint32_t op_32, uint32_t op_pc) \
@@ -37,6 +39,7 @@
uop_##func(ir, IREG_MM(dest_reg), IREG_MM(dest_reg), IREG_temp0_Q); \ uop_##func(ir, IREG_MM(dest_reg), IREG_MM(dest_reg), IREG_temp0_Q); \
} \ } \
\ \
uop_CALL_FUNC(ir, codegen_print_mmx); \
return op_pc + 1; \ return op_pc + 1; \
} }

View File

@@ -16,6 +16,8 @@
#include "codegen_ops_mmx_loadstore.h" #include "codegen_ops_mmx_loadstore.h"
#include "codegen_ops_helpers.h" #include "codegen_ops_helpers.h"
extern void codegen_print_mmx(void);
uint32_t uint32_t
ropMOVD_r_d(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc) ropMOVD_r_d(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
{ {
@@ -36,6 +38,7 @@ ropMOVD_r_d(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t
uop_MOVZX(ir, IREG_MM(dest_reg), IREG_temp0); uop_MOVZX(ir, IREG_MM(dest_reg), IREG_temp0);
} }
uop_CALL_FUNC(ir, codegen_print_mmx);
return op_pc + 1; return op_pc + 1;
} }
uint32_t uint32_t
@@ -62,6 +65,7 @@ ropMOVD_d_r(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t
uop_MEM_STORE_REG(ir, ireg_seg_base(target_seg), IREG_eaaddr, IREG_temp0); uop_MEM_STORE_REG(ir, ireg_seg_base(target_seg), IREG_eaaddr, IREG_temp0);
} }
uop_CALL_FUNC(ir, codegen_print_mmx);
return op_pc + 1; return op_pc + 1;
} }
@@ -84,6 +88,7 @@ ropMOVQ_r_q(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t
uop_MEM_LOAD_REG(ir, IREG_MM(dest_reg), ireg_seg_base(target_seg), IREG_eaaddr); uop_MEM_LOAD_REG(ir, IREG_MM(dest_reg), ireg_seg_base(target_seg), IREG_eaaddr);
} }
uop_CALL_FUNC(ir, codegen_print_mmx);
return op_pc + 1; return op_pc + 1;
} }
@@ -107,5 +112,6 @@ ropMOVQ_q_r(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t
uop_MEM_STORE_REG(ir, ireg_seg_base(target_seg), IREG_eaaddr, IREG_MM(src_reg)); uop_MEM_STORE_REG(ir, ireg_seg_base(target_seg), IREG_eaaddr, IREG_MM(src_reg));
} }
uop_CALL_FUNC(ir, codegen_print_mmx);
return op_pc + 1; return op_pc + 1;
} }

View File

@@ -16,6 +16,7 @@
#include "codegen_ops_mmx_logic.h" #include "codegen_ops_mmx_logic.h"
#include "codegen_ops_helpers.h" #include "codegen_ops_helpers.h"
extern void codegen_print_mmx(void);
uint32_t uint32_t
ropPAND(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc) ropPAND(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
{ {
@@ -36,6 +37,7 @@ ropPAND(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetc
uop_AND(ir, IREG_MM(dest_reg), IREG_MM(dest_reg), IREG_temp0_Q); uop_AND(ir, IREG_MM(dest_reg), IREG_MM(dest_reg), IREG_temp0_Q);
} }
uop_CALL_FUNC(ir, codegen_print_mmx);
return op_pc + 1; return op_pc + 1;
} }
uint32_t uint32_t
@@ -58,6 +60,7 @@ ropPANDN(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fet
uop_ANDN(ir, IREG_MM(dest_reg), IREG_MM(dest_reg), IREG_temp0_Q); uop_ANDN(ir, IREG_MM(dest_reg), IREG_MM(dest_reg), IREG_temp0_Q);
} }
uop_CALL_FUNC(ir, codegen_print_mmx);
return op_pc + 1; return op_pc + 1;
} }
uint32_t uint32_t
@@ -80,6 +83,7 @@ ropPOR(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetch
uop_OR(ir, IREG_MM(dest_reg), IREG_MM(dest_reg), IREG_temp0_Q); uop_OR(ir, IREG_MM(dest_reg), IREG_MM(dest_reg), IREG_temp0_Q);
} }
uop_CALL_FUNC(ir, codegen_print_mmx);
return op_pc + 1; return op_pc + 1;
} }
uint32_t uint32_t
@@ -102,5 +106,6 @@ ropPXOR(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetc
uop_XOR(ir, IREG_MM(dest_reg), IREG_MM(dest_reg), IREG_temp0_Q); uop_XOR(ir, IREG_MM(dest_reg), IREG_MM(dest_reg), IREG_temp0_Q);
} }
uop_CALL_FUNC(ir, codegen_print_mmx);
return op_pc + 1; return op_pc + 1;
} }

View File

@@ -16,6 +16,7 @@
#include "codegen_ops_mmx_pack.h" #include "codegen_ops_mmx_pack.h"
#include "codegen_ops_helpers.h" #include "codegen_ops_helpers.h"
extern void codegen_print_mmx(void);
#define ropPpack(func) \ #define ropPpack(func) \
uint32_t rop##func(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), \ uint32_t rop##func(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), \
uint32_t fetchdat, uint32_t op_32, uint32_t op_pc) \ uint32_t fetchdat, uint32_t op_32, uint32_t op_pc) \
@@ -37,6 +38,7 @@
uop_##func(ir, IREG_MM(dest_reg), IREG_MM(dest_reg), IREG_temp0_Q); \ uop_##func(ir, IREG_MM(dest_reg), IREG_MM(dest_reg), IREG_temp0_Q); \
} \ } \
\ \
uop_CALL_FUNC(ir, codegen_print_mmx); \
return op_pc + 1; \ return op_pc + 1; \
} }

View File

@@ -16,6 +16,7 @@
#include "codegen_ops_mmx_shift.h" #include "codegen_ops_mmx_shift.h"
#include "codegen_ops_helpers.h" #include "codegen_ops_helpers.h"
extern void codegen_print_mmx(void);
uint32_t uint32_t
ropPSxxW_imm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc) ropPSxxW_imm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
{ {
@@ -39,6 +40,7 @@ ropPSxxW_imm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t
return 0; return 0;
} }
uop_CALL_FUNC(ir, codegen_print_mmx);
codegen_mark_code_present(block, cs + op_pc + 1, 1); codegen_mark_code_present(block, cs + op_pc + 1, 1);
return op_pc + 2; return op_pc + 2;
} }
@@ -65,6 +67,7 @@ ropPSxxD_imm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t
return 0; return 0;
} }
uop_CALL_FUNC(ir, codegen_print_mmx);
codegen_mark_code_present(block, cs + op_pc + 1, 1); codegen_mark_code_present(block, cs + op_pc + 1, 1);
return op_pc + 2; return op_pc + 2;
} }
@@ -91,6 +94,7 @@ ropPSxxQ_imm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t
return 0; return 0;
} }
uop_CALL_FUNC(ir, codegen_print_mmx);
codegen_mark_code_present(block, cs + op_pc + 1, 1); codegen_mark_code_present(block, cs + op_pc + 1, 1);
return op_pc + 2; return op_pc + 2;
} }