Re: [PATCH 1/5] powerpc/asm: Add a patch_site macro & helpers for patching instructions
From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2018-08-09 09:52:32
Christophe LEROY [off-list ref] writes:
Le 08/08/2018 =C3=A0 18:30, Christophe LEROY a =C3=A9crit=C2=A0:quoted
Le 23/07/2018 =C3=A0 17:07, Michael Ellerman a =C3=A9crit=C2=A0:
...
quoted
quoted
diff --git a/arch/powerpc/include/asm/code-patching.h=20b/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=20*addr, =C2=A0 int patch_branch(unsigned int *addr, unsigned long target, int f=
lags);
quoted
quoted
=C2=A0 int patch_instruction(unsigned int *addr, unsigned int instr); =C2=A0 int raw_patch_instruction(unsigned int *addr, unsigned int instr=
);
quoted
quoted
+int patch_instruction_site(s32 *addr, unsigned int instr); +int patch_branch_site(s32 *site, unsigned long target, int flags);=20 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=20 not an absolute one.
No worries.=20 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