Received: from eggs.gnu.org ([140.186.70.92]:36177) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RyQx6-0006Na-70 for qemu-devel@nongnu.org; Fri, 17 Feb 2012 11:46:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RyQwr-0002G2-MH for qemu-devel@nongnu.org; Fri, 17 Feb 2012 11:46:32 -0500 Received: from cantor2.suse.de ([195.135.220.15]:47351 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RyQwr-0002FS-H1 for qemu-devel@nongnu.org; Fri, 17 Feb 2012 11:46:17 -0500 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Fri, 17 Feb 2012 17:46:01 +0100 Message-Id: <1329497164-20086-2-git-send-email-afaerber@suse.de> In-Reply-To: <1329497164-20086-1-git-send-email-afaerber@suse.de> References: <1329497164-20086-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH 1/4] target-i386: Introduce x86_cpuid_version_set_family() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: andre.przywara@amd.com, =?UTF-8?q?Andreas=20F=C3=A4rber?= Move the logic for setting the family and extended family into a helper function. To make the helper self-contained and in preparation of future unordered/multiple uses, mask out any previous family values first. Signed-off-by: Andreas F=C3=A4rber --- target-i386/cpuid.c | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-) diff --git a/target-i386/cpuid.c b/target-i386/cpuid.c index b9bfeaf..598a27c 100644 --- a/target-i386/cpuid.c +++ b/target-i386/cpuid.c @@ -597,6 +597,16 @@ static int check_features_against_host(x86_def_t *gu= est_def) return rv; } =20 +static void x86_cpuid_version_set_family(CPUX86State *env, int family) +{ + env->cpuid_version &=3D ~0xff00f00; + if (family > 0x0f) { + env->cpuid_version |=3D 0xf00 | ((family - 0x0f) << 20); + } else { + env->cpuid_version |=3D family << 8; + } +} + static int cpu_x86_find_by_name(x86_def_t *x86_cpu_def, const char *cpu_= model) { unsigned int i; @@ -883,10 +893,7 @@ int cpu_x86_register (CPUX86State *env, const char *= cpu_model) } env->cpuid_vendor_override =3D def->vendor_override; env->cpuid_level =3D def->level; - if (def->family > 0x0f) - env->cpuid_version =3D 0xf00 | ((def->family - 0x0f) << 20); - else - env->cpuid_version =3D def->family << 8; + x86_cpuid_version_set_family(env, def->family); env->cpuid_version |=3D ((def->model & 0xf) << 4) | ((def->model >> = 4) << 16); env->cpuid_version |=3D def->stepping; env->cpuid_features =3D def->features; --=20 1.7.7