From e3d643ea1603e75da3d32e58c559963e0f89a5cf Mon Sep 17 00:00:00 2001 From: Matt Borgerson Date: Wed, 3 Aug 2016 23:13:38 -0700 Subject: [PATCH] Fix the TSC at 733 MHz The time stamp counter (accessed via `rdtsc`) may be used as a performance counter in some titles. On the Xbox, the TSC runs at a constant 733 MHz. --- hw/i386/pc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 6c82ada3d4..c8dc98b645 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -144,7 +144,12 @@ static uint64_t ioportF0_read(void *opaque, hwaddr addr, unsigned size) /* TSC handling */ uint64_t cpu_get_tsc(CPUX86State *env) { +#ifdef TARGET_XBOX + return muldiv64(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL), 733333333, + get_ticks_per_sec()); +#else return cpu_get_ticks(); +#endif } /* SMM support */