organising stuff s bit

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%4092
This commit is contained in:
Borja Ferrer 2006-09-22 11:52:19 +00:00
parent 1bf17b05bb
commit 80688365a2
2 changed files with 19 additions and 21 deletions

View File

@ -247,8 +247,8 @@ void Write_Check_VerifyAddr(JitWriter *jit, jit_uint8_t reg, bool firstcall)
jitoffs_t jmp1 = IA32_Jump_Cond_Imm8(jit, CC_AE, 0); jitoffs_t jmp1 = IA32_Jump_Cond_Imm8(jit, CC_AE, 0);
IA32_Cmp_Reg_Rm_Disp8(jit, reg, AMX_REG_INFO, AMX_INFO_HEAP); IA32_Cmp_Reg_Rm_Disp8(jit, reg, AMX_REG_INFO, AMX_INFO_HEAP);
jitoffs_t jmp2 = IA32_Jump_Cond_Imm8(jit, CC_B, 0); jitoffs_t jmp2 = IA32_Jump_Cond_Imm8(jit, CC_B, 0);
IA32_Lea_Reg_DispRegMult(jit, REG_ECX, reg, REG_EDI, NOSCALE); IA32_Lea_Reg_DispRegMult(jit, AMX_REG_TMP, reg, AMX_REG_DAT, NOSCALE);
IA32_Cmp_Rm_Reg(jit, REG_ECX, AMX_REG_STK, MOD_REG); IA32_Cmp_Rm_Reg(jit, AMX_REG_TMP, AMX_REG_STK, MOD_REG);
jitoffs_t jmp3 = IA32_Jump_Cond_Imm8(jit, CC_AE, 0); jitoffs_t jmp3 = IA32_Jump_Cond_Imm8(jit, CC_AE, 0);
IA32_Send_Jump8_Here(jit, jmp1); IA32_Send_Jump8_Here(jit, jmp1);
Write_Error(jit, SP_ERR_MEMACCESS); Write_Error(jit, SP_ERR_MEMACCESS);
@ -328,15 +328,15 @@ void Write_CheckMargin_Heap(JitWriter *jit)
//mov ecx, [esi+hea] //mov ecx, [esi+hea]
//cmp ecx, [esi+hlw] //cmp ecx, [esi+hlw]
//jl :error_heapmin //jl :error_heapmin
IA32_Mov_Reg_Rm_Disp8(jit, REG_ECX, AMX_REG_INFO, AMX_INFO_HEAP); IA32_Mov_Reg_Rm_Disp8(jit, AMX_REG_TMP, AMX_REG_INFO, AMX_INFO_HEAP);
IA32_Cmp_Reg_Rm_Disp8(jit, REG_ECX, AMX_REG_INFO, AMX_INFO_HEAPLOW); IA32_Cmp_Reg_Rm_Disp8(jit, AMX_REG_TMP, AMX_REG_INFO, AMX_INFO_HEAPLOW);
jitoffs_t hm = IA32_Jump_Cond_Imm8(jit, CC_L, 0); jitoffs_t hm = IA32_Jump_Cond_Imm8(jit, CC_L, 0);
//lea ecx, [edi+ecx+STACK_MARGIN] //lea ecx, [edi+ecx+STACK_MARGIN]
//cmp ecx, ebp //cmp ecx, ebp
// jg :error_heaplow // jg :error_heaplow
//OR //OR
// ret // ret
IA32_Lea_Reg_DispRegMultImm8(jit, REG_ECX, AMX_REG_DAT, REG_ECX, NOSCALE, STACK_MARGIN); IA32_Lea_Reg_DispRegMultImm8(jit, AMX_REG_TMP, AMX_REG_DAT, AMX_REG_TMP, NOSCALE, STACK_MARGIN);
IA32_Cmp_Rm_Reg(jit, REG_ECX, AMX_REG_STK, MOD_REG); IA32_Cmp_Rm_Reg(jit, REG_ECX, AMX_REG_STK, MOD_REG);
jitoffs_t hl = IA32_Jump_Cond_Imm8(jit, CC_G, 0); jitoffs_t hl = IA32_Jump_Cond_Imm8(jit, CC_G, 0);
jitoffs_t cont; jitoffs_t cont;
@ -378,7 +378,6 @@ void Write_CheckMargin_Stack(JitWriter *jit)
IA32_Send_Jump8_Here(jit, jmp); IA32_Send_Jump8_Here(jit, jmp);
} }
void Macro_PushN_Addr(JitWriter *jit, int i) void Macro_PushN_Addr(JitWriter *jit, int i)
{ {
//push eax //push eax
@ -643,4 +642,3 @@ JITX86::JITX86()
OpAdvTable[OP_SYSREQ_ND] = -3; OpAdvTable[OP_SYSREQ_ND] = -3;
OpAdvTable[OP_PUSH_R] = -3; OpAdvTable[OP_PUSH_R] = -3;
} }

View File

