Skip to contentSkip to conversation

Fix cpuid KVM crash on i386

PATCH Applied Lubomir Rintel 2 participants 2 messages Mar 3, 2009 – Mar 5, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix cpuid KVM crash on i386

Cpuid should return into vec, not overwrite past address in count. Changeset 6565 broke this.

helper.c +4 -4
Index: target-i386/helper.c
===================================================================
@@ -1418,10 +1418,10 @@
 #else
     asm volatile("pusha \n\t"
                  "cpuid \n\t"
-                 "mov %%eax, 0(%1) \n\t"
-                 "mov %%ebx, 4(%1) \n\t"
-                 "mov %%ecx, 8(%1) \n\t"
-                 "mov %%edx, 12(%1) \n\t"
+                 "mov %%eax, 0(%2) \n\t"
+                 "mov %%ebx, 4(%2) \n\t"
+                 "mov %%ecx, 8(%2) \n\t"
+                 "mov %%edx, 12(%2) \n\t"
                  "popa"
                  : : "a"(function), "c"(count), "S"(vec)
                  : "memory", "cc");
#1 lore raw
Quoted 3 lines · Lubomir Rintel

Cpuid should return into vec, not overwrite past address in count. Changeset 6565 broke this.

Applied to both stable and trunk. Thanks.

Regards,

Anthony Liguori

Quoted 27 lines

Index: target-i386/helper.c
===================================================================

helper.c +4 -4
@@ -1418,10 +1418,10 @@
 #else
     asm volatile("pusha \n\t"
                  "cpuid \n\t"
-                 "mov %%eax, 0(%1) \n\t"
-                 "mov %%ebx, 4(%1) \n\t"
-                 "mov %%ecx, 8(%1) \n\t"
-                 "mov %%edx, 12(%1) \n\t"
+                 "mov %%eax, 0(%2) \n\t"
+                 "mov %%ebx, 4(%2) \n\t"
+                 "mov %%ecx, 8(%2) \n\t"
+                 "mov %%edx, 12(%2) \n\t"
                  "popa"
                  : : "a"(function), "c"(count), "S"(vec)
                  : "memory", "cc");