From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55675) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VlPmP-0006I9-Ex for qemu-devel@nongnu.org; Tue, 26 Nov 2013 16:02:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VlPmI-0004tz-Jf for qemu-devel@nongnu.org; Tue, 26 Nov 2013 16:02:45 -0500 Received: from mail-lb0-f180.google.com ([209.85.217.180]:40571) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VlPmI-0004tm-CU for qemu-devel@nongnu.org; Tue, 26 Nov 2013 16:02:38 -0500 Received: by mail-lb0-f180.google.com with SMTP id w6so4747877lbh.25 for ; Tue, 26 Nov 2013 13:02:37 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <1385389344-22301-1-git-send-email-sebastian.huber@embedded-brains.de> References: <1385389344-22301-1-git-send-email-sebastian.huber@embedded-brains.de> From: Peter Maydell Date: Tue, 26 Nov 2013 21:02:17 +0000 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] [PATCH] SPARC: Fix LEON3 power down instruction List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Sebastian Huber Cc: Ronald Hecht , Blue Swirl , QEMU Developers , Fabien Chouteau On 25 November 2013 14:22, Sebastian Huber wrote: > The env->pc is not necessarily up-to-date in the helper function. Use > the program counter of the disassembly context instead. > > Signed-off-by: Sebastian Huber > --- > target-sparc/helper.c | 6 +++--- > target-sparc/helper.h | 2 +- > target-sparc/translate.c | 3 ++- > 3 files changed, 6 insertions(+), 5 deletions(-) > > diff --git a/target-sparc/helper.c b/target-sparc/helper.c > index e70d1bc..50912ff 100644 > --- a/target-sparc/helper.c > +++ b/target-sparc/helper.c > @@ -314,14 +314,14 @@ target_ulong helper_tsubcctv(CPUSPARCState *env, target_ulong src1, > } > > #ifndef TARGET_SPARC64 > -void helper_power_down(CPUSPARCState *env) > +void helper_power_down(CPUSPARCState *env, uint32_t pc) > { > CPUState *cs = CPU(sparc_env_get_cpu(env)); > > cs->halted = 1; > env->exception_index = EXCP_HLT; > - env->pc = env->npc; > - env->npc = env->pc + 4; > + env->pc = pc + 4; > + env->npc = pc + 8; > cpu_loop_exit(env); This seems a bit of an odd way to do this. I think most of the frontends have the generated code do a sync-up of the PC before calling the helper. -- PMM