Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

special assembly instruction missing in C-compiler

Posted on 1999-01-18
3
Medium Priority
?
190 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 400 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
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…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

972 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