This is the mail archive of the gcc@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: Clarification Req: Regarding "memory" clobber for cache operation is required (?)


--- "Ashok.A" <ashok_kumar_ak@yahoo.com> wrote:
> Hello,
> 
> Need one clarification regarding the issue given
> below. Could you please clarify it? 
> 
> To invalidate a cache line, do we really need to
> use "memory" clobber in inline asm?
> 
> Example: (for MIPS-III architecture) 
> 
>    asm ("cache 17, 0(%0)"
>         : /* no outputs */
>         : "r"(ptr));
> 
> Where, 'ptr' (pointer to unsigned char type) points
> to base address of cache to be invalidated.
> 
> For this case, do we need "memory" clobber in the
> inline asm? Or, anyway to specifiy appropriate 
> memory constraints?
> 
> Expecting for yours response ...
> 
> Thanks,
> Ashok
> 
> P.S: I have checked the linux source. Looks neither
>      "memory" clobber nor any memory constraint is
>      specified in inline asm for similar operations
>      in linux source.
> 
>      
> --- Jim Wilson <wilson@specifixinc.com> wrote:
> > Ashok.A wrote:
> > > I need clarification regarding the "+m"
> > constraints.
> > > I heard that "+m" constraints cannot be used
> > > in "inline asm". Is it true?
> > 
> > Current sources will give a warning for both of
> your
> > examples.  Neither 
> > read-write "+" or matching "1" constraints should
> be
> > used with mems in 
> > an asm.  These both require that the operands are
> > the same, but the 
> > compiler is not able to guarantee this for mems. 
> We
> > can only make this 
> > work for register constraints.
> > 
> > Try changing the lw to use %2 instead of %1, and
> > then use "m" for the 
> > second operand.  I think this is the way it is
> > supposed to work nowadays.
> > -- 
> > Jim Wilson, GNU Tools Support,
> > http://www.SpecifixInc.com
> > 
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Finance Tax Center - File online. File on
> time.
> http://taxes.yahoo.com/filing.html


__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html


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