From 28ab0e2edb36685da7280b24e665962754d9e4ff Mon Sep 17 00:00:00 2001 From: bellard Date: Thu, 20 May 2004 14:02:14 +0000 Subject: added cpu_get_tsc() git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@837 c046a42c-6fe2-441c-8c8c-71466251a162 --- target-i386/cpu.h | 2 ++ target-i386/helper.c | 13 ++----------- 2 files changed, 4 insertions(+), 11 deletions(-) (limited to 'target-i386') diff --git a/target-i386/cpu.h b/target-i386/cpu.h index 19340d2579..9f16a487f0 100644 --- a/target-i386/cpu.h +++ b/target-i386/cpu.h @@ -443,6 +443,8 @@ int cpu_x86_signal_handler(int host_signum, struct siginfo *info, void *puc); void cpu_x86_set_a20(CPUX86State *env, int a20_state); +uint64_t cpu_get_tsc(CPUX86State *env); + /* will be suppressed */ void cpu_x86_update_cr0(CPUX86State *env, uint32_t new_cr0); diff --git a/target-i386/helper.c b/target-i386/helper.c index f2305e32c4..5782babc20 100644 --- a/target-i386/helper.c +++ b/target-i386/helper.c @@ -1775,20 +1775,11 @@ void helper_invlpg(unsigned int addr) cpu_x86_flush_tlb(env, addr); } -/* rdtsc */ -#if !defined(__i386__) && !defined(__x86_64__) -uint64_t emu_time; -#endif - void helper_rdtsc(void) { uint64_t val; -#if defined(__i386__) || defined(__x86_64__) - asm volatile ("rdtsc" : "=A" (val)); -#else - /* better than nothing: the time increases */ - val = emu_time++; -#endif + + val = cpu_get_tsc(env); EAX = val; EDX = val >> 32; } -- cgit v1.2.3