* [Qemu-devel] [PATCH] target-mips: Fix RDHWR on CP0.Count
@ 2015-09-04 8:21 Alex Smith
2015-09-08 9:44 ` Leon Alrae
0 siblings, 1 reply; 3+ messages in thread
From: Alex Smith @ 2015-09-04 8:21 UTC (permalink / raw)
To: qemu-devel; +Cc: Leon Alrae, Alex Smith, Aurelien Jarno
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 <alex.smith@imgtec.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: Leon Alrae <leon.alrae@imgtec.com>
---
target-mips/op_helper.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/target-mips/op_helper.c b/target-mips/op_helper.c
index 809a061e296b..6fe00201c10d 100644
--- a/target-mips/op_helper.c
+++ b/target-mips/op_helper.c
@@ -2185,7 +2185,7 @@ target_ulong helper_rdhwr_cc(CPUMIPSState *env)
{
if ((env->hflags & MIPS_HFLAG_CP0) ||
(env->CP0_HWREna & (1 << 2)))
- return env->CP0_Count;
+ return (int32_t)cpu_mips_get_count(env);
else
helper_raise_exception(env, EXCP_RI);
--
2.5.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] target-mips: Fix RDHWR on CP0.Count
2015-09-04 8:21 [Qemu-devel] [PATCH] target-mips: Fix RDHWR on CP0.Count Alex Smith
@ 2015-09-08 9:44 ` Leon Alrae
2015-09-08 10:07 ` Alex Smith
0 siblings, 1 reply; 3+ messages in thread
From: Leon Alrae @ 2015-09-08 9:44 UTC (permalink / raw)
To: Alex Smith, qemu-devel; +Cc: Alex Smith, Aurelien Jarno
On 04/09/15 09:21, 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 <alex.smith@imgtec.com>
> Cc: Aurelien Jarno <aurelien@aurel32.net>
> Cc: Leon Alrae <leon.alrae@imgtec.com>
> ---
> target-mips/op_helper.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/target-mips/op_helper.c b/target-mips/op_helper.c
> index 809a061e296b..6fe00201c10d 100644
> --- a/target-mips/op_helper.c
> +++ b/target-mips/op_helper.c
> @@ -2185,7 +2185,7 @@ target_ulong helper_rdhwr_cc(CPUMIPSState *env)
> {
> if ((env->hflags & MIPS_HFLAG_CP0) ||
> (env->CP0_HWREna & (1 << 2)))
> - return env->CP0_Count;
> + return (int32_t)cpu_mips_get_count(env);
> else
> helper_raise_exception(env, EXCP_RI);
>
>
Thanks for the patch, this looks correct for system mode. However, if
you try to build mips*-linux-user it will fail -- cpu_mips_get_count()
and family aren't defined in linux-user (we don't seem to care about
modifying CP0_Count).
Also, QEMU coding style requires that every indented statement is braced
(these style issues are in quite many places in existing code, but new
code should follow the correct style).
Could you fix these two issues, please?
Thanks,
Leon
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] target-mips: Fix RDHWR on CP0.Count
2015-09-08 9:44 ` Leon Alrae
@ 2015-09-08 10:07 ` Alex Smith
0 siblings, 0 replies; 3+ messages in thread
From: Alex Smith @ 2015-09-08 10:07 UTC (permalink / raw)
To: Leon Alrae, qemu-devel; +Cc: Alex Smith, Aurelien Jarno
On 08/09/2015 10:44, Leon Alrae wrote:
> On 04/09/15 09:21, 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 <alex.smith@imgtec.com>
>> Cc: Aurelien Jarno <aurelien@aurel32.net>
>> Cc: Leon Alrae <leon.alrae@imgtec.com>
>> ---
>> target-mips/op_helper.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/target-mips/op_helper.c b/target-mips/op_helper.c
>> index 809a061e296b..6fe00201c10d 100644
>> --- a/target-mips/op_helper.c
>> +++ b/target-mips/op_helper.c
>> @@ -2185,7 +2185,7 @@ target_ulong helper_rdhwr_cc(CPUMIPSState *env)
>> {
>> if ((env->hflags & MIPS_HFLAG_CP0) ||
>> (env->CP0_HWREna & (1 << 2)))
>> - return env->CP0_Count;
>> + return (int32_t)cpu_mips_get_count(env);
>> else
>> helper_raise_exception(env, EXCP_RI);
>>
>>
>
> Thanks for the patch, this looks correct for system mode. However, if
> you try to build mips*-linux-user it will fail -- cpu_mips_get_count()
> and family aren't defined in linux-user (we don't seem to care about
> modifying CP0_Count).
>
> Also, QEMU coding style requires that every indented statement is braced
> (these style issues are in quite many places in existing code, but new
> code should follow the correct style).
>
> Could you fix these two issues, please?
Sure, will do. I'll send a new patch shortly.
Thanks,
Alex
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-09-08 10:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-04 8:21 [Qemu-devel] [PATCH] target-mips: Fix RDHWR on CP0.Count Alex Smith
2015-09-08 9:44 ` Leon Alrae
2015-09-08 10:07 ` Alex Smith
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).