[PATCH] powerpc: Instrument Hypervisor Calls

Mike Kravetz kravetz at us.ibm.com
Sat Aug 26 04:52:40 EST 2006

On Thu, Aug 24, 2006 at 04:55:10PM +1000, Paul Mackerras wrote:
> > +	/* calculate address of stat structure */		\
> > +	ld	r4,STK_PARM(r3)(r1);	/* use opcode as */	\
> > +	rldicl	r4,r4,62,2;		/* index into array */	\
> > +	mulli	r4,r4,HCALL_STAT_SIZE;				\
> It's a pity our multiplies are slow (6 cycles).  The rldicl would I
> think be more clearly expressed as srdi r4,r4,2.  We could use a shift
> and add instead of the multiply if we put a big fat comment in the
> header that defines the structure warning people to adjust the
> assembly if they change the structure.  Might not be worth it though.

I would rather keep the multiply and minimal safety it provides when
people change the structure.

> BTW are we going to die horribly if someone uses an hcall greater than
> MAX_HCALL_OPCODES?  The hcall functions are available to modules, so
> it would be quite possible for a module to come along and try to use
> some new hcalls that weren't known about when the kernel was built.

Yes, bad things would happen.  This is/was a bad assumption on my part
that all callers would pass in valid opcodes.  I'll put in a simple check
for that.


More information about the Linuxppc-dev mailing list