Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1J1MZg-0005kr-PX for qemu-devel@nongnu.org; Sun, 09 Dec 2007 08:52:04 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1J1MZg-0005kc-4w for qemu-devel@nongnu.org; Sun, 09 Dec 2007 08:52:04 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J1MZg-0005kZ-2E for qemu-devel@nongnu.org; Sun, 09 Dec 2007 08:52:04 -0500 Received: from il.qumranet.com ([82.166.9.18]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1J1MZf-0007kH-HN for qemu-devel@nongnu.org; Sun, 09 Dec 2007 08:52:03 -0500 Received: from localhost (karma.qumranet.com [10.0.50.239]) by il.qumranet.com (Postfix) with ESMTP id E6E05250132 for ; Sun, 9 Dec 2007 15:52:01 +0200 (IST) Date: Sun, 9 Dec 2007 15:52:01 +0200 From: Dan Kenigsberg Subject: Re: [Qemu-devel] [PATCH] Allow setting the vendor_id string with x86's -cpu option Message-ID: <20071209135201.GA5113@karma.qumranet.com> References: <20071125132334.GA9555@karma.qumranet.com> <20071209030244.GC12436@networkno.de> <20071209092721.GA2858@karma.qumranet.com> <200712091136.36900.paul@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200712091136.36900.paul@codesourcery.com> 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 On Sun, Dec 09, 2007 at 11:36:34AM +0000, Paul Brook wrote: > > + x86_cpu_def->vendor1 = cpu_to_le32(*(uint32_t *)val); > > + x86_cpu_def->vendor2 = cpu_to_le32(*(uint32_t *)(val + > > 4)); + x86_cpu_def->vendor3 = cpu_to_le32(*(uint32_t *)(val > > Still not good enough. val might not be aligned. > So, is it that my only hope is going back to basics? diff --git a/target-i386/helper2.c b/target-i386/helper2.c index 67658e2..2ef4be3 100644 --- a/target-i386/helper2.c +++ b/target-i386/helper2.c @@ -254,6 +254,18 @@ static int cpu_x86_find_by_name(x86_def_t *x86_cpu_def, const char *cpu_model) goto error; } x86_cpu_def->stepping = stepping; + } else if (!strcmp(featurestr, "vendor")) { + if (strlen(val) != 12) { + fprintf(stderr, "vendor string must be 12 chars long\n"); + x86_cpu_def = 0; + goto error; + } + x86_cpu_def->vendor1 = val[0] + (val[1] << 8) + + (val[2] << 16) + (val[3] << 24); + x86_cpu_def->vendor2 = val[4] + (val[5] << 8) + + (val[6] << 16) + (val[7] << 24); + x86_cpu_def->vendor3 = val[8] + (val[9] << 8) + + (val[10] << 16) + (val[11] << 24); } else { fprintf(stderr, "unrecognized feature %s\n", featurestr); x86_cpu_def = 0;