Commit 867abc7e50500178423799f28179efef73f3f1b3

Authored by aurel32
1 parent 30a3848b

target-mips: fix commits 7040 and 7042

CPU state should also be saved for helpers that in fine call
cpu_unlink_tb(). Reported by Stefan Weil.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7096 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 6 additions and 2 deletions
target-mips/translate.c
@@ -3697,6 +3697,7 @@ static void gen_mtc0 (CPUState *env, DisasContext *ctx, TCGv t0, int reg, int se @@ -3697,6 +3697,7 @@ static void gen_mtc0 (CPUState *env, DisasContext *ctx, TCGv t0, int reg, int se
3697 case 12: 3697 case 12:
3698 switch (sel) { 3698 switch (sel) {
3699 case 0: 3699 case 0:
  3700 + save_cpu_state(ctx, 1);
3700 gen_helper_mtc0_status(t0); 3701 gen_helper_mtc0_status(t0);
3701 /* BS_STOP isn't good enough here, hflags may have changed. */ 3702 /* BS_STOP isn't good enough here, hflags may have changed. */
3702 gen_save_pc(ctx->pc + 4); 3703 gen_save_pc(ctx->pc + 4);
@@ -3731,6 +3732,7 @@ static void gen_mtc0 (CPUState *env, DisasContext *ctx, TCGv t0, int reg, int se @@ -3731,6 +3732,7 @@ static void gen_mtc0 (CPUState *env, DisasContext *ctx, TCGv t0, int reg, int se
3731 case 13: 3732 case 13:
3732 switch (sel) { 3733 switch (sel) {
3733 case 0: 3734 case 0:
  3735 + save_cpu_state(ctx, 1);
3734 gen_helper_mtc0_cause(t0); 3736 gen_helper_mtc0_cause(t0);
3735 rn = "Cause"; 3737 rn = "Cause";
3736 break; 3738 break;
@@ -4861,6 +4863,7 @@ static void gen_dmtc0 (CPUState *env, DisasContext *ctx, TCGv t0, int reg, int s @@ -4861,6 +4863,7 @@ static void gen_dmtc0 (CPUState *env, DisasContext *ctx, TCGv t0, int reg, int s
4861 case 12: 4863 case 12:
4862 switch (sel) { 4864 switch (sel) {
4863 case 0: 4865 case 0:
  4866 + save_cpu_state(ctx, 1);
4864 gen_helper_mtc0_status(t0); 4867 gen_helper_mtc0_status(t0);
4865 /* BS_STOP isn't good enough here, hflags may have changed. */ 4868 /* BS_STOP isn't good enough here, hflags may have changed. */
4866 gen_save_pc(ctx->pc + 4); 4869 gen_save_pc(ctx->pc + 4);
@@ -4895,14 +4898,13 @@ static void gen_dmtc0 (CPUState *env, DisasContext *ctx, TCGv t0, int reg, int s @@ -4895,14 +4898,13 @@ static void gen_dmtc0 (CPUState *env, DisasContext *ctx, TCGv t0, int reg, int s
4895 case 13: 4898 case 13:
4896 switch (sel) { 4899 switch (sel) {
4897 case 0: 4900 case 0:
  4901 + save_cpu_state(ctx, 1);
4898 gen_helper_mtc0_cause(t0); 4902 gen_helper_mtc0_cause(t0);
4899 rn = "Cause"; 4903 rn = "Cause";
4900 break; 4904 break;
4901 default: 4905 default:
4902 goto die; 4906 goto die;
4903 } 4907 }
4904 - /* Stop translation as we may have switched the execution mode */  
4905 - ctx->bstate = BS_STOP;  
4906 break; 4908 break;
4907 case 14: 4909 case 14:
4908 switch (sel) { 4910 switch (sel) {
@@ -7972,6 +7974,7 @@ static void decode_opc (CPUState *env, DisasContext *ctx) @@ -7972,6 +7974,7 @@ static void decode_opc (CPUState *env, DisasContext *ctx)
7972 break; 7974 break;
7973 case OPC_DI: 7975 case OPC_DI:
7974 check_insn(env, ctx, ISA_MIPS32R2); 7976 check_insn(env, ctx, ISA_MIPS32R2);
  7977 + save_cpu_state(ctx, 1);
7975 gen_helper_di(t0); 7978 gen_helper_di(t0);
7976 gen_store_gpr(t0, rt); 7979 gen_store_gpr(t0, rt);
7977 /* Stop translation as we may have switched the execution mode */ 7980 /* Stop translation as we may have switched the execution mode */
@@ -7979,6 +7982,7 @@ static void decode_opc (CPUState *env, DisasContext *ctx) @@ -7979,6 +7982,7 @@ static void decode_opc (CPUState *env, DisasContext *ctx)
7979 break; 7982 break;
7980 case OPC_EI: 7983 case OPC_EI:
7981 check_insn(env, ctx, ISA_MIPS32R2); 7984 check_insn(env, ctx, ISA_MIPS32R2);
  7985 + save_cpu_state(ctx, 1);
7982 gen_helper_ei(t0); 7986 gen_helper_ei(t0);
7983 gen_store_gpr(t0, rt); 7987 gen_store_gpr(t0, rt);
7984 /* Stop translation as we may have switched the execution mode */ 7988 /* Stop translation as we may have switched the execution mode */