diff mbox series

[v2,09/29] KVM: nVMX: Explicitly reference the scratch reg in nested early checks

Message ID 20190124175845.15926-10-sean.j.christopherson@intel.com (mailing list archive)
State New, archived
Headers show
Series KVM: VMX: Move vCPU-run to proper asm sub-routine | expand

Commit Message

Sean Christopherson Jan. 24, 2019, 5:58 p.m. UTC
Using %1 to reference RCX, i.e. the 'vmx' pointer', is obtuse and
fragile, e.g. it results in cryptic and infurating compile errors if the
output constraints touched by anything more than a gentle breeze.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
---
 arch/x86/kvm/vmx/nested.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jim Mattson Jan. 24, 2019, 11:15 p.m. UTC | #1
On Thu, Jan 24, 2019 at 9:59 AM Sean Christopherson
<sean.j.christopherson@intel.com> wrote:
>
> Using %1 to reference RCX, i.e. the 'vmx' pointer', is obtuse and
> fragile, e.g. it results in cryptic and infurating compile errors if the
> output constraints touched by anything more than a gentle breeze.
>
> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Reviewed-by: Jim Mattson <jmattson@google.com>
diff mbox series

Patch

diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
index 671887f7d8c7..b92291b8e54b 100644
--- a/arch/x86/kvm/vmx/nested.c
+++ b/arch/x86/kvm/vmx/nested.c
@@ -2756,7 +2756,7 @@  static int nested_vmx_check_vmentry_hw(struct kvm_vcpu *vcpu)
 		/* Set HOST_RSP */
 		"sub $%c[wordsize], %%" _ASM_SP "\n\t" /* temporarily adjust RSP for CALL */
 		__ex("vmwrite %%" _ASM_SP ", %%" _ASM_DX) "\n\t"
-		"mov %%" _ASM_SP ", %c[host_rsp](%1)\n\t"
+		"mov %%" _ASM_SP ", %c[host_rsp](%% " _ASM_CX ")\n\t"
 		"add $%c[wordsize], %%" _ASM_SP "\n\t" /* un-adjust RSP */
 
 		/* Check if vmlaunch or vmresume is needed */