Christophe LEROY <christophe.le...@c-s.fr> writes: > Le 08/08/2018 à 18:30, Christophe LEROY a écrit : >> Le 23/07/2018 à 17:07, Michael Ellerman a écrit : ... >>> diff --git a/arch/powerpc/include/asm/code-patching.h >>> b/arch/powerpc/include/asm/code-patching.h >>> index 812535f40124..b2051234ada8 100644 >>> --- a/arch/powerpc/include/asm/code-patching.h >>> +++ b/arch/powerpc/include/asm/code-patching.h >>> @@ -32,6 +32,8 @@ unsigned int create_cond_branch(const unsigned int >>> *addr, >>> int patch_branch(unsigned int *addr, unsigned long target, int flags); >>> int patch_instruction(unsigned int *addr, unsigned int instr); >>> int raw_patch_instruction(unsigned int *addr, unsigned int instr); >>> +int patch_instruction_site(s32 *addr, unsigned int instr); >>> +int patch_branch_site(s32 *site, unsigned long target, int flags); >> >> Why use s32* instead of unsigned int* as usual for pointer to code ? > > Forget my stupid question, I didn't see it was a relative address and > not an absolute one.
No worries. It is a bit non-obvious at first glance, it looks like the s32 * points to the instruction. But it points to the s32 that holds the relative offset from itself, of the instruction. We could add a typedef to try and make that more obvious, but I generally don't like typedefs that hide pointerness. cheers