* [Qemu-devel] [PATCH] linux-user: SPARC "rd %tick" can be used by user application
@ 2018-05-28 19:48 Laurent Vivier
2018-05-28 22:25 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 2+ messages in thread
From: Laurent Vivier @ 2018-05-28 19:48 UTC (permalink / raw)
To: Mark Cave-Ayland, qemu-devel
Cc: Artyom Tarasenko, Riku Voipio, Laurent Vivier
we have the same problem decribed in 7d6b1daedd
("linux-user, ppc: mftbl can be used by user application")
for ppc in the case of sparc.
When we use an application trying to resolve a name, it hangs in
0x00000000ff5dd40c: rd %tick, %o5
0x00000000ff5dd410: srlx %o5, 0x20, %o4
0x00000000ff5dd414: btst %o5, %g4
0x00000000ff5dd418: be %icc, 0xff5dd40c
because %tick is staying at 0.
As QEMU_CLOCK_VIRTUAL is not available in linux-user mode,
simply use cpu_get_host_ticks() instead.
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
target/sparc/helper.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/target/sparc/helper.c b/target/sparc/helper.c
index 1d854890b4..46232788c8 100644
--- a/target/sparc/helper.c
+++ b/target/sparc/helper.c
@@ -67,7 +67,9 @@ uint64_t helper_tick_get_count(CPUSPARCState *env, void *opaque, int mem_idx)
return cpu_tick_get_count(timer);
#else
- return 0;
+ /* In user-mode, QEMU_CLOCK_VIRTUAL doesn't exist.
+ Just pass through the host cpu clock ticks. */
+ return cpu_get_host_ticks();
#endif
}
--
2.14.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] linux-user: SPARC "rd %tick" can be used by user application
2018-05-28 19:48 [Qemu-devel] [PATCH] linux-user: SPARC "rd %tick" can be used by user application Laurent Vivier
@ 2018-05-28 22:25 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 2+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-05-28 22:25 UTC (permalink / raw)
To: Laurent Vivier, Mark Cave-Ayland, qemu-devel
Cc: Riku Voipio, Artyom Tarasenko
On 05/28/2018 04:48 PM, Laurent Vivier wrote:
> we have the same problem decribed in 7d6b1daedd
> ("linux-user, ppc: mftbl can be used by user application")
> for ppc in the case of sparc.
>
> When we use an application trying to resolve a name, it hangs in
>
> 0x00000000ff5dd40c: rd %tick, %o5
> 0x00000000ff5dd410: srlx %o5, 0x20, %o4
> 0x00000000ff5dd414: btst %o5, %g4
> 0x00000000ff5dd418: be %icc, 0xff5dd40c
>
> because %tick is staying at 0.
>
> As QEMU_CLOCK_VIRTUAL is not available in linux-user mode,
> simply use cpu_get_host_ticks() instead.
>
> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> target/sparc/helper.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/target/sparc/helper.c b/target/sparc/helper.c
> index 1d854890b4..46232788c8 100644
> --- a/target/sparc/helper.c
> +++ b/target/sparc/helper.c
> @@ -67,7 +67,9 @@ uint64_t helper_tick_get_count(CPUSPARCState *env, void *opaque, int mem_idx)
>
> return cpu_tick_get_count(timer);
> #else
> - return 0;
> + /* In user-mode, QEMU_CLOCK_VIRTUAL doesn't exist.
> + Just pass through the host cpu clock ticks. */
> + return cpu_get_host_ticks();
> #endif
> }
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-05-28 22:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-28 19:48 [Qemu-devel] [PATCH] linux-user: SPARC "rd %tick" can be used by user application Laurent Vivier
2018-05-28 22:25 ` Philippe Mathieu-Daudé
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).