[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] Allow setting the vendor_id string with x86's -
From: |
Dan Kenigsberg |
Subject: |
Re: [Qemu-devel] [PATCH] Allow setting the vendor_id string with x86's -cpu option |
Date: |
Sun, 9 Dec 2007 20:58:34 +0200 |
User-agent: |
Mutt/1.5.17 (2007-11-01) |
On Sun, Dec 09, 2007 at 07:29:49PM +0100, Andreas Schwab wrote:
> Dan Kenigsberg <address@hidden> writes:
>
> > + 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);
>
> That will do the wrong thing with the sign bit.
>
Please tell me when I'm done making a fool of myself.
diff --git a/target-i386/helper2.c b/target-i386/helper2.c
index 67658e2..98c03cc 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;