qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] target-ppc : Make hreg_store_msr returns exception
@ 2014-09-05 13:45 Pierre Mallard
  2014-09-10 13:19 ` [Qemu-devel] [Qemu-ppc] " Alexander Graf
  0 siblings, 1 reply; 2+ messages in thread
From: Pierre Mallard @ 2014-09-05 13:45 UTC (permalink / raw)
  To: qemu-devel, qemu-ppc; +Cc: Pierre Mallard, tommusta

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.

Signed-off-by: Pierre Mallard <mallard.pierre@gmail.com>
---
 target-ppc/excp_helper.c |    2 +-
 target-ppc/helper_regs.h |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/target-ppc/excp_helper.c b/target-ppc/excp_helper.c
index 922e86d..f76942b 100644
--- a/target-ppc/excp_helper.c
+++ b/target-ppc/excp_helper.c
@@ -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);
diff --git a/target-ppc/helper_regs.h b/target-ppc/helper_regs.h
index 271fddf..36a522a 100644
--- a/target-ppc/helper_regs.h
+++ b/target-ppc/helper_regs.h
@@ -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) {
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [Qemu-ppc] [PATCH] target-ppc : Make hreg_store_msr returns exception
  2014-09-05 13:45 [Qemu-devel] [PATCH] target-ppc : Make hreg_store_msr returns exception Pierre Mallard
@ 2014-09-10 13:19 ` Alexander Graf
  0 siblings, 0 replies; 2+ messages in thread
From: Alexander Graf @ 2014-09-10 13:19 UTC (permalink / raw)
  To: Pierre Mallard, qemu-devel, qemu-ppc; +Cc: tommusta



On 05.09.14 15:45, Pierre Mallard wrote:
> 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.
> 
> Signed-off-by: Pierre Mallard <mallard.pierre@gmail.com>

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-09-10 13:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-05 13:45 [Qemu-devel] [PATCH] target-ppc : Make hreg_store_msr returns exception Pierre Mallard
2014-09-10 13:19 ` [Qemu-devel] [Qemu-ppc] " Alexander Graf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).