News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

My version of a CPU identification utility

Started by Mark44, February 22, 2014, 04:08:06 AM

Previous topic - Next topic

Mark44

I've noticed several posts with code on how to identify which CPU you're running. I've recently been learning about the various SSE technologies as well as AVX, and I needed to be able to tell which of these technologies was supported on my Intel i7 processor. I've attached my own take on a CPU ID utility.

Here's an example of the info that it provides.
C:\Users\Mark\Documents\Visual Studio 2010\Projects\CPUInfo\Debug>cpuinfo
Extended + family ID: 06
Extended + model ID: 3a
Stepping: 9
Microarchiture: Ivy Bridge

CPU has FP unit.
CPU has MMX.
CPU has SSE.
CPU has SSE2.
CPU has SSE3.
CPU has SSE 4.1.
CPU has SSE 4.2.
CPU has AVX.
CPU does not have AVX2.


One feature of my code that I haven't seen elsewhere is that it displays the (Intel-specific) microarchitecture, which is useful to know if you're reading the Intel documentation. A shortcoming is that the code I wrote was a quick-and-dirty utility that works on the one machine I tested it on.

Gunther

Mark,

good approach. You would have presumably more answers if you would write an additional version with an external assembler. Apart from that it's a solid work.

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

TWell

Binary compiled with msvc2010 sp1 using msvcrt.dll

dedndave

Jochen, Hutch, and I, and many others have written various versions of CPU ID routines
search the old forum


dedndave

i am running XP SP3
for the EXE that Timppa compiled...



never saw that one before - lol

GoneFishing

Here's the output for my CPU:
Quote
Extended + family ID: 06
Extended + model ID: 17
Stepping: a
Microarchiture: Enhanced Intel Core Microarchitecture

CPU has FP unit.
CPU has MMX.
CPU has SSE.
CPU has SSE2.
CPU has SSE3.
CPU does not have SSE 4.1.
CPU does not have SSE 4.2.
CPU does not have AVX.
Compiles and runs nicely here  :t

GoneFishing

Quote from: dedndave on February 22, 2014, 04:51:31 AM
i am running XP SP3
for the EXE that Timppa compiled...



never saw that one before - lol
Probably you don't have right version of msvcrt.dll

dedndave


GoneFishing

shure
check the imports
[EDIT]: Hmm ... strange ,  maybe it's Win XP's kernel32.dll that throws an error ?

Gunther

Dave,

Quote from: dedndave on February 22, 2014, 04:51:31 AM
i am running XP SP3
for the EXE that Timppa compiled...



never saw that one before - lol

that's very strange.

Mark,

works fine under Windows XP (emulation) and native Windows 7 (64 bit). Here is the output:

Extended + family ID: 06
Extended + model ID: 3a
Stepping: 9
Microarchiture: Ivy Bridge

CPU has FP unit.
CPU has MMX.
CPU has SSE.
CPU has SSE2.
CPU has SSE3.
CPU has SSE 4.1.
CPU has SSE 4.2.
CPU has AVX.
CPU does not have AVX2.

F:\MatMul>


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

Mark44

Quote from: Gunther on February 22, 2014, 04:26:54 AM
Mark,

good approach. You would have presumably more answers if you would write an additional version with an external assembler. Apart from that it's a solid work.

Gunther
At the moment, all I have is the MS assembler in VS 10. I will look into downloading one of the other assemblers I've seen described here.

jj2007

Quote from: dedndave on February 22, 2014, 04:51:31 AM
i am running XP SP3
for the EXE that Timppa compiled...

Same problem here, XP SP3 & can't find the entry point :(

TWell

My bad, now corrected. :icon_redface:

Quote from: dedndave on February 22, 2014, 04:51:31 AM
i am running XP SP3
for the EXE that Timppa compiled...



never saw that one before - lol
I forgot to link msvcrt_winxp.obj from WDDK when using msvcrt.lib/msvcrt.dll

Gunther

Hi Mark,

Quote from: Mark44 on February 22, 2014, 05:14:49 AM
At the moment, all I have is the MS assembler in VS 10. I will look into downloading one of the other assemblers I've seen described here.

that's a good idea. In the upper right corner of the forum you'll find MASM32 download link. A nearly 100% MASM compatible assembler is jWasm, which I would strongly recommend. It's fast, lean and well maintained by our forum member Japheth. Moreover, some MASM bugs are eliminated. Another similar tool is the Solar Assembler, which is written and maintained by forum member and Global Moderator BogdanOntanu.

In the other direction you have the NASM like tools like NASM and YASM, both not bad and worth a try. Another alternative is FASM.

I've installed in parallel MASM, jWasm, YASM and GAS for Windows XP, Windows 7, Linux and BSD. That's not a problem. Have fun and happy installing.

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

Mark44

Gunther,
I'll check those out. jWasm and Solar sound interesting, from what I've read about them on this forum.

Back about 20 years ago I was a co-author of a book on targeting DOS using assembly, and did a lot of work with Borland's Turbo Assembler (TASM). I did all of the compiling/assembling and linking from the command line. At the moment I'm doing everything through VS, and the switches for MASM (via VS) are something of a mystery to me, although I'm coming along.