aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm64/kernel/insn.c
diff options
context:
space:
mode:
authorZi Shen Lim <zlim.lnx@gmail.com>2014-08-27 00:15:19 -0400
committerWill Deacon <will.deacon@arm.com>2014-09-08 09:39:19 -0400
commit345e0d35ecdd7aff31881462a6f7786fda3241d9 (patch)
treea8f0b185fb6b0a41666e3265654bd4655f7823db /arch/arm64/kernel/insn.c
parentc0cafbae20d2878883ec3c06d6ea30ff38a6bf92 (diff)
arm64: introduce aarch64_insn_gen_cond_branch_imm()
Introduce function to generate conditional branch (immediate) instructions. Signed-off-by: Zi Shen Lim <zlim.lnx@gmail.com> Acked-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'arch/arm64/kernel/insn.c')
-rw-r--r--arch/arm64/kernel/insn.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/arch/arm64/kernel/insn.c b/arch/arm64/kernel/insn.c
index 67979364daf6..b65edc02cf81 100644
--- a/arch/arm64/kernel/insn.c
+++ b/arch/arm64/kernel/insn.c
@@ -380,6 +380,23 @@ u32 aarch64_insn_gen_comp_branch_imm(unsigned long pc, unsigned long addr,
380 offset >> 2); 380 offset >> 2);
381} 381}
382 382
383u32 aarch64_insn_gen_cond_branch_imm(unsigned long pc, unsigned long addr,
384 enum aarch64_insn_condition cond)
385{
386 u32 insn;
387 long offset;
388
389 offset = branch_imm_common(pc, addr, SZ_1M);
390
391 insn = aarch64_insn_get_bcond_value();
392
393 BUG_ON(cond < AARCH64_INSN_COND_EQ || cond > AARCH64_INSN_COND_AL);
394 insn |= cond;
395
396 return aarch64_insn_encode_immediate(AARCH64_INSN_IMM_19, insn,
397 offset >> 2);
398}
399
383u32 __kprobes aarch64_insn_gen_hint(enum aarch64_insn_hint_op op) 400u32 __kprobes aarch64_insn_gen_hint(enum aarch64_insn_hint_op op)
384{ 401{
385 return aarch64_insn_get_hint_value() | op; 402 return aarch64_insn_get_hint_value() | op;