소스 검색

linux-user/sparc64: Fix the handling of window spill trap

Fix the handling of window spill traps by keeping cansave into account
when calculating the new CWP.

Signed-off-by: Giuseppe Musacchio <thatlemon@gmail.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20200625091204.3186186-3-laurent@vivier.eu>
Giuseppe Musacchio 5 년 전
부모
커밋
d43624c400
2개의 변경된 파일10개의 추가작업 그리고 2개의 파일을 삭제
  1. 5 1
      bsd-user/main.c
  2. 5 1
      linux-user/sparc/cpu_loop.c

+ 5 - 1
bsd-user/main.c

@@ -413,7 +413,11 @@ static void save_window(CPUSPARCState *env)
     save_window_offset(env, cpu_cwp_dec(env, env->cwp - 2));
     save_window_offset(env, cpu_cwp_dec(env, env->cwp - 2));
     env->wim = new_wim;
     env->wim = new_wim;
 #else
 #else
-    save_window_offset(env, cpu_cwp_dec(env, env->cwp - 2));
+    /*
+     * cansave is zero if the spill trap handler is triggered by `save` and
+     * nonzero if triggered by a `flushw`
+     */
+    save_window_offset(env, cpu_cwp_dec(env, env->cwp - env->cansave - 2));
     env->cansave++;
     env->cansave++;
     env->canrestore--;
     env->canrestore--;
 #endif
 #endif

+ 5 - 1
linux-user/sparc/cpu_loop.c

@@ -69,7 +69,11 @@ static void save_window(CPUSPARCState *env)
     save_window_offset(env, cpu_cwp_dec(env, env->cwp - 2));
     save_window_offset(env, cpu_cwp_dec(env, env->cwp - 2));
     env->wim = new_wim;
     env->wim = new_wim;
 #else
 #else
-    save_window_offset(env, cpu_cwp_dec(env, env->cwp - 2));
+    /*
+     * cansave is zero if the spill trap handler is triggered by `save` and
+     * nonzero if triggered by a `flushw`
+     */
+    save_window_offset(env, cpu_cwp_dec(env, env->cwp - env->cansave - 2));
     env->cansave++;
     env->cansave++;
     env->canrestore--;
     env->canrestore--;
 #endif
 #endif