Instead, route cpu_get_ticks through accel driver.
---
accel.h | 9 +++++++++
hw/pc.c | 13 ++-----------
kqemu.c | 4 ++++
3 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/accel.h b/accel.h
index 5395e05..9d5b3a2 100644
--- a/accel.h
+++ b/accel.h
@@ -7,6 +7,7 @@ typedef struct QEMUAccel {
int (*profile)(CPUState *env, char *buf);
void (*set_notdirty)(ram_addr_t addr);
void (*modify_page)(ram_addr_t addr, int dirty_flags);
+ uint64_t (*get_real_ticks)(void);
} QEMUAccel;
extern QEMUAccel *current_accel;
@@ -66,3 +67,11 @@ static inline void accel_modify_page(target_ulong addr, int
dirty_flags)
current_accel->modify_page(addr, dirty_flags);
}
+int64_t cpu_get_ticks(void);
+
+static inline uint64_t accel_get_real_ticks(void)
+{
+ if (current_accel && current_accel->get_real_ticks)
+ return current_accel->get_real_ticks();
+ return cpu_get_ticks();
+}
diff --git a/hw/pc.c b/hw/pc.c
index 4c5e1c3..3d0e038 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -32,6 +32,7 @@
#include "smbus.h"
#include "boards.h"
#include "console.h"
+#include "accel.h"
/* output Bochs bios info messages */
//#define DEBUG_BIOS
@@ -73,17 +74,7 @@ static void ioportF0_write(void *opaque, uint32_t addr,
uint32_t data)
/* TSC handling */
uint64_t cpu_get_tsc(CPUX86State *env)
{
- /* Note: when using kqemu, it is more logical to return the host TSC
- because kqemu does not trap the RDTSC instruction for
- performance reasons */
-#if USE_KQEMU
- if (env->kqemu_enabled) {
- return cpu_get_real_ticks();
- } else
-#endif
- {
- return cpu_get_ticks();
- }
+ return accel_get_real_ticks();
}
/* SMM support */
diff --git a/kqemu.c b/kqemu.c
index 9c3d0c5..9184b26 100644
--- a/kqemu.c
+++ b/kqemu.c
@@ -444,6 +444,10 @@ QEMUAccel kqemu_accel = {
.profile = kqemu_profile,
.set_notdirty = kqemu_set_notdirty,
.modify_page = kqemu_modify_page,
+ /* Note: when using kqemu, it is more logical to return the host TSC
+ because kqemu does not trap the RDTSC instruction for
+ performance reasons */
+ .get_real_ticks = cpu_get_real_ticks,
};
--
1.5.5.1
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html