News:

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

Main Menu

Instruction Set detection for 32 bit Operating Systems

Started by Gunther, February 03, 2013, 08:24:36 AM

Previous topic - Next topic

FORTRANS

Hi,

Quote from: Antariy on April 29, 2014, 08:17:10 AM
I did not notice CMOV in the ASM source,

   Right.  I replaced the .686P directive with a .586, and the code
assembled with the same results both ways.  One line caused ML
6.14 to complain either way.  So it had to be something else.
Either the C code or the Windows environment between the two
machines.  I had no way to test those in any meaningful way.

   I was going to look up the opcode in the error message, but
you did that first.  (Another problem would be me trying to determine
when (which processor version) an instruction was introduced.
I do not have that information at hand here.)

Regards,

Steve N.

Biterider

        Supported Features by Processor and Operating System
        ====================================================

Vendor String: GenuineIntel
Brand  String: Intel(R)Core(TM)i7-4770KCPU@3.50GHz

        Instruction Sets
        ----------------

MMX  SSE  SSE2  SSE3  SSSE3  SSE4.1  SSE4.2  AVX  AVX2

        Supported Special Instructions
        ------------------------------

Conditional Moves
FXSAVE and FXSTOR
XSAVE and XSTOR for processor extended state management.
POPCNT
RDRAND
AES (Advanced Encryption Standard) Instruction Set
FMA (Fused Multiply Add) extensions using YMM state.
16-bit floating-point Conversion Instructions

Regards, Biterider

Gunther

Thank you Biterider for testing the application. Good processor (Haswell microarchitecture with AVX 2). :t Have you already used the new instructions?

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

Gunther

Under the first post of this thread you'll find the archive Iset32U2.zip. It's an update. The C source is now compiled for an 80386 and should run without a crash on older processors, too. I've changed the program logic.

  • The application checks first the instruction sets, which are available.
  • If the CPUID instruction is available, it checks for Vendor String and Brand String.
  • The application checks additional features.
The program has now the following output:
Quote
                Supported Features
                ==================

Vendor String: GenuineIntel
Brand  String: Intel(R)Core(TM)i7-3770CPU@3.40GHz

                Instruction Sets
                ----------------

MMX  SSE  SSE2  SSE3  SSSE3  SSE4.1  SSE4.2

                Supported Special Instructions
                ------------------------------

Conditional Moves
FXSAVE and FXSTOR
XSAVE and XSTOR for processor extended state management.
POPCNT
RDRAND
AES (Advanced Encryption Standard) Instruction Set
16-bit floating-point Conversion Instructions

Please, press enter to end the application ...

Your test results both old as well as new machines, your comments and proposals are welcome.

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

GoneFishing

Quote
      Supported Features
      ==================

Vendor String: GenuineIntel
Brand  String: Intel(R)Celeron(R)CPUE3400@2.60GHz

      Instruction Sets
      ----------------

MMX  SSE  SSE2  SSE3  SSSE3

      Supported Special Instructions
      ------------------------------

Conditional Moves
FXSAVE and FXSTOR
XSAVE and XSTOR for processor extended state management.

dedndave

Gunther
as far as i am able to determine, the 80386 + windows combination is very unlikely
well - anything newer than windows 3.1, at least, which wouldn't run a PE file

it's hard to find documented history indicating there were any 386 embedded controllers with windows ce
that would be the only case where a PE file might run on a 386

Antariy

Dave, Win32s is the "extender" for Win3.1 which allows to run regular 32 bit PE files.

FORTRANS

Quote from: Gunther on May 02, 2014, 09:16:39 PM
Under the first post of this thread you'll find the archive Iset32U2.zip. It's an update. The C source is now compiled for an 80386 and should run without a crash on older processors, too.

[...]

Your test results both old as well as new machines, your comments and proposals are welcome.

Hi Gunther,

   It is still faulting on the P-MMX.  And the error looks similar.

CPU executed an invalid instruction in
module CPU.EXE at 0167:004036b0.
Registers:
EAX=80000000 CS=0167 EIP=004036b0 EFLGS=00010246
EBX=0074fa98 SS=016f ESP=0074fa80 EBP=0074fd58
ECX=c14b27d0 DS=016f ESI=0074fcdd FS=0e47
EDX=00008000 ES=016f EDI=0074fa94 GS=0000
Bytes at CS:EIP:
0f 44 c2 8d 53 02 0f 44 da 00 c0 83 db 03 29 fb


   A suggestion:  Could you put a version label of some sort at
the top of the output?  Something like; Author, Purpose, Version,
and Date or a subset of those?  Certainly not required, but would
be nice.

Regards,

Steve N.

Gunther

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

dedndave

here is some code i wrote a few years back
maybe Gunther will find it useful   :P
        pushfd
        mov     ecx,240000h              ;bit 21 = ID, bit 18 = 386/486
        pop     eax
        mov     edx,eax                  ;EDX = original
        xor     eax,ecx                  ;EAX = toggled
        push    eax
        popfd                            ;EFLAGS = new
        pushfd
        pop     eax                      ;EAX = new
        push    edx
        popfd                            ;EFLAGS = original
        xor     eax,edx                  ;EAX = toggle result
        and     eax,ecx

;if EAX bit 18 is set, CPU is 486 or higher
;if EAX bit 21 is set, CPU supports CPUID instruction
;no versions of the 386 supported CPUID
;late versions of the 486 support CPUID

FORTRANS

Quote from: Gunther on May 03, 2014, 02:28:57 AM
Hi Steve,

did you use the right archive?

Hi Gunther,

   I hope so...

02-05-14  12:03a                93,895 CPU.EXE
02-05-14  09:58a                43,832 Iset32U2.zip


Regards,

Steve

Antariy

Hi Gunther, after some debugging I found that it seems that the problem is in the static CRT that is used by the compiler, it uses the instruction which causes a fault, in more details there is a code which searches for some dlls, and in the code which does this there are those instructions (CMOVs).

I recompiled your program with MSVC10 and CRTDLL.DLL, the file attached. The source is original.

Gunther

Hi Alex,

Quote from: Antariy on May 03, 2014, 02:40:45 AM
Hi Gunther, after some debugging I found that it seems that the problem is in the static CRT that is used by the compiler, it uses the instruction which causes a fault, in more details there is a code which searches for some dlls, and in the code which does this there are those instructions (CMOVs).

thank you. Good catch.  :t I'll incorporate your EXE into the archive. It is now Iset32U3 and contains 2 subdirectories: \Iset32U3\GCC contains the GCC related files, including cpu.exe. \Iset32U3\MSVC10 contains only cpu.exe, generated with MSVC.

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


FORTRANS

Hi Alex,

   Here is the result of the program from Reply #56 from my
P-MMX laptop.

                Supported Features
                ==================

Vendor String: GenuineIntel
Brand  String: Not supported.

                Instruction Sets
                ----------------

MMX

                Supported Special Instructions
                ------------------------------


Please, press enter to end the application ...


Regards,

Steve N.