A89: Re: placing data into C variables from ASM(" ") constructs


[Prev][Next][Index][Thread]

A89: Re: placing data into C variables from ASM(" ") constructs




Niklas Brunlid writes:

 > >   asm volatile ( "
 > 
 > What does volatile mean when combined with asm() ?

Tells gcc to keep the assembly in place even if it seems to be
useless, based on its input/output parameters. 
 
 > >    "=&d" (c) : "d" (a), "0" (b) " "d0", "d1", "a5" );
 > 
 > Forgot a colon here :-)

Yes, but substituted with a " ! :-)
 
 > How does gcc deal with memory being changed?

Before calling the assembly, it flushes all cached memory 
locations. That is, it no more holds a copy of any memory 
location in registers. Therefore, any further references
to memory objects will cause re-fetched from memory.
 
 > I thought you named your input operands as being clobbered by adding "0", "1"
 > a.s.o. to the clobbered list?

Yes, you can do that with the current gcc. I do not know what compiler 
version is the TI gcc based on. Older gcc variants did not allow you
to do that, nor could you use the '+' qualifier, for read/write operands.
I left them out, for this reason. Sorry.

Regards,

Zoltan


Follow-Ups: References: