From patchwork Mon Apr 12 23:19:26 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [10/10] Implement cpu_get_real_ticks for Alpha. From: Richard Henderson X-Patchwork-Id: 50007 Message-Id: <29d618c3c7e0f73507abf2c0204cf8a83187a3e0.1271114639.git.rth@twiddle.net> To: qemu-devel@nongnu.org Cc: aurelien@aurel32.net Date: Mon, 12 Apr 2010 16:19:26 -0700 Signed-off-by: Richard Henderson --- qemu-timer.h | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/qemu-timer.h b/qemu-timer.h index d2e15f4..6e2d2e1 100644 --- a/qemu-timer.h +++ b/qemu-timer.h @@ -209,6 +209,19 @@ static inline int64_t cpu_get_real_ticks(void) return (int64_t)(count * cyc_per_count); } +#elif defined(__alpha__) + +static inline int64_t cpu_get_real_ticks(void) +{ + uint64_t cc; + uint32_t cur, ofs; + + asm volatile("rpcc %0" : "=r"(cc)); + cur = cc; + ofs = cc >> 32; + return cur - ofs; +} + #else /* The host CPU doesn't have an easily accessible cycle counter. Just return a monotonically increasing value. This will be