Re: [PATCH 09/11] KVM: nSVM: Use kvm_rax_read() now that it's mode-aware
From: Yosry Ahmed
Date: Tue Apr 21 2026 - 19:22:55 EST
On Thu, Apr 09, 2026 at 04:56:20PM -0700, Sean Christopherson wrote:
> Now that kvm_rax_read() truncates the output value to 32 bits if the
> vCPU isn't in 64-bit mode, use it instead of the more verbose (and very
> technically slower) kvm_register_read().
>
> Note! VMLOAD, VMSAVE, and VMRUN emulation are still technically buggy,
> as they can use EAX (versus RAX) in 64-bit mode via an operand size
> prefix. Don't bother trying to handle that case, as it would require
> decoding the code stream, which would open an entirely different can of
> worms, and in practice no sane guest would shove garbage into RAX[63:32]
> and then execute VMLOAD/VMSAVE/VMRUN with just EAX.
>
> No functional change intended.
>
> Cc: Yosry Ahmed <yosry@xxxxxxxxxx>
> Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>
> ---
Reviewed-by: Yosry Ahmed <yosry@xxxxxxxxxx>