@ -250,7 +250,7 @@ inline void IA32_And_Rm_Reg(JitWriter *jit, jit_uint8_t dest, jit_uint8_t src, j
jit->write_ubyte(ia32_modrm(mode, src, dest)); jit->write_ubyte(ia32_modrm(mode, src, dest));
} }
inline void IA32_And_Rm_Imm32(JitWriter *jit, jit_uint8_t reg, jit_uint32_t c) inline void IA32_And_Rm_Imm32(JitWriter *jit, jit_uint8_t reg, jit_int32_t c)
{ {
if (reg == REG_EAX) if (reg == REG_EAX)
{ {
@ -259,7 +259,7 @@ inline void IA32_And_Rm_Imm32(JitWriter *jit, jit_uint8_t reg, jit_uint32_t c)
jit->write_ubyte(IA32_AND_RM_IMM32); jit->write_ubyte(IA32_AND_RM_IMM32);
jit->write_ubyte(ia32_modrm(MOD_REG, 4, reg)); jit->write_ubyte(ia32_modrm(MOD_REG, 4, reg));
} }
jit->write_uint32(c); jit->write_int32(c);
} }
inline void IA32_Not_Rm(JitWriter *jit, jit_uint8_t reg, jit_uint8_t mode) inline void IA32_Not_Rm(JitWriter *jit, jit_uint8_t reg, jit_uint8_t mode)
@ -322,6 +322,12 @@ inline void IA32_Add_Rm_Reg(JitWriter *jit, jit_uint8_t dest, jit_uint8_t src, j
jit->write_ubyte(ia32_modrm(mode, src, dest)); jit->write_ubyte(ia32_modrm(mode, src, dest));
} }
inline void IA32_Add_Reg_Rm(JitWriter *jit, jit_uint8_t dest, jit_uint8_t src, jit_uint8_t mode)
{
jit->write_ubyte(IA32_ADD_REG_RM);
jit->write_ubyte(ia32_modrm(mode, dest, src));
}
inline void IA32_Add_Rm_Imm8(JitWriter *jit, jit_uint8_t reg, jit_int8_t value, jit_uint8_t mode) inline void IA32_Add_Rm_Imm8(JitWriter *jit, jit_uint8_t reg, jit_int8_t value, jit_uint8_t mode)
{ {
jit->write_ubyte(IA32_ADD_RM_IMM8); jit->write_ubyte(IA32_ADD_RM_IMM8);
@ -348,12 +354,6 @@ inline void IA32_Sub_Rm_Reg(JitWriter *jit, jit_uint8_t dest, jit_uint8_t src, j
jit->write_ubyte(ia32_modrm(mode, src, dest)); jit->write_ubyte(ia32_modrm(mode, src, dest));
} }
inline void IA32_Sbb_Rm_Reg(JitWriter *jit, jit_uint8_t dest, jit_uint8_t src, jit_uint8_t mode)
{
jit->write_ubyte(IA32_SBB_RM_REG);
jit->write_ubyte(ia32_modrm(mode, src, dest));
}
inline void IA32_Sub_Reg_Rm(JitWriter *jit, jit_uint8_t dest, jit_uint8_t src, jit_uint8_t mode) inline void IA32_Sub_Reg_Rm(JitWriter *jit, jit_uint8_t dest, jit_uint8_t src, jit_uint8_t mode)
{ {
jit->write_ubyte(IA32_SUB_REG_RM); jit->write_ubyte(IA32_SUB_REG_RM);
@ -374,6 +374,12 @@ inline void IA32_Sub_Rm_Imm32(JitWriter *jit, jit_uint8_t reg, jit_int32_t val,
jit->write_int32(val); jit->write_int32(val);
} }
inline void IA32_Sbb_Rm_Reg(JitWriter *jit, jit_uint8_t dest, jit_uint8_t src, jit_uint8_t mode)
{
jit->write_ubyte(IA32_SBB_RM_REG);
jit->write_ubyte(ia32_modrm(mode, src, dest));
}
inline void IA32_Sbb_Eax_Imm32(JitWriter *jit, jit_int32_t value) inline void IA32_Sbb_Eax_Imm32(JitWriter *jit, jit_int32_t value)
{ {
jit->write_ubyte(IA32_SBB_EAX_IMM32); jit->write_ubyte(IA32_SBB_EAX_IMM32);
@ -425,12 +431,6 @@ inline void IA32_Add_Rm_Reg_Disp8(JitWriter *jit, jit_uint8_t dest, jit_uint8_t
jit->write_byte(disp); jit->write_byte(disp);
} }
inline void IA32_Add_Reg_Rm(JitWriter *jit, jit_uint8_t dest, jit_uint8_t src, jit_uint8_t mode)
{
jit->write_ubyte(IA32_ADD_REG_RM);
jit->write_ubyte(ia32_modrm(mode, dest, src));
}
inline void IA32_Add_Reg_Rm_Disp8(JitWriter *jit, jit_uint8_t dest, jit_uint8_t src, jit_int8_t disp) inline void IA32_Add_Reg_Rm_Disp8(JitWriter *jit, jit_uint8_t dest, jit_uint8_t src, jit_int8_t disp)
{ {
jit->write_ubyte(IA32_ADD_REG_RM); jit->write_ubyte(IA32_ADD_REG_RM);