aboutsummaryrefslogtreecommitdiff
path: root/target-m68k/helper.c
diff options
context:
space:
mode:
Diffstat (limited to 'target-m68k/helper.c')
-rw-r--r--target-m68k/helper.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/target-m68k/helper.c b/target-m68k/helper.c
index d9ea830c67..1a54e6678b 100644
--- a/target-m68k/helper.c
+++ b/target-m68k/helper.c
@@ -132,7 +132,7 @@ void m68k_cpu_init_gdb(M68kCPU *cpu)
/* TODO: Add [E]MAC registers. */
}
-uint32_t cpu_m68k_flush_flags(CPUM68KState *env, int op)
+static uint32_t cpu_m68k_flush_flags(CPUM68KState *env, int op)
{
int flags;
uint32_t src;
@@ -272,6 +272,18 @@ set_x:
return flags;
}
+uint32_t cpu_m68k_get_ccr(CPUM68KState *env)
+{
+ return cpu_m68k_flush_flags(env, env->cc_op) | env->cc_x * CCF_X;
+}
+
+void cpu_m68k_set_ccr(CPUM68KState *env, uint32_t val)
+{
+ env->cc_op = CC_OP_FLAGS;
+ env->cc_dest = val & 0xf;
+ env->cc_x = (val & CCF_X ? 1 : 0);
+}
+
void HELPER(movec)(CPUM68KState *env, uint32_t reg, uint32_t val)
{
M68kCPU *cpu = m68k_env_get_cpu(env);
@@ -466,7 +478,8 @@ uint32_t HELPER(addx_cc)(CPUM68KState *env, uint32_t op1, uint32_t op2)
void HELPER(set_sr)(CPUM68KState *env, uint32_t val)
{
- env->sr = val & 0xffff;
+ env->sr = val & 0xffe0;
+ cpu_m68k_set_ccr(env, val);
m68k_switch_sp(env);
}