{
int cf, pf, af, zf, sf, of;
int src1, src2;
- src1 = CC_SRC;
- src2 = CC_SRC - CC_DST;
+ src1 = CC_DST + CC_SRC;
+ src2 = CC_SRC;
cf = (DATA_TYPE)src1 < (DATA_TYPE)src2;
pf = parity_table[(uint8_t)CC_DST];
af = (CC_DST ^ src1 ^ src2) & 0x10;
static int glue(compute_c_sub, SUFFIX)(void)
{
int src1, src2, cf;
- src1 = CC_SRC;
- src2 = CC_SRC - CC_DST;
+ src1 = CC_DST + CC_SRC;
+ src2 = CC_SRC;
cf = (DATA_TYPE)src1 < (DATA_TYPE)src2;
return cf;
}
{
int cf, pf, af, zf, sf, of;
int src1, src2;
- src1 = CC_SRC;
- src2 = CC_SRC - CC_DST - 1;
+ src1 = CC_DST + CC_SRC + 1;
+ src2 = CC_SRC;
cf = (DATA_TYPE)src1 <= (DATA_TYPE)src2;
pf = parity_table[(uint8_t)CC_DST];
af = (CC_DST ^ src1 ^ src2) & 0x10;
static int glue(compute_c_sbb, SUFFIX)(void)
{
int src1, src2, cf;
- src1 = CC_SRC;
- src2 = CC_SRC - CC_DST - 1;
+ src1 = CC_DST + CC_SRC + 1;
+ src2 = CC_SRC;
cf = (DATA_TYPE)src1 <= (DATA_TYPE)src2;
return cf;
}
return cf | pf | af | zf | sf | of;
}
-#if DATA_BITS == 32
static int glue(compute_c_shl, SUFFIX)(void)
{
+ return (CC_SRC >> (DATA_BITS - 1)) & CC_C;
+}
+
+#if DATA_BITS == 32
+static int glue(compute_c_sar, SUFFIX)(void)
+{
return CC_SRC & 1;
}
#endif
void OPPROTO glue(op_jb_sub, SUFFIX)(void)
{
int src1, src2;
- src1 = CC_SRC;
- src2 = CC_SRC - CC_DST;
+ src1 = CC_DST + CC_SRC;
+ src2 = CC_SRC;
if ((DATA_TYPE)src1 < (DATA_TYPE)src2)
- EIP = PARAM1;
+ JUMP_TB(PARAM1, 0, PARAM2);
else
- EIP = PARAM2;
+ JUMP_TB(PARAM1, 1, PARAM3);
FORCE_RET();
}
void OPPROTO glue(op_jz_sub, SUFFIX)(void)
{
if ((DATA_TYPE)CC_DST == 0)
- EIP = PARAM1;
+ JUMP_TB(PARAM1, 0, PARAM2);
else
- EIP = PARAM2;
+ JUMP_TB(PARAM1, 1, PARAM3);
FORCE_RET();
}
void OPPROTO glue(op_jbe_sub, SUFFIX)(void)
{
int src1, src2;
- src1 = CC_SRC;
- src2 = CC_SRC - CC_DST;
+ src1 = CC_DST + CC_SRC;
+ src2 = CC_SRC;
if ((DATA_TYPE)src1 <= (DATA_TYPE)src2)
- EIP = PARAM1;
+ JUMP_TB(PARAM1, 0, PARAM2);
else
- EIP = PARAM2;
+ JUMP_TB(PARAM1, 1, PARAM3);
FORCE_RET();
}
void OPPROTO glue(op_js_sub, SUFFIX)(void)
{
if (CC_DST & SIGN_MASK)
- EIP = PARAM1;
+ JUMP_TB(PARAM1, 0, PARAM2);
else
- EIP = PARAM2;
+ JUMP_TB(PARAM1, 1, PARAM3);
FORCE_RET();
}
void OPPROTO glue(op_jl_sub, SUFFIX)(void)
{
int src1, src2;
- src1 = CC_SRC;
- src2 = CC_SRC - CC_DST;
+ src1 = CC_DST + CC_SRC;
+ src2 = CC_SRC;
if ((DATA_STYPE)src1 < (DATA_STYPE)src2)
- EIP = PARAM1;
+ JUMP_TB(PARAM1, 0, PARAM2);
else
- EIP = PARAM2;
+ JUMP_TB(PARAM1, 1, PARAM3);
FORCE_RET();
}
void OPPROTO glue(op_jle_sub, SUFFIX)(void)
{
int src1, src2;
- src1 = CC_SRC;
- src2 = CC_SRC - CC_DST;
+ src1 = CC_DST + CC_SRC;
+ src2 = CC_SRC;
if ((DATA_STYPE)src1 <= (DATA_STYPE)src2)
- EIP = PARAM1;
+ JUMP_TB(PARAM1, 0, PARAM2);
else
- EIP = PARAM2;
+ JUMP_TB(PARAM1, 1, PARAM3);
FORCE_RET();
}
void OPPROTO glue(op_setb_T0_sub, SUFFIX)(void)
{
int src1, src2;
- src1 = CC_SRC;
- src2 = CC_SRC - CC_DST;
+ src1 = CC_DST + CC_SRC;
+ src2 = CC_SRC;
T0 = ((DATA_TYPE)src1 < (DATA_TYPE)src2);
}
void OPPROTO glue(op_setbe_T0_sub, SUFFIX)(void)
{
int src1, src2;
- src1 = CC_SRC;
- src2 = CC_SRC - CC_DST;
+ src1 = CC_DST + CC_SRC;
+ src2 = CC_SRC;
T0 = ((DATA_TYPE)src1 <= (DATA_TYPE)src2);
}
void OPPROTO glue(op_setl_T0_sub, SUFFIX)(void)
{
int src1, src2;
- src1 = CC_SRC;
- src2 = CC_SRC - CC_DST;
+ src1 = CC_DST + CC_SRC;
+ src2 = CC_SRC;
T0 = ((DATA_STYPE)src1 < (DATA_STYPE)src2);
}
void OPPROTO glue(op_setle_T0_sub, SUFFIX)(void)
{
int src1, src2;
- src1 = CC_SRC;
- src2 = CC_SRC - CC_DST;
+ src1 = CC_DST + CC_SRC;
+ src2 = CC_SRC;
T0 = ((DATA_STYPE)src1 <= (DATA_STYPE)src2);
}
{
int cf;
cf = cc_table[CC_OP].compute_c();
- CC_SRC = T0;
T0 = T0 + T1 + cf;
- CC_DST = T0;
CC_OP = CC_OP_ADDB + SHIFT + cf * 3;
}
{
int cf;
cf = cc_table[CC_OP].compute_c();
- CC_SRC = T0;
T0 = T0 - T1 - cf;
- CC_DST = T0;
CC_OP = CC_OP_SUBB + SHIFT + cf * 3;
}
void OPPROTO glue(glue(op_cmpxchg, SUFFIX), _T0_T1_EAX_cc)(void)
{
- CC_SRC = EAX;
+ CC_SRC = T0;
CC_DST = EAX - T0;
if ((DATA_TYPE)CC_DST == 0) {
T0 = T1;
#define STRING_SUFFIX _a32
#define SI_ADDR (uint8_t *)A0 + ESI
-#define DI_ADDR env->seg_cache[R_ES].base + EDI
+#define DI_ADDR env->segs[R_ES].base + EDI
#define INC_SI() ESI += inc
#define INC_DI() EDI += inc
#define CX ECX
#define STRING_SUFFIX _a16
#define SI_ADDR (uint8_t *)A0 + (ESI & 0xffff)
-#define DI_ADDR env->seg_cache[R_ES].base + (EDI & 0xffff)
+#define DI_ADDR env->segs[R_ES].base + (EDI & 0xffff)
#define INC_SI() ESI = (ESI & ~0xffff) | ((ESI + inc) & 0xffff)
#define INC_DI() EDI = (EDI & ~0xffff) | ((EDI + inc) & 0xffff)
#define CX (ECX & 0xffff)