From: Laurent Vivier Date: Mon, 28 May 2018 19:48:12 +0000 (+0200) Subject: linux-user: SPARC "rd %tick" can be used by user application X-Git-Tag: qemu-xen-4.12.0-rc1~188^2~15 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=b8e13ba94e39aae79be5724b2a382091e4c91c83;p=qemu-xen.git linux-user: SPARC "rd %tick" can be used by user application 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 Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20180528194812.31216-1-laurent@vivier.eu> --- 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 }