From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:48805) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QwzOI-00028d-47 for qemu-devel@nongnu.org; Fri, 26 Aug 2011 12:36:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QwzOH-0003al-1Y for qemu-devel@nongnu.org; Fri, 26 Aug 2011 12:36:22 -0400 Received: from mail-qy0-f180.google.com ([209.85.216.180]:40897) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QwzOG-0003ad-UL for qemu-devel@nongnu.org; Fri, 26 Aug 2011 12:36:21 -0400 Received: by qyk31 with SMTP id 31so2885326qyk.4 for ; Fri, 26 Aug 2011 09:36:20 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <4E57C9AC.4040703@twiddle.net> References: <1314308722-14495-1-git-send-email-rth@twiddle.net> <1314308722-14495-7-git-send-email-rth@twiddle.net> <4E576264.2050200@redhat.com> <4E57C9AC.4040703@twiddle.net> Date: Fri, 26 Aug 2011 17:36:19 +0100 Message-ID: From: Peter Maydell Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 6/6] target-alpha: Add high-resolution access to wall clock and an alarm. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: Paolo Bonzini , qemu-devel@nongnu.org On 26 August 2011 17:28, Richard Henderson wrote: > On 08/25/2011 11:07 PM, Paolo Bonzini wrote: >> On 08/26/2011 05:51 AM, Peter Maydell wrote: >>> Don't you need some magic around helper calls that read/write >>> the time to keep -icount working? I don't understand this but >>> Paolo does... >> >> Let's say I understand the theory (how icount relies on it) >> more than the practice (how the targets should do it). :) > > Heh. =C2=A0Well, let's say that while I've aped the other targets in > how icount is treated in the translator, I have no idea what it > is really supposed to accomplish, and so have never used it. Well, "what it's supposed to accomplish" is straightforward enough, we want to keep a count of cycles executed (and I think also maintain determinism, although that I'm less certain about). Since we only update the count at the start of each basic block, we (potentially) have to stop the basic block where we hit an I/O operation which fiddles with the timer. For I/O via memory accesses this is all dealt with by the generic code, but where the CPU has some instruction which does things with timers not via a memory access there needs to be a bit of special casing. Look at the way target-i386 and target-mips use gen_io_start() and gen_io_end() around x86 io insns and MIPS mtc0. I think that what you need is (a) to bracket with gen_io_start/end and (b) to end the translation block, but that's really just guesswork from the existing code... -- PMM