[PATCH 9/10] powerpc: Add helper functions for synthesising instructions at runtime
Olof Johansson
olof at lixom.net
Thu Oct 13 23:27:14 EST 2005
Looks good. I have just a couple of nitpicks below. :)
On Thu, Oct 13, 2005 at 06:42:25PM +1000, Michael Ellerman wrote:
> +static inline void make_instruction(unsigned long addr, unsigned int instr)
This really is more of a "store instruction" function, but whatever. ;-)
Goes with the theme of the rest.
> +static inline void make_function_call(unsigned long addr, void * func)
> +{
> + unsigned long func_addr;
> +
> +#ifdef CONFIG_PPC64
> + func_addr = *(unsigned long *)func;
I'm sure someone will at some point in the future ask why it needs to
be dereferenced like this only on ppc64. A small comment to the effect
of it being needed because of the function descriptors could be useful.
> +#else
> + func_addr = (unsigned long)func;
> +#endif
> + make_branch(addr, func_addr, 1, 0);
Hmm. Maybe some enums/defines for BRANCH_ABSOLUTE, BRANCH_RELATIVE could
enhance readability when used.
-Olof
More information about the Linuxppc64-dev
mailing list