Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > GCC and asm()

Reply
Thread Tools

GCC and asm()

 
 
Spike
Guest
Posts: n/a
 
      12-22-2004
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!



 
Reply With Quote
 
 
 
 
Emmanuel Delahaye
Guest
Posts: n/a
 
      12-22-2004
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.

news:gnu.gcc.help

--
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++

 
Reply With Quote
 
 
 
 
Default User
Guest
Posts: n/a
 
      12-22-2004
Spike wrote:

> Once again TIA!


Once again, gnu.gcc.help





Brian

 
Reply With Quote
 
Michael Mair
Guest
Posts: n/a
 
      12-22-2004

Spike wrote:
> 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
--
E-Mail: Mine is a gmx dot de address.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Gcc 3.4.X to Gcc 4.1.X upgrading kas C++ 1 04-22-2010 08:56 PM
GCC 3.4.3 and GCC 4.1.2 ashnin C++ 1 07-07-2008 01:10 PM
Template construction in old gcc 3.3.3 does not compile in gcc 3.4.4 eknecronzontas@yahoo.com C++ 5 09-17-2005 12:27 AM
gcc 2.95 and gcc 3.2 gouqizi.lvcha@gmail.com C++ 8 03-16-2005 02:34 AM
C99 structure initialization in gcc-2.95.3 vs gcc-3.3.1 Kevin P. Fleming C Programming 2 11-06-2003 05:15 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57