aboutsummaryrefslogtreecommitdiff
path: root/op-arm.c
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2003-07-09 17:10:32 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2003-07-09 17:10:32 +0000
commit6e295807acbaf7eb3200a685376fb968ebdb8571 (patch)
treee5292b167e9550bf6997fd4372108393d0e9454b /op-arm.c
parentf2674e31e0b79a8e30335438f274b846d084a383 (diff)
ARM fixes
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@314 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'op-arm.c')
-rw-r--r--op-arm.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/op-arm.c b/op-arm.c
index 40cf3cd253..8e5cce0e9b 100644
--- a/op-arm.c
+++ b/op-arm.c
@@ -154,11 +154,11 @@ void OPPROTO op_adcl_T0_T1_cc(void)
FORCE_RET();
}
-#define OPSUB(sub, sbc, T0, T1) \
+#define OPSUB(sub, sbc, res, T0, T1) \
\
void OPPROTO op_ ## sub ## l_T0_T1(void) \
{ \
- T0 -= T1; \
+ res = T0 - T1; \
} \
\
void OPPROTO op_ ## sub ## l_T0_T1_cc(void) \
@@ -167,13 +167,14 @@ void OPPROTO op_ ## sub ## l_T0_T1_cc(void) \
src1 = T0; \
T0 -= T1; \
env->NZF = T0; \
- env->CF = src1 < T1; \
+ env->CF = src1 >= T1; \
env->VF = (src1 ^ T1) & (src1 ^ T0); \
+ res = T0; \
} \
\
void OPPROTO op_ ## sbc ## l_T0_T1(void) \
{ \
- T0 = T0 - T1 + env->CF - 1; \
+ res = T0 - T1 + env->CF - 1; \
} \
\
void OPPROTO op_ ## sbc ## l_T0_T1_cc(void) \
@@ -182,20 +183,20 @@ void OPPROTO op_ ## sbc ## l_T0_T1_cc(void) \
src1 = T0; \
if (!env->CF) { \
T0 = T0 - T1 - 1; \
- T0 += T1; \
- env->CF = src1 < T1; \
+ env->CF = src1 >= T1; \
} else { \
T0 = T0 - T1; \
- env->CF = src1 <= T1; \
+ env->CF = src1 > T1; \
} \
env->VF = (src1 ^ T1) & (src1 ^ T0); \
env->NZF = T0; \
+ res = T0; \
FORCE_RET(); \
}
-OPSUB(sub, sbc, T0, T1)
+OPSUB(sub, sbc, T0, T0, T1)
-OPSUB(rsb, rsc, T1, T0)
+OPSUB(rsb, rsc, T0, T1, T0)
void OPPROTO op_andl_T0_T1(void)
{
@@ -222,11 +223,16 @@ void OPPROTO op_notl_T1(void)
T1 = ~T1;
}
-void OPPROTO op_logic_cc(void)
+void OPPROTO op_logic_T0_cc(void)
{
env->NZF = T0;
}
+void OPPROTO op_logic_T1_cc(void)
+{
+ env->NZF = T1;
+}
+
#define EIP (env->regs[15])
void OPPROTO op_test_eq(void)
@@ -334,10 +340,7 @@ void OPPROTO op_jmp(void)
void OPPROTO op_movl_T0_psr(void)
{
- int ZF;
- ZF = (env->NZF == 0);
- T0 = env->cpsr | (env->NZF & 0x80000000) | (ZF << 30) |
- (env->CF << 29) | ((env->VF & 0x80000000) >> 3);
+ T0 = compute_cpsr();
}
/* NOTE: N = 1 and Z = 1 cannot be stored currently */