SH4 ic_cache_invalidate code broken

tm tm@kloo.net
Tue Jul 31 09:02:00 GMT 2001


tm wrote:
> 
> Alexandre Oliva wrote:
> >
> > On Jun  4, 2001, Toshi Morita <tm2@best.com> wrote:
> >
> > > I just thought of another failure mode for this code chunk.
> > > It assumes that both ic_invalidate and the target thunk are
> > > in the cacheable area.
> >
> > > If ic_invalidate is in the noncacheable area, then it will NOT
> > > clear any cache lines.
> >
> > > I think, at the very minimum, these assumptions need to be
> > > documented in comments so people will be less likely to trip
> > > over them.
> >
> > Indeed.  Will you please post a patch to that effect.
> 
> Okay, will try to do sometime this weekend.

A little late, but here it is; unfortunately this emailer can't
insert a file, so it's an attachment.

I think we should also rename ic_invalidate to
ic_invalidate_single_line...
the current name implies the entire instruction cache is invalidated,
which is incorrect. It only invalidates a single line.

Toshi
Mon Jul 30 14:31:37 PDT 2001  Toshiyasu Morita  <toshiyasu.morita@hsa.hitachi.com>

	* config/sh/lib1funcs.asm (ic_invalidate): Clarify operating assumptions 

*** lib1funcs.asm.bak	Mon Jul 30 13:47:33 2001
--- lib1funcs.asm	Mon Jul 30 13:54:15 2001
***************
*** 1212,1217 ****
--- 1212,1221 ----
  #endif /* L_set_fpscr */
  #ifdef L_ic_invalidate
  #if defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__)
+ 
+ ! Note: This function does not work if placed in a noncacheable area,
+ !       e.g. in the P2 or P4 areas. It must be in either the P1 or P3 areas.
+ 
  	.global GLOBAL(ic_invalidate)
  GLOBAL(ic_invalidate):
  	ocbwb	@r4


More information about the Gcc-patches mailing list