qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Aurelien Jarno <aurelien@aurel32.net>
To: Andre Przywara <andre.przywara@amd.com>
Cc: john.cooper@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 03/13] cpuid: moved host_cpuid function and remove prototype
Date: Sat, 6 Mar 2010 19:26:15 +0100	[thread overview]
Message-ID: <20100306182615.GE14275@volta.aurel32.net> (raw)
In-Reply-To: <1265105301-3455-4-git-send-email-andre.przywara@amd.com>

On Tue, Feb 02, 2010 at 11:08:11AM +0100, Andre Przywara wrote:
> the host_cpuid function was located at the end of the file and had
> a prototype before it's first use. Move it up and remove the
> prototype.
> 
> Signed-off-by: Andre Przywara <andre.przywara@amd.com>

Acked-by: Aurelien Jarno <aurelien@aurel32.net>

> ---
>  target-i386/cpuid.c |   70 ++++++++++++++++++++++++--------------------------
>  1 files changed, 34 insertions(+), 36 deletions(-)
> 
> diff --git a/target-i386/cpuid.c b/target-i386/cpuid.c
> index 0a17020..cc080f4 100644
> --- a/target-i386/cpuid.c
> +++ b/target-i386/cpuid.c
> @@ -338,8 +338,40 @@ static x86_def_t x86_defs[] = {
>      },
>  };
>  
> -static void host_cpuid(uint32_t function, uint32_t count, uint32_t *eax,
> -                               uint32_t *ebx, uint32_t *ecx, uint32_t *edx);
> +static void host_cpuid(uint32_t function, uint32_t count,
> +                       uint32_t *eax, uint32_t *ebx,
> +                       uint32_t *ecx, uint32_t *edx)
> +{
> +#if defined(CONFIG_KVM)
> +    uint32_t vec[4];
> +
> +#ifdef __x86_64__
> +    asm volatile("cpuid"
> +                 : "=a"(vec[0]), "=b"(vec[1]),
> +                   "=c"(vec[2]), "=d"(vec[3])
> +                 : "0"(function), "c"(count) : "cc");
> +#else
> +    asm volatile("pusha \n\t"
> +                 "cpuid \n\t"
> +                 "mov %%eax, 0(%2) \n\t"
> +                 "mov %%ebx, 4(%2) \n\t"
> +                 "mov %%ecx, 8(%2) \n\t"
> +                 "mov %%edx, 12(%2) \n\t"
> +                 "popa"
> +                 : : "a"(function), "c"(count), "S"(vec)
> +                 : "memory", "cc");
> +#endif
> +
> +    if (eax)
> +	*eax = vec[0];
> +    if (ebx)
> +	*ebx = vec[1];
> +    if (ecx)
> +	*ecx = vec[2];
> +    if (edx)
> +	*edx = vec[3];
> +#endif
> +}
>  
>  static int cpu_x86_fill_model_id(char *str)
>  {
> @@ -578,40 +610,6 @@ int cpu_x86_register (CPUX86State *env, const char *cpu_model)
>      return 0;
>  }
>  
> -static void host_cpuid(uint32_t function, uint32_t count,
> -                       uint32_t *eax, uint32_t *ebx,
> -                       uint32_t *ecx, uint32_t *edx)
> -{
> -#if defined(CONFIG_KVM)
> -    uint32_t vec[4];
> -
> -#ifdef __x86_64__
> -    asm volatile("cpuid"
> -                 : "=a"(vec[0]), "=b"(vec[1]),
> -                   "=c"(vec[2]), "=d"(vec[3])
> -                 : "0"(function), "c"(count) : "cc");
> -#else
> -    asm volatile("pusha \n\t"
> -                 "cpuid \n\t"
> -                 "mov %%eax, 0(%2) \n\t"
> -                 "mov %%ebx, 4(%2) \n\t"
> -                 "mov %%ecx, 8(%2) \n\t"
> -                 "mov %%edx, 12(%2) \n\t"
> -                 "popa"
> -                 : : "a"(function), "c"(count), "S"(vec)
> -                 : "memory", "cc");
> -#endif
> -
> -    if (eax)
> -	*eax = vec[0];
> -    if (ebx)
> -	*ebx = vec[1];
> -    if (ecx)
> -	*ecx = vec[2];
> -    if (edx)
> -	*edx = vec[3];
> -#endif
> -}
>  
>  static void get_cpuid_vendor(CPUX86State *env, uint32_t *ebx,
>                               uint32_t *ecx, uint32_t *edx)
> -- 
> 1.6.4
> 
> 
> 
> 
> 

-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net

  reply	other threads:[~2010-03-06 18:26 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-02 10:08 [Qemu-devel] [PATCH 00/13] i386 cpuid: cleanup and fixes Andre Przywara
2010-02-02 10:08 ` [Qemu-devel] [PATCH 01/13] cpuid: move CPUID functions into separate file Andre Przywara
2010-03-06 18:25   ` Aurelien Jarno
2010-02-02 10:08 ` [Qemu-devel] [PATCH 02/13] cpuid: replace magic number with named constant Andre Przywara
2010-03-06 18:25   ` Aurelien Jarno
2010-02-02 10:08 ` [Qemu-devel] [PATCH 03/13] cpuid: moved host_cpuid function and remove prototype Andre Przywara
2010-03-06 18:26   ` Aurelien Jarno [this message]
2010-02-02 10:08 ` [Qemu-devel] [PATCH 04/13] cpuid: Replace strtok with get_opt_name Andre Przywara
2010-02-02 10:08 ` [Qemu-devel] [PATCH 05/13] cpuid: add missing CPUID feature flag names Andre Przywara
2010-03-06 18:26   ` Aurelien Jarno
2010-02-02 10:08 ` [Qemu-devel] [PATCH 06/13] cpuid: list all known x86 CPUID feature flags Andre Przywara
2010-02-02 10:08 ` [Qemu-devel] [PATCH 07/13] cpuid: remove unnecessary kvm_trim function Andre Przywara
2010-02-02 10:08 ` [Qemu-devel] [PATCH 08/13] cpuid: simplify CPUID flag search function Andre Przywara
2010-02-02 10:08 ` [Qemu-devel] [PATCH 09/13] cpuid: propagate further CPUID leafs when -cpu host Andre Przywara
2010-02-02 10:08 ` [Qemu-devel] [PATCH 10/13] cpuid: add TCG feature bit trimming Andre Przywara
2010-02-02 10:08 ` [Qemu-devel] [PATCH 11/13] cpuid: Always expose 32 and 64-bit CPUs Andre Przywara
2010-02-02 10:08 ` [Qemu-devel] [PATCH 12/13] cpuid: Add kvm32 CPU model Andre Przywara
2010-02-02 10:08 ` [Qemu-devel] [PATCH 13/13] cpuid: fix CPUID levels Andre Przywara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100306182615.GE14275@volta.aurel32.net \
    --to=aurelien@aurel32.net \
    --cc=andre.przywara@amd.com \
    --cc=john.cooper@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).