Skip to content

Commit 31acc59

Browse files
chleroympe
authored andcommitted
powerpc/code-patching: Move instr_is_branch_{i/b}form() in code-patching.h
To enable moving selftests in their own C file in following patch, move instr_is_branch_iform() and instr_is_branch_bform() to code-patching.h Signed-off-by: Christophe Leroy <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/fca0f3b191211b3681020885a611bf73eef20563.1638446239.git.christophe.leroy@csgroup.eu
1 parent 29562a9 commit 31acc59

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

arch/powerpc/include/asm/code-patching.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,21 @@ static inline int modify_instruction_site(s32 *site, unsigned int clr, unsigned
5858
return modify_instruction((unsigned int *)patch_site_addr(site), clr, set);
5959
}
6060

61+
static inline unsigned int branch_opcode(ppc_inst_t instr)
62+
{
63+
return ppc_inst_primary_opcode(instr) & 0x3F;
64+
}
65+
66+
static inline int instr_is_branch_iform(ppc_inst_t instr)
67+
{
68+
return branch_opcode(instr) == 18;
69+
}
70+
71+
static inline int instr_is_branch_bform(ppc_inst_t instr)
72+
{
73+
return branch_opcode(instr) == 16;
74+
}
75+
6176
int instr_is_relative_branch(ppc_inst_t instr);
6277
int instr_is_relative_link_branch(ppc_inst_t instr);
6378
unsigned long branch_target(const u32 *instr);

arch/powerpc/lib/code-patching.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -285,21 +285,6 @@ int create_cond_branch(ppc_inst_t *instr, const u32 *addr,
285285
return 0;
286286
}
287287

288-
static unsigned int branch_opcode(ppc_inst_t instr)
289-
{
290-
return ppc_inst_primary_opcode(instr) & 0x3F;
291-
}
292-
293-
static int instr_is_branch_iform(ppc_inst_t instr)
294-
{
295-
return branch_opcode(instr) == 18;
296-
}
297-
298-
static int instr_is_branch_bform(ppc_inst_t instr)
299-
{
300-
return branch_opcode(instr) == 16;
301-
}
302-
303288
int instr_is_relative_branch(ppc_inst_t instr)
304289
{
305290
if (ppc_inst_val(instr) & BRANCH_ABSOLUTE)

0 commit comments

Comments
 (0)