[05/11] KVM: VMX: Save RSI to an unused output in vmx_vcpu_run() asm blob
diff mbox series

Message ID 20181220203035.23041-1-sean.j.christopherson@intel.com
State New
Headers show
  • KVM: VMX: Clean up VM-Enter/VM-Exit asm code
Related show

Commit Message

Sean Christopherson Dec. 20, 2018, 8:30 p.m. UTC
RSI is clobbered by the VM-Enter asm blob in vmx_vcpu_run(), but it's
not marked as such, probably because GCC doesn't let you mark inputs
as clobbered.  "Save" RSI to a dummy output so that GCC recognizes it
as being clobbered.

Note that this has a funky dependency on removing the 'vmx_return'
global variable definition from vmx_vcpu_run()'s asm blob (done in a
prior patch), as attempting to declare RSI as output would generate a
cryptic compiler error that magically disappeared when vmx_return was

Fixes: 773e8a0425c9 ("x86/kvm: use Enlightened VMCS when running on Hyper-V")
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
 arch/x86/kvm/vmx/vmx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff mbox series

diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index 5d07d385b637..1821fb9ac009 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -6219,7 +6219,7 @@  static void vmx_vcpu_run(struct kvm_vcpu *vcpu)
 		"xor %%esi, %%esi \n\t"
 		"xor %%edi, %%edi \n\t"
 		"pop  %%" _ASM_BP "; pop  %%" _ASM_DX " \n\t"
+	      : ASM_CALL_CONSTRAINT, "=S"((int){0})
 	      : "c"(vmx), "d"((unsigned long)HOST_RSP), "S"(evmcs_rsp),
 		[launched]"i"(offsetof(struct vcpu_vmx, __launched)),
 		[fail]"i"(offsetof(struct vcpu_vmx, fail)),