From 1b050077d2d72b15c73257c13e2e46932786f7e2 Mon Sep 17 00:00:00 2001 From: Andre Przywara Date: Sat, 19 Sep 2009 00:30:49 +0200 Subject: target-i386: add RDTSCP support RDTSCP reads the time stamp counter and atomically also the content of a 32-bit MSR, which can be freely set by the OS. This allows CPU local data to be queried by userspace. Linux uses this to allow a fast implementation of the getcpu() syscall, which uses the vsyscall page to avoid a context switch. AMD CPUs since K8RevF and Intel CPUs since Nehalem support this instruction. RDTSCP is guarded by the RDTSCP CPUID bit (Fn8000_0001:EDX[27]). Signed-off-by: Andre Przywara Signed-off-by: Aurelien Jarno --- target-i386/machine.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'target-i386/machine.c') diff --git a/target-i386/machine.c b/target-i386/machine.c index ab3132902..e5a060fcc 100644 --- a/target-i386/machine.c +++ b/target-i386/machine.c @@ -171,6 +171,7 @@ void cpu_save(QEMUFile *f, void *opaque) qemu_put_be64s(f, &env->mce_banks[4*i + 3]); } } + qemu_put_be64s(f, &env->tsc_aux); } #ifdef USE_X86LDOUBLE @@ -377,6 +378,9 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id) } } + if (version_id >= 11) { + qemu_get_be64s(f, &env->tsc_aux); + } /* XXX: ensure compatiblity for halted bit ? */ /* XXX: compute redundant hflags bits */ env->hflags = hflags; -- cgit v1.2.3-65-gdbad