Received: from eggs.gnu.org ([2001:4830:134:3::10]:33299) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zc5lv-0000eo-6C for qemu-devel@nongnu.org; Wed, 16 Sep 2015 02:00:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zc5lr-0001GJ-Vp for qemu-devel@nongnu.org; Wed, 16 Sep 2015 02:00:47 -0400 Received: from hall.aurel32.net ([2001:bc8:30d7:100::1]:44813) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zc5lr-0001Fy-Qh for qemu-devel@nongnu.org; Wed, 16 Sep 2015 02:00:43 -0400 Date: Wed, 16 Sep 2015 07:27:40 +0200 From: Aurelien Jarno Message-ID: <20150916052740.GB12445@aurel32.net> References: <1441708451-12699-1-git-send-email-alex.smith@imgtec.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1441708451-12699-1-git-send-email-alex.smith@imgtec.com> Subject: Re: [Qemu-devel] [PATCH v2] target-mips: Fix RDHWR on CP0.Count List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alex Smith Cc: Leon Alrae , qemu-devel@nongnu.org, Alex Smith On 2015-09-08 11:34, Alex Smith wrote: > For RDHWR on the CP0.Count register, env->CP0_Count was being returned. > This value is a delta against the QEMU_CLOCK_VIRTUAL clock, not the > correct current value of CP0.Count. Use cpu_mips_get_count() instead. > > Signed-off-by: Alex Smith > Cc: Aurelien Jarno > Cc: Leon Alrae > --- > Changes in v2: > - Fix build breakage for user builds. > - Correct existing code to follow QEMU coding style. > --- > target-mips/op_helper.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/target-mips/op_helper.c b/target-mips/op_helper.c > index 809a061e296b..99574322a29c 100644 > --- a/target-mips/op_helper.c > +++ b/target-mips/op_helper.c > @@ -2184,10 +2184,15 @@ target_ulong helper_rdhwr_synci_step(CPUMIPSState *env) > target_ulong helper_rdhwr_cc(CPUMIPSState *env) > { > if ((env->hflags & MIPS_HFLAG_CP0) || > - (env->CP0_HWREna & (1 << 2))) > + (env->CP0_HWREna & (1 << 2))) { > +#ifdef CONFIG_USER_ONLY > return env->CP0_Count; > - else > +#else > + return (int32_t)cpu_mips_get_count(env); > +#endif > + } else { > helper_raise_exception(env, EXCP_RI); > + } > > return 0; > } Reviewed-by: Aurelien Jarno Independently of your patch, I do wonder if we shouldn't change the return type of cpu_mips_get_count to int32_t. With your patch, there are now 2 calls to this functions, and both cast the value to int32_t. -- Aurelien Jarno GPG: 4096R/1DDD8C9B aurelien@aurel32.net http://www.aurel32.net