From patchwork Mon Apr 12 23:19:26 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 50007 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id BF79AB7C48 for ; Tue, 13 Apr 2010 09:44:07 +1000 (EST) Received: from localhost ([127.0.0.1]:40937 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O1THM-0006CT-9O for incoming@patchwork.ozlabs.org; Mon, 12 Apr 2010 19:42:56 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O1T1v-0000tZ-N5 for qemu-devel@nongnu.org; Mon, 12 Apr 2010 19:26:59 -0400 Received: from [140.186.70.92] (port=54813 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O1T1m-0000nP-Hn for qemu-devel@nongnu.org; Mon, 12 Apr 2010 19:26:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O1T1f-0007FA-G8 for qemu-devel@nongnu.org; Mon, 12 Apr 2010 19:26:50 -0400 Received: from are.twiddle.net ([75.149.56.221]:42314) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O1T1f-0007El-6R for qemu-devel@nongnu.org; Mon, 12 Apr 2010 19:26:43 -0400 Received: by are.twiddle.net (Postfix, from userid 5000) id 9B7F5F84; Mon, 12 Apr 2010 16:26:40 -0700 (PDT) Message-Id: <29d618c3c7e0f73507abf2c0204cf8a83187a3e0.1271114639.git.rth@twiddle.net> In-Reply-To: References: From: Richard Henderson Date: Mon, 12 Apr 2010 16:19:26 -0700 To: qemu-devel@nongnu.org X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: aurelien@aurel32.net Subject: [Qemu-devel] [PATCH 10/10] Implement cpu_get_real_ticks for Alpha. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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