[RFT] Fix for unhandled msr c0000081 problems under Intel cpus

Avi Kivity
2006-12-13T09:45:29Z

[-- Attachment #1: Type: text/plain, Size: 250 bytes --]

If you've experienced this problem, please test the attached patch (to
qemu, not the kernel module) and report back. The patch basically tells
the guest that the msr doesn't exist.

--
error compiling committee.c: too many arguments to function

[-- Attachment #2: msr_star-intel-fix.patch --]
[-- Type: text/x-patch, Size: 1021 bytes --]

Index: qemu/qemu-kvm.c
===================================================================
--- qemu/qemu-kvm.c (revision 4089)
+++ qemu/qemu-kvm.c (working copy)
@@ -408,6 +408,7 @@
{
CPUState **envs = opaque;
CPUState *saved_env;
+ uint32_t eax = *rax;

saved_env = env;
env = envs[0];
@@ -421,6 +422,27 @@
*rcx = env->regs[R_ECX];
*rbx = env->regs[R_EBX];
*rax = env->regs[R_EAX];
+ // don't report long mode/syscall if no native support
+ if (eax == 0x80000001) {
+ unsigned long h_eax = eax, h_edx;
+
+
+ // horrible hack to workaround gcc 3 register pressure trouble
+ asm (
+#ifdef __x86_64__
+ "push %%rbx; push %%rcx; cpuid; pop %%rcx; pop %%rbx"
+#else
+ "push %%ebx; push %%ecx; cpuid; pop %%ecx; pop %%ebx"
+#endif
+ : "+a"(h_eax), "=d"(h_edx));
+
+ // long mode
+ if ((h_edx & 0x20000000) == 0)
+ *rdx &= ~0x20000000ull;
+ // syscall
+ if ((h_edx & 0x00000800) == 0)
+ *rdx &= ~0x00000800ull;
+ }
env = saved_env;
return 0;
}

[-- Attachment #3: Type: text/plain, Size: 347 bytes --]

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

[-- Attachment #4: Type: text/plain, Size: 186 bytes --]

_______________________________________________
kvm-devel mailing list
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org