Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Checking for RDTSC support

Posted on 1998-01-02
2
Medium Priority
?
278 Views
Last Modified: 2013-12-03
Is there a quick check you can do to find out if the RDTSC (time stamp)
instruction
is supported on the particular CPU that you're running on?

I know you can back this out by doing a bunch of tests to see what brand
and model
CPU you have, and then figuring out from that info if the RDTSC
instruction is supported,
but I'm hoping to have a simpler runtime check that doesn't require us
to keep track
of every CPU brand and model.

Currently if you execute the RDTSC on cpu's that don't support it, Win95
pops up a
box about an illegal instruction. Is there some way you can attempt to
execute the
RDTSC and then catch the fact that its not supported before Win95 gets
upset
about it? If so, will this work on NT also?

Thanks for any help you can give me-
Paul Titchener

0
Comment
Question by:titchener
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 1

Accepted Solution

by:
Arkadiy earned 300 total points
ID: 1409811
You probably should use structured exceptions. Something like this:
BOOL bCommandAccessible = TRUE;
__try
{
   asm{RDTSC ...}
}
__except(1)
{
  //the command is not accessible
  bCommandAccessible = FALSE;
  ASSERT(_exception_code() == 6); //6 means invalid instruction
}

That code applies to Visual C++. If you use something els, see help on _structured_ (not C++) exception handling.
P.S. I never tried this code to catch a bad command exception. I use it mostly for code 5 (GPF)
0
 

Author Comment

by:titchener
ID: 1409812
I didn't try the suggested approach in the answer yet, but
it makes sense and looks like it will probably work well.

Thanks,

Paul Titchener
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question