Solved

special assembly instruction missing in C-compiler

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

760 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

21 Experts available now in Live!

Get 1:1 Help Now