diff options
author | Zi Shen Lim <zlim.lnx@gmail.com> | 2014-08-27 00:15:19 -0400 |
---|---|---|
committer | Will Deacon <will.deacon@arm.com> | 2014-09-08 09:39:19 -0400 |
commit | 345e0d35ecdd7aff31881462a6f7786fda3241d9 (patch) | |
tree | a8f0b185fb6b0a41666e3265654bd4655f7823db /arch/arm64/kernel/insn.c | |
parent | c0cafbae20d2878883ec3c06d6ea30ff38a6bf92 (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.c | 17 |
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 | ||
383 | u32 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 | |||
383 | u32 __kprobes aarch64_insn_gen_hint(enum aarch64_insn_hint_op op) | 400 | u32 __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; |