I am tired of this stuff as well but I was after an easy to use algo to test if you can use the later instruction sets so I have kept dabbling to make it easier to use. This one is coded with BT to make it easier to read and has the eflags test on board so it won't crash on an old timer even if you can get win32 to run on it. I felt cheated in that the first version in the rewrite used CMOVC with no jumps but then it dawned that there may be something that will run win32 that did not have the CMOVxx family of instructions so I had to do it again.
IF 0 ; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
Build this template with "CONSOLE ASSEMBLE AND LINK"
ENDIF ; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
include \masm32\include\masm32rt.inc
.686p
testi PROTO :DWORD
X86ST STRUCT
sse42 dd ?
sse41 dd ?
ssse3 dd ?
sse3 dd ?
sse2 dd ?
sse dd ?
mmx dd ?
X86ST ENDS
.code
start:
; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
call main
inkey
exit
; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
main proc
LOCAL x86 :X86ST
invoke testi,ADDR x86
print str$(x86.sse42),13,10
print str$(x86.sse41),13,10
print str$(x86.ssse3),13,10
print str$(x86.sse3),13,10
print str$(x86.sse2),13,10
print str$(x86.sse),13,10
print str$(x86.mmx),13,10
ret
main endp
; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
testi proc pStruct:DWORD
; returns 0 if no CPUID, 1 if it is supported.
; if supported tests from MMX to SSE4.2 and
; writes results to structure
; -------------------------------------------------
; test for CPUID so it does not crash on old timers
; -------------------------------------------------
pushfd
pop eax
mov ecx, eax
xor eax, 00000000001000000000000000000000b ; set bit 21 of eflags
push eax
popfd
pushfd
pop eax
xor eax, ecx ; test if its changed
jnz exists ; if changed then CPUID
xor eax, eax ; returns 0 if no CPUID
ret
; -------------------------------------------------
exists:
push esi
mov esi, pStruct
mov eax, 1
cpuid
mov (X86ST PTR [esi]).sse42, 0
bt ecx, 20 ; sse4.2
jnc @F
mov (X86ST PTR [esi]).sse42, 1
@@:
mov (X86ST PTR [esi]).sse41, 0
bt ecx, 19 ; sse4.1
jnc @F
mov (X86ST PTR [esi]).sse41, 1
@@:
mov (X86ST PTR [esi]).ssse3, 0
bt ecx, 9 ; ssse3
jnc @F
mov (X86ST PTR [esi]).ssse3, 1
@@:
mov (X86ST PTR [esi]).sse3, 0
bt ecx, 0 ; sse3
jnc @F
mov (X86ST PTR [esi]).sse3, 1
@@:
mov (X86ST PTR [esi]).sse2, 0
bt edx, 26 ; sse2
jnc @F
mov (X86ST PTR [esi]).sse2, 1
@@:
mov (X86ST PTR [esi]).sse, 0
bt edx, 25 ; sse
jnc @F
mov (X86ST PTR [esi]).sse, 1
@@:
mov (X86ST PTR [esi]).mmx, 0
bt edx, 23 ; mmx
jnc @F
mov (X86ST PTR [esi]).mmx, 1
@@:
pop esi
mov eax, 1
ret
testi endp
; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
end start
you have to watch register addressing modes and conditional branch distances, as well :P
once you get to the part where you know you have a pentium, you can breath a little
:bg
I doubt that win32 will run on an 8086. Win32 capable processors have no problems with either. Further there is no branch that exceeds signed byte range in this algo. Having written code for the original i486 (still own it) the original DX 33 meg version could do both and I vaguely remember a young guy running win95 OEM on a 486SX.
The algo only tests instruction sets, its not trying to be CPU-Z. Anything old enough to be a problem does not run win32 or from the testing by other members it already runs on PIII, PII and I think the earliest non MMX pentiums. I seem to have missed the drift of your post.
Since this is in the lab
mov (X86ST PTR [esi]).sse42, 0
bt ecx, 20 ; sse4.2
jnc @F
mov (X86ST PTR [esi]).sse42, 1
@@:
sub eax,eax
mov (X86ST PTR [esi]).sse42, eax
bt ecx, 20 ; sse4.2
adc (X86ST PTR [esi]).sse42, eax
Or zero the struc then just bt and adc.
>I vaguely remember a young guy running win95 OEM on a 486SX.
Hey, that was me! but it was osr2...back in the summer of 69 96
TRUE/FALSE, no initialization, one write, no branch
bt ecx, 20 ; sse4.2
sbb eax,eax
mov (X86ST PTR [esi]).sse42, eax
:bg
Thanks folks, novel approach, branchless without CMOVxx. :U
I actually found a use for SETC.
;; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
; "mmi" Multi media Instructions
OPTION PROLOGUE:NONE
OPTION EPILOGUE:NONE
mmi proc pStruct:DWORD
; returns 0 if no CPUID, 1 if it is supported.
; if supported tests from MMX to SSE4.2 and
; writes results to structure
; -------------------------------------------------
; test for CPUID so it does not crash on old timers
; -------------------------------------------------
pushfd
pop eax
mov ecx, eax
xor eax, 00000000001000000000000000000000b ; set bit 21 of eflags
push eax
popfd
pushfd
pop eax
xor eax, ecx ; test if its changed
jnz exists ; if changed then CPUID
xor eax, eax ; returns 0 if no CPUID
ret 4
; -------------------------------------------------
exists:
; -------------------
; zero fill structure
; -------------------
mov ecx, SIZEOF X86ST
shr ecx, 2
mov eax, [esp+4] ; pStruct
@@:
mov DWORD PTR [eax], 0
add eax, 4
sub ecx, 1
jnz @B
mov eax, 1
cpuid
mov eax, [esp+4] ; pStruct
bt ecx, 20 ; sse4.2
setc BYTE PTR (X86ST PTR [eax]).sse42
bt ecx, 19 ; sse4.1
setc BYTE PTR (X86ST PTR [eax]).sse41
bt ecx, 9 ; ssse3
setc BYTE PTR (X86ST PTR [eax]).ssse3
bt ecx, 0 ; sse3
setc BYTE PTR (X86ST PTR [eax]).sse3
bt edx, 26 ; sse2
setc BYTE PTR (X86ST PTR [eax]).sse2
bt edx, 25 ; sse
setc BYTE PTR (X86ST PTR [eax]).sse
bt edx, 23 ; mmx
setc BYTE PTR (X86ST PTR [eax]).mmx
mov eax, 1
ret 4
mmi endp
OPTION PROLOGUE:PrologueDef
OPTION EPILOGUE:EpilogueDef
; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
Pity it only works on bytes, and you have to init the table.
Instead of
mov ecx, SIZEOF X86ST
shr ecx, 2
you could use this for a fixed size structure
mov ecx, SIZEOF X86ST SHR 2
Wouldn't it make more sense for the new feature to be at the end of the table so when it expands the rest of the table remains the same?
:bg
> mov ecx, SIZEOF X86ST SHR 2
Saves the SHR in code which makes sense.
> Wouldn't it make more sense for the new feature to be at the end of the table so when it expands the rest of the table remains the same?
I have missed something here, by passing the structure adress you are selecting the member to write to by its name so you can routinely add extra members to the structure.
It was more of a backward compatibility thought.. Although you really want the user to keep all the code/versions synchronized
X86ST STRUCT
mmx dd ?
sse dd ?
sse2 dd ?
sse3 dd ?
ssse3 dd ?
sse41 dd ?
sse42 dd ?
; New features added here expanding the structure
X86ST ENDS
The other thing Microsoft typically does is add a size field as the first record.
This does make sense in a context where the information was being pulled out of the operating system but in the context where the information is being taken directly from the processor there is nothing that is going to change it except hardware change that breaks the existing reference material. If for example it was an external structure in the OS, if it was changed out of the published order, it would break code that was written using it but where the structure is handled internally only then with a built binary nothing external to the binary will change the information.
I confess I shot the structure together in decending order because the Intel reference material had it written that way in the table and an order inversion or random shuffle would not change anything as each structure member is addressed in code by its name.
Thanks Hutch!
This is a very usefull code :U
What missing is the subdivision for "Extended MMX" - SSE Primer -
Like AMD "Athlon" and "Duron" are capable of executing MMX integer extentions but not SSE.
3DNow! subdivision would be a nice add-in as well. :wink
Ficko,
I know what they are but I don't have an AMD box to test on and its almost impossible to get a reliable result without being able to test it. You can determine if the box is an AMD from the Vendor string "AuthenticAMD" but it needs tests for the two 3DNow sets and extended MMX and sse4a.
Hutch - you might be able to use this thread as a reference book
you can see the code - then, you can see how it ran on a hundred different machines
http://www.masm32.com/board/index.php?topic=13044.msg101030#msg101030
Ficko,
I added to the test piece the values I know for AMD but I have no way of testing them.
I get these returns on an Intel Quad.
-----
INTEL
-----
0 sse4.2
1 sse4.1
1 ssse3
1 sse3
1 sse2
1 sse
1 mmx
---
AMD
---
0 sse4a
0 mmx_ex
0 3DNow
0 3DNow_ex
Press any key to continue ...
Could I impose on you to run this code on an AMD, anything late like an Athlon or Phenom ii.
Thanks it looks good at the first glance :U
"AMD Athlon"
Quote
-----
INTEL
-----
0 sse4.2
0 sse4.1
0 ssse3
0 sse3
0 sse2
0 sse
1 mmx
---
AMD
---
0 sse4a
1 mmx_ex
1 3DNow
1 3DNow_ex
and
"AMD Athlon 64 3500+"
Quote
-----
INTEL
-----
0 sse4.2
0 sse4.1
0 ssse3
1 sse3
1 sse2
1 sse
1 mmx
---
AMD
---
0 sse4a
1 mmx_ex
1 3DNow
1 3DNow_ex
Gratsie,
May have struck a winner with it.
Now I wonder if anyone is running a later Phenom II. A 955 or 965 BE ?
Sempron, not what you requested but your results are coming back correctly for me now
-----
INTEL
-----
0 sse4.2
0 sse4.1
0 ssse3
1 sse3
1 sse2
1 sse
1 mmx
---
AMD
---
0 sse4a
1 mmx_ex
1 3DNow
1 3DNow_ex
AMD Athlon 64 3200+ (NewCastle)
-----
INTEL
-----
0 sse4.2
0 sse4.1
0 ssse3
0 sse3
1 sse2
1 sse
1 mmx
---
AMD
---
0 sse4a
1 mmx_ex
1 3DNow
1 3DNow_ex
For debugging, a tool which captures the CPUID return values for the 00000xxx and 80000xxx ranges might permit you record/playback and basically emulate of CPUID for testing purposes. CPU-Z puts this data, and some MSR's into its text log
CPUID
0x00000000 0x00000001 0x68747541 0x444D4163 0x69746E65
0x00000001 0x00000FF0 0x00000800 0x00000000 0x078BFBFF
0x80000000 0x80000018 0x68747541 0x444D4163 0x69746E65
0x80000001 0x00000FF0 0x0000010A 0x00000000 0xE1D3FBFF
0x80000002 0x20444D41 0x6C687441 0x74286E6F 0x3620296D
0x80000003 0x72502034 0x7365636F 0x20726F73 0x30303233
0x80000004 0x0000002B 0x00000000 0x00000000 0x00000000
0x80000005 0xFF08FF08 0xFF20FF20 0x40020140 0x40020140
0x80000006 0x00000000 0x42004200 0x02008140 0x00000000
0x80000007 0x00000000 0x00000000 0x00000000 0x0000000F
0x80000008 0x00003028 0x00000000 0x00000000 0x00000000
0x80000009 0x00000000 0x00000000 0x00000000 0x00000000
0x8000000A 0x00000000 0x00000000 0x00000000 0x00000000
0x8000000B 0x00000000 0x00000000 0x00000000 0x00000000
0x8000000C 0x00000000 0x00000000 0x00000000 0x00000000
0x8000000D 0x00000000 0x00000000 0x00000000 0x00000000
0x8000000E 0x00000000 0x00000000 0x00000000 0x00000000
0x8000000F 0x00000000 0x00000000 0x00000000 0x00000000
0x80000010 0x00000000 0x00000000 0x00000000 0x00000000
0x80000011 0x00000000 0x00000000 0x00000000 0x00000000
0x80000012 0x00000000 0x00000000 0x00000000 0x00000000
0x80000013 0x00000000 0x00000000 0x00000000 0x00000000
0x80000014 0x00000000 0x00000000 0x00000000 0x00000000
0x80000015 0x00000000 0x00000000 0x00000000 0x00000000
0x80000016 0x00000000 0x00000000 0x00000000 0x00000000
0x80000017 0x00000000 0x00000000 0x00000000 0x00000000
0x80000018 0x00000000 0x00000000 0x00000000 0x00000000
MSR 0x0000001B 0x00000000 0xFEE00900
MSR 0xC001001E 0x00000000 0x00000006
MSR 0xC0010015 0x00000000 0x0C000000
MSR 0xC0010042 0x00000202 0x000C0C0C
MSR 0xC0010041 0x00000001 0x0000020C
that would be great if we had such a file for all the processors
which, the guys at cpu-z have probably collected over time
they aren't going to give that database away for free
they want to sell you a library to ID CPU's in apps
which i think is kinda cheesy - lol
they'd be better off to give the library away and sell more website advertising space, and/or for more money
EDIT
the reason i say that is, most application authors who really need such a library are capable of writing their own
to be full-featured, a kmd is required to access MSR's and CR's
i found such a library for free, but i wanted to learn to write my own
Ok, here's a quick throw away app in C. It collects the CPUID data, outputs a human readable version and a MASM pasteable block of data. It also generates a CPUIDEMU.ASM file with the data and an emulation function.
Here's the data for a Prescott P4
index eax ebx ecx edx
00000000 - 00000005 756E6547 6C65746E 49656E69 - ....GenuntelineI
00000001 - 00000F34 00020800 0000441D BFEBFBFF - 4........D......
00000002 - 605B5001 00000000 00000000 007C7040 - .P[`........@p|.
00000003 - 00000000 00000000 00000000 00000000 - ................
00000004 - 00000000 00000000 00000000 00000000 - ................
00000005 - 00000040 00000040 00000000 00000000 - @...@...........
80000000 - 80000008 00000000 00000000 00000000 - ................
80000001 - 00000000 00000000 00000000 00000000 - ................
80000002 - 20202020 20202020 20202020 6E492020 - In
80000003 - 286C6574 50202952 69746E65 52286D75 - tel(R) Pentium(R
80000004 - 20342029 20555043 30302E33 007A4847 - ) 4 CPU 3.00GHz.
80000005 - 00000000 00000000 00000000 00000000 - ................
80000006 - 00000000 00000000 04006040 00000000 - ........@`......
80000007 - 00000000 00000000 00000000 00000000 - ................
80000008 - 00002024 00000000 00000000 00000000 - $ ..............
Press any key to continue..
EmuTable equ $
dd 000000000h,000000005h,0756E6547h,06C65746Eh,049656E69h
dd 000000001h,000000F34h,001020800h,00000441Dh,0BFEBFBFFh
dd 000000002h,0605B5001h,000000000h,000000000h,0007C7040h
dd 000000003h,000000000h,000000000h,000000000h,000000000h
dd 000000004h,000000000h,000000000h,000000000h,000000000h
dd 000000005h,000000040h,000000040h,000000000h,000000000h
dd 080000000h,080000008h,000000000h,000000000h,000000000h
dd 080000001h,000000000h,000000000h,000000000h,000000000h
dd 080000002h,020202020h,020202020h,020202020h,06E492020h
dd 080000003h,0286C6574h,050202952h,069746E65h,052286D75h
dd 080000004h,020342029h,020555043h,030302E33h,0007A4847h
dd 080000005h,000000000h,000000000h,000000000h,000000000h
dd 080000006h,000000000h,000000000h,004006040h,000000000h
dd 080000007h,000000000h,000000000h,000000000h,000000000h
dd 080000008h,000002024h,000000000h,000000000h,000000000h
dd 0FFFFFFFFh
Press any key to continue..
CPUIDEMU.ASM file generated by the program
.386
.MODEL FLAT,C
.DATA
EmuTable equ $
dd 000000000h,000000005h,0756E6547h,06C65746Eh,049656E69h
dd 000000001h,000000F34h,000020800h,00000441Dh,0BFEBFBFFh
dd 000000002h,0605B5001h,000000000h,000000000h,0007C7040h
dd 000000003h,000000000h,000000000h,000000000h,000000000h
dd 000000004h,000000000h,000000000h,000000000h,000000000h
dd 000000005h,000000040h,000000040h,000000000h,000000000h
dd 080000000h,080000008h,000000000h,000000000h,000000000h
dd 080000001h,000000000h,000000000h,000000000h,000000000h
dd 080000002h,020202020h,020202020h,020202020h,06E492020h
dd 080000003h,0286C6574h,050202952h,069746E65h,052286D75h
dd 080000004h,020342029h,020555043h,030302E33h,0007A4847h
dd 080000005h,000000000h,000000000h,000000000h,000000000h
dd 080000006h,000000000h,000000000h,004006040h,000000000h
dd 080000007h,000000000h,000000000h,000000000h,000000000h
dd 080000008h,000002024h,000000000h,000000000h,000000000h
dd 0FFFFFFFFh
.CODE
CPUIDEmu PROC ; On Entry EAX = Index
push esi
mov esi,EmuTable
cmp eax,0FFFFFFFFh
jz cpuid_30
cpuid_10:
cmp [esi],eax
jz cpuid_20
add esi,20
cmp dword ptr [esi],0FFFFFFFFh
jnz cpuid_10
jmp cpuid_30
cpuid_20:
mov eax,[esi + 4]
mov ebx,[esi + 8]
mov ecx,[esi + 12]
mov edx,[esi + 16]
cpuid_30:
pop esi
ret
CPUIDEmu ENDP
END
Here from my NewCastle Athlon
index eax ebx ecx edx
00000000 - 00000001 68747541 444D4163 69746E65 - ....AuthcAMDenti
00000001 - 00000FF0 00000800 00000000 078BFBFF - ................
80000000 - 80000018 68747541 444D4163 69746E65 - ....AuthcAMDenti
80000001 - 00000FF0 0000010A 00000000 E1D3FBFF - ................
80000002 - 20444D41 6C687441 74286E6F 3620296D - AMD Athlon(tm) 6
80000003 - 72502034 7365636F 20726F73 30303233 - 4 Processor 3200
80000004 - 0000002B 00000000 00000000 00000000 - +...............
80000005 - FF08FF08 FF20FF20 40020140 40020140 - .... . .@..@@..@
80000006 - 00000000 42004200 02008140 00000000 - .....B.B@.......
80000007 - 00000000 00000000 00000000 0000000F - ................
80000008 - 00003028 00000000 00000000 00000000 - (0..............
80000009 - 00000000 00000000 00000000 00000000 - ................
8000000A - 00000000 00000000 00000000 00000000 - ................
8000000B - 00000000 00000000 00000000 00000000 - ................
8000000C - 00000000 00000000 00000000 00000000 - ................
8000000D - 00000000 00000000 00000000 00000000 - ................
8000000E - 00000000 00000000 00000000 00000000 - ................
8000000F - 00000000 00000000 00000000 00000000 - ................
80000010 - 00000000 00000000 00000000 00000000 - ................
80000011 - 00000000 00000000 00000000 00000000 - ................
80000012 - 00000000 00000000 00000000 00000000 - ................
80000013 - 00000000 00000000 00000000 00000000 - ................
80000014 - 00000000 00000000 00000000 00000000 - ................
80000015 - 00000000 00000000 00000000 00000000 - ................
80000016 - 00000000 00000000 00000000 00000000 - ................
80000017 - 00000000 00000000 00000000 00000000 - ................
80000018 - 00000000 00000000 00000000 00000000 - ................
Press any key to continue..
EmuTable equ $
dd 000000000h,000000001h,068747541h,0444D4163h,069746E65h
dd 000000001h,000000FF0h,000000800h,000000000h,0078BFBFFh
dd 080000000h,080000018h,068747541h,0444D4163h,069746E65h
dd 080000001h,000000FF0h,00000010Ah,000000000h,0E1D3FBFFh
dd 080000002h,020444D41h,06C687441h,074286E6Fh,03620296Dh
dd 080000003h,072502034h,07365636Fh,020726F73h,030303233h
dd 080000004h,00000002Bh,000000000h,000000000h,000000000h
dd 080000005h,0FF08FF08h,0FF20FF20h,040020140h,040020140h
dd 080000006h,000000000h,042004200h,002008140h,000000000h
dd 080000007h,000000000h,000000000h,000000000h,00000000Fh
dd 080000008h,000003028h,000000000h,000000000h,000000000h
dd 080000009h,000000000h,000000000h,000000000h,000000000h
dd 08000000Ah,000000000h,000000000h,000000000h,000000000h
dd 08000000Bh,000000000h,000000000h,000000000h,000000000h
dd 08000000Ch,000000000h,000000000h,000000000h,000000000h
dd 08000000Dh,000000000h,000000000h,000000000h,000000000h
dd 08000000Eh,000000000h,000000000h,000000000h,000000000h
dd 08000000Fh,000000000h,000000000h,000000000h,000000000h
dd 080000010h,000000000h,000000000h,000000000h,000000000h
dd 080000011h,000000000h,000000000h,000000000h,000000000h
dd 080000012h,000000000h,000000000h,000000000h,000000000h
dd 080000013h,000000000h,000000000h,000000000h,000000000h
dd 080000014h,000000000h,000000000h,000000000h,000000000h
dd 080000015h,000000000h,000000000h,000000000h,000000000h
dd 080000016h,000000000h,000000000h,000000000h,000000000h
dd 080000017h,000000000h,000000000h,000000000h,000000000h
dd 080000018h,000000000h,000000000h,000000000h,000000000h
dd 0FFFFFFFFh
Press any key to continue..
Clive
you might want to dump the two full series of cache descriptors
not that that info is used to ID processors, much
either way, it would be nice to have a data base to work from :U
now, we just need some people with strange processors to run it for us - lol
i had thought of creating a website to collect similar data files
let anyone run it - i figured they'd be afraid it was some kind of a virus :P
Don't have much in the way of AMD kit here. If I was getting real fancy I would have it email or upload to a website, but like you said that usually freaks people out.
It should catch the Intel cache descriptors provided CPUID#0 eax returns the correct number of CPUID records. I haven't looked at AMD docs in a while, and my MSR code can't inject the driver in Vista/Win7
Here is an Intel Core Solo
index eax ebx ecx edx
00000000 - 0000000A 756E6547 6C65746E 49656E69 - ....GenuntelineI
00000001 - 000006E8 00010800 0000C189 AFE9FBFF - ................
00000002 - 02B3B001 000000F0 00000000 2C04307D - ............}0.,
00000003 - 00000000 00000000 00000000 00000000 - ................
00000004 - 00000000 00000000 00000000 00000000 - ................
00000005 - 00000040 00000040 00000003 00022220 - @...@....... "..
00000006 - 00000001 00000002 00000001 00000000 - ................
00000007 - 00000000 00000000 00000000 00000000 - ................
00000008 - 00000000 00000000 00000000 00000000 - ................
00000009 - 00000000 00000000 00000000 00000000 - ................
0000000A - 07280201 00000000 00000000 00000000 - ..(.............
80000000 - 80000008 00000000 00000000 00000000 - ................
80000001 - 00000000 00000000 00000000 00100000 - ................
80000002 - 756E6547 20656E69 65746E49 2952286C - Genuine Intel(R)
80000003 - 55504320 20202020 20202020 54202020 - CPU T
80000004 - 30353331 20402020 36382E31 007A4847 - 1350 @ 1.86GHz.
80000005 - 00000000 00000000 00000000 00000000 - ................
80000006 - 00000000 00000000 08006040 00000000 - ........@`......
80000007 - 00000000 00000000 00000000 00000000 - ................
80000008 - 00002020 00000000 00000000 00000000 - ..............
Press any key to continue..
EmuTable equ $
dd 000000000h,00000000Ah,0756E6547h,06C65746Eh,049656E69h
dd 000000001h,0000006E8h,000010800h,00000C189h,0AFE9FBFFh
dd 000000002h,002B3B001h,0000000F0h,000000000h,02C04307Dh
dd 000000003h,000000000h,000000000h,000000000h,000000000h
dd 000000004h,000000000h,000000000h,000000000h,000000000h
dd 000000005h,000000040h,000000040h,000000003h,000022220h
dd 000000006h,000000001h,000000002h,000000001h,000000000h
dd 000000007h,000000000h,000000000h,000000000h,000000000h
dd 000000008h,000000000h,000000000h,000000000h,000000000h
dd 000000009h,000000000h,000000000h,000000000h,000000000h
dd 00000000Ah,007280201h,000000000h,000000000h,000000000h
dd 080000000h,080000008h,000000000h,000000000h,000000000h
dd 080000001h,000000000h,000000000h,000000000h,000100000h
dd 080000002h,0756E6547h,020656E69h,065746E49h,02952286Ch
dd 080000003h,055504320h,020202020h,020202020h,054202020h
dd 080000004h,030353331h,020402020h,036382E31h,0007A4847h
dd 080000005h,000000000h,000000000h,000000000h,000000000h
dd 080000006h,000000000h,000000000h,008006040h,000000000h
dd 080000007h,000000000h,000000000h,000000000h,000000000h
dd 080000008h,000002020h,000000000h,000000000h,000000000h
dd 0FFFFFFFFh
Press any key to continue..
P3 Coppermine
index eax ebx ecx edx
00000000 - 00000002 756E6547 6C65746E 49656E69 - ....GenuntelineI
00000001 - 00000665 00000000 00000000 0183FBFF - e...............
00000002 - 03020101 00000000 00000000 0C040841 - ............A...
80000000 - 03020101 00000000 00000000 0C040841 - ............A...
Press any key to continue..
EmuTable equ $
dd 000000000h,000000002h,0756E6547h,06C65746Eh,049656E69h
dd 000000001h,000000665h,000000000h,000000000h,00183FBFFh
dd 000000002h,003020101h,000000000h,000000000h,00C040841h
dd 0FFFFFFFFh
Press any key to continue..
I should probably fire up Deschutes and Katmai
it's still cool :U
i wasn't going to post mine - you already have the prescott
but, there are a few different steppings
yours must be a little newer than mine - i see a few bits set in yours that aren't set here
index eax ebx ecx edx
00000000 - 00000005 756E6547 6C65746E 49656E69 - ....GenuntelineI
00000001 - 00000F43 00020800 0000649D BFEBFBFF - C........d......
00000002 - 605B5001 00000000 00000000 007D7040 - .P[`........@p}.
00000003 - 00000000 00000000 00000000 00000000 - ................
00000004 - 00000000 00000000 00000000 00000000 - ................
00000005 - 00000040 00000040 00000000 00000000 - @...@...........
80000000 - 80000008 00000000 00000000 00000000 - ................
80000001 - 00000000 00000000 00000000 20100000 - ...............
80000002 - 20202020 20202020 20202020 6E492020 - In
80000003 - 286C6574 50202952 69746E65 52286D75 - tel(R) Pentium(R
80000004 - 20342029 20555043 30302E33 007A4847 - ) 4 CPU 3.00GHz.
80000005 - 00000000 00000000 00000000 00000000 - ................
80000006 - 00000000 00000000 08006040 00000000 - ........@`......
80000007 - 00000000 00000000 00000000 00000000 - ................
80000008 - 00003024 00000000 00000000 00000000 - $0..............
EmuTable equ $
dd 000000000h,000000005h,0756E6547h,06C65746Eh,049656E69h
dd 000000001h,000000F43h,001020800h,00000649Dh,0BFEBFBFFh
dd 000000002h,0605B5001h,000000000h,000000000h,0007D7040h
dd 000000003h,000000000h,000000000h,000000000h,000000000h
dd 000000004h,000000000h,000000000h,000000000h,000000000h
dd 000000005h,000000040h,000000040h,000000000h,000000000h
dd 080000000h,080000008h,000000000h,000000000h,000000000h
dd 080000001h,000000000h,000000000h,000000000h,020100000h
dd 080000002h,020202020h,020202020h,020202020h,06E492020h
dd 080000003h,0286C6574h,050202952h,069746E65h,052286D75h
dd 080000004h,020342029h,020555043h,030302E33h,0007A4847h
dd 080000005h,000000000h,000000000h,000000000h,000000000h
dd 080000006h,000000000h,000000000h,008006040h,000000000h
dd 080000007h,000000000h,000000000h,000000000h,000000000h
dd 080000008h,000003024h,000000000h,000000000h,000000000h
dd 0FFFFFFFFh
EDIT - this prescott does support EM64T
Interesting stuff if you want to do a CPU-Z replacement but the target of the original algo I posted was to determine what later instructions sets could be used programmatically so the programmer could write alternate code for different processors.
invoke mmi,ADDR x86
cmp x86.sse2, 0
jne alternative
What I need with the algo is someone who has a Phenom II to see if sse4a is recognised.
Indeed, but if you want to test code before deploying it, emulating hardware you don't have can permit you to be 99.9% sure it will work as expected. It also permits you to perform regression testing from the comfort of your own computer. Plus you don't have to wait for us to test it.
Quote from: dedndave on May 05, 2010, 03:08:07 AM
i wasn't going to post mine - you already have the prescott but, there are a few different steppings
yours must be a little newer than mine - i see a few bits set in yours that aren't set here
I have a couple, the box here is Step D0, 1MB L2, without 64-bit. There is another Prescott and Cedar Mill at the office, I think the one at the office supports 64-bit.
Here a Pentium Dual Core (Merom) MMX, SSE 1,2,3,3e, EM64T
index eax ebx ecx edx
00000000 - 0000000A 756E6547 6C65746E 49656E69 - ....GenuntelineI
00000001 - 000006FD 00020800 0000E39D BFEBFBFF - ................
00000002 - 05B0B101 005657F0 00000000 2CB43078 - .....WV.....x0.,
00000003 - 00000000 00000000 00000000 00000000 - ................
00000004 - 00000000 00000000 00000000 00000000 - ................
00000005 - 00000040 00000040 00000003 00001110 - @...@...........
00000006 - 00000001 00000002 00000001 00000000 - ................
00000007 - 00000000 00000000 00000000 00000000 - ................
00000008 - 00000400 00000000 00000000 00000000 - ................
00000009 - 00000000 00000000 00000000 00000000 - ................
0000000A - 07280202 00000000 00000000 00000503 - ..(.............
80000000 - 80000008 00000000 00000000 00000000 - ................
80000001 - 00000000 00000000 00000001 20100000 - ...............
80000002 - 65746E49 2952286C 6E655020 6D756974 - Intel(R) Pentium
80000003 - 20295228 6C617544 50432020 54202055 - (R) Dual CPU T
80000004 - 30333332 20402020 30362E31 007A4847 - 2330 @ 1.60GHz.
80000005 - 00000000 00000000 00000000 00000000 - ................
80000006 - 00000000 00000000 04004040 00000000 - ........@@......
80000007 - 00000000 00000000 00000000 00000000 - ................
80000008 - 00003024 00000000 00000000 00000000 - $0..............
Press any key to continue..
EmuTable equ $
dd 000000000h,00000000Ah,0756E6547h,06C65746Eh,049656E69h
dd 000000001h,0000006FDh,001020800h,00000E39Dh,0BFEBFBFFh
dd 000000002h,005B0B101h,0005657F0h,000000000h,02CB43078h
dd 000000003h,000000000h,000000000h,000000000h,000000000h
dd 000000004h,000000000h,000000000h,000000000h,000000000h
dd 000000005h,000000040h,000000040h,000000003h,000001110h
dd 000000006h,000000001h,000000002h,000000001h,000000000h
dd 000000007h,000000000h,000000000h,000000000h,000000000h
dd 000000008h,000000400h,000000000h,000000000h,000000000h
dd 000000009h,000000000h,000000000h,000000000h,000000000h
dd 00000000Ah,007280202h,000000000h,000000000h,000000503h
dd 080000000h,080000008h,000000000h,000000000h,000000000h
dd 080000001h,000000000h,000000000h,000000001h,020100000h
dd 080000002h,065746E49h,02952286Ch,06E655020h,06D756974h
dd 080000003h,020295228h,06C617544h,050432020h,054202055h
dd 080000004h,030333332h,020402020h,030362E31h,0007A4847h
dd 080000005h,000000000h,000000000h,000000000h,000000000h
dd 080000006h,000000000h,000000000h,004004040h,000000000h
dd 080000007h,000000000h,000000000h,000000000h,000000000h
dd 080000008h,000003024h,000000000h,000000000h,000000000h
dd 0FFFFFFFFh
Press any key to continue..
Here is the results on my 3 running boxes.
index eax ebx ecx edx
00000000 - 0000000D 756E6547 6C65746E 49656E69 - ....GenuntelineI
00000001 - 0001067A 03040800 0408E3FD BFEBFBFF - z...............
00000002 - 05B0B101 005657F0 00000000 2CB4304E - .....WV.....N0.,
00000003 - 00000000 00000000 00000000 00000000 - ................
00000004 - 00000000 00000000 00000000 00000000 - ................
00000005 - 00000040 00000040 00000003 00022220 - @...@....... "..
00000006 - 00000001 00000002 00000003 00000000 - ................
00000007 - 00000000 00000000 00000000 00000000 - ................
00000008 - 00000400 00000000 00000000 00000000 - ................
00000009 - 00000000 00000000 00000000 00000000 - ................
0000000A - 07280202 00000000 00000000 00000503 - ..(.............
0000000B - 00000000 00000000 00000000 00000000 - ................
0000000C - 00000000 00000000 00000000 00000000 - ................
0000000D - 00000000 00000000 00000000 00000000 - ................
80000000 - 80000008 00000000 00000000 00000000 - ................
80000001 - 00000000 00000000 00000001 20100000 - ...............
80000002 - 65746E49 2952286C 726F4320 4D542865 - Intel(R) Core(TM
80000003 - 51203229 20646175 20555043 51202020 - )2 Quad CPU Q
80000004 - 30353639 20402020 30302E33 007A4847 - 9650 @ 3.00GHz.
80000005 - 00000000 00000000 00000000 00000000 - ................
80000006 - 00000000 00000000 18008040 00000000 - ........@.......
80000007 - 00000000 00000000 00000000 00000000 - ................
80000008 - 00003024 00000000 00000000 00000000 - $0..............
Press any key to continue..
index eax ebx ecx edx
00000000 - 00000005 756E6547 6C65746E 49656E69 - ....GenuntelineI
00000001 - 00000F4A 00010800 000065BD BFEBFBFF - J........e......
00000002 - 605B5101 00000000 00000000 007D7040 - .Q[`........@p}.
00000003 - 00000000 00000000 00000000 00000000 - ................
00000004 - 00000000 00000000 00000000 00000000 - ................
00000005 - 00000040 00000040 00000000 00000000 - @...@...........
80000000 - 80000008 00000000 00000000 00000000 - ................
80000001 - 00000000 00000000 00000001 20000000 - ...............
80000002 - 20202020 20202020 20202020 20202020 -
80000003 - 47202020 69756E65 4920656E 6C65746E - Genuine Intel
80000004 - 20295228 20555043 30382E33 007A4847 - (R) CPU 3.80GHz.
80000005 - 00000000 00000000 00000000 00000000 - ................
80000006 - 00000000 00000000 08006040 00000000 - ........@`......
80000007 - 00000000 00000000 00000000 00000000 - ................
80000008 - 00003024 00000000 00000000 00000000 - $0..............
Press any key to continue..
00000000 - 0000000B 756E6547 6C65746E 49656E69 - ....GenuntelineI
00000001 - 000106E5 02100800 0098E3FD BFEBFBFF - ................
00000002 - 55035A01 00F0B2E4 00000000 09CA212C - .Z.U........,!..
00000003 - 00000000 00000000 00000000 00000000 - ................
00000004 - 00000000 00000000 00000000 00000000 - ................
00000005 - 00000040 00000040 00000003 00001120 - @...@....... ...
00000006 - 00000003 00000002 00000001 00000000 - ................
00000007 - 00000000 00000000 00000000 00000000 - ................
00000008 - 00000000 00000000 00000000 00000000 - ................
00000009 - 00000000 00000000 00000000 00000000 - ................
0000000A - 07300403 00000044 00000000 00000603 - ..0.D...........
0000000B - 00000000 00000000 000000C0 00000000 - ................
80000000 - 80000008 00000000 00000000 00000000 - ................
80000001 - 00000000 00000000 00000001 28100000 - ...............(
80000002 - 65746E49 2952286C 726F4320 4D542865 - Intel(R) Core(TM
80000003 - 37692029 55504320 20202020 20202020 - ) i7 CPU
80000004 - 30363820 20402020 30382E32 007A4847 - 860 @ 2.80GHz.
80000005 - 00000000 00000000 00000000 00000000 - ................
80000006 - 00000000 00000000 01006040 00000000 - ........@`......
80000007 - 00000000 00000000 00000000 00000100 - ................
80000008 - 00003024 00000000 00000000 00000000 - $0..............
Press any key to continue..
Clive - this one does support EM64T - updated the previous post
what we should do is start a new thread in the laboratory and move or copy these runs over there
that way, they are all in one place and we don't prevent Hutch from getting the results he needs
Hutch - Magicle has a Phenom with SSE4a
so does Greenhorn
Paul Brennick has a Turion that supports SSE4a
Dave,
If I remember correctly all of the prescott series PIVs supported EM64T. I don't know if that left you with an extra instruction set that you could use with them but the 3.0, 3.2 and 3.8 Prescotts I have owned all supported EM64T.
as i understand it, the very early ones did not
i could be mistaken, as it's very easy to be when it comes to cpuid - lol
i was very disappointed to learn that mine does not support SAHF/LAHF in 64-bit mode, though :(
Dave,
If you can raise a few spare roubles an Intel i3 is in fact a nice gadget, I built one for friends recently. Genuine dual core with hyperthreading running at just under 3 gig. I set it up with XP SP3 with 2 x 500 gig disks and 4 gig of memory. Everything ran well on it and the machine actually felt fast to use. I only have 1 PIV left now, the server 3.8 gig chip that I bought from Hong Kong and while it does run well, has SpeedStep, hyperthreading, virtualisation etc etc .... the newer ones are faster at almost everything and are true 64 bit hardware.
With the demise of the Gigabyte board on the 3.2 gig PIV, I managed to use the 2 new 320 gig disks and the USB front panel card reader on the new box but it still wasted the rare bits in it, Scythe copper cooler, Northbridge chip cooler, 2 x 1 gig pieces ofr DDR2 and sad to say the last 2 320 gig ATA disks as I have nothing else that will run ATA disks.
On the bright side the two new WD disks that came out of it benchmark at about 105 meg/sec with HDTUNE so they are fast enough to use on the new box, made up for the weird way that the Intel XtremeHD worked where all of the disks must be cotrolled through the Xhd. I normally leave the first pair as normal disks and stripe matched pairs with later ones.
i don't suppose an i3 would swap right into this m/b ? :bg
the truth is, the way i set up XP, i am quite pleased with this machine in terms of performance
going from 1 Gb to 4 Gb RAM would probably help a lot
it would be fun to play with a couple real cores
if it is simple and inexpensive to speed it up.....
ave,
You would need another board and DDR3 memory to go with it but the i3 processors are very cheap, AMD competition has forced Intel to become a lot more competitive. I was nearly tempted to build an AMD Phenom II 965 BE as they are coming down in price but went for the Intel Quad i7 as there was not that much price difference.
I was impressed with the i3 I built for friends, proper dual core with hyperthreading gave it very good multithread performance and at just on 3 gig each core is faster than the fastest PIV so they are no slouch performance wise. The i3 is later technology that the i7 I am running, its 32nm technology where the i7 is 45nm from memory. They run almost stone cold and need very little cooling, perhaps where you live in summer it could use a bit but nothing like the heat a Prescott PIV produces.
Funny enough the model you have runs the hottest of that familiy as the later PIVs had the speedstep technology that dropped their core speed on idle.
yes - it does get a little warm
they put a good-sized heat sink with a fan on it
my problems have been with hard-drives - i suppose the temperature inside the box hasn't helped that situation
i was interested in this latest i7 - not that i really need an upgrade
but, the i3 sounds like a good choice
if i need to look for a new one, i will have to compare prices
no problem as far as keeping the same box - it has all kinds of flash readers on the front - most of them i have never used - lol
Memory Stick - Compact Flash - SM/xD PictureCard - SD/MMC
The work Prescott is a 2MB L2 model with EM64T. http://processorfinder.intel.com/details.aspx?sSpec=SL7Z9
The home one (1MB L2, w/HT) is probably this one. http://processorfinder.intel.com/details.aspx?sSpec=SL7J6
Only Hyperthreading, no EM64T. All part of Intel's feature pricing model.
AMD Athlon(tm) 64 Processor 3000+
-----
INTEL
-----
0 sse4.2
0 sse4.1
0 ssse3
1 sse3
1 sse2
1 sse
1 mmx
---
AMD
---
0 sse4a
1 mmx_ex
1 3DNow
1 3DNow_ex
Press any key to continue ...
Hutch I attached a small modification of your code that displays the users CPU name(using cpuid), so that you can see what they have, I also added a build.bat :P
Thanks Cube.
With thanks to Paul Dixon who tested the algo, it seems to work fine on AMD Phenom II CPUs so that algo does what it is supposed to do, check for CPUID and if present fills the structure of instruction types with either 0 if not present or 1 if the instruction set is present.
Nice job :U
QuoteHutch I attached a small modification of your code that displays the users CPU name(using cpuid),.....
Hi "E^cube"
I think you have some flaws in your modification. :bg
1.) You call "GetCPUName" too early bypassing Hutch protection for "old timers".
2.) if eax>=80000005h should be eax>=80000004h there is only 3 string pulls:
80000002h
80000003h and
80000004h
3.) You didn't take care of "AMD K5" it is BIG-Endian
80000002h 2D444D41 7428354B 5020296D 65636F72
;AMD- K5(r m) P roce
80000003h 726F7373 00000000 00000000 00000000
;ssor
80000004h 00000000 00000000 00000000 00000000
the big-endian K5 is a new one on me
i don't remember seeing anything about that in the AMD docs or on sandpile...
http://www.sandpile.org/ia32/cpuid.htm
Yep there is not too much about it anywhere and I can't conform it eighter - not having one :green -
Only this http://asm.inightmare.org/opcodelst/index.php?op=CPUID
May some one has a "K5" around and can test it ? ::)
i read the comments in that routine, Ficko
i can see where it could be a little bit mis-leading for you as English is a foriegn language to you
the comment merely mentions that intel storage is big-endian
but, when you place the dword values into memory, the strings come out in the right order
i don't think there is anything special about the order of the AMD K5 strings
i can't really verify it, because noone that has a K5 ran the program in this thread :lol
http://www.masm32.com/board/index.php?topic=13044.0
after poking around a bit, i see that MichaelW has or used to have a K5
he only posted data for a P3, though
maybe we can get him to post K5 data in that thread :bg
Quote...little bit mis-leading for you as English is a foriegn language to you
Damn! - I need some English lessions. :toothy -
I have a K5 system, but when the fan in the power supply on my P3 started making noise I robbed the power supply from the K5, and I keep forgetting to pick up a new one.
I don't recall anything unusual about how the K5 does CPUID.
Here are the results on a Compaq AMD K6 450 running win98se. Seems to recognise MMX and 3DNow OK, AMD string is correct but no processor string.
Manufacturer = AuthenticAMD
Model ID string = i486 or early Pentium Processor
-----
INTEL
-----
0 sse4.2
0 sse4.1
0 ssse3
0 sse3
0 sse2
0 sse
1 mmx
---
AMD
---
0 sse4a
0 mmx_ex
1 3DNow
0 3DNow_ex
Press any key to continue ...
try this one Hutch...
I was thinking, I fix a couple of computers a fortnight and could run an info program on each of them. We could build up a database.
One thing I would like to see is family/model/stepping info to narrow it down more.
Clive had written a program that did a complete CPUID dump into a file
that would be ideal for data-base collection, as all the details are there :U
as a side-effect, it tells you which standard/extended leaves are supported, for example
the only thing you can't do programmatically is to read the part numbers on the physical package - lol
Dave,
You are out of luck, it wads a junk laptop a lady gave me so I messed around and formatted a floppy, tried out a couple of test apps then it stopped. Screen went blank and it would not start. It did the only thing it could be useful for, gave me the results on an old K6.
Heading for the scrapheap real soon. :bg
lol - you always get the winners, Hutch
well - there is a little bug fix there, anyways
Ficko had 2 out of 3 right i think...
http://www.masm32.com/board/index.php?topic=13894.msg111160#msg111160
if it was sitting in her closet, the battery may have gone south (or north, down there, i guess)