GCC and asm()

S

Spike

What's wrong with this:

ULONG CPUID_Result=0;
asm ("movl $1,%%eax;cpuid;"
:"=a"(CPUID_Result)
: //Ingen input!
:"%eax","%ebx","%ecx","%edx");

All I want to do is call CPUID with EAX=1 and have to result stored in
CPUID_Result!

Once again TIA!
 
E

Emmanuel Delahaye

Spike wrote on 22/12/04 :
What's wrong with this:

ULONG CPUID_Result=0;
asm ("movl $1,%%eax;cpuid;"
:"=a"(CPUID_Result)
: //Ingen input!
:"%eax","%ebx","%ecx","%edx");

All I want to do is call CPUID with EAX=1 and have to result stored in
CPUID_Result!

You are off-topic on clc.

Are you aware that asm in gcc is AT&T style (destination and source are
reversed and other twisted things...)

Details on a gcc forum where you question belongs to.


--
Emmanuel
The C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html
The C-library: http://www.dinkumware.com/refxc.html

"Clearly your code does not meet the original spec."
"You are sentenced to 30 lashes with a wet noodle."
-- Jerry Coffin in a.l.c.c++
 
M

Michael Mair

Spike said:
What's wrong with this:

ULONG CPUID_Result=0;
asm ("movl $1,%%eax;cpuid;"
:"=a"(CPUID_Result)
: //Ingen input!
:"%eax","%ebx","%ecx","%edx");

You did not ask this question in gnu.gcc.* (if in doubt, use
gnu.gcc.help)

-Michael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top