From: Avi Kivity <avi@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>, kvm@vger.kernel.org
Subject: [PATCH kvm-unit-tests 3/4] Add rdpmc instruction accessor
Date: Mon, 13 Jun 2011 15:28:46 +0300 [thread overview]
Message-ID: <1307968127-22440-4-git-send-email-avi@redhat.com> (raw)
In-Reply-To: <1307968127-22440-1-git-send-email-avi@redhat.com>
Signed-off-by: Avi Kivity <avi@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.5.3
next prev parent reply other threads:[~2011-06-13 12:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-13 12:28 [PATCH kvm-unit-tests 0/4] PMU tests Avi Kivity
2011-06-13 12:28 ` [PATCH kvm-unit-tests 1/4] Build tests with optimization enabled Avi Kivity
2011-06-13 12:28 ` [PATCH kvm-unit-tests 2/4] startup: prepare CPU for floating point operation Avi Kivity
2011-06-13 12:28 ` Avi Kivity [this message]
2011-06-13 12:28 ` [PATCH kvm-unit-tests 4/4] Add PMU test Avi Kivity
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1307968127-22440-4-git-send-email-avi@redhat.com \
--to=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox