Skip to content

Commit 87e8e36

Browse files
committed
KVM: SVM: Clobber RAX instead of RBX when discarding spec_ctrl_intercepted
POP @spec_ctrl_intercepted into RAX instead of RBX when discarding it from the stack so that __svm_sev_es_vcpu_run() doesn't modify any non-volatile registers. __svm_sev_es_vcpu_run() doesn't return a value, and RAX is already are clobbered multiple times in the #VMEXIT path. This will allowing using the host save area to save/restore non-volatile registers in __svm_sev_es_vcpu_run(). Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com> Link: https://lore.kernel.org/r/20240223204233.3337324-5-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent 331282f commit 87e8e36

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/x86/kvm/svm/vmenter.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,8 @@ SYM_FUNC_START(__svm_sev_es_vcpu_run)
350350
*/
351351
UNTRAIN_RET_VM
352352

353-
/* "Pop" @spec_ctrl_intercepted. */
354-
pop %rbx
353+
/* "Pop" and discard @spec_ctrl_intercepted. */
354+
pop %rax
355355

356356
pop %rbx
357357

0 commit comments

Comments
 (0)