Re: [PATCH bpf-next v6 2/4] arm64: Add LDR (literal) instruction

From: Xu Kuohai
Date: Tue Jul 05 2022 - 21:43:42 EST


On 7/6/2022 12:39 AM, Will Deacon wrote:
> 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
>

will fix

>>
>> 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.
>

will rename

> Anyway, I checked the encodings and the code looks good, so:
>
> Acked-by: Will Deacon <will@xxxxxxxxxx>
>
> Will
> .