Skip to contentSkip to conversation

target-ppc : Make hreg_store_msr returns exception

PATCH In review Pierre Mallard 2 participants 2 messages Sep 5, 2014 – Sep 10, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target-ppc : Make hreg_store_msr returns exception

hreg_store_msr was both returning 0 or an exception number which could be POWERPC_EXCP_NONE. In case POWERPC_EXCP_NONE was returned, helper_store_msr was handling uncorrectly this return value and raise an exception. This patch correct this behavior by making hreg_store_msr always return an exception number, and helper_store_msr test for POWERPC_EXCP_NONE.

---
 target-ppc/excp_helper.c |    2 +-
 target-ppc/helper_regs.h |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
target-ppc/excp_helper.c +1 -1
index 922e86d..f76942b 100644
@@ -855,7 +855,7 @@ void helper_store_msr(CPUPPCState *env, target_ulong val)
     CPUState *cs;
 
     val = hreg_store_msr(env, val, 0);
-    if (val != 0) {
+    if (val != POWERPC_EXCP_NONE) {
         cs = CPU(ppc_env_get_cpu(env));
         cs->interrupt_request |= CPU_INTERRUPT_EXITTB;
         helper_raise_exception(env, val);
target-ppc/helper_regs.h +1 -1
index 271fddf..36a522a 100644
@@ -72,7 +72,7 @@ static inline int hreg_store_msr(CPUPPCState *env, target_ulong value,
     CPUState *cs = CPU(ppc_env_get_cpu(env));
 #endif
 
-    excp = 0;
+    excp = POWERPC_EXCP_NONE;
     value &= env->msr_mask;
 #if !defined(CONFIG_USER_ONLY)
     if (!alter_hv) {
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 7 lines · Pierre Mallard

hreg_store_msr was both returning 0 or an exception number which could be POWERPC_EXCP_NONE. In case POWERPC_EXCP_NONE was returned, helper_store_msr was handling uncorrectly this return value and raise an exception. This patch correct this behavior by making hreg_store_msr always return an exception number, and helper_store_msr test for POWERPC_EXCP_NONE.

Are you sure that's a bug, not a feature? I think this idea behind POWERPC_EXCP_NONE in this code path is to pull the guest out of its TB so that no stale code could be executed after an MSR.IR/DR change.

Alex