linux-user/sparc: Tidy window spill/fill traps

Add some macros to localize the hw difference between v9 and pre-v9.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230216054516.1267305-6-richard.henderson@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
This commit is contained in:
Richard Henderson 2023-02-15 19:45:06 -10:00 committed by Laurent Vivier
parent 88cdb6032f
commit 6f772241e6

View File

@ -158,6 +158,15 @@ static void flush_windows(CPUSPARCState *env)
#define syscall_cc xcc #define syscall_cc xcc
#endif #endif
/* Avoid ifdefs below for the v9 and pre-v9 hw traps. */
#ifdef TARGET_SPARC64
#define TARGET_TT_SPILL TT_SPILL
#define TARGET_TT_FILL TT_FILL
#else
#define TARGET_TT_SPILL TT_WIN_OVF
#define TARGET_TT_FILL TT_WIN_UNF
#endif
void cpu_loop (CPUSPARCState *env) void cpu_loop (CPUSPARCState *env)
{ {
CPUState *cs = env_cpu(env); CPUState *cs = env_cpu(env);
@ -204,20 +213,14 @@ void cpu_loop (CPUSPARCState *env)
env->npc = env->npc + 4; env->npc = env->npc + 4;
break; break;
#ifndef TARGET_SPARC64 case TARGET_TT_SPILL: /* window overflow */
case TT_WIN_OVF: /* window overflow */
save_window(env); save_window(env);
break; break;
case TT_WIN_UNF: /* window underflow */ case TARGET_TT_FILL: /* window underflow */
restore_window(env);
break;
#else
case TT_SPILL: /* window overflow */
save_window(env);
break;
case TT_FILL: /* window underflow */
restore_window(env); restore_window(env);
break; break;
#ifdef TARGET_SPARC64
#ifndef TARGET_ABI32 #ifndef TARGET_ABI32
case 0x16e: case 0x16e:
flush_windows(env); flush_windows(env);