fixes here and there
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%4095
This commit is contained in:
parent
96505c8e60
commit
845ae65797
@ -951,7 +951,7 @@ inline void WriteOp_Cmps(JitWriter *jit)
|
|||||||
//sbb eax, eax
|
//sbb eax, eax
|
||||||
//sbb eax, -1
|
//sbb eax, -1
|
||||||
IA32_Sbb_Rm_Reg(jit, REG_EAX, REG_EAX, MOD_REG);
|
IA32_Sbb_Rm_Reg(jit, REG_EAX, REG_EAX, MOD_REG);
|
||||||
IA32_Sbb_Eax_Imm32(jit, -1);
|
IA32_Sbb_Eax_Imm32(jit, -1);//:TODO: use imm8 here
|
||||||
|
|
||||||
//:cmps1
|
//:cmps1
|
||||||
//pop esi
|
//pop esi
|
||||||
@ -1077,12 +1077,12 @@ inline void WriteOp_Lodb_I(JitWriter *jit)
|
|||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
IA32_And_Rm_Imm32(jit, AMX_REG_PRI, 0x000000FF);
|
IA32_And_Rm_Imm32(jit, AMX_REG_PRI, 0x000000FF);//:TODO: replace with AND EAX, imm32
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
IA32_And_Rm_Imm32(jit, AMX_REG_PRI, 0x0000FFFF);
|
IA32_And_Rm_Imm32(jit, AMX_REG_PRI, 0x0000FFFF);//:TODO: replace with AND EAX, imm32
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1112,7 +1112,7 @@ inline void WriteOp_Strb_I(JitWriter *jit)
|
|||||||
IA32_Mov_Rm16_Reg_Disp_Reg(jit, AMX_REG_DAT, AMX_REG_ALT, NOSCALE, AMX_REG_PRI);
|
IA32_Mov_Rm16_Reg_Disp_Reg(jit, AMX_REG_DAT, AMX_REG_ALT, NOSCALE, AMX_REG_PRI);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 3:
|
case 4:
|
||||||
{
|
{
|
||||||
IA32_Mov_Rm_Reg_Disp_Reg(jit, AMX_REG_DAT, AMX_REG_ALT, NOSCALE, AMX_REG_PRI);
|
IA32_Mov_Rm_Reg_Disp_Reg(jit, AMX_REG_DAT, AMX_REG_ALT, NOSCALE, AMX_REG_PRI);
|
||||||
break;
|
break;
|
||||||
@ -1222,7 +1222,7 @@ inline void WriteOp_Sctrl(JitWriter *jit)
|
|||||||
{
|
{
|
||||||
//mov ebx, eax - overwrite frm
|
//mov ebx, eax - overwrite frm
|
||||||
//mov frm, eax - overwrite stacked frame
|
//mov frm, eax - overwrite stacked frame
|
||||||
//add ebx, edi - relocate local frm
|
//add ebx, edi - relocate local frm //:TODO: use LEA here!!!
|
||||||
IA32_Mov_Reg_Rm(jit, AMX_REG_FRM, AMX_REG_PRI, MOD_REG);
|
IA32_Mov_Reg_Rm(jit, AMX_REG_FRM, AMX_REG_PRI, MOD_REG);
|
||||||
IA32_Mov_Rm_Reg(jit, AMX_INFO_FRM, AMX_REG_PRI, MOD_MEM_REG);
|
IA32_Mov_Rm_Reg(jit, AMX_INFO_FRM, AMX_REG_PRI, MOD_MEM_REG);
|
||||||
IA32_Add_Rm_Reg(jit, AMX_REG_FRM, AMX_REG_DAT, MOD_REG);
|
IA32_Add_Rm_Reg(jit, AMX_REG_FRM, AMX_REG_DAT, MOD_REG);
|
||||||
@ -1325,7 +1325,7 @@ inline void WriteOp_Ret(JitWriter *jit)
|
|||||||
//ret
|
//ret
|
||||||
IA32_Mov_Reg_Rm(jit, AMX_REG_FRM, AMX_REG_STK, MOD_MEM_REG);
|
IA32_Mov_Reg_Rm(jit, AMX_REG_FRM, AMX_REG_STK, MOD_MEM_REG);
|
||||||
IA32_Add_Rm_Imm8(jit, AMX_REG_STK, 4, MOD_REG);
|
IA32_Add_Rm_Imm8(jit, AMX_REG_STK, 4, MOD_REG);
|
||||||
IA32_Mov_Reg_Rm_Disp8(jit, AMX_REG_INFO, AMX_REG_FRM, AMX_INFO_FRM);
|
IA32_Mov_Reg_Rm_Disp8(jit, AMX_REG_INFO, AMX_REG_FRM, AMX_INFO_FRM);//:TODO: this is wrong!
|
||||||
IA32_Add_Rm_Reg(jit, AMX_REG_FRM, AMX_REG_DAT, MOD_REG);
|
IA32_Add_Rm_Reg(jit, AMX_REG_FRM, AMX_REG_DAT, MOD_REG);
|
||||||
IA32_Return(jit);
|
IA32_Return(jit);
|
||||||
}
|
}
|
||||||
@ -1340,7 +1340,7 @@ inline void WriteOp_Retn(JitWriter *jit)
|
|||||||
IA32_Mov_Reg_Rm(jit, AMX_REG_FRM, AMX_REG_STK, MOD_MEM_REG);
|
IA32_Mov_Reg_Rm(jit, AMX_REG_FRM, AMX_REG_STK, MOD_MEM_REG);
|
||||||
IA32_Mov_Reg_Rm_Disp8(jit, AMX_REG_TMP, AMX_REG_STK, 4);
|
IA32_Mov_Reg_Rm_Disp8(jit, AMX_REG_TMP, AMX_REG_STK, 4);
|
||||||
IA32_Add_Rm_Imm8(jit, AMX_REG_STK, 8, MOD_REG);
|
IA32_Add_Rm_Imm8(jit, AMX_REG_STK, 8, MOD_REG);
|
||||||
IA32_Mov_Rm_Reg_Disp8(jit, AMX_REG_INFO, AMX_REG_FRM, AMX_INFO_FRM);
|
IA32_Mov_Rm_Reg_Disp8(jit, AMX_REG_INFO, AMX_REG_FRM, AMX_INFO_FRM);//:TODO: this is wrong!
|
||||||
IA32_Add_Rm_Reg(jit, AMX_REG_FRM, AMX_REG_DAT, MOD_REG);
|
IA32_Add_Rm_Reg(jit, AMX_REG_FRM, AMX_REG_DAT, MOD_REG);
|
||||||
|
|
||||||
//add ebp, [ebp] - reduce by this # of params
|
//add ebp, [ebp] - reduce by this # of params
|
||||||
|
@ -283,7 +283,7 @@ void Write_BoundsCheck(JitWriter *jit)
|
|||||||
//cmp eax, ecx
|
//cmp eax, ecx
|
||||||
//jg :err_bounds
|
//jg :err_bounds
|
||||||
//ret
|
//ret
|
||||||
IA32_Cmp_Rm_Imm32(jit, MOD_REG, AMX_REG_PRI, 0);
|
IA32_Cmp_Rm_Imm32(jit, MOD_REG, AMX_REG_PRI, 0);//:TODO: use imm8
|
||||||
jitoffs_t jmp1 = IA32_Jump_Cond_Imm8(jit, CC_L, 0);
|
jitoffs_t jmp1 = IA32_Jump_Cond_Imm8(jit, CC_L, 0);
|
||||||
//:TODO: make sure this is right order
|
//:TODO: make sure this is right order
|
||||||
IA32_Cmp_Rm_Reg(jit, AMX_REG_PRI, AMX_REG_TMP, MOD_REG);
|
IA32_Cmp_Rm_Reg(jit, AMX_REG_PRI, AMX_REG_TMP, MOD_REG);
|
||||||
@ -296,11 +296,11 @@ void Write_BoundsCheck(JitWriter *jit)
|
|||||||
} else {
|
} else {
|
||||||
//cmp eax, 0
|
//cmp eax, 0
|
||||||
//jl :err_bounds
|
//jl :err_bounds
|
||||||
IA32_Cmp_Rm_Imm32(jit, MOD_REG, AMX_REG_PRI, 0);
|
IA32_Cmp_Rm_Imm32(jit, MOD_REG, AMX_REG_PRI, 0);//:TODO: use imm8
|
||||||
jitoffs_t jmp1 = IA32_Jump_Cond_Imm8(jit, CC_L, 0);
|
jitoffs_t jmp1 = IA32_Jump_Cond_Imm8(jit, CC_L, 0);
|
||||||
//cmp eax, <val>
|
//cmp eax, <val>
|
||||||
//jg :err_bounds
|
//jg :err_bounds
|
||||||
IA32_Cmp_Rm_Imm32(jit, MOD_REG, AMX_REG_PRI, jit->read_cell());
|
IA32_Cmp_Rm_Imm32(jit, MOD_REG, AMX_REG_PRI, jit->read_cell());//:TODO:check val size and use cmp eax or imm8
|
||||||
jitoffs_t jmp2 = IA32_Jump_Cond_Imm8(jit, CC_G, 0);
|
jitoffs_t jmp2 = IA32_Jump_Cond_Imm8(jit, CC_G, 0);
|
||||||
//jmp :continue
|
//jmp :continue
|
||||||
jitoffs_t cont = IA32_Jump_Imm8(jit, 0);
|
jitoffs_t cont = IA32_Jump_Imm8(jit, 0);
|
||||||
|
@ -579,11 +579,11 @@ inline void IA32_Popad(JitWriter *jit)
|
|||||||
jit->write_ubyte(IA32_POPAD);
|
jit->write_ubyte(IA32_POPAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void IA32_Push_Rm_Disp8(JitWriter *jit, jit_uint8_t reg, jit_uint8_t disp8)
|
inline void IA32_Push_Rm_Disp8(JitWriter *jit, jit_uint8_t reg, jit_int8_t disp8)
|
||||||
{
|
{
|
||||||
jit->write_ubyte(IA32_PUSH_RM);
|
jit->write_ubyte(IA32_PUSH_RM);
|
||||||
jit->write_ubyte(ia32_modrm(MOD_DISP8, 6, reg));
|
jit->write_ubyte(ia32_modrm(MOD_DISP8, 6, reg));
|
||||||
jit->write_ubyte(disp8); // :TODO: is it ubyte or byte??
|
jit->write_byte(disp8);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -871,11 +871,11 @@ inline void IA32_Cmp_Rm_Imm32(JitWriter *jit, jit_uint8_t mode, jit_uint8_t rm,
|
|||||||
jit->write_int32(imm32);
|
jit->write_int32(imm32);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void IA32_Cmp_Rm_Imm32_Disp8(JitWriter *jit, jit_uint8_t reg, jit_uint8_t disp8, jit_int32_t imm32)
|
inline void IA32_Cmp_Rm_Imm32_Disp8(JitWriter *jit, jit_uint8_t reg, jit_int8_t disp8, jit_int32_t imm32)
|
||||||
{
|
{
|
||||||
jit->write_ubyte(IA32_CMP_RM_IMM32);
|
jit->write_ubyte(IA32_CMP_RM_IMM32);
|
||||||
jit->write_ubyte(ia32_modrm(MOD_DISP8, 7, reg));
|
jit->write_ubyte(ia32_modrm(MOD_DISP8, 7, reg));
|
||||||
jit->write_ubyte(disp8);
|
jit->write_byte(disp8);
|
||||||
jit->write_int32(imm32);
|
jit->write_int32(imm32);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user