Received: from eggs.gnu.org ([140.186.70.92]:36162) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RyQx3-0006NH-Ud for qemu-devel@nongnu.org; Fri, 17 Feb 2012 11:46:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RyQwr-0002G1-M7 for qemu-devel@nongnu.org; Fri, 17 Feb 2012 11:46:29 -0500 Received: from cantor2.suse.de ([195.135.220.15]:47348 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RyQwr-0002FO-H6 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:04 +0100 Message-Id: <1329497164-20086-5-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 4/4] target-i386: Introduce x86_cpuid_set_model_id() 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 to transform the 48-char model ID into the 12-word model value into a helper. Signed-off-by: Andreas F=C3=A4rber --- target-i386/cpuid.c | 33 +++++++++++++++++++-------------- 1 files changed, 19 insertions(+), 14 deletions(-) diff --git a/target-i386/cpuid.c b/target-i386/cpuid.c index 7a99fcd..aa70214 100644 --- a/target-i386/cpuid.c +++ b/target-i386/cpuid.c @@ -619,6 +619,24 @@ static void x86_cpuid_version_set_stepping(CPUX86Sta= te *env, int stepping) env->cpuid_version |=3D stepping & 0xf; } =20 +static void x86_cpuid_set_model_id(CPUX86State *env, const char *model_i= d) +{ + int c, len, i; + + if (model_id =3D=3D NULL) { + model_id =3D ""; + } + len =3D strlen(model_id); + for (i =3D 0; i < 48; i++) { + if (i >=3D len) { + c =3D '\0'; + } else { + c =3D (uint8_t)model_id[i]; + } + env->cpuid_model[i >> 2] |=3D c << (8 * (i & 3)); + } +} + static int cpu_x86_find_by_name(x86_def_t *x86_cpu_def, const char *cpu_= model) { unsigned int i; @@ -929,20 +947,7 @@ int cpu_x86_register (CPUX86State *env, const char *= cpu_model) env->cpuid_ext3_features &=3D TCG_EXT3_FEATURES; env->cpuid_svm_features &=3D TCG_SVM_FEATURES; } - { - const char *model_id =3D def->model_id; - int c, len, i; - if (!model_id) - model_id =3D ""; - len =3D strlen(model_id); - for(i =3D 0; i < 48; i++) { - if (i >=3D len) - c =3D '\0'; - else - c =3D (uint8_t)model_id[i]; - env->cpuid_model[i >> 2] |=3D c << (8 * (i & 3)); - } - } + x86_cpuid_set_model_id(env, def->model_id); return 0; } =20 --=20 1.7.7