[PATCH] powerpc: Don't use toc in decrementer_iSeries_masked

David Gibson david at gibson.dropbear.id.au
Mon Feb 6 17:44:38 EST 2006


On Mon, Feb 06, 2006 at 05:42:47PM +1100, David Gibson wrote:
> On Mon, Feb 06, 2006 at 05:34:14PM +1100, Michael Ellerman wrote:
> > Since 404849bbd2bfd62e05b36f4753f6e1af6050a824 we've been using
> > LOAD_REG_ADDRBASE, which uses the toc pointer, in decrementer_iSeries_masked.
> > 
> > This can explode if we take the decrementer interrupt while we're in a module,
> > because the toc pointer in r2 will be the module's toc pointer.
> > 
> > Instead do an immediate load. I'm not sure if we really need the trickery in
> > here, what do people think?
> > 
> >  arch/powerpc/kernel/head_64.S |    9 +++++++--
> >  1 files changed, 7 insertions(+), 2 deletions(-)
> > 
> > Index: iseries/arch/powerpc/kernel/head_64.S
> > ===================================================================
> > --- iseries.orig/arch/powerpc/kernel/head_64.S
> > +++ iseries/arch/powerpc/kernel/head_64.S
> > @@ -752,8 +752,13 @@ decrementer_iSeries_masked:
> >  	li	r11,1
> >  	ld	r12,PACALPPACAPTR(r13)
> >  	stb	r11,LPPACADECRINT(r12)
> > -	LOAD_REG_ADDRBASE(r12,tb_ticks_per_jiffy)
> > -	lwz	r12,ADDROFF(tb_ticks_per_jiffy)(r12)
> > +	/* We have no TOC pointer in here, so we can't load tb_ticks_per_jiffy
> > +	 * using the usual macros. We want to be fast, so we assume the top
> > +	 * word of the lppaca pointer is the same as the top word of
> > +	 * &tb_ticks_per_jiffy.
> > +	 */
> 
> you need a
> 	clrrdi	r12,r12,32
> here, because r12's low word may not contain zero.
> 
> > +	oris    r12,r12,tb_ticks_per_jiffy at h

Oh, and that needs to be @ha, because the load offset below is treated
as signed.

> > +	lwz	r12,tb_ticks_per_jiffy at l(r12)
> >  	mtspr	SPRN_DEC,r12
> >  	/* fall through */

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson



More information about the Linuxppc64-dev mailing list