[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH v6 08/32] icount: implement icount requesting
From: |
Pavel Dovgalyuk |
Subject: |
[Qemu-devel] [RFC PATCH v6 08/32] icount: implement icount requesting |
Date: |
Mon, 08 Dec 2014 10:53:45 +0300 |
User-agent: |
StGit/0.16 |
Replay uses number of executed instructions to determine corrent events
injection moments. This patch introduces new function for querying the
instructions counter.
Signed-off-by: Pavel Dovgalyuk <address@hidden>
---
cpus.c | 13 ++++++++++---
include/qemu/timer.h | 1 +
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/cpus.c b/cpus.c
index 38af588..6602acc 100644
--- a/cpus.c
+++ b/cpus.c
@@ -136,8 +136,7 @@ typedef struct TimersState {
static TimersState timers_state;
-/* Return the virtual CPU time, based on the instruction counter. */
-static int64_t cpu_get_icount_locked(void)
+int64_t cpu_get_icount_raw(void)
{
int64_t icount;
CPUState *cpu = current_cpu;
@@ -145,10 +144,18 @@ static int64_t cpu_get_icount_locked(void)
icount = timers_state.qemu_icount;
if (cpu) {
if (!cpu_can_do_io(cpu)) {
- fprintf(stderr, "Bad clock read\n");
+ fprintf(stderr, "Bad icount read\n");
+ exit(1);
}
icount -= (cpu->icount_decr.u16.low + cpu->icount_extra);
}
+ return icount;
+}
+
+/* Return the virtual CPU time, based on the instruction counter. */
+static int64_t cpu_get_icount_locked(void)
+{
+ int64_t icount = cpu_get_icount_raw();
return timers_state.qemu_icount_bias + cpu_icount_to_ns(icount);
}
diff --git a/include/qemu/timer.h b/include/qemu/timer.h
index 5f5210d..3dae414 100644
--- a/include/qemu/timer.h
+++ b/include/qemu/timer.h
@@ -743,6 +743,7 @@ static inline int64_t get_clock(void)
#endif
/* icount */
+int64_t cpu_get_icount_raw(void);
int64_t cpu_get_icount(void);
int64_t cpu_get_clock(void);
int64_t cpu_get_clock_offset(void);
- [Qemu-devel] [RFC PATCH v6 00/32] Deterministic replay core, Pavel Dovgalyuk, 2014/12/08
- [Qemu-devel] [RFC PATCH v6 01/32] i386: partial revert of interrupt poll fix, Pavel Dovgalyuk, 2014/12/08
- [Qemu-devel] [RFC PATCH v6 02/32] cpu-exec: fix cpu_exec_nocache, Pavel Dovgalyuk, 2014/12/08
- [Qemu-devel] [RFC PATCH v6 03/32] icount: set can_do_io outside TB execution, Pavel Dovgalyuk, 2014/12/08
- [Qemu-devel] [RFC PATCH v6 04/32] replay: global variables and function stubs, Pavel Dovgalyuk, 2014/12/08
- [Qemu-devel] [RFC PATCH v6 05/32] sysemu: system functions for replay, Pavel Dovgalyuk, 2014/12/08
- [Qemu-devel] [RFC PATCH v6 06/32] replay: internal functions for replay log, Pavel Dovgalyuk, 2014/12/08
- [Qemu-devel] [RFC PATCH v6 07/32] cpu-exec: reset exception_index correctly, Pavel Dovgalyuk, 2014/12/08
- [Qemu-devel] [RFC PATCH v6 08/32] icount: implement icount requesting,
Pavel Dovgalyuk <=
[Qemu-devel] [RFC PATCH v6 09/32] replay: introduce icount event, Pavel Dovgalyuk, 2014/12/08
[Qemu-devel] [RFC PATCH v6 10/32] i386: do not cross the pages boundaries in replay mode, Pavel Dovgalyuk, 2014/12/08
[Qemu-devel] [RFC PATCH v6 11/32] From 7abf2f72777958d395cfd01d97fe707cc06152b5 Mon Sep 17 00:00:00 2001, Pavel Dovgalyuk, 2014/12/08