Commit 3ede8f69 authored by Julio Guerra's avatar Julio Guerra Committed by Michael Tokarev
Browse files

taget-ppc: Fix read access to IBAT registers higher than IBAT3



Fix the index used to read the IBAT's vector which results in IBAT0..3 instead
of IBAT4..N.

The bug appeared by saving/restoring contexts including IBATs values.

Signed-off-by: default avatarJulio Guerra <julio@farjump.io>
Signed-off-by: default avatarMichael Tokarev <mjt@tls.msk.ru>
parent 68851b98
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -305,7 +305,7 @@ static void spr_read_ibat (DisasContext *ctx, int gprn, int sprn)

static void spr_read_ibat_h (DisasContext *ctx, int gprn, int sprn)
{
    tcg_gen_ld_tl(cpu_gpr[gprn], cpu_env, offsetof(CPUPPCState, IBAT[sprn & 1][(sprn - SPR_IBAT4U) / 2]));
    tcg_gen_ld_tl(cpu_gpr[gprn], cpu_env, offsetof(CPUPPCState, IBAT[sprn & 1][((sprn - SPR_IBAT4U) / 2) + 4]));
}

static void spr_write_ibatu (DisasContext *ctx, int sprn, int gprn)