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]

Re: gcc inline assembler - filling a structure


Vincent De Groote <list.encelade@gmail.com> writes:

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

The gcc sources call cpuid themselves.  Look at gcc/config/i386/cpuid.h
for examples.

Ian


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