mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 17:23:56 -06:00
linux-user/sparc: Handle tstate in sparc64_get/set_context()
Correctly implement save/restore of the tstate field in sparc64_get_context() and sparc64_set_context(): * Don't use the CWP value from the guest in set_context * Construct and save a tstate value rather than leaving it as zero in get_context To do this we factor out the "calculate TSTATE value from CPU state" code from sparc_cpu_do_interrupt() into its own sparc64_tstate() function; that in turn requires us to move some of the function prototypes out from inside a CPU_NO_IO_DEFS ifdef guard. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20201106152738.26026-5-peter.maydell@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
This commit is contained in:
parent
0ad20314f1
commit
7a5805a08f
3 changed files with 24 additions and 12 deletions
|
@ -608,10 +608,6 @@ target_ulong cpu_get_psr(CPUSPARCState *env1);
|
|||
void cpu_put_psr(CPUSPARCState *env1, target_ulong val);
|
||||
void cpu_put_psr_raw(CPUSPARCState *env1, target_ulong val);
|
||||
#ifdef TARGET_SPARC64
|
||||
target_ulong cpu_get_ccr(CPUSPARCState *env1);
|
||||
void cpu_put_ccr(CPUSPARCState *env1, target_ulong val);
|
||||
target_ulong cpu_get_cwp64(CPUSPARCState *env1);
|
||||
void cpu_put_cwp64(CPUSPARCState *env1, int cwp);
|
||||
void cpu_change_pstate(CPUSPARCState *env1, uint32_t new_pstate);
|
||||
void cpu_gl_switch_gregs(CPUSPARCState *env, uint32_t new_gl);
|
||||
#endif
|
||||
|
@ -829,4 +825,24 @@ static inline bool tb_am_enabled(int tb_flags)
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifdef TARGET_SPARC64
|
||||
/* win_helper.c */
|
||||
target_ulong cpu_get_ccr(CPUSPARCState *env1);
|
||||
void cpu_put_ccr(CPUSPARCState *env1, target_ulong val);
|
||||
target_ulong cpu_get_cwp64(CPUSPARCState *env1);
|
||||
void cpu_put_cwp64(CPUSPARCState *env1, int cwp);
|
||||
|
||||
static inline uint64_t sparc64_tstate(CPUSPARCState *env)
|
||||
{
|
||||
uint64_t tstate = (cpu_get_ccr(env) << 32) |
|
||||
((env->asi & 0xff) << 24) | ((env->pstate & 0xf3f) << 8) |
|
||||
cpu_get_cwp64(env);
|
||||
|
||||
if (env->def.features & CPU_FEATURE_GL) {
|
||||
tstate |= (env->gl & 7ULL) << 40;
|
||||
}
|
||||
return tstate;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue