]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
KVM: SVM: Let gcc to choose which registers to save (i386)
authorLaurent Vivier <Laurent.Vivier@bull.net>
Thu, 25 Oct 2007 12:18:54 +0000 (14:18 +0200)
committerAvi Kivity <avi@qumranet.com>
Wed, 30 Jan 2008 15:52:57 +0000 (17:52 +0200)
This patch lets GCC to determine which registers to save when we
switch to/from a VCPU in the case of AMD i386

* Original code saves following registers:

    ebx, ecx, edx, esi, edi, ebp

* Patched code:

  - informs GCC that we modify following registers
    using the clobber description:

    ebx, ecx, edx, esi, edi

  - rbp is saved (pop/push) because GCC seems to ignore its use in the clobber
    description.

Signed-off-by: Laurent Vivier <Laurent.Vivier@bull.net>
Signed-off-by: Avi Kivity <avi@qumranet.com>
drivers/kvm/svm.c

index debd0912a016cba3c1ccfdc0bbc2d0e7fef79734..fe2a5e8b0524a995b20d176c9b0486bae6989ece 100644 (file)
@@ -1501,8 +1501,7 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
 #ifdef CONFIG_X86_64
                "push %%rbp; \n\t"
 #else
-               "push %%ebx; push %%ecx; push %%edx;"
-               "push %%esi; push %%edi; push %%ebp;"
+               "push %%ebp; \n\t"
 #endif
 
 #ifdef CONFIG_X86_64
@@ -1573,8 +1572,7 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
                "mov %%edi, %c[rdi](%[svm]) \n\t"
                "mov %%ebp, %c[rbp](%[svm]) \n\t"
 
-               "pop  %%ebp; pop  %%edi; pop  %%esi;"
-               "pop  %%edx; pop  %%ecx; pop  %%ebx; \n\t"
+               "pop  %%ebp; \n\t"
 #endif
                :
                : [svm]"a"(svm),
@@ -1599,6 +1597,8 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
 #ifdef CONFIG_X86_64
                , "rbx", "rcx", "rdx", "rsi", "rdi"
                , "r8", "r9", "r10", "r11" , "r12", "r13", "r14", "r15"
+#else
+               , "ebx", "ecx", "edx" , "esi", "edi"
 #endif
                );