Yet more logging
This commit is contained in:
@@ -31,9 +31,9 @@ static struct {
|
|||||||
} codegen_instructions[MAX_INSTRUCTION_COUNT];
|
} codegen_instructions[MAX_INSTRUCTION_COUNT];
|
||||||
|
|
||||||
void
|
void
|
||||||
codegen_print_mmx(void)
|
codegen_print_mmx(const char* str)
|
||||||
{
|
{
|
||||||
pclog("MMX results: %016llX, %016llX, %016llX, %016llX, %016llX, %016llX, %016llX, %016llX\n", (unsigned long long)cpu_state.MM[0].q, (unsigned long long)cpu_state.MM[1].q, (unsigned long long)cpu_state.MM[2].q, (unsigned long long)cpu_state.MM[3].q, (unsigned long long)cpu_state.MM[4].q, (unsigned long long)cpu_state.MM[5].q, (unsigned long long)cpu_state.MM[6].q, (unsigned long long)cpu_state.MM[7].q);
|
pclog("MMX results: %016llX, %016llX, %016llX, %016llX, %016llX, %016llX, %016llX, %016llX (%s)\n", (unsigned long long)cpu_state.MM[0].q, (unsigned long long)cpu_state.MM[1].q, (unsigned long long)cpu_state.MM[2].q, (unsigned long long)cpu_state.MM[3].q, (unsigned long long)cpu_state.MM[4].q, (unsigned long long)cpu_state.MM[5].q, (unsigned long long)cpu_state.MM[6].q, (unsigned long long)cpu_state.MM[7].q, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|||||||
@@ -850,28 +850,28 @@ codegen_LOAD_FUNC_ARG3(codeblock_t *block, uop_t *uop)
|
|||||||
static int
|
static int
|
||||||
codegen_LOAD_FUNC_ARG0_IMM(codeblock_t *block, uop_t *uop)
|
codegen_LOAD_FUNC_ARG0_IMM(codeblock_t *block, uop_t *uop)
|
||||||
{
|
{
|
||||||
host_arm64_mov_imm(block, REG_ARG0, uop->imm_data);
|
host_arm64_MOVX_IMM(block, REG_ARG0, uop->imm_data);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
static int
|
static int
|
||||||
codegen_LOAD_FUNC_ARG1_IMM(codeblock_t *block, uop_t *uop)
|
codegen_LOAD_FUNC_ARG1_IMM(codeblock_t *block, uop_t *uop)
|
||||||
{
|
{
|
||||||
host_arm64_mov_imm(block, REG_ARG1, uop->imm_data);
|
host_arm64_MOVX_IMM(block, REG_ARG1, uop->imm_data);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
static int
|
static int
|
||||||
codegen_LOAD_FUNC_ARG2_IMM(codeblock_t *block, uop_t *uop)
|
codegen_LOAD_FUNC_ARG2_IMM(codeblock_t *block, uop_t *uop)
|
||||||
{
|
{
|
||||||
host_arm64_mov_imm(block, REG_ARG2, uop->imm_data);
|
host_arm64_MOVX_IMM(block, REG_ARG2, uop->imm_data);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
static int
|
static int
|
||||||
codegen_LOAD_FUNC_ARG3_IMM(codeblock_t *block, uop_t *uop)
|
codegen_LOAD_FUNC_ARG3_IMM(codeblock_t *block, uop_t *uop)
|
||||||
{
|
{
|
||||||
host_arm64_mov_imm(block, REG_ARG3, uop->imm_data);
|
host_arm64_MOVX_IMM(block, REG_ARG3, uop->imm_data);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -220,9 +220,9 @@ static int
|
|||||||
codegen_CALL_INSTRUCTION_FUNC(codeblock_t *block, uop_t *uop)
|
codegen_CALL_INSTRUCTION_FUNC(codeblock_t *block, uop_t *uop)
|
||||||
{
|
{
|
||||||
# if _WIN64
|
# if _WIN64
|
||||||
host_x86_MOV32_REG_IMM(block, REG_ECX, uop->imm_data);
|
host_x86_MOV64_REG_IMM(block, REG_RCX, uop->imm_data);
|
||||||
# else
|
# else
|
||||||
host_x86_MOV32_REG_IMM(block, REG_EDI, uop->imm_data);
|
host_x86_MOV64_REG_IMM(block, REG_RDI, uop->imm_data);
|
||||||
# endif
|
# endif
|
||||||
host_x86_CALL(block, uop->p);
|
host_x86_CALL(block, uop->p);
|
||||||
host_x86_TEST32_REG(block, REG_EAX, REG_EAX);
|
host_x86_TEST32_REG(block, REG_EAX, REG_EAX);
|
||||||
@@ -906,9 +906,9 @@ static int
|
|||||||
codegen_LOAD_FUNC_ARG0_IMM(codeblock_t *block, uop_t *uop)
|
codegen_LOAD_FUNC_ARG0_IMM(codeblock_t *block, uop_t *uop)
|
||||||
{
|
{
|
||||||
# if _WIN64
|
# if _WIN64
|
||||||
host_x86_MOV32_REG_IMM(block, REG_ECX, uop->imm_data);
|
host_x86_MOV64_REG_IMM(block, REG_RCX, uop->imm_data);
|
||||||
# else
|
# else
|
||||||
host_x86_MOV32_REG_IMM(block, REG_EDI, uop->imm_data);
|
host_x86_MOV64_REG_IMM(block, REG_RDI, uop->imm_data);
|
||||||
# endif
|
# endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -916,9 +916,9 @@ static int
|
|||||||
codegen_LOAD_FUNC_ARG1_IMM(codeblock_t *block, uop_t *uop)
|
codegen_LOAD_FUNC_ARG1_IMM(codeblock_t *block, uop_t *uop)
|
||||||
{
|
{
|
||||||
# if _WIN64
|
# if _WIN64
|
||||||
host_x86_MOV32_REG_IMM(block, REG_EDX, uop->imm_data);
|
host_x86_MOV64_REG_IMM(block, REG_RDX, uop->imm_data);
|
||||||
# else
|
# else
|
||||||
host_x86_MOV32_REG_IMM(block, REG_ESI, uop->imm_data);
|
host_x86_MOV64_REG_IMM(block, REG_RSI, uop->imm_data);
|
||||||
# endif
|
# endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -336,7 +336,7 @@ typedef struct uop_t {
|
|||||||
ir_reg_t src_reg_a;
|
ir_reg_t src_reg_a;
|
||||||
ir_reg_t src_reg_b;
|
ir_reg_t src_reg_b;
|
||||||
ir_reg_t src_reg_c;
|
ir_reg_t src_reg_c;
|
||||||
uint32_t imm_data;
|
uintptr_t imm_data;
|
||||||
void *p;
|
void *p;
|
||||||
ir_host_reg_t dest_reg_a_real;
|
ir_host_reg_t dest_reg_a_real;
|
||||||
ir_host_reg_t src_reg_a_real, src_reg_b_real, src_reg_c_real;
|
ir_host_reg_t src_reg_a_real, src_reg_b_real, src_reg_c_real;
|
||||||
@@ -601,7 +601,7 @@ uop_gen_reg_src3_imm(uint32_t uop_type, ir_data_t *ir, int src_reg_a, int src_re
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
uop_gen_imm(uint32_t uop_type, ir_data_t *ir, uint32_t imm)
|
uop_gen_imm(uint32_t uop_type, ir_data_t *ir, uintptr_t imm)
|
||||||
{
|
{
|
||||||
uop_t *uop = uop_alloc(ir, uop_type);
|
uop_t *uop = uop_alloc(ir, uop_type);
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
#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);
|
extern void codegen_print_mmx(const char* str);
|
||||||
|
|
||||||
#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), \
|
||||||
@@ -39,6 +39,7 @@ extern void codegen_print_mmx(void);
|
|||||||
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_LOAD_FUNC_ARG_IMM(ir, 0, (uintptr_t)__func__); \
|
||||||
uop_CALL_FUNC(ir, codegen_print_mmx); \
|
uop_CALL_FUNC(ir, codegen_print_mmx); \
|
||||||
return op_pc + 1; \
|
return op_pc + 1; \
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
#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);
|
extern void codegen_print_mmx(const char* str);
|
||||||
|
|
||||||
#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), \
|
||||||
@@ -39,6 +39,7 @@ extern void codegen_print_mmx(void);
|
|||||||
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_LOAD_FUNC_ARG_IMM(ir, 0, (uintptr_t)__func__); \
|
||||||
uop_CALL_FUNC(ir, codegen_print_mmx); \
|
uop_CALL_FUNC(ir, codegen_print_mmx); \
|
||||||
return op_pc + 1; \
|
return op_pc + 1; \
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
#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);
|
extern void codegen_print_mmx(const char* str);
|
||||||
|
|
||||||
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)
|
||||||
@@ -38,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_LOAD_FUNC_ARG_IMM(ir, 0, (uintptr_t)__func__);
|
||||||
uop_CALL_FUNC(ir, codegen_print_mmx);
|
uop_CALL_FUNC(ir, codegen_print_mmx);
|
||||||
return op_pc + 1;
|
return op_pc + 1;
|
||||||
}
|
}
|
||||||
@@ -65,6 +66,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_LOAD_FUNC_ARG_IMM(ir, 0, (uintptr_t)__func__);
|
||||||
uop_CALL_FUNC(ir, codegen_print_mmx);
|
uop_CALL_FUNC(ir, codegen_print_mmx);
|
||||||
return op_pc + 1;
|
return op_pc + 1;
|
||||||
}
|
}
|
||||||
@@ -88,6 +90,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_LOAD_FUNC_ARG_IMM(ir, 0, (uintptr_t)__func__);
|
||||||
uop_CALL_FUNC(ir, codegen_print_mmx);
|
uop_CALL_FUNC(ir, codegen_print_mmx);
|
||||||
return op_pc + 1;
|
return op_pc + 1;
|
||||||
}
|
}
|
||||||
@@ -112,6 +115,7 @@ 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_LOAD_FUNC_ARG_IMM(ir, 0, (uintptr_t)__func__);
|
||||||
uop_CALL_FUNC(ir, codegen_print_mmx);
|
uop_CALL_FUNC(ir, codegen_print_mmx);
|
||||||
return op_pc + 1;
|
return op_pc + 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +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);
|
extern void codegen_print_mmx(const char* str);
|
||||||
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)
|
||||||
{
|
{
|
||||||
@@ -37,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_LOAD_FUNC_ARG_IMM(ir, 0, (uintptr_t)__func__);
|
||||||
uop_CALL_FUNC(ir, codegen_print_mmx);
|
uop_CALL_FUNC(ir, codegen_print_mmx);
|
||||||
return op_pc + 1;
|
return op_pc + 1;
|
||||||
}
|
}
|
||||||
@@ -60,6 +61,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_LOAD_FUNC_ARG_IMM(ir, 0, (uintptr_t)__func__);
|
||||||
uop_CALL_FUNC(ir, codegen_print_mmx);
|
uop_CALL_FUNC(ir, codegen_print_mmx);
|
||||||
return op_pc + 1;
|
return op_pc + 1;
|
||||||
}
|
}
|
||||||
@@ -83,6 +85,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_LOAD_FUNC_ARG_IMM(ir, 0, (uintptr_t)__func__);
|
||||||
uop_CALL_FUNC(ir, codegen_print_mmx);
|
uop_CALL_FUNC(ir, codegen_print_mmx);
|
||||||
return op_pc + 1;
|
return op_pc + 1;
|
||||||
}
|
}
|
||||||
@@ -106,6 +109,7 @@ 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_LOAD_FUNC_ARG_IMM(ir, 0, (uintptr_t)__func__);
|
||||||
uop_CALL_FUNC(ir, codegen_print_mmx);
|
uop_CALL_FUNC(ir, codegen_print_mmx);
|
||||||
return op_pc + 1;
|
return op_pc + 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +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);
|
extern void codegen_print_mmx(const char* str);
|
||||||
#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) \
|
||||||
@@ -38,6 +38,7 @@ extern void codegen_print_mmx(void);
|
|||||||
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_LOAD_FUNC_ARG_IMM(ir, 0, (uintptr_t)__func__); \
|
||||||
uop_CALL_FUNC(ir, codegen_print_mmx); \
|
uop_CALL_FUNC(ir, codegen_print_mmx); \
|
||||||
return op_pc + 1; \
|
return op_pc + 1; \
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +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);
|
extern void codegen_print_mmx(const char* str);
|
||||||
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)
|
||||||
{
|
{
|
||||||
@@ -40,6 +40,7 @@ ropPSxxW_imm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uop_LOAD_FUNC_ARG_IMM(ir, 0, (uintptr_t)__func__);
|
||||||
uop_CALL_FUNC(ir, codegen_print_mmx);
|
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;
|
||||||
@@ -67,6 +68,7 @@ ropPSxxD_imm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uop_LOAD_FUNC_ARG_IMM(ir, 0, (uintptr_t)__func__);
|
||||||
uop_CALL_FUNC(ir, codegen_print_mmx);
|
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;
|
||||||
@@ -94,6 +96,7 @@ ropPSxxQ_imm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uop_LOAD_FUNC_ARG_IMM(ir, 0, (uintptr_t)__func__);
|
||||||
uop_CALL_FUNC(ir, codegen_print_mmx);
|
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;
|
||||||
|
|||||||
Reference in New Issue
Block a user