"%r15",
};
-int tcg_target_reg_alloc_order[TCG_TARGET_NB_REGS] = {
+int tcg_target_reg_alloc_order[] = {
TCG_REG_RDI,
TCG_REG_RSI,
TCG_REG_RDX,
};
static void patch_reloc(uint8_t *code_ptr, int type,
- tcg_target_long value)
+ tcg_target_long value, tcg_target_long addend)
{
+ value += addend;
switch(type) {
case R_X86_64_32:
if (value != (uint32_t)value)
}
}
+#if defined(CONFIG_SOFTMMU)
/* XXX: incomplete. index must be different from ESP */
static void tcg_out_modrm_offset2(TCGContext *s, int opc, int r, int rm,
int index, int shift,
tcg_out32(s, offset);
}
}
+#endif
static inline void tcg_out_mov(TCGContext *s, int ret, int arg)
{
}
}
-static inline void tcg_out_ld(TCGContext *s, int ret,
+static inline void tcg_out_ld(TCGContext *s, TCGType type, int ret,
int arg1, tcg_target_long arg2)
{
- tcg_out_modrm_offset(s, 0x8b | P_REXW, ret, arg1, arg2); /* movq */
+ if (type == TCG_TYPE_I32)
+ tcg_out_modrm_offset(s, 0x8b, ret, arg1, arg2); /* movl */
+ else
+ tcg_out_modrm_offset(s, 0x8b | P_REXW, ret, arg1, arg2); /* movq */
}
-static inline void tcg_out_st(TCGContext *s, int arg,
+static inline void tcg_out_st(TCGContext *s, TCGType type, int arg,
int arg1, tcg_target_long arg2)
{
- tcg_out_modrm_offset(s, 0x89 | P_REXW, arg, arg1, arg2); /* movq */
+ if (type == TCG_TYPE_I32)
+ tcg_out_modrm_offset(s, 0x89, arg, arg1, arg2); /* movl */
+ else
+ tcg_out_modrm_offset(s, 0x89 | P_REXW, arg, arg1, arg2); /* movq */
}
static inline void tgen_arithi32(TCGContext *s, int c, int r0, int32_t val)
tcg_out8(s, 0x80 + opc);
}
tcg_out_reloc(s, s->code_ptr, R_386_PC32, label_index, -4);
- tcg_out32(s, -4);
+ s->code_ptr += 4;
}
}
/* use test */
switch(cond) {
case TCG_COND_EQ:
- c = JCC_JNE;
+ c = JCC_JE;
break;
case TCG_COND_NE:
c = JCC_JNE;
tcg_out_jxx(s, tcg_cond_to_jcc[cond], label_index);
}
} else {
- tcg_out_modrm(s, 0x01 | (ARITH_CMP << 3) | rexw, arg1, arg2);
+ tcg_out_modrm(s, 0x01 | (ARITH_CMP << 3) | rexw, arg2, arg1);
tcg_out_jxx(s, tcg_cond_to_jcc[cond], label_index);
}
}