powerpc/code-patching: Add a helper to get the address of a patch_site
authorChristophe Leroy <christophe.leroy@c-s.fr>
Fri, 19 Oct 2018 06:55:04 +0000 (06:55 +0000)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 26 Oct 2018 10:58:58 +0000 (21:58 +1100)
This patch adds a helper to get the address of a patch_site.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
[mpe: Call it "patch site" addr]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/code-patching.h

index 31733a95bbd052bda1038f8160b127181d3cffc2..3d5acd2b113a2d64b12f5f8a1487483c2cc24159 100644 (file)
@@ -36,6 +36,11 @@ 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);
 
+static inline unsigned long patch_site_addr(s32 *site)
+{
+       return (unsigned long)site + *site;
+}
+
 int instr_is_relative_branch(unsigned int instr);
 int instr_is_relative_link_branch(unsigned int instr);
 int instr_is_branch_to_addr(const unsigned int *instr, unsigned long addr);