kvm: userspace: Initialise ECX value with 'count' as host_cpuid now expects it
PATCH 1/1 kvm: userspace: Initialise ECX value with 'count' as host_cpuid now expects it
host_cpuid now accepts a 'count' parameter for cpuid. Initialise the value of ecx before any call to the function.
Signed-off-by Amit Shah <[email protected]>
--- qemu/qemu-kvm-x86.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
qemu/qemu-kvm-x86.c +2 -0
@@ -534,6 +534,7 @@ int kvm_arch_qemu_init_env(CPUState *cenv)#endif copy.regs[R_EAX ] =0 ; + copy.regs[R_ECX ] =0 ;qemu_kvm_cpuid_on_env (©); limit = copy.regs[R_EAX ];
@@ -559,6 +560,7 @@ int kvm_arch_qemu_init_env(CPUState *cenv) } copy.regs[R_EAX ] =0x80000000 ; + copy.regs[R_ECX ] =0 ;qemu_kvm_cpuid_on_env (©); limit = copy.regs[R_EAX ];
Signature · 1 line
1.6.0.6
Quoted 21 lines · Amit Shah
host_cpuidnow accepts a 'count' parameter for cpuid. Initialise the value of ecx before any call to the function.Signed-off-by Amit Shah <[email protected]>--- qemu/qemu-kvm-x86.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)qemu/qemu-kvm-x86.c +1
-0@@ -534,6 +534,7 @@ int kvm_arch_qemu_init_env(CPUState *cenv)#endif copy.regs[R_EAX ] =0 ; + copy.regs[R_ECX ] =0 ;qemu_kvm_cpuid_on_env (©); limit = copy.regs[R_EAX ];
qemu/qemu-kvm-x86.c int kvm_arch_qemu_init_env(CPUState *cenv) · line 566
Quoted 7 lines
qemu/qemu-kvm-x86.c +1
-0@@ -559,6 +560,7 @@ int kvm_arch_qemu_init_env(CPUState *cenv) } copy.regs[R_EAX ] =0x80000000 ; + copy.regs[R_ECX ] =0 ;qemu_kvm_cpuid_on_env (©); limit = copy.regs[R_EAX ];
Does this make any difference? Neither function actually depends on ecx.
Signature · 2 lines
I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.
Quoted 19 lines · Avi Kivity
Quoted 18 lines · Amit Shah
host_cpuidnow accepts a 'count' parameter for cpuid. Initialise the value of ecx before any call to the function.Signed-off-by Amit Shah <[email protected]>--- qemu/qemu-kvm-x86.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)qemu/qemu-kvm-x86.c +1
-0@@ -534,6 +534,7 @@ int kvm_arch_qemu_init_env(CPUState *cenv)#endif copy.regs[R_EAX ] =0 ; + copy.regs[R_ECX ] =0 ;qemu_kvm_cpuid_on_env (©); limit = copy.regs[R_EAX ];
Quoted 8 lines
Quoted 6 lines
qemu/qemu-kvm-x86.c +0
-0@@ -559,6 +560,7 @@ int kvm_arch_qemu_init_env(CPUState *cenv) }copy.regs[R_EAX] = 0x80000000; + copy.regs[R_ECX] = 0; qemu_kvm_cpuid_on_env(©); limit = copy.regs[R_EAX];Does this make any difference? Neither function actually depends on ecx.
No; it doesn't. But it's good practice to init all the data that a function takes as arguments.