473,395 Members | 1,742 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

GCC and asm()

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!

Nov 14 '05 #1
3 1827
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++

Nov 14 '05 #2
Spike wrote:
Once again TIA!


Once again, gnu.gcc.help

Brian

Nov 14 '05 #3

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.

Nov 14 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Nico Vrouwe | last post by:
Hi! I wrote a pretty nice D3D framework in C++. Everything is done in classes and it all works great. Now I want to make a special version of it that is as small as possible. But I want to keep...
13
by: Cristian Tota | last post by:
If I am using inline asm in functions, like this: void func(){ __asm{ // asm code }; }; is it guaranteed that this does not mess up the registries? (As opposed to using inline asm in...
15
asm
by: Josh Lessard | last post by:
Hey everyone...quick question for you. I was under the impression that the `asm' command was not part of standard C++ because all assembly language instructions are machine dependent. However, I...
5
by: __PPS__ | last post by:
Hello I have a simple question about inline asm. suppose I have asm { push eax, 123 } does it mean that it will have exactly this effect as in usual asm or it's just a suggestion to the compiler...
2
by: LordBlue | last post by:
Hi, please forgive me if i'm sending this post in the wrong place, and please don't tell me to post it in another group, because if i found a better one i'd have already done it. I'm writing a...
1
by: R | last post by:
hello. I've got problem with linking asm and c procedures. I've got main.c where i've got my external definitions: extern int buffer(int,int,int); // coded in asm extern int hash(int,int);...
37
by: Patrik Huber | last post by:
Hello! I got the following Code in Assembler (NASM), which prints out "5" in realmode: mov ax, 0xB800 mov es, ax mov byte , '5' I want to do the same in gcc now, but I'm stuck. GCC...
10
by: Protoman | last post by:
I'm having the trouble getting the inline assembler and/or linker of Dev-Cpp to see my variable that's been passed into the C++ fn where the inline ASM code is. Can anyone help me figure out how to...
0
by: Alex Chudnovsky | last post by:
Hi all, I've got a rather weird problem in VS 2005 (and VS 2003 for that matter) when trying to debug a piece of Visual C++ code with asm bits in it. The problem is that I can't step over that...
32
by: fermineutron | last post by:
A while back i tried to calculate factorials of large numbers using arrays in C, the array encoded integer arithemetic that i wrote in C was very slow, it would take almost a second to multiply 2...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.