Solved

special assembly instruction missing in C-compiler

Posted on 1999-01-18
3
185 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 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
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 learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

623 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