The idea in the first place was to make re-usable routines that could be used to determine if later SSE instruction sets could be used in a program that is running on a particular processor. The test piece is a simple dialog interface that tests if CPUID is available, if it is it gets the brand and CPU strings and tests the Intel specs of SSE 4.2 down to MMX. Form looking at what is available it would appear that a detect rountine for AMD hardware needs to be done seperately as there is enough divergence in capacity to warrant doing it this way.
From the brand string it is easy enough to determine if the processor is Intel or AMD then switch to the rountine that handles specific instruction sets for each processor. In the library there is a procedure "intel_mm_set" that works according to the Intel specification,what I had in mind was another routine "amd_mm_set" that checked for specific AMD sets like 3Dnow and sse4a.
I get nothing - isn't a dialog supposed to show?
Hi Hutch,
Project.exe does not display a GUI. No any output.
don't use the Brand String to determine the vendor, Hutch
instead, use the Vendor ID String, which is supported on all CPU's that support CPUID except, perhaps, the 486's
there are a dozen or so Vendor ID strings to contend with
as i posted in the other thread, a few non-AMD parts support 3DNow!
while most of those do not support 3DNow!+, bit 30 is reserved on those processors for that purpose
there is one or two feature bits that are Intel only, also
so, for the reduced set of feature bits that you are shooting for, there are probably only 3 or 4 masks to contend with
you can combine the extracted feature bits into a single dword before masking
that way, each vendor-dependant mask is a single dword
Now I am confused, I downloaded it to check if there was any damage to the zip file but it runs correctly here. A simple dialog interface with 2 buttons and a set of static controls to display the data. It should not matter but it has a 64 pixel square RGB/a icon that is displayed on the dialog.
I am running on XP SP3 which works correctly.
Hi Hutch,
My system is XP SP3. I removed the line :
1 MANIFEST "manifest.xml"
from rsrc.rc and rebuilt the project. Now, the application works fine. Not 100% sure if it's a resource problem but could you check the manifest and resource files?
it runs fine here, Hutch
just can't copy/paste the result :P
i am running XP Pro SP2 with a prescott
is that your mother ?
(http://img691.imageshack.us/img691/8681/cputest.jpg)
the info is correct
works fine for me on xp sp2 but heres vendor code by tedd
.586
.model flat, stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib
include \masm32\include\user32.inc
includelib \masm32\lib\user32.lib
;***************************************************************************************************
.data
mbTitle db "Vendor String",0
.data?
buff db 256 dup (?)
.code
start:
mov eax,80000000h
cpuid
.IF (eax>=80000005h)
push edi
lea edi,[buff]
mov eax,80000002h
cpuid
mov [edi+00h],eax
mov [edi+04h],ebx
mov [edi+08h],ecx
mov [edi+0Ch],edx
mov eax,80000003h
cpuid
mov [edi+10h],eax
mov [edi+14h],ebx
mov [edi+18h],ecx
mov [edi+1Ch],edx
mov eax,80000004h
cpuid
mov [edi+20h],eax
mov [edi+24h],ebx
mov [edi+28h],ecx
mov [edi+2Ch],edx
mov eax,80000005h
cpuid
mov [edi+30h],eax
mov [edi+34h],ebx
mov [edi+38h],ecx
mov [edi+3Ch],edx
invoke MessageBox, NULL,edi,ADDR mbTitle,MB_OK or MB_ICONINFORMATION
pop edi
.ENDIF
invoke ExitProcess, NULL
end start
that is the Brand String, Cube - not the Vendor String
the Vendor String on mine is "GenuineIntel"
for most AMD parts, it is "AuthenticAMD"
Dave,
That looks correct for the prescott you use. The image is a Raphael painting from the 15th century.
Erol, I am not sure what is going on with the manifest, I have tested the exe on win2000, xp sp3 and win7 64 and it runs correctly with that manifest. have you got some form of security software that may rejest the exe with that manifest ?
Cube, thanks for Tedd's code but I had already worked that one out myself.
ok, he was calling it the vendor string so idk, also it works fine for me on win7 in vmware aswell, can more people test this please to make sure its alright?
Cube,
It looks fine, I would be tempted to put it in a seperate proc so it can be used from any app. Just pass a buffer to it and write to the buffer.
Vendor Strings
"GenuineIntel" Intel processor
"AuthenticAMD" AMD processor
"AMDisbetter!" AMD engineering samples
"AMD ISBETTER" AMD engineering samples
"Geode by NSC" National Semiconductor (now AMD) (embedded systems)
"CyrixInstead" Cyrix
"VIA VIA VIA " VIA
"CentaurHauls" Centaur (includes IDT/WinChip 2)
"UMC UMC UMC " UMC
"NexGenDriven" NexGen
"RiseRiseRise" Rise Technology
"SiS SiS SiS " SiS
"GenuineTMx86" Transmeta
"TransmetaCPU" Transmeta
EDIT - WinChip - the company has changed hands so many times
possible WinChip Vendor strings: CentaurHauls, GenuineIntel, AuthenticAMD, CyrixInstead
stuff like that makes using CPUID a pain in the ass
processors that support 3DNow! and 3DNow!+ bits
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
Dave,
Now you know why I don't particularly want to deal with the legacy stuff, as long as it will run on the old stuf without an invalid opcode exception and will show the vendor string it will do the job. The real action is in late Intel and AMD processors and what instruction sets they can use.
If you get no to everything its integer instructions only, then in ascending order, MMX SSE SSE2/3/4.1/2 and when I track it down for AMD the 3Dnow and later stuff.
Hi Hutch,
I tried the original executable on my other computer running XP SP3. No any security software and no any display. Removing the manifest worked on my laptop too.
well - the 3DNow! enhancements are widely used, particularly in multi-media apps
that makes them worth dealing with
if you leave it out - that is probably ok - they can write their own code - lol
when you choose to leave a vendor out, you have to make a lot of qualifier statements
it's like writing a letter of recommendation for an employee
if you say one little bad thing about the employee, the letter is useless to him - lol
if the programmer using the routine wants to incorporate it into an app, they don't want a list of qualifying statements
by the time you are done writing this routine, you will have pulled out all your hair
better PhotoShop yourself to see how that looks - it may not be worth it - lol
Workes fine here on win7 x64, core2duo e8400. Features detected are correct (no sse4.2 for me lol)
P.S.: Who the hell uses 3dnow ? :bdg
Thanks Erol, I will have to try and work out what is happening with the manifest, its necessary for late model OS versions and I thought this one was correct.
For it to work on my XP Home SP3 I needed to add the line "invoke InitCommonControls" after start:
Sinsi,
Thanks, I have that code for that template, I removed it because it does not use any common controls. :bg
OK, I just added the full supprt for the common controls. At the risk of imposing on Sinsi and Erol, I need to see if this solves the problems that have been reported on WinXP because of either the manifest or not having initialised the common control library.
New one works OK now :U
Gratsie,
I will have to see if it works on Erol's machines now. It makes sense that the manifest and initialising the common control library are related, just doess not happen on my Xp Pro SP3.
Hi Hutch,
The new version works perfectly, many thanks :U
Thanks Erol, you have made me wiser. Looks like including a manifest means initialising the common control library.
Quote from: hutch-- on April 27, 2010, 02:03:38 AM
Thanks Erol, you have made me wiser. Looks like including a manifest means initialising the common control library.
Interesting. Does the manifest actually force ml.exe to insert an invoke InitCommonControls?
JJ,
No, but at least on some Windows versions if you have a manifest and no common control initialisation, the app won't run. All I did with this test piece after Sinsi posted his result was enable the common control initialisation and it worked on Erols XP machines.