linux-user: correctly manage SR in ucontext

Use cpu_m68k_get_ccr()/cpu_m68k_set_ccr() to setup and restore correctly
the value of SR in the ucontext structure

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20170225110517.2832-2-laurent@vivier.eu>
This commit is contained in:
Laurent Vivier 2017-02-25 12:05:16 +01:00
parent 1c1df0198b
commit 3219de458c

View File

@ -5676,6 +5676,7 @@ static inline int target_rt_setup_ucontext(struct target_ucontext *uc,
CPUM68KState *env)
{
target_greg_t *gregs = uc->tuc_mcontext.gregs;
uint32_t sr = cpu_m68k_get_ccr(env);
__put_user(TARGET_MCONTEXT_VERSION, &uc->tuc_mcontext.version);
__put_user(env->dregs[0], &gregs[0]);
@ -5695,7 +5696,7 @@ static inline int target_rt_setup_ucontext(struct target_ucontext *uc,
__put_user(env->aregs[6], &gregs[14]);
__put_user(env->aregs[7], &gregs[15]);
__put_user(env->pc, &gregs[16]);
__put_user(env->sr, &gregs[17]);
__put_user(sr, &gregs[17]);
return 0;
}
@ -5729,7 +5730,7 @@ static inline int target_rt_restore_ucontext(CPUM68KState *env,
__get_user(env->aregs[7], &gregs[15]);
__get_user(env->pc, &gregs[16]);
__get_user(temp, &gregs[17]);
env->sr = (env->sr & 0xff00) | (temp & 0xff);
cpu_m68k_set_ccr(env, temp);
return 0;