@samitouri / QOSamiQemu / commits / 2d9b12962f

target/i386/hvf/hvf.c: fix compilation

../target/i386/hvf/hvf.c:476:31: error: use of undeclared identifier 'cpu' 476 | X86CPU *x86_cpu = X86_CPU(cpu); | ^ ../target/i386/hvf/hvf.c:479:24: error: use of undeclared identifier 'cpu' 479 | env->cr[0] = rvmcs(cpu->accel->fd, VMCS_GUEST_CR0); | ^ ../target/i386/hvf/hvf.c:480:24: error: use of undeclared identifier 'cpu' 480 | env->cr[3] = rvmcs(cpu->accel->fd, VMCS_GUEST_CR3); | ^ ../target/i386/hvf/hvf.c:481:23: error: use of undeclared identifier 'cpu' 481 | env->cr[2] = rreg(cpu->accel->fd, HV_X86_CR2); | ^ ../target/i386/hvf/hvf.c:486:31: error: use of undeclared identifier 'cpu' 486 | X86CPU *x86_cpu = X86_CPU(cpu); | ^ ../target/i386/hvf/hvf.c:489:11: error: use of undeclared identifier 'cpu' 489 | wvmcs(cpu->accel->fd, VMCS_GUEST_CR0, env->cr[0]); | ^ ../target/i386/hvf/hvf.c:490:11: error: use of undeclared identifier 'cpu' 490 | wvmcs(cpu->accel->fd, VMCS_GUEST_CR3, env->cr[3]); | ^ 7 errors generated. Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Reviewed-by: Mohamed Mediouni <mohamed@unpredictable.fr> Link: https://lore.kernel.org/r/20260307181856.2209-2-mohamed@unpredictable.fr Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Pierrick Bouvier committed Mar 7, 2026 at 19:18 UTC 2d9b12962f8806456ea240df2f000c1a65af3a0b
1 file changed +7 -7
target/i386/hvf/hvf.c
+7 -7
@@ -472,21 +472,21 @@ static void hvf_cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
472
473 static void hvf_load_crs(CPUState *cs)
474 {
475 - X86CPU *x86_cpu = X86_CPU(cpu);
475 + X86CPU *x86_cpu = X86_CPU(cs);
476 CPUX86State *env = &x86_cpu->env;
477
478 - env->cr[0] = rvmcs(cpu->accel->fd, VMCS_GUEST_CR0);
479 - env->cr[3] = rvmcs(cpu->accel->fd, VMCS_GUEST_CR3);
480 - env->cr[2] = rreg(cpu->accel->fd, HV_X86_CR2);
478 + env->cr[0] = rvmcs(cs->accel->fd, VMCS_GUEST_CR0);
479 + env->cr[3] = rvmcs(cs->accel->fd, VMCS_GUEST_CR3);
480 + env->cr[2] = rreg(cs->accel->fd, HV_X86_CR2);
481 }
482
483 static void hvf_save_crs(CPUState *cs)
484 {
485 - X86CPU *x86_cpu = X86_CPU(cpu);
485 + X86CPU *x86_cpu = X86_CPU(cs);
486 CPUX86State *env = &x86_cpu->env;
487
488 - wvmcs(cpu->accel->fd, VMCS_GUEST_CR0, env->cr[0]);
489 - wvmcs(cpu->accel->fd, VMCS_GUEST_CR3, env->cr[3]);
488 + wvmcs(cs->accel->fd, VMCS_GUEST_CR0, env->cr[0]);
489 + wvmcs(cs->accel->fd, VMCS_GUEST_CR3, env->cr[3]);
490 wreg(cs->accel->fd, HV_X86_CR2, env->cr[2]);
491 }
492