Re: [PATCH v3 01/20] KVM: VMX: Macrofy 64-bit GPR swapping in __vmx_vcpu_run()
From: Chang S. Bae
Date: Wed Apr 29 2026 - 13:22:36 EST
On 4/29/2026 12:50 AM, Paolo Bonzini wrote:
On Tue, Apr 28, 2026 at 10:12 PM Chang S. Bae <chang.seok.bae@xxxxxxxxx> wrote:Okay, I think I didn't close look at the error. Simply "\reg_num" to "reg_num" builds fine. Yes, REG_TYPE can go away.
On 4/28/2026 2:03 AM, Paolo Bonzini wrote:
I would also consider using inst.h's name-to-index conversion:Yup! Also, looks like still needs the REG_TYPE macro:
.macro LOAD_GPRS src:req, regs_ofs:req, regs:vararg
.irp reg, \regs
#ifdef CONFIG_X86_64
R64_NUM reg_num \reg
#else
R32_NUM reg_num \reg
#endif
.if \reg_num <> REG_NUM_INVALID
mov (\regs_ofs + \reg_num * WORD_SIZE)(%_ASM_DI), \reg
.else
.err invalid register \reg
.endif
.endr
.endm
I don't think so, you can (and should) assume that \reg has WORD_SIZE
size (i.e. disallow %eax if CONFIG_X86_64 is set). Only CLEAR_REGS
uses smaller registers but it does not need the reg_num.
Thanks,
Chang