diff options
author | ths <ths@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-12-02 06:10:04 +0000 |
---|---|---|
committer | ths <ths@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-12-02 06:10:04 +0000 |
commit | 823029f909b3666660418387d48ea6a207f23f26 (patch) | |
tree | 356260657906ad5d96f02ce66cad404f7c9879be /target-sh4/op.c | |
parent | a36e69ddfe8452211bcf3ed94716c60bce5ccd8c (diff) |
SH4 delay slot code update, by Magnus Damm.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3761 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'target-sh4/op.c')
-rw-r--r-- | target-sh4/op.c | 54 |
1 files changed, 17 insertions, 37 deletions
diff --git a/target-sh4/op.c b/target-sh4/op.c index 0902fca359..0dcec49060 100644 --- a/target-sh4/op.c +++ b/target-sh4/op.c @@ -19,16 +19,6 @@ */ #include "exec.h" -static inline void set_flag(uint32_t flag) -{ - env->flags |= flag; -} - -static inline void clr_flag(uint32_t flag) -{ - env->flags &= ~flag; -} - static inline void set_t(void) { env->sr |= SR_T; @@ -110,28 +100,37 @@ void OPPROTO op_not_T0(void) void OPPROTO op_bf_s(void) { env->delayed_pc = PARAM1; - set_flag(DELAY_SLOT_CONDITIONAL | ((~env->sr) & SR_T)); + if (!(env->sr & SR_T)) { + env->flags |= DELAY_SLOT_TRUE; + } RETURN(); } void OPPROTO op_bt_s(void) { env->delayed_pc = PARAM1; - set_flag(DELAY_SLOT_CONDITIONAL | (env->sr & SR_T)); + if (env->sr & SR_T) { + env->flags |= DELAY_SLOT_TRUE; + } + RETURN(); +} + +void OPPROTO op_store_flags(void) +{ + env->flags &= DELAY_SLOT_TRUE; + env->flags |= PARAM1; RETURN(); } void OPPROTO op_bra(void) { env->delayed_pc = PARAM1; - set_flag(DELAY_SLOT); RETURN(); } void OPPROTO op_braf_T0(void) { env->delayed_pc = PARAM1 + T0; - set_flag(DELAY_SLOT); RETURN(); } @@ -139,7 +138,6 @@ void OPPROTO op_bsr(void) { env->pr = PARAM1; env->delayed_pc = PARAM2; - set_flag(DELAY_SLOT); RETURN(); } @@ -147,7 +145,6 @@ void OPPROTO op_bsrf_T0(void) { env->pr = PARAM1; env->delayed_pc = PARAM1 + T0; - set_flag(DELAY_SLOT); RETURN(); } @@ -155,26 +152,12 @@ void OPPROTO op_jsr_T0(void) { env->pr = PARAM1; env->delayed_pc = T0; - set_flag(DELAY_SLOT); RETURN(); } void OPPROTO op_rts(void) { env->delayed_pc = env->pr; - set_flag(DELAY_SLOT); - RETURN(); -} - -void OPPROTO op_clr_delay_slot(void) -{ - clr_flag(DELAY_SLOT); - RETURN(); -} - -void OPPROTO op_clr_delay_slot_conditional(void) -{ - clr_flag(DELAY_SLOT_CONDITIONAL); RETURN(); } @@ -242,7 +225,6 @@ void OPPROTO op_rte(void) { env->sr = env->ssr; env->delayed_pc = env->spc; - set_flag(DELAY_SLOT); RETURN(); } @@ -458,7 +440,6 @@ void OPPROTO op_cmp_pz_T0(void) void OPPROTO op_jmp_T0(void) { env->delayed_pc = T0; - set_flag(DELAY_SLOT); RETURN(); } @@ -993,11 +974,10 @@ void OPPROTO op_jT(void) void OPPROTO op_jdelayed(void) { - uint32_t flags; - flags = env->flags; - env->flags &= ~(DELAY_SLOT | DELAY_SLOT_CONDITIONAL); - if (flags & DELAY_SLOT) - GOTO_LABEL_PARAM(1); + if (env->flags & DELAY_SLOT_TRUE) { + env->flags &= ~DELAY_SLOT_TRUE; + GOTO_LABEL_PARAM(1); + } RETURN(); } |