Commit 59795a1f92ed81b63612edd41323792e81d2af7a

Authored by balrog
1 parent 2576d836

x86 CPUID extended family/model (Andre Przywara).

x86 CPUs feature extended family/model bits in CPUID leaf
0000_0001|EAX. Refer to page 10 in:
http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/25481.pdf

Those bits are necessary to model newer AMD CPUs:
-cpu qemu64,family=15,model=65,stepping=3 or
-cpu qemu64,family=16,model=4,stepping=2

Signed-off-by: Andre Przywara <andre.przywara@amd.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5664 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 7 additions and 2 deletions
target-i386/helper.c
... ... @@ -337,7 +337,7 @@ static int cpu_x86_find_by_name(x86_def_t *x86_cpu_def, const char *cpu_model)
337 337 } else if (!strcmp(featurestr, "model")) {
338 338 char *err;
339 339 model = strtol(val, &err, 10);
340   - if (!*val || *err || model < 0 || model > 0xf) {
  340 + if (!*val || *err || model < 0 || model > 0xff) {
341 341 fprintf(stderr, "bad numerical value %s\n", val);
342 342 goto error;
343 343 }
... ... @@ -416,7 +416,12 @@ static int cpu_x86_register (CPUX86State *env, const char *cpu_model)
416 416 env->cpuid_vendor3 = CPUID_VENDOR_INTEL_3;
417 417 }
418 418 env->cpuid_level = def->level;
419   - env->cpuid_version = (def->family << 8) | (def->model << 4) | def->stepping;
  419 + if (def->family > 0x0f)
  420 + env->cpuid_version = 0xf00 | ((def->family - 0x0f) << 20);
  421 + else
  422 + env->cpuid_version = def->family << 8;
  423 + env->cpuid_version |= ((def->model & 0xf) << 4) | ((def->model >> 4) << 16);
  424 + env->cpuid_version |= def->stepping;
420 425 env->cpuid_features = def->features;
421 426 env->pat = 0x0007040600070406ULL;
422 427 env->cpuid_ext_features = def->ext_features;
... ...