Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1J6OAt-0000rx-87 for qemu-devel@nongnu.org; Sun, 23 Dec 2007 05:35:15 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1J6OAr-0000rl-8K for qemu-devel@nongnu.org; Sun, 23 Dec 2007 05:35:14 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J6OAr-0000ri-0w for qemu-devel@nongnu.org; Sun, 23 Dec 2007 05:35:13 -0500 Received: from il.qumranet.com ([82.166.9.18]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1J6OAq-00056f-Cm for qemu-devel@nongnu.org; Sun, 23 Dec 2007 05:35:12 -0500 Received: from localhost (karma.qumranet.com [10.0.50.239]) by il.qumranet.com (Postfix) with ESMTP id 338ECA0009 for ; Sun, 23 Dec 2007 12:34:44 +0200 (IST) Date: Sun, 23 Dec 2007 12:34:44 +0200 From: Dan Kenigsberg Message-ID: <20071223103443.GA10783@karma.qumranet.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] [PATCH] Correct the max cpuid level for each x86 cpu model Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Hi, This little patch corrects the max cpuid level that is exposed to the guest for each of the x86 cpu models. It allows cpuid levels other than 2. Dan. diff --git a/target-i386/helper2.c b/target-i386/helper2.c index b9b3093..dee53d6 100644 --- a/target-i386/helper2.c +++ b/target-i386/helper2.c @@ -119,6 +119,7 @@ CPUX86State *cpu_x86_init(const char *cpu_model) typedef struct x86_def_t { const char *name; + uint32_t level; uint32_t vendor1, vendor2, vendor3; char model_id[48]; int family; @@ -136,6 +137,7 @@ static x86_def_t x86_defs[] = { #ifdef TARGET_X86_64 { .name = "qemu64", + .level = 2, .vendor1 = 0x68747541, /* "Auth" */ .vendor2 = 0x69746e65, /* "enti" */ .vendor3 = 0x444d4163, /* "cAMD" */ @@ -156,6 +158,7 @@ static x86_def_t x86_defs[] = { #endif { .name = "qemu32", + .level = 2, .family = 6, .model = 3, .stepping = 3, @@ -165,6 +168,7 @@ static x86_def_t x86_defs[] = { }, { .name = "486", + .level = 0, .family = 4, .model = 0, .stepping = 0, @@ -173,6 +177,7 @@ static x86_def_t x86_defs[] = { }, { .name = "pentium", + .level = 1, .family = 5, .model = 4, .stepping = 3, @@ -181,6 +186,7 @@ static x86_def_t x86_defs[] = { }, { .name = "pentium2", + .level = 2, .family = 6, .model = 5, .stepping = 2, @@ -189,6 +195,7 @@ static x86_def_t x86_defs[] = { }, { .name = "pentium3", + .level = 2, .family = 6, .model = 7, .stepping = 3, @@ -321,7 +328,7 @@ static int cpu_x86_register (CPUX86State *env, const char *cpu_model) env->cpuid_vendor2 = 0x49656e69; /* "ineI" */ env->cpuid_vendor3 = 0x6c65746e; /* "ntel" */ } - env->cpuid_level = 2; + env->cpuid_level = def->level; env->cpuid_version = (def->family << 8) | (def->model << 4) | def->stepping; env->cpuid_features = def->features; env->pat = 0x0007040600070406ULL;