aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUros Bizjak <ubizjak@gmail.com>2018-10-17 10:46:57 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2018-10-17 13:08:21 -0400
commit43ce76ce731ff7f9cff51124fee738018c18a864 (patch)
tree9652072a1aaf6821cf8d60ee1081e401844c81a4
parentc4f55198c7c2b87909b166ffc2f6b68d9af6766c (diff)
KVM/x86: Use 32bit xor to clear registers in svm.c
x86_64 zero-extends 32bit xor operation to a full 64bit register. Also add a comment and remove unnecessary instruction suffix in vmx.c Signed-off-by: Uros Bizjak <ubizjak@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--arch/x86/kvm/svm.c28
-rw-r--r--arch/x86/kvm/vmx.c6
2 files changed, 18 insertions, 16 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 1086bebaeea3..f416f5c7f2ae 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -5637,26 +5637,24 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)
5637 "mov %%r13, %c[r13](%[svm]) \n\t" 5637 "mov %%r13, %c[r13](%[svm]) \n\t"
5638 "mov %%r14, %c[r14](%[svm]) \n\t" 5638 "mov %%r14, %c[r14](%[svm]) \n\t"
5639 "mov %%r15, %c[r15](%[svm]) \n\t" 5639 "mov %%r15, %c[r15](%[svm]) \n\t"
5640#endif
5641 /* 5640 /*
5642 * Clear host registers marked as clobbered to prevent 5641 * Clear host registers marked as clobbered to prevent
5643 * speculative use. 5642 * speculative use.
5644 */ 5643 */
5645 "xor %%" _ASM_BX ", %%" _ASM_BX " \n\t" 5644 "xor %%r8d, %%r8d \n\t"
5646 "xor %%" _ASM_CX ", %%" _ASM_CX " \n\t" 5645 "xor %%r9d, %%r9d \n\t"
5647 "xor %%" _ASM_DX ", %%" _ASM_DX " \n\t" 5646 "xor %%r10d, %%r10d \n\t"
5648 "xor %%" _ASM_SI ", %%" _ASM_SI " \n\t" 5647 "xor %%r11d, %%r11d \n\t"
5649 "xor %%" _ASM_DI ", %%" _ASM_DI " \n\t" 5648 "xor %%r12d, %%r12d \n\t"
5650#ifdef CONFIG_X86_64 5649 "xor %%r13d, %%r13d \n\t"
5651 "xor %%r8, %%r8 \n\t" 5650 "xor %%r14d, %%r14d \n\t"
5652 "xor %%r9, %%r9 \n\t" 5651 "xor %%r15d, %%r15d \n\t"
5653 "xor %%r10, %%r10 \n\t"
5654 "xor %%r11, %%r11 \n\t"
5655 "xor %%r12, %%r12 \n\t"
5656 "xor %%r13, %%r13 \n\t"
5657 "xor %%r14, %%r14 \n\t"
5658 "xor %%r15, %%r15 \n\t"
5659#endif 5652#endif
5653 "xor %%ebx, %%ebx \n\t"
5654 "xor %%ecx, %%ecx \n\t"
5655 "xor %%edx, %%edx \n\t"
5656 "xor %%esi, %%esi \n\t"
5657 "xor %%edi, %%edi \n\t"
5660 "pop %%" _ASM_BP 5658 "pop %%" _ASM_BP
5661 : 5659 :
5662 : [svm]"a"(svm), 5660 : [svm]"a"(svm),
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 91f4f5288150..3677609145a4 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -62,7 +62,7 @@
62 62
63#define __ex(x) __kvm_handle_fault_on_reboot(x) 63#define __ex(x) __kvm_handle_fault_on_reboot(x)
64#define __ex_clear(x, reg) \ 64#define __ex_clear(x, reg) \
65 ____kvm_handle_fault_on_reboot(x, "xorl " reg " , " reg) 65 ____kvm_handle_fault_on_reboot(x, "xor " reg ", " reg)
66 66
67MODULE_AUTHOR("Qumranet"); 67MODULE_AUTHOR("Qumranet");
68MODULE_LICENSE("GPL"); 68MODULE_LICENSE("GPL");
@@ -11285,6 +11285,10 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
11285 "mov %%r13, %c[r13](%0) \n\t" 11285 "mov %%r13, %c[r13](%0) \n\t"
11286 "mov %%r14, %c[r14](%0) \n\t" 11286 "mov %%r14, %c[r14](%0) \n\t"
11287 "mov %%r15, %c[r15](%0) \n\t" 11287 "mov %%r15, %c[r15](%0) \n\t"
11288 /*
11289 * Clear host registers marked as clobbered to prevent
11290 * speculative use.
11291 */
11288 "xor %%r8d, %%r8d \n\t" 11292 "xor %%r8d, %%r8d \n\t"
11289 "xor %%r9d, %%r9d \n\t" 11293 "xor %%r9d, %%r9d \n\t"
11290 "xor %%r10d, %%r10d \n\t" 11294 "xor %%r10d, %%r10d \n\t"