From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55153) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XF3pm-0002TR-FW for qemu-devel@nongnu.org; Wed, 06 Aug 2014 12:13:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XF3pg-0005VO-Ah for qemu-devel@nongnu.org; Wed, 06 Aug 2014 12:13:02 -0400 Received: from mail-wi0-x235.google.com ([2a00:1450:400c:c05::235]:61427) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XF3pg-0005VB-2x for qemu-devel@nongnu.org; Wed, 06 Aug 2014 12:12:56 -0400 Received: by mail-wi0-f181.google.com with SMTP id bs8so3509119wib.2 for ; Wed, 06 Aug 2014 09:12:55 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Wed, 6 Aug 2014 18:12:28 +0200 Message-Id: <1407341555-13173-5-git-send-email-pbonzini@redhat.com> In-Reply-To: <1407341555-13173-1-git-send-email-pbonzini@redhat.com> References: <1407341555-13173-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PULL 04/11] timer: add cpu_icount_to_ns function. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: KONRAD Frederic 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 Reviewed-by: Paolo Bonzini Signed-off-by: Paolo Bonzini --- cpus.c | 7 ++++++- include/qemu/timer.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cpus.c b/cpus.c index a6b6557..62636a6 100644 --- a/cpus.c +++ b/cpus.c @@ -146,7 +146,7 @@ static int64_t cpu_get_icount_locked(void) } icount -= (cpu->icount_decr.u16.low + cpu->icount_extra); } - return timers_state.qemu_icount_bias + (icount << icount_time_shift); + return timers_state.qemu_icount_bias + cpu_icount_to_ns(icount); } int64_t cpu_get_icount(void) @@ -162,6 +162,11 @@ int64_t cpu_get_icount(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 7f9a074..e12c714 100644 --- a/include/qemu/timer.h +++ b/include/qemu/timer.h @@ -745,6 +745,7 @@ static inline int64_t get_clock(void) /* icount */ 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) */ -- 1.9.3