From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35820) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WRHnX-0005fn-DA for qemu-devel@nongnu.org; Sat, 22 Mar 2014 05:01:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WRHnS-00034j-8W for qemu-devel@nongnu.org; Sat, 22 Mar 2014 05:00:59 -0400 Received: from mail-ee0-x230.google.com ([2a00:1450:4013:c00::230]:58403) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WRHnS-00034J-0P for qemu-devel@nongnu.org; Sat, 22 Mar 2014 05:00:54 -0400 Received: by mail-ee0-f48.google.com with SMTP id b57so2558031eek.21 for ; Sat, 22 Mar 2014 02:00:53 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <532D5141.4030406@redhat.com> Date: Sat, 22 Mar 2014 10:00:49 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1395429454-24690-1-git-send-email-fred.konrad@greensocs.com> <1395429454-24690-8-git-send-email-fred.konrad@greensocs.com> In-Reply-To: <1395429454-24690-8-git-send-email-fred.konrad@greensocs.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC PATCH 07/12] timer: add cpu_icount_to_ns function. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: fred.konrad@greensocs.com, qemu-devel@nongnu.org Cc: mark.burton@greensocs.com Il 21/03/2014 20:17, fred.konrad@greensocs.com ha scritto: > From: KONRAD Frederic > > This adds cpu_icount_to_ns function which is needed for reverse execution. > > It returns the time for a specific instruction. > > Signed-off-by: KONRAD Frederic > --- > cpus.c | 9 +++++++-- > include/qemu/timer.h | 1 + > 2 files changed, 8 insertions(+), 2 deletions(-) > > diff --git a/cpus.c b/cpus.c > index 825d438..007de34 100644 > --- a/cpus.c > +++ b/cpus.c > @@ -146,9 +146,9 @@ static int64_t cpu_get_icount_locked(int with_bias) > } > > if (with_bias) { > - return timers_state.qemu_icount_bias + (icount << icount_time_shift); > + return timers_state.qemu_icount_bias + cpu_icount_to_ns(icount); > } else { > - return icount << icount_time_shift; > + return cpu_icount_to_ns(icount); > } > } > > @@ -178,6 +178,11 @@ int64_t cpu_get_icount_wo_bias(void) > return icount; > } > > +int64_t cpu_icount_to_ns(int64_t icount) > +{ > + return icount << icount_time_shift; > +} > + > /* return the host CPU cycle counter and handle stop/restart */ > /* Caller must hold the BQL */ > int64_t cpu_get_ticks(void) > diff --git a/include/qemu/timer.h b/include/qemu/timer.h > index da47194..0861d99 100644 > --- a/include/qemu/timer.h > +++ b/include/qemu/timer.h > @@ -753,6 +753,7 @@ static inline int64_t get_clock(void) > int64_t cpu_get_icount_wo_bias(void); > int64_t cpu_get_icount(void); > int64_t cpu_get_clock(void); > +int64_t cpu_icount_to_ns(int64_t icount); > > /*******************************************/ > /* host CPU ticks (if available) */ > Reviewed-by: Paolo Bonzini