Skip to content

Commit

Permalink
KVM: SVM,VMX: Use %rip-relative addressing to access kvm_rebooting
Browse files Browse the repository at this point in the history
Instruction with %rip-relative address operand is one byte shorter than
its absolute address counterpart and is also compatible with position
independent executable (-fpie) build.

No functional changes intended.

Cc: Sean Christopherson <seanjc@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Link: https://lore.kernel.org/r/20231031075312.47525-1-ubizjak@gmail.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
  • Loading branch information
ubizjak authored and sean-jc committed Nov 30, 2023
1 parent c52ffad commit 15223c4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions arch/x86/kvm/svm/vmenter.S
Original file line number Diff line number Diff line change
Expand Up @@ -270,16 +270,16 @@ SYM_FUNC_START(__svm_vcpu_run)
RESTORE_GUEST_SPEC_CTRL_BODY
RESTORE_HOST_SPEC_CTRL_BODY

10: cmpb $0, kvm_rebooting
10: cmpb $0, _ASM_RIP(kvm_rebooting)
jne 2b
ud2
30: cmpb $0, kvm_rebooting
30: cmpb $0, _ASM_RIP(kvm_rebooting)
jne 4b
ud2
50: cmpb $0, kvm_rebooting
50: cmpb $0, _ASM_RIP(kvm_rebooting)
jne 6b
ud2
70: cmpb $0, kvm_rebooting
70: cmpb $0, _ASM_RIP(kvm_rebooting)
jne 8b
ud2

Expand Down Expand Up @@ -381,7 +381,7 @@ SYM_FUNC_START(__svm_sev_es_vcpu_run)
RESTORE_GUEST_SPEC_CTRL_BODY
RESTORE_HOST_SPEC_CTRL_BODY

3: cmpb $0, kvm_rebooting
3: cmpb $0, _ASM_RIP(kvm_rebooting)
jne 2b
ud2

Expand Down
2 changes: 1 addition & 1 deletion arch/x86/kvm/vmx/vmenter.S
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ SYM_INNER_LABEL_ALIGN(vmx_vmexit, SYM_L_GLOBAL)
RET

.Lfixup:
cmpb $0, kvm_rebooting
cmpb $0, _ASM_RIP(kvm_rebooting)
jne .Lvmfail
ud2
.Lvmfail:
Expand Down

0 comments on commit 15223c4

Please sign in to comment.