public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kvm: userspace: Initialise ECX value with 'count' as host_cpuid now expects it
@ 2009-02-17 15:45 Amit Shah
  2009-02-17 18:11 ` Avi Kivity
  0 siblings, 1 reply; 3+ messages in thread
From: Amit Shah @ 2009-02-17 15:45 UTC (permalink / raw)
  To: avi; +Cc: kvm, Amit Shah

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 <amit.shah@redhat.com>
---
 qemu/qemu-kvm-x86.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/qemu/qemu-kvm-x86.c b/qemu/qemu-kvm-x86.c
index 5264015..b1e2da2 100644
--- a/qemu/qemu-kvm-x86.c
+++ b/qemu/qemu-kvm-x86.c
@@ -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(&copy);
     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(&copy);
     limit = copy.regs[R_EAX];
 
-- 
1.6.0.6


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] kvm: userspace: Initialise ECX value with 'count' as host_cpuid now expects it
  2009-02-17 15:45 [PATCH] kvm: userspace: Initialise ECX value with 'count' as host_cpuid now expects it Amit Shah
@ 2009-02-17 18:11 ` Avi Kivity
  2009-02-18  4:58   ` Amit Shah
  0 siblings, 1 reply; 3+ messages in thread
From: Avi Kivity @ 2009-02-17 18:11 UTC (permalink / raw)
  To: Amit Shah; +Cc: kvm

Amit Shah wrote:
> 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 <amit.shah@redhat.com>
> ---
>  qemu/qemu-kvm-x86.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/qemu/qemu-kvm-x86.c b/qemu/qemu-kvm-x86.c
> index 5264015..b1e2da2 100644
> --- a/qemu/qemu-kvm-x86.c
> +++ b/qemu/qemu-kvm-x86.c
> @@ -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(&copy);
>      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(&copy);
>      limit = copy.regs[R_EAX]; 
>   

Does this make any difference?  Neither function actually depends on ecx.

-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] kvm: userspace: Initialise ECX value with 'count' as host_cpuid now expects it
  2009-02-17 18:11 ` Avi Kivity
@ 2009-02-18  4:58   ` Amit Shah
  0 siblings, 0 replies; 3+ messages in thread
From: Amit Shah @ 2009-02-18  4:58 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm

On (Tue) Feb 17 2009 [18:11:55], Avi Kivity wrote:
> Amit Shah wrote:
>> 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 <amit.shah@redhat.com>
>> ---
>>  qemu/qemu-kvm-x86.c |    2 ++
>>  1 files changed, 2 insertions(+), 0 deletions(-)
>>
>> diff --git a/qemu/qemu-kvm-x86.c b/qemu/qemu-kvm-x86.c
>> index 5264015..b1e2da2 100644
>> --- a/qemu/qemu-kvm-x86.c
>> +++ b/qemu/qemu-kvm-x86.c
>> @@ -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(&copy);
>>      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(&copy);
>>      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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-02-18  4:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-17 15:45 [PATCH] kvm: userspace: Initialise ECX value with 'count' as host_cpuid now expects it Amit Shah
2009-02-17 18:11 ` Avi Kivity
2009-02-18  4:58   ` Amit Shah

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox