Author Topic: Instruction Set detection for 32 bit Operating Systems  (Read 47473 times)

FORTRANS

  • Member
  • *****
  • Posts: 1096
Re: Instruction Set detection for 32 bit Operating Systems
« Reply #45 on: April 30, 2014, 02:06:00 AM »
Hi,

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

  • Member
  • ****
  • Posts: 689
  • ObjAsm Developer
    • ObjAsm
Re: Instruction Set detection for 32 bit Operating Systems
« Reply #46 on: April 30, 2014, 02:45:46 AM »
        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

  • Member
  • *****
  • Posts: 3722
  • Forgive your enemies, but never forget their names
Re: Instruction Set detection for 32 bit Operating Systems
« Reply #47 on: April 30, 2014, 02:53:50 AM »
Thank you Biterider for testing the application. Good processor (Haswell microarchitecture with AVX 2). :t Have you already used the new instructions?

Gunther
Get your facts first, and then you can distort them.

Gunther

  • Member
  • *****
  • Posts: 3722
  • Forgive your enemies, but never forget their names
Re: Instruction Set detection for 32 bit Operating Systems
« Reply #48 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. 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
Get your facts first, and then you can distort them.

GoneFishing

  • Member
  • *****
  • Posts: 1071
  • Gone fishing
Re: Instruction Set detection for 32 bit Operating Systems
« Reply #49 on: May 02, 2014, 09:43:58 PM »
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

  • Member
  • *****
  • Posts: 8829
  • Still using Abacus 2.0
    • DednDave
Re: Instruction Set detection for 32 bit Operating Systems
« Reply #50 on: May 02, 2014, 11:49:34 PM »
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

  • Member
  • ****
  • Posts: 551
Re: Instruction Set detection for 32 bit Operating Systems
« Reply #51 on: May 03, 2014, 12:27:50 AM »
Dave, Win32s is the "extender" for Win3.1 which allows to run regular 32 bit PE files.

FORTRANS

  • Member
  • *****
  • Posts: 1096
Re: Instruction Set detection for 32 bit Operating Systems
« Reply #52 on: May 03, 2014, 01:22:17 AM »
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.

Code: [Select]
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

  • Member
  • *****
  • Posts: 3722
  • Forgive your enemies, but never forget their names
Re: Instruction Set detection for 32 bit Operating Systems
« Reply #53 on: May 03, 2014, 02:28:57 AM »
Hi Steve,

did you use the right archive?

Gunther
Get your facts first, and then you can distort them.

dedndave

  • Member
  • *****
  • Posts: 8829
  • Still using Abacus 2.0
    • DednDave
Re: Instruction Set detection for 32 bit Operating Systems
« Reply #54 on: May 03, 2014, 02:37:03 AM »
here is some code i wrote a few years back
maybe Gunther will find it useful   :P
Code: [Select]
        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

  • Member
  • *****
  • Posts: 1096
Re: Instruction Set detection for 32 bit Operating Systems
« Reply #55 on: May 03, 2014, 02:38: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

  • Member
  • ****
  • Posts: 551
Re: Instruction Set detection for 32 bit Operating Systems
« Reply #56 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).

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

Gunther

  • Member
  • *****
  • Posts: 3722
  • Forgive your enemies, but never forget their names
Re: Instruction Set detection for 32 bit Operating Systems
« Reply #57 on: May 03, 2014, 03:00:47 AM »
Hi Alex,

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
Get your facts first, and then you can distort them.

Antariy

  • Member
  • ****
  • Posts: 551
Re: Instruction Set detection for 32 bit Operating Systems
« Reply #58 on: May 03, 2014, 03:04:53 AM »
You are welcome, Gunther! :t

FORTRANS

  • Member
  • *****
  • Posts: 1096
Re: Instruction Set detection for 32 bit Operating Systems
« Reply #59 on: May 03, 2014, 03:12:43 AM »
Hi Alex,

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

Code: [Select]
                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.