KVM:x86: Clean up ModR/M "reg" initialization in reg op decoding
authorLiam Ni <zhiguangni01@gmail.com>
Thu, 8 Sep 2022 14:12:10 +0000 (22:12 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 26 Sep 2022 16:02:34 +0000 (12:02 -0400)
commite390f4d69da026149c8c80a7a2218e166d5643fc
treef2ddbf327ce12e43410d6061c9ee58295a244f36
parent02dfc44f205772f0edc0d8e58420205c1cf2f83b
KVM:x86: Clean up ModR/M "reg" initialization in reg op decoding

Refactor decode_register_operand() to get the ModR/M register if and
only if the instruction uses a ModR/M encoding to make it more obvious
how the register operand is retrieved.

Signed-off-by: Liam Ni <zhiguangni01@gmail.com>
Link: https://lore.kernel.org/r/20220908141210.1375828-1-zhiguangni01@zhaoxin.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/emulate.c