public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2 unit-test] Add rdpmc instruction accessor
@ 2012-02-26 15:20 Gleb Natapov
  2012-02-26 15:20 ` [PATCH 2/2 unit-test] Add PMU test Gleb Natapov
  0 siblings, 1 reply; 3+ messages in thread
From: Gleb Natapov @ 2012-02-26 15:20 UTC (permalink / raw)
  To: kvm; +Cc: avi, mtosatti

From: Avi Kivity <avi@redhat.com>

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-03-05 14:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-26 15:20 [PATCH 1/2 unit-test] Add rdpmc instruction accessor Gleb Natapov
2012-02-26 15:20 ` [PATCH 2/2 unit-test] Add PMU test Gleb Natapov
2012-03-05 14:20   ` Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox