There appears to be some demand for the collection of CPUID algos in a variety of test pieces that were done a couple of years ago. This is one of mine that dealt exclusively with Intel hardware.
you had a couple others, too
one for memory available and one for disk space
also - all the ProStart / CG versions :P
and - let's not forget QE and scripts
What I was hoping was that some of the other folks who have written code of this type would also post their examples. I confess that the algos I have developed to use CPUID were targetted at recognising a particular range of processors to determine what instruction sets could be used, MMX, SSE/2/3/4 etc .....
i have all the results from the one i wrote
many members ran it - so, i have a nice collection of info
i wanted to orginize it and "can" it into a single post or a text file attachment
Quote from: hutch-- on June 02, 2012, 11:51:32 AM
There appears to be some demand for the collection of CPUID algos in a variety of test pieces that were done a couple of years ago. This is one of mine that dealt exclusively with Intel hardware.
This is my simple CPUID code on the old forum, but it also is Intel-oriented up to SSE4.2, like yours,
Hutch.
Alex,
Repost the zip file(s), those links to the old UK site will not last forever.
Quote from: hutch-- on June 02, 2012, 08:37:15 PM
What I was hoping was that some of the other folks who have written code of this type would also post their examples.
Here is mine :biggrin:
include \masm32\MasmBasic\MasmBasic.inc ; download (http://masm32.com/board/index.php?topic=94.0)
Init
PrintCpu Inkey "hit any key"
Exit
end start
Intel(R) Celeron(R) M CPU 420 @ 1.60GHz (SSE3)
:biggrin:
Gee thanks, thats really useful. :eusa_clap:
...and short, too - lol
Quote from: hutch-- on June 03, 2012, 01:28:21 PM
Alex,
Repost the zip file(s), those links to the old UK site will not last forever.
Fixed the post where were links before.
Alex, :t
I have downloaded the zip files for a number of CPUID threads from the old MASM Forum.
Here is a list of zip attachments. I didn't actually write any of this code,...so, you'll notice that it generally works perfectly,...and, has absolutely NO BLOAT !!!
If you read through a number of high-quality Old MASM Forum threads, you will see that there are alot of variations and additional information available, including DAVE's old Signature file (which I can't seem to download from the original site). I was thinking of condensing and editing all this material into one directory or file (maybe a PDF file), and posting it here,...but, my internet access is currently severely restricted,...and, it would take me forever.
the program of mine was not really intended to be used as a CPUID routine, per se
it was simply intended to test the CPUID instruction on a variety of machines, to gather information
Possible suggest more :t algo for get_x86_instruction_sets, because it's more useful to get all processor abilities once, then if not discard records in program possible use MASK operator for easy get instructions sets. So, I've made a little changes in program :
ouch - i lost SSE3 :(
Vendor String = GenuineIntel
CPU String = Intel(R) Pentium(R) 4 CPU 3.00GHz
SSE4.2 NO
SSE4.1 NO
SSE3 NO
SSE2 YES
SSE YES
MMX YES
SSE3 is leaf 0000_0001, ECX bit 0
Dave I found your SSE3.
It moved to my PC. :biggrin:
But I lost my SSSE3
(http://members.home.nl/siekmanski/CPUID.png)
:biggrin:
SSE3 is leaf 0000_0001, ECX bit 0
SSSE3 is leaf 0000_0001, ECX bit 9
That's correct, but I've done exact this - so seemd you not have SSE3 and you vendor string could be duck,
in such case best is to get CPU frequency, if it's really 3000, probably something wrong in docs.
So, I've made a little changes in program :t
Hi,
The program from Reply #17 crashes on my P-III.
It also does not report SSE available.
Regards,
Steve
i am fairly certain that this machine supports SSE3
as many times as Jochen and i have tested it - lol
just to be sure, i wrote a simple console app to verify...
.XCREF
.NOLIST
INCLUDE \masm32\include\masm32rt.inc
.586
.LIST
.CODE
_main PROC
mov eax,1
cpuid
print uhex$(ecx),13,10
inkey
exit
_main ENDP
END _main
results on a prescott w/htt...
0000649D
leaf 0000_0001, ECX, bit 0 = 1
hi Adamanteus ,
your RECORD definitions are reversed: the first entry get the most significant bit/bit-range, the last the least significant bit/bit-range:
xyz RECORD bit2:1,bit1:1,bit0:1
unrelated...
if you are interested in the CPUID instruction,
a couple years ago, i made this table from the ones in intel/amd docs and added some corrections
That's originaly was used by C-structure, and h2incx version 0.99.19 (downloaded from old forum) such translated records. Records in MASM at all not good implemented – names of fields have global scope and what bit is most significant in it not written in documentation and MASM32 Reference also.
For Signatures.zip also thanks, I can't before find AMD Modles-Stepping names, even in AMD CPUID Specification.
P.S. I changed previous archive, now I hope it works :eusa_clap:
The measured frequency is not correct, because your code assumes that the performance counter's frequency is the same on all machines.
cpu_mips PROC USES ebx
LOCAL counter : QWORD, start : QWORD, stop : QWORD
LOCAL freq:QWORD
invoke QueryPerformanceFrequency,ADDR freq
invoke QueryPerformanceCounter, ADDR start
RDTSC
MOV DWORD PTR counter, EAX
MOV DWORD PTR counter + 4, EDX
; ïîëó?åíèå ìíîæèòåëÿ è òàêòîâ
invoke Sleep, 23
invoke QueryPerformanceCounter, ADDR stop
RDTSC
MOV EBX, DWORD PTR start
SUB DWORD PTR stop, EBX
MOV EBX, DWORD PTR start + 4
SBB DWORD PTR stop + 4, EBX
MOV DWORD PTR start, TIMERFREQSEC
FILD freq
FILD stop
FDIV ; äåëèì êîëè?åñòâî òèêîâ òàéìåðà â ñåêóíäó
SUB EAX, DWORD PTR counter
SBB EDX, DWORD PTR counter + 4
MOV DWORD PTR counter, EAX
MOV DWORD PTR counter + 4, EDX
FILD counter
FMUL ; ïîäïðàâëÿåì çíà?åíèå íà ôàêòè?åñêîå âðåìÿ
MOV DWORD PTR counter, 1000000 ; <= 1E6 !
FILD DWORD PTR counter
FDIV ; äåëèì íà ìèëëèîí îïåðàöèé â ñåêóíäó
FISTP DWORD PTR counter
MOV EAX, DWORD PTR counter
RET
cpu_mips ENDP
This one returns more useful values on my i5.
:t
Vendor String = GenuineIntel
CPU String = Intel(R) Pentium(R) 4 CPU 3.00GHz
Frequency = 12
SSE4.2 NO
SSE4.1 NO
SSE3 YES
SSE2 YES
SSE YES
MMX YES
you may want to add another one for SSSE3
and - i guess "Frequency = 12" is a multiplier ?
Quote from: qWord on July 06, 2012, 04:35:16 AM
The measured frequency is not correct, because your code assumes that the performance counter's frequency is the same on all machines.
Yes again right, that'a algo works on old versions of Windows better on TIMERFREQSEC constant, now happend better on QueryPerformanceFrequency, so it down and works better previous version.
Hi,
Still crashes. Screen capture JPEG renamed to ZIP
is attached.
Steve
perhaps it has something to do with how the icon is painted :P
(http://img209.imageshack.us/img209/6611/adam4.png)
Quote from: FORTRANS on July 06, 2012, 10:13:44 PM
Still crashes. Screen capture JPEG renamed to ZIP
That's not for all versions of Windows and hardware, if you are sure that have modern one – try to reinstall Windows, could be critical updates.
i doubt Steve is going to re-install windows
his machines have been tested by many programs :P
You may add some error handling code for the APIs.
Also, InitCommonControlsEx is called from a very "unusual place".
Quote from: FORTRANS on July 06, 2012, 10:13:44 PM
Still crashes. Screen capture JPEG renamed to ZIP
is attached.
Hi, Steve!
Just wondering why it's crashing. Could you run this command in the DOS box (cmd.exe) to get some more info?
ntsd intelmmi.exe
and then, when the new DEBUG-like debugger console window will open, type in it:
g [enter]
after that the debugged program will hang (crash) and control will be passed to a debugger (a prompt like
0:000> will appear in the debugger console window), type in the debugger:
kb [enter]
Contents of the console (entire or just info that was output after "kb") is a useful info which could help to find a bug.
Quote from: Antariy on July 08, 2012, 12:15:45 AM
Quote from: FORTRANS on July 06, 2012, 10:13:44 PM
Still crashes. Screen capture JPEG renamed to ZIP
is attached.
Hi, Steve!
Just wondering why it's crashing. Could you run this command in the DOS box (cmd.exe) to get some more info?
ntsd intelmmi.exe
Hi Antariy
Okay, will do.
Quote
and then, when the new DEBUG-like debugger console window will open, type in it:
g [enter]
after that the debugged program will hang (crash) and control will be passed to a debugger (a prompt like 0:000> will appear in the debugger console window), type in the debugger:
kb [enter]
Contents of the console (entire or just info that was output after "kb") is a useful info which could help to find a bug.
Well, here it is.
Microsoft(R) Windows 2000 Debugger
Version 5.00.2184.1
Copyright (C) Microsoft Corp. 1981-1999
CommandLine: intelmmi.exe
Symbol search path is: C:\WINNT
NTSD ModLoad: 00400000 0040a000 image00400000
NTSD ModLoad: 77f80000 77ffc000 ntdll.dll
NTSD ModLoad: 77e10000 77e6f000 C:\WINNT\system32\user32.dll
NTSD ModLoad: 7c570000 7c624000 C:\WINNT\system32\KERNEL32.dll
NTSD ModLoad: 77f40000 77f7d000 C:\WINNT\system32\GDI32.dll
NTSD ModLoad: 71710000 71794000 C:\WINNT\system32\comctl32.dll
NTSD ModLoad: 7c2d0000 7c335000 C:\WINNT\system32\ADVAPI32.dll
NTSD ModLoad: 77d30000 77d9f000 C:\WINNT\system32\RPCRT4.dll
eax=00000000 ebx=00131f04 ecx=00000009 edx=00000000 esi=7ffdf000 edi=00131f78
eip=77f9193c esp=0012f984 ebp=0012fc98 iopl=0 nv up ei pl nz na pe nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000202
ntdll!DbgBreakPoint:
77f9193c cc int 3
0:000> g
NTSD: access violation
eax=00495030 ebx=00000000 ecx=0005014c edx=00470650 esi=00000000 edi=00000111
eip=77e28ce8 esp=0012fde8 ebp=0012fe08 iopl=0 nv up ei pl nz na po nc
cs=001b ss=0023 ds=0023 es=0023 fs=0038 gs=0000 efl=00210206
user32!CharPrevW+408:
77e28ce8 f6432bc0 test byte ptr [ebx+0x2b],0xc0 ds:0023:0000002b=??
0:000> kb
*** ERROR: Module load completed but symbols could not be loaded for image004000
00
ChildEBP RetAddr Args to Child
0012fe08 77e2d428 0005014c 00000111 000003e8 user32!CharPrevW+0x408
0012fe40 77e14605 77e2d407 0005014c 00000111 user32!DefDlgProcA+0x21
0012fecc 77e1a7f2 0012ff18 00000000 77e2ecf3 user32!TranslateMessageEx+0x605
0012fefc 77e33568 0005014c 00495030 00000000 user32!DispatchMessageW+0xb
0012ff38 77e44327 0005014c 00000000 00000010 user32!MessageBoxA+0x1b5
0012ff5c 77e38d37 00400000 004092f8 00000000 user32!CheckRadioButton+0x13d
0012ff7c 77e3ede7 00400000 004092f8 00000000 user32!DialogBoxIndirectParamAorW+0
x34
0012ffa8 00401025 00400000 000003e8 00000000 user32!DialogBoxParamA+0x4a
0012fff0 00000000 00401000 00000000 000000c8 image00400000+0x1025
0:000> Hope that helps.
Regards,
Steve N.
Quote from: FORTRANS on July 08, 2012, 10:51:21 PM
Hi Antariy
Okay, will do.
...
Hope that helps.
Hi, Steve!
Yes, it have helped, thank you very much!
The bug (edited: to make it clear - it is not mine, as well as the program) is in
get_cpu_id_string function. It doesn't preserve EBX before CPUID instructions
at start of function.
Here is some incredible code. It just requires to copy and paste the source below directly into the console (on 32 bit OSes, x64 do not support 16 bit apps) to compile. Then type ATXT and this cool advanced CPUID proggie will run :biggrin:
debug
a
mov dx,11C
mov ah,9
int 21
push sp
pop ax
cmp ax,sp
mov dx,191
jz 112
mov dl,79
mov ah,9
int 21
xor ax,ax
int 16
ret
db 0D,0A,0D,0A,09,09,09,"The advanced CPU Identification program"
db 0D,0A,09,09,09,09," (c) Antariy 2012",0D,0A,0D,0A
db 09,09,09,"Here we have a $"
db "Tyrannosaurus reX86 CPU$"
db "Some modern 80286+ stuff$"
r cx
AA
n ATXT.com
w
q
yes - i seem to recall that some earlier processors altered SP before the PUSH instead of after
Quote from: dedndave on July 10, 2012, 08:49:42 AM
yes - i seem to recall that some earlier processors altered SP before the PUSH instead of after
:biggrin: :t
I have one to check ht support and core count, but is fasm. The only significant difference between fasm and masm is the use of brackets, so its not much difference.
; checks if HTT is supported on the cpu
; returns 0 in eax if not supported and 1 otherwise
proc HTSupport
xor eax,eax
cpuid
; check that functions 0-1 is at least supported as these are the ones we will use
cmp eax,1
jb .fail
; check that GenuineIntel, because intel is the only one that have hyper threading
cmp ebx,$756e6547 ; Genu
jne .fail
cmp edx,$49656e69 ; ineI
jne .fail
cmp ecx,$6c65746e ; ntel
jne .fail
; Now get HT flag in edx at bit 28 (zero based)
mov eax,1
cpuid
test edx,$10000000
jnz .succ
.fail: xor eax,eax
ret
.succ: mov eax,1
.bye: ret
endp
; Return the accurate number of cores (HT is checked too)
proc CoreCount
local ht rd 1
local s SYSTEM_INFO
stdcall HTSupport
mov [ht],eax
lea eax,[s]
invoke GetSystemInfo,eax
mov eax,[s.dwNumberOfProcessors]
mov ecx,[ht]
test ecx,ecx
jz @F
shr eax,1
@@: ret
endp