]> Git Repo - qemu.git/commitdiff
icount: introduce cpu_get_icount_raw
authorPavel Dovgalyuk <[email protected]>
Mon, 8 Dec 2014 07:53:45 +0000 (10:53 +0300)
committerPaolo Bonzini <[email protected]>
Mon, 15 Dec 2014 11:21:02 +0000 (12:21 +0100)
Separate accessing the instruction counter from the compensation for
speed and halting that are introduced by qemu_icount_bias.  This
introduces new infrastructure used by the record/replay patches.

Signed-off-by: Pavel Dovgalyuk <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
cpus.c
include/qemu/timer.h

diff --git a/cpus.c b/cpus.c
index 615d4ae07d3530fe9da36e13286927c9c36fef4b..5f8acba15d26095c1cdecd4919552e7e6dfb39db 100644 (file)
--- 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);
 }
 
index 5f5210d5431ac2796dd7ea76c7fe166989b146ca..3dae414f40a668fa047595c1ff3e4c526f83740f 100644 (file)
@@ -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);
This page took 0.027184 seconds and 4 git commands to generate.