]> git.baikalelectronics.ru Git - kernel.git/commit
arm64: Add LDR (literal) instruction
authorXu Kuohai <xukuohai@huawei.com>
Mon, 11 Jul 2022 15:08:21 +0000 (11:08 -0400)
committerDaniel Borkmann <daniel@iogearbox.net>
Mon, 11 Jul 2022 19:04:58 +0000 (21:04 +0200)
commit03834b90f494441f1c442edaf5ee476f93ba7185
treea9101a069b2289e3be70aa8ff8e2f673626e881e
parent0f3e2932e43cbfa9fc1999cf04a8663923341fc4
arm64: Add LDR (literal) instruction

Add LDR (literal) instruction to load data from address relative to PC.
This instruction will be used to implement long jump from bpf prog to
bpf trampoline in the follow-up patch.

The instruction encoding:

    3       2   2     2                                     0        0
    0       7   6     4                                     5        0
+-----+-------+---+-----+-------------------------------------+--------+
| 0 x | 0 1 1 | 0 | 0 0 |                imm19                |   Rt   |
+-----+-------+---+-----+-------------------------------------+--------+

for 32-bit, variant x == 0; for 64-bit, x == 1.

branch_imm_common() is used to check the distance between pc and target
address, since it's reused by this patch and LDR (literal) is not a branch
instruction, rename it to label_imm_common().

Signed-off-by: Xu Kuohai <xukuohai@huawei.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
Acked-by: Will Deacon <will@kernel.org>
Link: https://lore.kernel.org/bpf/20220711150823.2128542-3-xukuohai@huawei.com
arch/arm64/include/asm/insn.h
arch/arm64/lib/insn.c