News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

something about CPUID

Started by kejt, January 29, 2013, 02:15:11 AM

Previous topic - Next topic

kejt

Hi guys,
could someone explain me what about are AMD CPUID functions 01h reg EBX brand ID(8 bit field) and 80000001h reg EBX brand ID(12 bits field). How to interpret them? How it works?

Tedd

Potato2

kejt


QuoteI think RTFM covers this one :P

English is not my native language. I have some problems with understanding all this technical stuff.

Tedd

"[BrandId], is used by the BIOS to generate the processor name string. See the appropriate processor revision guide for how to program the processor name string."

It's just to distinguish between the different versions of the same processors, so the BIOS can use a table lookup and provide a nice string for its name.
Potato2

kejt

Do I will need it to determine appropriate CPU's name string or only Brand String function is enough. What about older CPUs. Does Brand String is supported on them?

Tedd

The brand string should be enough for most usage, though if you want to check for specific features, you should use the appropriate cpuid values, not strings.

CPUs that support CPUID will have a brand string, older CPUs that don't support CPUID will not have a brand string. There are other methods to check the CPU type when CPUID is not supported, but they are messy (playing with flags and reserved bits) and this is why CPUID was created.
Potato2

Gunther

Hi kejt,

first of all: welcome to the forum.

Quote from: kejt on January 29, 2013, 03:39:34 AM
Do I will need it to determine appropriate CPU's name string or only Brand String function is enough. What about older CPUs. Does Brand String is supported on them?

Determining the brand string isn't enough. Older CPUs (80486, 80386) doesn't support CPUID, so a brand string isn't available. Of course, on some late 80486 processors the CPUID instruction was implemented, but only as a stub, without functionality. A CPU detection procedure has to check that.

Gunther
You have to know the facts before you can distort them.

dedndave

well - normally, reading the manual will get you the info you need
however, if you want to identify CPU's, it's not that simple - lol

first - notice that there is a difference between "Brand ID", "Brand String", and "Vendor ID" (which is a string)
the brand string is contained on most CPU's that are in use today - it consists of 48 bytes
i showed you that one in the other thread

as Gunther mentioned, older CPU's did not support CPUID, at all
however, none of those CPU's will support windows 2000 or newer OS's

windows 95/98 will support a few early CPU's that have a very limited version of CPUID (perhaps none)

also, if you look at the intel and amd manuals, you will find some errors
identifying CPU's with CPUID is the fastest way i know to get a headache   :lol:

attached is an image i made that has many corrections
it's not up to date with many of the newer cores
but - the newer cores are very easy to identify
it is the older P3 cores that are tricky, as they do not provide the brand string
there are a few P3 cases where you cannot distinguish between models

kejt

I know this method of indentifing older CPUs - pushing and poping flags on the stack. for some time I'm trying to write program which in detail identyfies CPU. I have read manuals from Intel, AMD, Via, Cyrix and Transmeta. But there are things which i just don't understand. There is many things i don't know what they are, such as MONITOR/MWAIT or XSAVE Features. I want know what about I'm writing program. So I look around trying to make a research. Get more knowlegde. I know that indentyfing CPU is not so simple.

dedndave

yah - the old push pop stuff is no longer relavent
the reason is - it was used to ID CPU's that will not run modern operating systems

there are 2 bits of interest in the EFLAGS register, however

bit 18 - if you can alter this bit, you are using a 486 or higher
this is only valid under windows 95, as newer operating systems require a 486 or higher   :P

bit 21 - if bit 21 can be altered, it means that CPUID is supported
some later 486's support CPUID - i believe all pentiums and newer support CPUID
        pushfd
        mov     ecx,240000h              ;bit 21 = ID, bit 18 = 386/486
        pop     eax
        mov     edx,eax                  ;EDX = original
        xor     eax,ecx                  ;EAX = toggled
        push    eax
        popfd                            ;EFLAGS = new
        pushfd
        pop     eax                      ;EAX = new
        push    edx
        popfd                            ;EFLAGS = original
        xor     eax,edx                  ;EAX = toggle result
        and     eax,ecx

;EAX = 00240000h -> CPUID supported 486+
;EAX = 00200000h -> CPUID supported 386 (not a likely case)
;EAX = 00040000h -> CPUID not supported 486 (all pentiums support CPUID)
;EAX = 00000000h -> CPUID not supported 386

kejt

I don't got all of that what i was expected, but many others
valuable informations. Thanks for replies guys.

Adamanteus

Quote from: kejt on January 29, 2013, 02:15:11 AM
Hi guys,
could someone explain me what about are AMD CPUID functions 01h reg EBX brand ID(8 bit field) and 80000001h reg EBX brand ID(12 bits field). How to interpret them? How it works?
AMD uses BrandId that to build exact name of chip, that as usually stored as sting brand name. So basically, you need to look on revision sheet for each AMD family, that to know how to use BrandId for building name of chip.