From: Keir Fraser Date: Wed, 16 Dec 2009 12:45:18 +0000 (+0000) Subject: x86_emulate: Emulate RDTSCP instruction. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~12891 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=ea817bcbf516cdb57b58cc9c5e9c1f25fc101eee;p=xen.git x86_emulate: Emulate RDTSCP instruction. Signed-off-by: Keir Fraser --- diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c index 3385127e9f..3449f21eab 100644 --- a/xen/arch/x86/x86_emulate/x86_emulate.c +++ b/xen/arch/x86/x86_emulate/x86_emulate.c @@ -292,6 +292,7 @@ struct operand { #define MSR_LSTAR 0xc0000082 #define MSR_CSTAR 0xc0000083 #define MSR_FMASK 0xc0000084 +#define MSR_TSC_AUX 0xc0000103 /* Control register flags. */ #define CR0_PE (1<<0) @@ -3503,6 +3504,16 @@ x86_emulate( break; } + if ( modrm == 0xf9 ) /* rdtscp */ + { + uint64_t tsc_aux; + fail_if(ops->read_msr == NULL); + if ( (rc = ops->read_msr(MSR_TSC_AUX, &tsc_aux, ctxt)) != 0 ) + goto done; + _regs.ecx = (uint32_t)tsc_aux; + goto rdtsc; + } + switch ( modrm_reg & 7 ) { case 0: /* sgdt */ @@ -3712,7 +3723,7 @@ x86_emulate( break; } - case 0x31: /* rdtsc */ { + case 0x31: rdtsc: /* rdtsc */ { unsigned long cr4; uint64_t val; if ( !mode_ring0() )