Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: syssrc/sys/arch/i386/i386



On Sun, Dec 08, 2002 at 07:55:34PM +0000, Chris Gilbert wrote:
> On Sun, 8 Dec 2002 19:39:54 +0900
> Bang Jun-Young <junyoung%netbsd.org@localhost> wrote:
> 
> > On Sun, Dec 08, 2002 at 01:44:57PM +0900, Bang Jun-Young wrote:
> > > On Sun, Dec 08, 2002 at 01:16:05AM +0900, YAMAMOTO Takashi wrote:
> > > > is it needed to have strings for P4 and later processors?
> > > > brand string provided by cpuid insn isn't enough?
> > > 
> > > It is only available with P4.
> > 
> > One more note:
> > 
> > A better reason is that it is more reliable to use brand id number and
> > Intel also recommends that you do so.
> 
> Actually read the latest cpuid doc, and though it was saying that you
> should use brand string where possible, as it avoids any issue of a
> brand id being the same for a chip in it's normal and Xeon form.

String is not enough (so they introduced the number as well). Say,
the brand string is:

Intel(R) Pentium(R) 4 CPU 1.80GHz

How do you let NetBSD know what word is vendor and what is model,
etc.? Result code would be something like this:

        if (strstr(brandstr, "Intel") == 0)
                vendor = "Intel"; /* we don't need (R) */
        if (strstr(brandstr, "Pentium(R) 4") == 0)
                name = "Pentium 4"; /* we don't need (R) and the rest */
        else if (strstr(brandstr, "Xeon") == 0)
                name = "Xeon"; /* we don't need (TM) and the rest either */
        else if (strstr(brandstr, "Mobile") == 0 &&
            strstr(brandstr, "Pentium(R) 4") == 0)
                name = "Mobile Pentium 4"; /* "Mobile Intel(R) ..." */ 
        ...

Obviously, that is a step backward from table based lookup using brand id
numbers. (Note that I had no choice but using the basically same method
as the above for detecting AMD processors since they don't have the brand
id number)

Jun-Young

-- 
Bang Jun-Young <junyoung%netbsd.org@localhost>



Home | Main Index | Thread Index | Old Index