* [Qemu-devel] [PATCH] add rdpmc intercept for SVM
@ 2007-12-05 19:44 Bernhard Kauer
2007-12-07 13:14 ` Alexander Graf
0 siblings, 1 reply; 2+ messages in thread
From: Bernhard Kauer @ 2007-12-05 19:44 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 194 bytes --]
The attached patch adds an SVM intercept for rdpmc to qemu,
thus allowing a VMM to virtualize them. Please note that
performance counters are currently unimplemented in qemu.
Bernhard Kauer
[-- Attachment #2: qemu_rdpmc.diff --]
[-- Type: text/x-diff, Size: 1241 bytes --]
Index: target-i386/helper.c
--- target-i386/helper.c 18 Nov 2007 01:44:38 -0000 1.95
+++ target-i386/helper.c 5 Dec 2007 19:31:31 -0000
@@ -2743,6 +2816,19 @@
EDX = (uint32_t)(val >> 32);
}
+void helper_rdpmc()
+{
+ if ((env->cr[4] & CR4_PCE_MASK) && ((env->hflags & HF_CPL_MASK) != 0)) {
+ raise_exception(EXCP0D_GPF);
+ }
+
+ if (!svm_check_intercept_param(SVM_EXIT_RDPMC, 0))
+ {
+ // currently unimplemented
+ raise_exception_err(EXCP06_ILLOP, 0);
+ }
+}
+
#if defined(CONFIG_USER_ONLY)
void helper_wrmsr(void)
{
Index: target-i386/op.c
--- target-i386/op.c 23 Sep 2007 15:28:04 -0000 1.51
+++ target-i386/op.c 5 Dec 2007 19:31:32 -0000
@@ -953,6 +953,11 @@
helper_rdtsc();
}
+void OPPROTO op_rdpmc(void)
+{
+ helper_rdpmc();
+}
+
void OPPROTO op_cpuid(void)
{
helper_cpuid();
Index: target-i386/translate.c
--- target-i386/translate.c 8 Nov 2007 14:25:03 -0000 1.74
+++ target-i386/translate.c 5 Dec 2007 19:31:38 -0000
@@ -5653,5 +5653,9 @@
gen_op_rdtsc();
break;
+ case 0x133: /* rdpmc */
+ gen_jmp_im(pc_start - s->cs_base);
+ gen_op_rdpmc();
+ break;
case 0x134: /* sysenter */
if (CODE64(s))
goto illegal_op;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-12-07 13:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-05 19:44 [Qemu-devel] [PATCH] add rdpmc intercept for SVM Bernhard Kauer
2007-12-07 13:14 ` Alexander Graf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).