Question about printcpuinfo in sys/amd64/amd64/indentcpu.c

Garrett Cooper gcooper at FreeBSD.org
Fri Aug 20 14:14:48 UTC 2010


Hi,
    Currently the code in identcpu.c does a check for a specific cpu
value extension. This is set to 0x80000004 (even though the
corresponding code below iterates through 0x80000002:0x80000005):

        /* Check for extended CPUID information and a processor name. */
        if (cpu_exthigh >= 0x80000004) {
                brand = cpu_brand;
                for (i = 0x80000002; i < 0x80000005; i++) {
                        do_cpuid(i, regs);
                        memcpy(brand, regs, sizeof(regs));
                        brand += sizeof(regs);
                }
        }

    Why was this done? Because some processors lie and state that
they're newer than the processor version that they actually are?
    This was committed in CVS revision 1.80.2.14 with the following message:

MFC: Precursors to simple hyperthreading support and sync with current:
- Axe earlysetcpuclass() as it was OBE a long time ago.
- Add cpu_exthigh to hold the highest supported extended cpuid.
- Don't initialize cpu_class, the initial value isn't used anywhere.
- Make the support for processor names in the extended cpuid information
  shared between the AMD and Transmeta sections and also perform it for
  Intel CPUs.
- Support brand-indexed names for Intel CPUs.
- Sync AMD 486 cpu_model's with current.
- Remove duplicate and bogus docs for bits 28 and 29 of cpuid features.
- Document bits 30 and 31 of cpuid features.
- Display the number of logical cores on CPUs that support hyperthreading.
- Make hw_instruction_sse static.
- Move enable_sse()'s prototype to machine/md_var.h.
- Add cpu_procinfo to hold information about this processor from cpuid
  1 including count of HTT cores, brand index, local APIC ID, etc.

Thanks,
-Garrett


More information about the freebsd-hackers mailing list