From a721d390b302a383a99224e08d12caad2e97d7ab Mon Sep 17 00:00:00 2001 From: Alex Zuepke Date: Wed, 28 May 2014 19:25:36 +0200 Subject: [PATCH] PPC: e500: Fix MMUCSR0 emulation A "mtspr SPRMMUCSR0, reg" always flushed TLB0, because it passed the SPR number 0x3f4 to the flush routine. But we want to flush either TLB0 or TBL1 depending on the GPR value. Signed-off-by: Alex Zuepke [agraf: change subject line, fix TCGv size mismatch] Signed-off-by: Alexander Graf --- target-ppc/helper.h | 2 +- target-ppc/mmu_helper.c | 2 +- target-ppc/translate_init.c | 4 +--- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/target-ppc/helper.h b/target-ppc/helper.h index 7e00a76d75..5ee470632d 100644 --- a/target-ppc/helper.h +++ b/target-ppc/helper.h @@ -539,7 +539,7 @@ DEF_HELPER_2(booke206_tlbivax, void, env, tl) DEF_HELPER_2(booke206_tlbilx0, void, env, tl) DEF_HELPER_2(booke206_tlbilx1, void, env, tl) DEF_HELPER_2(booke206_tlbilx3, void, env, tl) -DEF_HELPER_2(booke206_tlbflush, void, env, i32) +DEF_HELPER_2(booke206_tlbflush, void, env, tl) DEF_HELPER_3(booke_setpid, void, env, i32, tl) DEF_HELPER_2(6xx_tlbd, void, env, tl) DEF_HELPER_2(6xx_tlbi, void, env, tl) diff --git a/target-ppc/mmu_helper.c b/target-ppc/mmu_helper.c index f029f41965..1e70536e36 100644 --- a/target-ppc/mmu_helper.c +++ b/target-ppc/mmu_helper.c @@ -2886,7 +2886,7 @@ void helper_booke206_tlbilx3(CPUPPCState *env, target_ulong address) tlb_flush(CPU(cpu), 1); } -void helper_booke206_tlbflush(CPUPPCState *env, uint32_t type) +void helper_booke206_tlbflush(CPUPPCState *env, target_ulong type) { int flags = 0; diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c index c13cbba16c..9b342c0438 100644 --- a/target-ppc/translate_init.c +++ b/target-ppc/translate_init.c @@ -1466,9 +1466,7 @@ static void spr_write_e500_l1csr1(void *opaque, int sprn, int gprn) static void spr_write_booke206_mmucsr0 (void *opaque, int sprn, int gprn) { - TCGv_i32 t0 = tcg_const_i32(sprn); - gen_helper_booke206_tlbflush(cpu_env, t0); - tcg_temp_free_i32(t0); + gen_helper_booke206_tlbflush(cpu_env, cpu_gpr[gprn]); } static void spr_write_booke_pid (void *opaque, int sprn, int gprn)