[PATCH] KVM: PPC: elide struct thread_struct instances from stack

Paul Mackerras paulus at samba.org
Tue Jun 1 08:40:40 EST 2010


On Mon, May 31, 2010 at 09:59:13PM +0200, Andreas Schwab wrote:

> Instead of instantiating a whole thread_struct on the stack use only the
> required parts of it.

...

> +_GLOBAL(kvm_cvt_fd)
> +	lfd	0,0(r5)			/* load up fpscr value */
> +	MTFSF_L(0)
> +	lfs	0,0(r3)
> +	stfd	0,0(r4)
> +	mffs	0
> +	stfd	0,0(r5)			/* save new fpscr value */
> +	blr
> +
> +_GLOBAL(kvm_cvt_df)
> +	lfd	0,0(r5)			/* load up fpscr value */
> +	MTFSF_L(0)
> +	lfd	0,0(r3)
> +	stfs	0,0(r4)
> +	mffs	0
> +	stfd	0,0(r5)			/* save new fpscr value */
> +	blr

I re-read the relevant part of the PowerPC architecture spec
yesterday, and it seems pretty clear that the FPSCR doesn't affect the
behaviour of lfs and stfs, and is not affected by them.  So in fact 4
out of the 7 instructions in each of those procedures are unnecessary
(and similarly for the cvt_fd/df used in the alignment fixup code).

Paul.


More information about the Linuxppc-dev mailing list