Skip to content

Commit

Permalink
ppc: Don't update NIP in facility unavailable interrupts
Browse files Browse the repository at this point in the history
This is no longer necessary as the helpers will properly retrieve
the return address when needed. Also remove gen_update_current_nip()
which didn't seem to make much sense to me.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
  • Loading branch information
ozbenh authored and dgibson committed Sep 7, 2016
1 parent a13f0a9 commit 57a2988
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 14 deletions.
1 change: 0 additions & 1 deletion target-ppc/cpu.h
Expand Up @@ -1202,7 +1202,6 @@ extern const struct VMStateDescription vmstate_ppc_cpu;
PowerPCCPU *cpu_ppc_init(const char *cpu_model);
void ppc_translate_init(void);
const char *ppc_cpu_lookup_alias(const char *alias);
void gen_update_current_nip(void *opaque);
/* you can call this signal handler from your SIGBUS and SIGSEGV
signal handlers to inform the virtual CPU of exceptions. non zero
is returned if the signal was handled by the virtual CPU. */
Expand Down
9 changes: 5 additions & 4 deletions target-ppc/misc_helper.c
Expand Up @@ -39,15 +39,16 @@ void helper_store_dump_spr(CPUPPCState *env, uint32_t sprn)

#ifdef TARGET_PPC64
static void raise_fu_exception(CPUPPCState *env, uint32_t bit,
uint32_t sprn, uint32_t cause)
uint32_t sprn, uint32_t cause,
uintptr_t raddr)
{
qemu_log("Facility SPR %d is unavailable (SPR FSCR:%d)\n", sprn, bit);

env->spr[SPR_FSCR] &= ~((target_ulong)FSCR_IC_MASK << FSCR_IC_POS);
cause &= FSCR_IC_MASK;
env->spr[SPR_FSCR] |= (target_ulong)cause << FSCR_IC_POS;

helper_raise_exception_err(env, POWERPC_EXCP_FU, 0);
raise_exception_err_ra(env, POWERPC_EXCP_FU, 0, raddr);
}
#endif

Expand All @@ -59,7 +60,7 @@ void helper_fscr_facility_check(CPUPPCState *env, uint32_t bit,
/* Facility is enabled, continue */
return;
}
raise_fu_exception(env, bit, sprn, cause);
raise_fu_exception(env, bit, sprn, cause, GETPC());
#endif
}

Expand All @@ -71,7 +72,7 @@ void helper_msr_facility_check(CPUPPCState *env, uint32_t bit,
/* Facility is enabled, continue */
return;
}
raise_fu_exception(env, bit, sprn, cause);
raise_fu_exception(env, bit, sprn, cause, GETPC());
#endif
}

Expand Down
7 changes: 0 additions & 7 deletions target-ppc/translate.c
Expand Up @@ -266,13 +266,6 @@ static inline void gen_update_nip(DisasContext *ctx, target_ulong nip)
tcg_gen_movi_tl(cpu_nip, nip);
}

void gen_update_current_nip(void *opaque)
{
DisasContext *ctx = opaque;

tcg_gen_movi_tl(cpu_nip, ctx->nip);
}

static void gen_exception_err(DisasContext *ctx, uint32_t excp, uint32_t error)
{
TCGv_i32 t0, t1;
Expand Down
2 changes: 0 additions & 2 deletions target-ppc/translate_init.c
Expand Up @@ -7470,7 +7470,6 @@ static void gen_fscr_facility_check(DisasContext *ctx, int facility_sprn,
TCGv_i32 t2 = tcg_const_i32(sprn);
TCGv_i32 t3 = tcg_const_i32(cause);

gen_update_current_nip(ctx);
gen_helper_fscr_facility_check(cpu_env, t1, t2, t3);

tcg_temp_free_i32(t3);
Expand All @@ -7485,7 +7484,6 @@ static void gen_msr_facility_check(DisasContext *ctx, int facility_sprn,
TCGv_i32 t2 = tcg_const_i32(sprn);
TCGv_i32 t3 = tcg_const_i32(cause);

gen_update_current_nip(ctx);
gen_helper_msr_facility_check(cpu_env, t1, t2, t3);

tcg_temp_free_i32(t3);
Expand Down

0 comments on commit 57a2988

Please sign in to comment.