From: Avi Kivity <avi@xxxxxxxxxx> Signed-off-by: Avi Kivity <avi@xxxxxxxxxx> Signed-off-by: Gleb Natapov <gleb@xxxxxxxxxx> --- lib/x86/processor.h | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/lib/x86/processor.h b/lib/x86/processor.h index f69f9ff..c7e1afb 100644 --- a/lib/x86/processor.h +++ b/lib/x86/processor.h @@ -2,6 +2,7 @@ #define LIBCFLAT_PROCESSOR_H #include "libcflat.h" +#include <stdint.h> struct descriptor_table_ptr { u16 limit; @@ -99,6 +100,13 @@ static inline void wrmsr(u32 index, u64 val) asm volatile ("wrmsr" : : "a"(a), "d"(d), "c"(index) : "memory"); } +static inline uint64_t rdpmc(uint32_t index) +{ + uint32_t a, d; + asm volatile ("rdpmc" : "=a"(a), "=d"(d) : "c"(index)); + return a | ((uint64_t)d << 32); +} + static inline void write_cr0(ulong val) { asm volatile ("mov %0, %%cr0" : : "r"(val) : "memory"); -- 1.7.7.3 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html