Solved

special assembly instruction missing in C-compiler

Posted on 1999-01-18
3
181 Views
Last Modified: 2010-04-16
I have tried to use the Intel Pentium instructions
CPUID, RDPMC and RDTSC together with a C-program
in a _asm{} in-line subroutine. These are however,
reported as errors by the Microsoft 5.0 C++ compiler
(it seems like it will not give the privilege to use
these hardware-close instructions).
Any suggestions?
0
Comment
Question by:poulsen
  • 2
3 Comments
 
LVL 22

Accepted Solution

by:
nietod earned 100 total points
ID: 1184425
Did you indicate that the target processor is a pentium?  These instructions are available only on a pentium or later processor.

If that still doesn't help you can use the "emit" instruction to "create" the instructions you need.


Let me know if you have questions.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1184426
I just tried the CPUID instruction in VC 6 and it was recognized
I tried it with VC 5 and had no luck getting it recognized.  I don't think it is supported directly.  I was ablt to make it work using _emit, however, like

__asm _emit 0x0F
__asm _emit 0xA2;

0
 

Author Comment

by:poulsen
ID: 1184427
Question solved by Nietod (I was also able to get around it myself by
selfmodifying code, which was not so elegant as NIetod's answer).
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
mixing C++ & C# in Vis Studio 2013 7 139
C++ question 3 61
passing data from one form to another form in c++ 27 72
c++, dynamic object by json 1 20
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

932 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now