svm: fix rflags and rax offsets
Paolo Bonzini
maintainerPATCH 1/1 svm: fix rflags and rax offsets
They need to include the offset from the VMCB base to the VMSA, which is 0x400.
Signed-off-by Paolo Bonzini <[email protected]>
--- x86/svm.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
x86/svm.h +4 -4
@@ -437,16 +437,16 @@ static inline void clgi(void)#define ASM_PRE_VMRUN_CMD \ "mov " GUEST_REG(rflags) ", %%r15\n\t" \ - "mov %%r15, 0x170(%%rax)\n\t" \ + "mov %%r15, 0x570(%%rax)\n\t" \ "mov " GUEST_REG(rax) ", %%r15\n\t" \ - "mov %%r15, 0x1f8(%%rax)\n\t" \ + "mov %%r15, 0x5f8(%%rax)\n\t" \ __SWAP_GPRS \#define ASM_POST_VMRUN_CMD \ __SWAP_GPRS \ - "mov 0x170(%%rax), %%r15\n\t" \ + "mov 0x570(%%rax), %%r15\n\t" \ "mov %%r15, " GUEST_REG(rflags) "\n\t" \ - "mov 0x1f8(%%rax), %%r15\n\t" \ + "mov 0x5f8(%%rax), %%r15\n\t" \ "mov %%r15, " GUEST_REG(rax)"\n\t" \#define SVM_BARE_VMRUN \
Signature · 1 line
2.54.0
Quoted 14 lines · Paolo Bonzini
They need to include the offset from the VMCB base to the VMSA, which is
0x400.Signed-off-by Paolo Bonzini <[email protected]>--- x86/svm.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)x86/svm.h +0
-0
x86/svm.h static inline void clgi(void) · line 442
Quoted 8 lines
x86/svm.h +2
-2@@ -437,16 +437,16 @@ static inline void clgi(void)#define ASM_PRE_VMRUN_CMD \ "mov " GUEST_REG(rflags) ", %%r15\n\t" \ - "mov %%r15, 0x170(%%rax)\n\t" \ + "mov %%r15, 0x570(%%rax)\n\t" \ "mov " GUEST_REG(rax) ", %%r15\n\t" \ - "mov %%r15, 0x1f8(%%rax)\n\t" \ + "mov %%r15, 0x5f8(%%rax)\n\t" \
The selftests have the same problem. Sashiko pointed it out while reviewing one of my patches touching the same area (fixing other register offsets):
https://sashiko.dev/#/patchset/20260518202514.2037078-1-yosry%40kernel.org?part=1.
Quoted 16 lines
x86/svm.h +2
-3__SWAP_GPRS \#define ASM_POST_VMRUN_CMD \ __SWAP_GPRS \ - "mov 0x170(%%rax), %%r15\n\t" \ + "mov 0x570(%%rax), %%r15\n\t" \ "mov %%r15, " GUEST_REG(rflags) "\n\t" \ - "mov 0x1f8(%%rax), %%r15\n\t" \ + "mov 0x5f8(%%rax), %%r15\n\t" \ "mov %%r15, " GUEST_REG(rax)"\n\t" \#define SVM_BARE_VMRUN \ --2.54.0