This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gcc inline assembler - filling a structure


Hello,

I would like to execute the cpuid instruction on a x86

So I declared

typedef unsigned long int register_t;

struct response_t {
 register_t eax;
 register_t ebx;
ÂÂ register_t ecx;
ÂÂ register_t edx;
};

void cpuid ( register_t command, struct response_t * response )Â {

...

}

How can I, in assembler, assign the value of a register (for example
ebx) to the response->ebx field ?

I also would like to wrap such function under a preprocessor #ifdef
directive, to check the target machine.
Is there a preprocessor definition I can use for this (a target like
x86) ? I cannot find the list of all preprocessor definitions defined
by gcc.


Thanks for your replies and your time

Vincent De Groote


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]