TempleOSCDV4.06.ISO

This commit is contained in:
Terry A. Davis authored and minexew committed 2018-09-08 21:47:19 +02:00
1 parent 6fe38d2d9d
commit b632ab9a4f
261 files changed
+6282 -5801

No files matched your search

+59 -59
View File
@@ -1,19 +1,19 @@
U0 ICAddEct(CIntermediateCode *tempi,CICType t1,I64 r1,I64 d1,
CICType t2,I64 r2,I64 d2,CICType t3,I64 r3,I64 d3,I64 op,I64 ip)
{
I64 i,temp,result_reg=REG_RAX;
I64 i,temp,res_reg=REG_RAX;
Bool swap=FALSE;
if (r3!=result_reg) {
if (r3!=res_reg) {
swap^=TRUE;
SwapI64(&t2,&t3);
SwapI64(&r2,&r3);
SwapI64(&d2,&d3);
}
if (t2.raw_type>=RT_I64 && r2!=result_reg && t2&MDG_REG_DISP_SIB_RIP) {
if (t2.raw_type>=RT_I64 && r2!=res_reg && t2&MDG_REG_DISP_SIB_RIP) {
if (t1&MDF_REG && !(r2==r1 && t2&MDG_REG_DISP_SIB))
result_reg=r1;
ICMov(tempi,MDF_REG+RT_I64,result_reg,0,t3,r3,d3,ip);
i=ICModr1(result_reg,t2,r2,d2);
res_reg=r1;
ICMov(tempi,MDF_REG+RT_I64,res_reg,0,t3,r3,d3,ip);
i=ICModr1(res_reg,t2,r2,d2);
if (tempi->ic_flags&ICF_LOCK)
ICU8(tempi,OC_LOCK_PREFIX);
ICRex(tempi,i.u8[1]);
@@ -26,31 +26,31 @@ U0 ICAddEct(CIntermediateCode *tempi,CICType t1,I64 r1,I64 d1,
temp=REG_RCX;
if (t1&MDF_REG)
result_reg=r1;
res_reg=r1;
if (temp==result_reg)
result_reg=REG_RDX;
if (temp==res_reg)
res_reg=REG_RDX;
if (swap) {
if (r3==temp && t3&MDG_REG_DISP_SIB)
temp=REG_RCX;
ICMov(tempi,MDF_REG+RT_I64,temp,0,t2,r2,d2,ip);
ICMov(tempi,MDF_REG+RT_I64,result_reg,0,t3,r3,d3,ip);
ICMov(tempi,MDF_REG+RT_I64,res_reg,0,t3,r3,d3,ip);
} else {
if (r2==result_reg && t2&MDG_REG_DISP_SIB)
result_reg=REG_RDX;
ICMov(tempi,MDF_REG+RT_I64,result_reg,0,t3,r3,d3,ip);
if (r2==res_reg && t2&MDG_REG_DISP_SIB)
res_reg=REG_RDX;
ICMov(tempi,MDF_REG+RT_I64,res_reg,0,t3,r3,d3,ip);
ICMov(tempi,MDF_REG+RT_I64,temp,0,t2,r2,d2,ip);
}
i=0x48;
if (result_reg>7)
if (res_reg>7)
i+=4;
if (temp>7)
i++;
if (tempi->ic_flags&ICF_LOCK)
ICU8(tempi,OC_LOCK_PREFIX);
ICU24(tempi,0xC00000+i+(temp&7)<<16+(result_reg&7)<<19+op<<8);
ICU24(tempi,0xC00000+i+(temp&7)<<16+(res_reg&7)<<19+op<<8);
}
ICMov(tempi,t1,r1,d1,MDF_REG+RT_I64,result_reg,0,ip);
ICMov(tempi,t1,r1,d1,MDF_REG+RT_I64,res_reg,0,ip);
}
U0 ICAddSubEctImm(CIntermediateCode *tempi,CICType t1,I64 r1,I64 d1,
@@ -480,7 +480,7 @@ U0 ICAddSubEctEqu(CIntermediateCode *tempi,U8 type_pointed_to,
CICType t3,I64 r3,I64 d3,I64 op,I64 ip)
{
Bool done;
I64 result_reg,temp,i;
I64 res_reg,temp,i;
if (tempi->ic_flags & ICF_BY_VAL) {
if (t3&MDF_IMM) {
ICAddSubEctImm(tempi,t2&MDG_MASK+type_pointed_to,r2,d2,t2&MDG_MASK+
@@ -508,47 +508,47 @@ U0 ICAddSubEctEqu(CIntermediateCode *tempi,U8 type_pointed_to,
}
if (t3.raw_type>=RT_I64 && t3&MDG_REG_DISP_SIB_RIP) {
if (t2&MDF_REG)
result_reg=r2;
res_reg=r2;
else {
result_reg=REG_RCX;
res_reg=REG_RCX;
ICMov(tempi,MDF_REG+RT_I64,REG_RCX,0,t2,r2,d2,ip);
}
i=ICModr1(result_reg,t3&MDG_MASK+type_pointed_to,r3,d3);
i=ICModr1(res_reg,t3&MDG_MASK+type_pointed_to,r3,d3);
if (tempi->ic_flags&ICF_LOCK)
ICU8(tempi,OC_LOCK_PREFIX);
ICRex(tempi,i.u8[1]);
ICU16(tempi,i.u8[2]<<8+op.u8[0]);
ICModr2(tempi,i,d3,ip+4);
ICMov(tempi,t2&MDG_MASK+type_pointed_to,r2,d2,
MDF_REG+RT_I64,result_reg,0,ip);
MDF_REG+RT_I64,res_reg,0,ip);
done=TRUE;
}
}
if (!done) {
ICMov(tempi,MDF_REG+RT_I64,REG_RAX,0,t3,r3,d3,ip);
if (t2&MDF_REG && r2!=REG_RAX)
result_reg=r2;
res_reg=r2;
else {
result_reg=REG_RCX;
res_reg=REG_RCX;
ICMov(tempi,MDF_REG+RT_I64,REG_RCX,0,
t2&MDG_MASK+type_pointed_to,r2,d2,ip);
}
if (tempi->ic_flags&ICF_LOCK)
ICU8(tempi,OC_LOCK_PREFIX);
if (result_reg>7)
if (res_reg>7)
ICU8(tempi,0x4C);
else
ICU8(tempi,0x48);
ICU16(tempi,0xC000+op.u8[0]+(result_reg&7)<<11);
ICU16(tempi,0xC000+op.u8[0]+(res_reg&7)<<11);
ICMov(tempi,t2&MDG_MASK+type_pointed_to,r2,d2,
MDF_REG+RT_I64,result_reg,0,ip);
MDF_REG+RT_I64,res_reg,0,ip);
}
}
} else {
done=FALSE;
if (t3&MDF_IMM && op.u8[2]) {
if (!d3.u32[1]) {
if (tempi->ic_flags&ICF_NO_DEPEND_RESULT &&
if (tempi->ic_flags&ICF_RES_NOT_USED &&
t2&MDF_REG && d3(U64)<=MAX_I8) {
ICSlashOp(tempi,MDF_DISP+type_pointed_to,r2,0,0x838000+op.u8[4],ip);
ICU8(tempi,d3);
@@ -557,19 +557,19 @@ U0 ICAddSubEctEqu(CIntermediateCode *tempi,U8 type_pointed_to,
ICMov(tempi,MDF_REG+RT_I64,REG_RCX,0,t2,r2,d2,ip);
ICMov(tempi,MDF_REG+RT_I64,REG_RAX,0,
MDF_DISP+type_pointed_to,REG_RCX,0,ip);
result_reg=REG_RAX;
res_reg=REG_RAX;
if (tempi->ic_flags&ICF_LOCK)
ICU8(tempi,OC_LOCK_PREFIX);
ICU16(tempi,op.u8[3]<<8+0x40);
ICU32(tempi,d3);
ICMov(tempi,MDF_DISP+type_pointed_to,REG_RCX,0,
MDF_REG+RT_I64,result_reg,0,ip);
MDF_REG+RT_I64,res_reg,0,ip);
done=TRUE;
} else if (type_pointed_to<RT_I64) {//OR/XOR
ICMov(tempi,MDF_REG+RT_I64,REG_RCX,0,t2,r2,d2,ip);
ICMov(tempi,MDF_REG+RT_I64,REG_RAX,0,
MDF_DISP+type_pointed_to,REG_RCX,0,ip);
result_reg=REG_RAX;
res_reg=REG_RAX;
if (tempi->ic_flags&ICF_LOCK)
ICU8(tempi,OC_LOCK_PREFIX);
if (d3.u16[1]) {
@@ -583,7 +583,7 @@ U0 ICAddSubEctEqu(CIntermediateCode *tempi,U8 type_pointed_to,
ICU8(tempi,d3);
}
ICMov(tempi,MDF_DISP+type_pointed_to,REG_RCX,0,
MDF_REG+RT_I64,result_reg,0,ip);
MDF_REG+RT_I64,res_reg,0,ip);
done=TRUE;
}
}
@@ -593,47 +593,47 @@ U0 ICAddSubEctEqu(CIntermediateCode *tempi,U8 type_pointed_to,
ICMov(tempi,MDF_REG+RT_I64,REG_RCX,0,t2,r2,d2,ip);
ICMov(tempi,MDF_REG+RT_I64,REG_RBX,0,
MDF_DISP+type_pointed_to,REG_RCX,0,ip);
result_reg=REG_RBX;
res_reg=REG_RBX;
if (tempi->ic_flags&ICF_LOCK)
ICU8(tempi,OC_LOCK_PREFIX);
ICU8(tempi,0x48);
ICU16(tempi,0xC000+op.u8[0]+(result_reg&7)<<11);
ICU16(tempi,0xC000+op.u8[0]+(res_reg&7)<<11);
ICMov(tempi,MDF_DISP+type_pointed_to,REG_RCX,0,
MDF_REG+RT_I64,result_reg,0,ip);
MDF_REG+RT_I64,res_reg,0,ip);
}
}
if (t1.mode)
ICMov(tempi,t1,r1,d1,MDF_REG+RT_I64,result_reg,0,ip);
ICMov(tempi,t1,r1,d1,MDF_REG+RT_I64,res_reg,0,ip);
}
U0 ICShift(CIntermediateCode *tempi,CICType t1,I64 r1,I64 d1,
CICType t2,I64 r2,I64 d2,CICType t3,I64 r3,I64 d3,
I64 us,I64 is,I64 ip)
{
I64 i=0x48,result_reg;
I64 i=0x48,res_reg;
if (tempi->ic_class->raw_type&RTF_UNSIGNED ||
tempi->ic_flags & ICF_USE_UNSIGNED)
is=us;
if (t1&MDF_REG) {
result_reg=r1;
if (result_reg>7)
res_reg=r1;
if (res_reg>7)
i++;
} else
result_reg=REG_RAX;
res_reg=REG_RAX;
if (t3&MDF_IMM) {
ICMov(tempi,MDF_REG+RT_I64,result_reg,0,t2,r2,d2,ip);
ICMov(tempi,MDF_REG+RT_I64,res_reg,0,t2,r2,d2,ip);
if (d3==1)
ICU24(tempi,i+is.u16[2]<<8+(result_reg&7)<<16);
ICU24(tempi,i+is.u16[2]<<8+(res_reg&7)<<16);
else {
ICU24(tempi,i+is.u16[0]<<8+(result_reg&7)<<16);
ICU24(tempi,i+is.u16[0]<<8+(res_reg&7)<<16);
ICU8(tempi,d3);
}
} else {
ICMov(tempi,MDF_REG+RT_I64,REG_RCX,0,t3,r3,d3,ip);
ICMov(tempi,MDF_REG+RT_I64,result_reg,0,t2,r2,d2,ip);
ICU24(tempi,i+is.u16[1]<<8+(result_reg&7)<<16);
ICMov(tempi,MDF_REG+RT_I64,res_reg,0,t2,r2,d2,ip);
ICU24(tempi,i+is.u16[1]<<8+(res_reg&7)<<16);
}
ICMov(tempi,t1,r1,d1,MDF_REG+RT_I64,result_reg,0,ip);
ICMov(tempi,t1,r1,d1,MDF_REG+RT_I64,res_reg,0,ip);
}
U0 ICShiftEqu(CIntermediateCode *tempi,U8 type_pointed_to,
@@ -641,7 +641,7 @@ U0 ICShiftEqu(CIntermediateCode *tempi,U8 type_pointed_to,
CICType t2,I64 r2,I64 d2,
CICType t3,I64 r3,I64 d3,I64 us,I64 is,I64 ip)
{
I64 result_reg;
I64 res_reg;
if (tempi->ic_class->raw_type&RTF_UNSIGNED ||
tempi->ic_flags & ICF_USE_UNSIGNED)
is=us;
@@ -649,46 +649,46 @@ U0 ICShiftEqu(CIntermediateCode *tempi,U8 type_pointed_to,
if (!(t3&MDF_IMM))
ICMov(tempi,MDF_REG+RT_I64,REG_RCX,0,t3,r3,d3,ip);
if (t2&MDF_REG)
result_reg=r2;
res_reg=r2;
else {
result_reg=REG_RAX;
res_reg=REG_RAX;
ICMov(tempi,MDF_REG+RT_I64,REG_RAX,0,
t2&MDG_MASK+type_pointed_to,r2,d2,ip);
}
if (result_reg>7)
if (res_reg>7)
ICU8(tempi,0x49);
else
ICU8(tempi,0x48);
if (t3&MDF_IMM) {
if (d3==1)
ICU16(tempi,is.u16[2]+(result_reg&7)<<8);
ICU16(tempi,is.u16[2]+(res_reg&7)<<8);
else {
ICU16(tempi,is.u16[0]+(result_reg&7)<<8);
ICU16(tempi,is.u16[0]+(res_reg&7)<<8);
ICU8(tempi,d3);
}
} else
ICU16(tempi,is.u16[1]+(result_reg&7)<<8);
ICU16(tempi,is.u16[1]+(res_reg&7)<<8);
ICMov(tempi,t2&MDG_MASK+type_pointed_to,r2,d2,
MDF_REG+RT_I64,result_reg,0,ip);
MDF_REG+RT_I64,res_reg,0,ip);
} else {
if (!(t3&MDF_IMM))
ICMov(tempi,MDF_REG+RT_I64,REG_RCX,0,t3,r3,d3,ip);
ICMov(tempi,MDF_REG+RT_I64,REG_RDX,0,t2,r2,d2,ip);
ICMov(tempi,MDF_REG+RT_I64,REG_RAX,0,MDF_DISP+type_pointed_to,REG_RDX,0,ip);
result_reg=REG_RAX;
res_reg=REG_RAX;
ICU8(tempi,0x48);
if (t3&MDF_IMM) {
if (d3==1)
ICU16(tempi,is.u16[2]+(result_reg&7)<<8);
ICU16(tempi,is.u16[2]+(res_reg&7)<<8);
else {
ICU16(tempi,is.u16[0]+(result_reg&7)<<8);
ICU16(tempi,is.u16[0]+(res_reg&7)<<8);
ICU8(tempi,d3);
}
} else
ICU16(tempi,is.u16[1]+(result_reg&7)<<8);
ICU16(tempi,is.u16[1]+(res_reg&7)<<8);
ICMov(tempi,
MDF_DISP+type_pointed_to,REG_RDX,0,MDF_REG+RT_I64,result_reg,0,ip);
MDF_DISP+type_pointed_to,REG_RDX,0,MDF_REG+RT_I64,res_reg,0,ip);
}
if (t1.mode)
ICMov(tempi,t1,r1,d1,MDF_REG+RT_I64,result_reg,0,ip);
ICMov(tempi,t1,r1,d1,MDF_REG+RT_I64,res_reg,0,ip);
}