added cpu_get_tsc()

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@837 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
bellard 2004-05-20 14:02:14 +00:00
parent b54ad0498e
commit 28ab0e2edb
5 changed files with 56 additions and 11 deletions

View file

@ -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);

View file

@ -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;
}