Signed-off-by: Philippe Mathieu-Daudé --- target/ppc/cpu.h | 2 ++ target/ppc/cpu.c | 8 ++++++++ target/ppc/excp_helper.c | 3 +-- target/ppc/kvm.c | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index d637a50798f..e3e4bce91b7 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -2822,6 +2822,8 @@ enum { target_ulong cpu_read_xer(const CPUPPCState *env); void cpu_write_xer(CPUPPCState *env, target_ulong xer); +uint64_t ppc_load_epr(CPUPPCState *env); + /* * All 64-bit server processors compliant with arch 2.x, ie. 970 and newer, * have PPC_SEGMENT_64B. diff --git a/target/ppc/cpu.c b/target/ppc/cpu.c index 4d8faaddee2..f24801a9731 100644 --- a/target/ppc/cpu.c +++ b/target/ppc/cpu.c @@ -26,6 +26,7 @@ #include "fpu/softfloat-helpers.h" #include "mmu-hash64.h" #include "helper_regs.h" +#include "system/memory.h" #include "system/tcg.h" target_ulong cpu_read_xer(const CPUPPCState *env) @@ -105,6 +106,13 @@ void ppc_store_lpcr(PowerPCCPU *cpu, target_ulong val) ppc_maybe_interrupt(env); } +uint64_t ppc_load_epr(CPUPPCState *env) +{ + CPUState *cs = env_cpu(env); + + return ldl_phys(cs->as, env->mpic_iack); +} + #if defined(TARGET_PPC64) void ppc_update_ciabr(CPUPPCState *env) { diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index 6d05b865058..3b476c145ab 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -1166,9 +1166,8 @@ static void powerpc_excp_booke(PowerPCCPU *cpu, int excp) break; case POWERPC_EXCP_EXTERNAL: /* External input */ if (env->mpic_proxy) { - CPUState *cs = env_cpu(env); /* IACK the IRQ on delivery */ - env->spr[SPR_BOOKE_EPR] = ldl_phys(cs->as, env->mpic_iack); + env->spr[SPR_BOOKE_EPR] = ppc_load_epr(env); } break; case POWERPC_EXCP_ALIGN: /* Alignment exception */ diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index 41bd03ec2a2..3bff75b7f54 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -1692,7 +1692,7 @@ int kvm_arch_handle_exit(CPUState *cs, struct kvm_run *run) #endif case KVM_EXIT_EPR: trace_kvm_handle_epr(); - run->epr.epr = ldl_phys(cs->as, env->mpic_iack); + run->epr.epr = ppc_load_epr(env); ret = 0; break; case KVM_EXIT_WATCHDOG: -- 2.53.0