lkml.org 
[lkml]   [2022]   [Jul]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH bpf-next v6 2/4] arm64: Add LDR (literal) instruction
On Sat, Jun 25, 2022 at 12:12:53PM -0400, Xu Kuohai wrote:
> 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 rampoline in the follow-up patch.

typo: trampoline

>
> 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 aarch64_imm_common().

nit, but I think "label_imm_common()" would be a better name.

Anyway, I checked the encodings and the code looks good, so:

Acked-by: Will Deacon <will@kernel.org>

Will

\
 
 \ /
  Last update: 2022-07-05 18:40    [W:0.168 / U:0.160 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site