From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55466) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZctoM-0005Xi-VI for qemu-devel@nongnu.org; Fri, 18 Sep 2015 07:26:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZctoJ-0007b9-P6 for qemu-devel@nongnu.org; Fri, 18 Sep 2015 07:26:38 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:59205) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZctoJ-0007al-JT for qemu-devel@nongnu.org; Fri, 18 Sep 2015 07:26:35 -0400 From: Leon Alrae Date: Fri, 18 Sep 2015 12:25:28 +0100 Message-ID: <1442575535-4735-4-git-send-email-leon.alrae@imgtec.com> In-Reply-To: <1442575535-4735-1-git-send-email-leon.alrae@imgtec.com> References: <1442575535-4735-1-git-send-email-leon.alrae@imgtec.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PULL 03/10] target-mips: Fix RDHWR on CP0.Count List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Alex Smith , Aurelien Jarno From: Alex Smith 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 Reviewed-by: Leon Alrae Reviewed-by: Aurelien Jarno Signed-off-by: Leon Alrae --- 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 1aa9e3c..94de108 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; } -- 2.1.0