[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 28/47] icount: introduce cpu_get_icount_raw
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 28/47] icount: introduce cpu_get_icount_raw |
Date: |
Mon, 15 Dec 2014 17:38:12 +0100 |
From: Pavel Dovgalyuk <address@hidden>
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 <address@hidden>
Signed-off-by: Paolo Bonzini <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 615d4ae..5f8acba 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);
--
1.8.3.1
- [Qemu-devel] [PULL 23/47] scsi: Use g_new() & friends where that makes obvious sense, (continued)
- [Qemu-devel] [PULL 27/47] icount: set can_do_io outside TB execution, Paolo Bonzini, 2014/12/15
- [Qemu-devel] [PULL 25/47] cpu-exec: fix cpu_exec_nocache, Paolo Bonzini, 2014/12/15
- [Qemu-devel] [PULL 28/47] icount: introduce cpu_get_icount_raw,
Paolo Bonzini <=
- [Qemu-devel] [PULL 29/47] cpu-exec: invalidate nocache translation if they are interrupted, Paolo Bonzini, 2014/12/15
- [Qemu-devel] [PULL 30/47] timer: introduce new QEMU_CLOCK_VIRTUAL_RT clock, Paolo Bonzini, 2014/12/15
- [Qemu-devel] [PULL 31/47] cpus: make icount warp behave well with respect to stop/cont, Paolo Bonzini, 2014/12/15
- [Qemu-devel] [PULL 32/47] i386: do not cross the pages boundaries in replay mode, Paolo Bonzini, 2014/12/15
- [Qemu-devel] [PULL 34/47] target-i386: add VME to all CPUs, Paolo Bonzini, 2014/12/15
- [Qemu-devel] [PULL 33/47] pc: add 2.3 machine types, Paolo Bonzini, 2014/12/15
- [Qemu-devel] [PULL 35/47] target-i386: add f16c and rdrand to Haswell and Broadwell, Paolo Bonzini, 2014/12/15
- [Qemu-devel] [PULL 36/47] target-i386: add Ivy Bridge CPU model, Paolo Bonzini, 2014/12/15
- [Qemu-devel] [PULL 38/47] linuxboot: fix loading old kernels, Paolo Bonzini, 2014/12/15
- [Qemu-devel] [PULL 37/47] kvm/apic: fix 2.2->2.1 migration, Paolo Bonzini, 2014/12/15