Le 01/11/2016 à 21:03, Laurent Vivier a écrit : > diff --git a/target-m68k/op_helper.c b/target-m68k/op_helper.c > index 48e02e4..a4bfa4e 100644
> +void HELPER(divull)(CPUM68KState *env, int numr, int regr, uint32_t den) > +{ > + uint64_t num = deposit64(env->dregs[numr], 32, 32, env->dregs[regr]); > + uint64_t quot; > + uint32_t rem; > + > + if (den == 0) { > + raise_exception_ra(env, EXCP_DIV0, GETPC()); > + } > + quot = num / den; > + rem = num % den; > + > + env->cc_c = 0; /* always cleared, even if overflow */ > + if (quot > 0xffffffffULL) { > + env->cc_v = -1; > + /* nothing else is modified */ > + /* real 68040 keeps Z and N on overflow, > + * whereas documentation says "undefined" > + */ > + return; > + } ... > + > +void HELPER(divsll)(CPUM68KState *env, int numr, int regr, int32_t den) > +{ > + int64_t num = deposit64(env->dregs[numr], 32, 32, env->dregs[regr]); > + int64_t quot; > int32_t rem; > > - num = env->div1; > - den = env->div2; > if (den == 0) { > - raise_exception(env, EXCP_DIV0); > + raise_exception_ra(env, EXCP_DIV0, GETPC()); > } > quot = num / den; > rem = num % den; > > - env->cc_v = (word && quot != (int16_t)quot ? -1 : 0); > + env->cc_c = 0; /* always cleared, even if overflow */ > + if (quot != (int32_t)quot) { > + env->cc_v = -1; > + /* nothing else is modified */ > + /* real 68040 keeps Z and N on overflow, > + * whereas documentation says "undefined" > + */ > + return; > + } On a real 68040, for divsll and divull, Z is unset. (while divsw/divuw don't modify it as we do). So I will update the patch with this behavior. Laurent