News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

CPUID test piece.

Started by hutch--, April 23, 2010, 06:27:50 AM

Previous topic - Next topic

Greenhorn__

Hi Hutch,

here's my result ...
AuthenticAMD
AMD Phenom(tm) II X4 955 Processor
0 SSE 4.2
0 SSE 4.1
1 SSE 3
1 SSE 2
1 SSE
1 MMX
Press any key to continue ...

:wink

Regards
Greenhorn
You can fool some of the people all of the time, and all of the people some of the time, but you can not fool all of the people all of the time.
(Abraham Lincoln)

dedndave

Clive - those methods are discouraged by intel and amd

but....
1) ALL pentium class CPU's support CPUID, although it may be disabled on some Cyrix devices
2) you may easily distinquish a 386-class CPU from a 486-class CPU by toggling bit 18 of the EFLAGS register
3) the 386 may not be used for anything after windows 95

the documentation states that a 486 is required for windows 95, but i seem to remember installing it on a 386
my memory is not what it used to be, so the documentation could be right

there may be some 386 class devices in embedded systems running windows CE - not sure about that one   :P

clive

Quote from: dedndave on April 23, 2010, 05:38:55 PM
Clive - those methods are discouraged by intel and amd

Absent other "approved" methods from the offending parties there aren't many other options. Anyhow the code mainly found it's way into diagnostic applications rather than DOS or Windows drivers, because end users were particularly hopeless identifying what hardware they had to my tech support group. If self modifying code is scary, the code to probe and identify North bridge, South bridge (motherboard chipsets), and Multi-IO chips gets to be very dicey. Typically you'd look at the CPU, and things like the number of address bits decoded, stuck at bits, etc before using magic sequences to unlock the hardware. The PCI configuration is now quite stable/defined, but the initial chipsets and first couple of years saw a number of rather unstable implementations.

Most of this stuff is so old as to be mostly irrelevant.
It could be a random act of randomness. Those happen a lot as well.

dedndave

QuoteMost of this stuff is so old as to be mostly irrelevant

that's the thing - we are writing a 32-bit routine - no use in worrying about 16-bit CPU's - lol
for this kind of routine, however, it is nice to support back to windows 3.1 and 386's
that way, the programmer that is incorporating the routine into an app is not limited by the support of one routine
there are still quite a few windows 98 users out there
we have a few guys in here that have windows 3.1 systems to test on, too   :P
discerning 386's and 486's is very simple
the real problem areas are Pentium 2/3 class CPUs
some of the later Pentium 3's support brand strings, too
the ones that don't are a mess - lol

frktons

GenuineIntel
Intel(R) Core(TM)2 CPU          6600  @ 2.40GHz
0 SSE 4.2
0 SSE 4.1
1 SSE 3
1 SSE 2
1 SSE
1 MMX
----------------------------------------------------------------------------------------------------
Manufacturer = GenuineIntel

Model ID string = Intel(R) Core(TM)2 CPU          6600  @ 2.40GHz

Supported Instruction Sets
SSE4.2 NO
SSE4.1 NO
SSE3   YES
SSE2   YES
SSE    YES
MMX    YES
------------------------------------------------------------------------------------------------------

Cheers
Mind is like a parachute. You know what to do in order to use it :-)

hutch--

Thanks guys, I picked this stuff out of the current Intel instruction manual and so far the Intel specific functions seem to work on most hardware. I used a suggestion of Dave's to put some form of ID string for hardware earlier than PIVs which appears to be working but I know the variation in pre-PIV hardware made reliable identification difficult. I need to get access at AMD specific data to pick up the 3DNOW even though its ancient but the late Phenom II series will need to be handled as well as they are a popular processor. (Was tempted to buy one for the newest box Phenom II X4 965 BE but settled on an i7 860 because of its advantage with hyperthreading.)

The drift of this type of function is so you can reliably determine if you can use SSE instruction sets, the ID strings are only of limited use in things like Sysinfo apps.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

dedndave

#21
it would greatly simplify the routine for older CPUs if you could just do:

1) 80386 Class CPU
2) 80486 Class CPU
3) Pentium Class CPU
4) Pentium II Class CPU
5) Pentium III Class CPU

except for Pentium III's, within any one family, the differences are small
later Pentium III's support brand string - no problem there
the real problem is earier Pentium III's - there are a lot of different ones - many were called Celeron's or Xeon's
just call them Pentium III Class and be done with it   :P

EDIT
Intel
if extended model is not 0, brand string is supported
if family is greater than 6, brand string is supported
for family 6, model 0Bh and up support brand string (i am pretty sure this is correct - i will verify)

AMD
all AMD chips support brand string, which makes it easy   :P

3DNow!...
CPUID, eax=80000001, edx bit 31     3DNow!  (AMD only)
CPUID, eax=80000001, edx bit 30     3DNow!+ (AMD only)

these bits should be masked off for non-AMD parts
AMD acquired one or two of the little CPU companies (transmeta maybe ?) - so, a few of their chips support 3DNow also

let me see if i can find specific details......
here we go
for these devices, EDX bits 30 and 31 are valid

All AMD processors after K6-2 (inclusive)
National Semiconductor Geode, later AMD Geode
VIA C3 (also known as Cyrix III) "Samuel", "Ezra", and "Eden" cores
IDT Winchip 2

what i was doing was creating FeatureBitMask's according to the different vendor strings

dedndave

here is a table i was making that combines Intel and AMD signatures
it isn't quite complete, but many of the Intel documentation errors have been corrected

http://www.4shared.com/file/WHXNrzwq/Signature.html

clive

I put this list together from my old DOS notes, last updated 1999. Based on personal observation, or customer logs

; Generic ID, probably match DX at reset, hard to say

