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

x
?
Solved

special assembly instruction missing in C-compiler

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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
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.

722 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