News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

CPU and instruction detection

Started by Gunther, January 28, 2013, 10:07:46 PM

Previous topic - Next topic

Gunther

Here's a quote from the IntelĀ® 64 and IA-32 Architectures Optimization Reference Manual, Order Number: 248966-026, p. 4-6:

Quote
Prior to using AVX, the application must identify that the operating system supports the XGETBV instruction, the YMM register state, in addition to processor's support for YMM state management using XSAVE/XRSTOR and AVX instructions. The following simplified sequence accomplishes both and is strongly recommended.
1) Detect CPUID.1:ECX.OSXSAVE[bit 27] = 1 (XGETBV enabled for application use1)
2) Issue XGETBV and verify that XFEATURE_ENABLED_MASK[2:1] = '11b' (XMM state and YMM state are enabled by OS).
3) detect CPUID.1:ECX.AVX[bit 28] = 1 (AVX instructions supported).
(Step 3 can be done in any order relative to 1 and 2)

Has anybody done these steps for the CPU and instruction set detection? Any source code available?

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

dedndave

the problem is that intel and amd don't write operating systems - lol
come to think of it, it would be nice if they did   :P

steps 1 and 3 are easy to do
i have never tried step 2

http://software.intel.com/en-us/blogs/2011/04/14/is-avx-enabled
i would read the user comments also

Gunther

Hi Dave,

Quote from: dedndave on January 29, 2013, 12:14:50 AM
http://software.intel.com/en-us/blogs/2011/04/14/is-avx-enabled
i would read the user comments also

I know that link and it's a slightly modified code variant which Intel provides in the manual.

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

dedndave

it doesn't appear that you have to access the control registers

that is when feature identification becomes a little more painful
i guess you need a kernel mode driver to access those registers
and - on newer OS's, MS has this WHQL thing that falls in the "piss-me-off" catagory - lol
i am an XP fan, forever - even if i can't do 64-bit or AVX

Gunther

Hi Dave,

Quote from: dedndave on January 29, 2013, 12:54:29 AM
i am an XP fan, forever - even if i can't do 64-bit or AVX

there's a 64 bit XP, too.  :lol: But of course, AVX isn't supported by that OS.

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

dedndave

yah - my understanding of xp-64 is that it has a lot of problems
i may have a 64-bit machine some time in the future, but my 32-bit XP's will always be my fave

Gunther

Hi Dave,

Quote from: dedndave on January 29, 2013, 04:55:34 AM
i may have a 64-bit machine some time in the future, but my 32-bit XP's will always be my fave

so far as I know, the oldest Sempron or Celeron can handle 64 bit operating systems. Why not give it a try? You could run both systems in parallel with a good boot manager. But for 64 bit I would recommend Windows 7, not XP.

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

dedndave

i have a prescott that supports "em64"
kind of a lame duck, i think
it would probably run xp64

at some point, i will probably acquire a laptop with windows 7-64
i don't have a laptop, so i can kill 2 birds with one stone

wifee has a laptop that came with vista on it
she cried until i managed to get xp on it for her   :P

Gunther

Hi Dave,

Quote from: dedndave on January 29, 2013, 10:11:16 AM
i have a prescott that supports "em64"
kind of a lame duck, i think
it would probably run xp64

it would run without any doubt a 64 bit Linux.

Quote from: dedndave on January 29, 2013, 10:11:16 AM
at some point, i will probably acquire a laptop with windows 7-64
i don't have a laptop, so i can kill 2 birds with one stone

that's a good idea. Go forward.

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

Magnum

Quote from: dedndave on January 29, 2013, 12:14:50 AM
the problem is that intel and amd don't write operating systems - lol
come to think of it, it would be nice if they did   :P


That would be nice if they did.

I think they could make a killer o.s. and would do it without having a 'tude.

I remember when they sent me some programming and chip manuals for free.

Andy
Take care,
                   Andy

Ubuntu-mate-18.04-desktop-amd64

http://www.goodnewsnetwork.org

dedndave

probably something in the monopoly laws prevents them from doing so
otherwise - they certainly have the resources to do it - especially intel
if not by law - maybe by agreement with ms   :P

Magnum

Do you think Intel would make chips that only ran their o.s. ?

Already some companies strong arm all kinds of sweet heart deals.

Monster O.S.'s need monster hard drives, etc.

You can infer a lot of the "back room activities" it by going deep and reading the specifics on some of the patches and updates.

On another funny side.

In my limited user, I had configured to use the oldest i.e.

Even though I had +R on i.e., it changed mysteriously to sp3 version.

But when I am using my admin account, it uses the sp2 version.  :t

Just for shi*s and grins, I added +S to iexplore.exe.

Laterz.





Take care,
                   Andy

Ubuntu-mate-18.04-desktop-amd64

http://www.goodnewsnetwork.org

dedndave

QuoteDo you think Intel would make chips that only ran their o.s. ?

yah - i am pretty sure that would be a violation of laws
microsoft got sued for bundling IE with windows
how do you think the fed would react to an os that only ran on the same companies chips - lol

back in the day, i remember intel's x86 assembler
it was a bit clumsy, really - very basic
but, it was good enough for ibm to use for writing pc/xt bios code
in fact, it handled rom-able code better than masm, in some ways
well - masm is not intended for use, other than code to be run under ms operating systems
i have played some tricks and used it for my own rom-able code, though (personal use)

Magnum

They got sued but it's still bundled with the o.s. except for Europe.  :icon13:

Take care,
                   Andy

Ubuntu-mate-18.04-desktop-amd64

http://www.goodnewsnetwork.org

dedndave

yah - i really didn't understand that one   :redface:
if i buy an operating system, i want one that comes with a browser
what do they think ? - i am going to buy one ? - or, maybe they think i can write one - lol