; 0010 8088/8086
; 0020 V20/V30
; 0110 80188/80186
; 0200 80286
; 0300 80386 Generic
; 0310 80386DX (14 byte prefetch)
; 0320 80386SX (12 byte prefetch)
; 0330 80376
; 0340 80386SL (ID via SL chipset register)

; GenuineIntel

; Mask CPUID w/0xFFF

; 0400 80486 Generic
; 041x 80486DX  (Stepping  )
; 042x 80486SX  (Stepping 3+) 042A 80486DX SL
; 043x 80486DX2 (Stepping 5+) 0435 80486DX2 SL (Possibly 80487)
; 044x 80486SL  (ID via SL chipset register)
; 045x 80486SX2
; 046x ?
; 047x 80486DX2WB
; 048x 80486DX4
; 049x 80486DX4WB

; 05xx Pentium
; 0510 Pentium 5v 60/66 MHz (Stepping 7+ Fixes FDIV)
; 0520 Pentium 3.3v 75/90/100/120 Mhz (Stepping 4+ Fixes FDIV)
; 0530 Pentium P24T
; 0540 Overdrive for Pentium 3.3v
; 0550 Overdrive for 80486DX4
; 0560 Overdrive for Penitum 5v
; 0580 Pentium MMX (Tillamook)

; 06xx 80686 Generic
; 061x Pentium Pro
; 063x Pentium II (Klamath)
; 065x Pentium II (Deschutes)
; 066x Pentium II (Mendocino)
; 0660            Slot1
; 0665            PPGA
; 066A Pentium II (Dixon) 128/256K L2
; 067x Pentium III (Katmai)
; 068x Pentium III (Coppermine)

; AuthenticAMD

; 043x AMD80486DX2
; 047x AMD80486DX2WB
; 048x AMD80486DX4
; 049x AMD80486DX4WB
; 04Ex AMD80486Plus   AMD5x86
; 04Fx AMD80486PlusWB AMD5x86WB
; 050x AMD5k86 (SSA5)
; 051x AMD5k86
; 056x AMD6k86

; My ID# (Not AMD or Intel by signature)
; 04Ex IBM486 (10 byte prefetch)
; 04Fx Cyrix486 (14 byte prefetch)
It could be a random act of randomness. Those happen a lot as well.

clive

This looks quite good also
http://www.rom.by/comment/39298

http://www.ukcpu.net/Programming/OS/cpuid.txt

Christian's site would also be highly credible, he's probably had all these on the bench.
http://www.sandpile.org/ia32/cpuid.htm

ECX Bit 29 AVX (Advanced Vectorization)
ECX Bit 25 AES (Encryption)
ECX Bit 23 POPCNT (Population Count)

ECX Bit 5 VMX (Vanderpool) Virtualization

ECX Bit 0 SSE3
ECX Bit 9 SSE3E (Core Duo 2 New Instructions)
ECX Bit 19 SSE4.1
ECX Bit 20 SSE4.2 (SSE4E)

EDX Bit 23 MMX
EDX Bit 25 SSE
EDX Bit 26 SSE2
EDX Bit 28 HTT (Jackson) Hyperthreading
It could be a random act of randomness. Those happen a lot as well.

hutch--

The list on Christian's site is close enough to comprehensive but its pointed at a different target, if you were doing legacy processor identification it would be a goldmine but what I am chasing apart from the two easy to get processor strings is the instruction set capability and the Intel data on Intel hardware here seems to be OK. Intel seem to be reasonably stable at the moment with their top line of i3 i5 and i7 processors but AMD are changing their lines very fast at the moment, 4 core Phenom II and recently the 6 core versions and i have not yet decyphered the AMD manual on CPUID that I downloaded this morning.

The end result would be to know what instruction set you can use and the actual core count not including hyperthreading. The ID strings don't in themselves do anything that is particularly useful. I also need to do a check for support of the CPUID opcode to see if its available but for anything that will run Win2000 or later I think from memory that they all support it.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

clive

P4 Willamette
GenuineIntel
Intel(R) Celeron(R) CPU 1.80GHz
0 SSE 4.2
0 SSE 4.1
0 SSE 3
1 SSE 2
1 SSE
1 MMX


Manufacturer = GenuineIntel

Model ID string = Intel(R) Celeron(R) CPU 1.80GHz

Supported Instruction Sets
SSE4.2 NO
SSE4.1 NO
SSE3   NO
SSE2   YES
SSE    YES
MMX    YES
It could be a random act of randomness. Those happen a lot as well.

hutch--

Clive,

A quick question, the Willamette series PIVs from memory went from 1.5 to about 2.0 gig versions before the Northwood core took over, vaguely I remember the main differences from the Celeron to the PIV of that era was cache size and not much else ?
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

clive

Yes, the Willamette was the 180 nm part (1.3 to 2.0 GHz), and the Northwood the 130 nm, with some fixes, tweaked the pipelines and added Hyper Threading (or at least exposed it). I had a conversation with Christian years ago about "Jackson Technology" which was the code name for HT.

As I recall the Celeron part had the smaller cache and restricted FSB.

This bad boy is in a system with an 845GL chipset (400 MHz FSB), and is a total dog even with 1GB of DDR at (133/266). I was shopping around on eBay for a Northwood that might run in it.

-Clive
It could be a random act of randomness. Those happen a lot as well.

hutch--

I remember the main advantage of the 1.5 gig PIV I had was you could thrash it for hours and it never went over about 25c. I had to install a copper cooler on the 2.8 gig Northwood to keep it under 35c with long loads.

I used it for years as it was still faster than the later Prescotts on most code but the board was taken out by a power supply that went bang. Put a new one in but the old power supply took out the northbridge chip when it went bang.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php